purchase_create_bill_button/views/purchase_order_views.xml
2026-06-19 10:02:31 +07:00

21 lines
1.3 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="purchase_order_form_inherit" model="ir.ui.view">
<field name="name">purchase.order.form.inherit.create.bill</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml">
<!-- Add Create Bill buttons in header after the file uploader widget -->
<xpath expr="//widget[@name='purchase_file_uploader']" position="after">
<button name="action_create_invoice" string="Create Bill" type="object" class="oe_highlight" context="{'create_bill':True}" invisible="state != 'purchase' or invoice_status != 'to invoice'" data-hotkey="w"/>
<button name="action_create_invoice" string="Create Bill" type="object" context="{'create_bill':True}" invisible="state != 'purchase' or invoice_status != 'no'" data-hotkey="w"/>
</xpath>
<!-- Modify the Vendor Bills smart button to be visible even if invoice_count is 0 -->
<xpath expr="//button[@name='action_view_invoice']" position="attributes">
<attribute name="invisible">state in ('draft', 'sent', 'to approve')</attribute>
</xpath>
</field>
</record>
</odoo>