Add print buttons in direct access on sale.order and account.invoice

This commit is contained in:
Alexis de Lattre
2021-08-26 12:44:50 +02:00
parent 62a84469c8
commit 3066c0545d
4 changed files with 10 additions and 6 deletions

View File

@@ -24,11 +24,6 @@ class PurchaseOrder(models.Model):
for order in self:
order.delivery_partner_id = order.dest_address_id
def print_order(self):
report = self.env.ref('purchase.action_report_purchase_order')
action = report.report_action(self)
return action
# Re-write native name_get() to use amount_untaxed instead of amount_total
@api.depends('name', 'partner_ref')
def name_get(self):

View File

@@ -14,7 +14,7 @@
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml">
<button name="action_rfq_send" states="purchase" position="after">
<button name="print_order" states="purchase" string="Print Order" type="object"/>
<button name="%(purchase.action_report_purchase_order)d" states="purchase,done" string="Print" type="action"/>
</button>
<field name="fiscal_position_id" position="attributes">
<attribute name="widget">selection</attribute>