account_move_views.xml 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?xml version="1.0" encoding="utf-8"?>
  2. <odoo>
  3. <record id="view_move_form_inherit_purchase" model="ir.ui.view">
  4. <field name="name">account.move.inherit.purchase</field>
  5. <field name="model">account.move</field>
  6. <field name="inherit_id" ref="account.view_move_form"/>
  7. <field name="arch" type="xml">
  8. <!-- Auto-complete could be done from either a bill either a purchase order -->
  9. <field name="invoice_vendor_bill_id" position="after">
  10. <t groups="purchase.group_purchase_user">
  11. <field name="purchase_id" invisible="1"/>
  12. <label for="purchase_vendor_bill_id" string="Auto-Complete" class="oe_edit_only"
  13. attrs="{'invisible': ['|', ('state','!=','draft'), ('move_type', '!=', 'in_invoice')]}" />
  14. <field name="purchase_vendor_bill_id" nolabel="1"
  15. attrs="{'invisible': ['|', ('state','!=','draft'), ('move_type', '!=', 'in_invoice')]}"
  16. class="oe_edit_only"
  17. domain="partner_id and [('company_id', '=', company_id), ('partner_id.commercial_partner_id', '=', commercial_partner_id)] or [('company_id', '=', company_id)]"
  18. placeholder="Select a purchase order or an old bill"
  19. context="{'show_total_amount': True}"
  20. options="{'no_create': True, 'no_open': True}"/>
  21. </t>
  22. </field>
  23. <label name="invoice_vendor_bill_id_label" position="attributes">
  24. <attribute name="groups">!purchase.group_purchase_user</attribute>
  25. </label>
  26. <field name="invoice_vendor_bill_id" position="attributes">
  27. <attribute name="groups">!purchase.group_purchase_user</attribute>
  28. </field>
  29. <!-- Add link to purchase_line_id to account.move.line -->
  30. <xpath expr="//field[@name='invoice_line_ids']/tree/field[@name='company_id']" position="after">
  31. <field name="purchase_line_id" groups="purchase.group_purchase_user" invisible="1"/>
  32. <field name="purchase_order_id" groups="purchase.group_purchase_user" attrs="{'column_invisible': [('parent.move_type', '!=', 'in_invoice')]}" optional="hide"/>
  33. </xpath>
  34. <xpath expr="//field[@name='line_ids']/tree/field[@name='company_id']" position="after">
  35. <field name="purchase_line_id" groups="purchase.group_purchase_user" invisible="1"/>
  36. </xpath>
  37. <xpath expr="//div[@name='button_box']" position="inside">
  38. <button class="oe_stat_button"
  39. name="action_view_source_purchase_orders"
  40. type="object"
  41. groups="purchase.group_purchase_user"
  42. icon="fa-pencil-square-o"
  43. attrs="{'invisible': ['|', ('purchase_order_count', '=', 0), ('move_type', 'not in', ('out_invoice', 'out_refund', 'in_invoice', 'in_refund', 'out_receipt', 'in_receipt'))]}">
  44. <field string="Purchases" name="purchase_order_count" widget="statinfo"/>
  45. </button>
  46. </xpath>
  47. </field>
  48. </record>
  49. </odoo>