invoice_view.xml 2.0 KB

123456789101112131415161718192021222324252627282930313233343536
  1. <?xml version="1.0"?>
  2. <openerp>
  3. <data>
  4. <!-- readonly for group restrict prices and not can modify -->
  5. <record id="invoice_form" model="ir.ui.view">
  6. <field name="name">price_security.invoice.form</field>
  7. <field name="model">account.invoice</field>
  8. <field name="inherit_id" ref="account.invoice_form"/>
  9. <field name="groups_id" eval="[(6, 0, [ref('group_restrict_prices')])]"/>
  10. <field name="arch" type="xml">
  11. <xpath expr="//field[@name='invoice_line']/tree" position="inside">
  12. <field name="product_can_modify_prices" invisible="1"/>
  13. </xpath>
  14. <!-- add readonly price unit -->
  15. <xpath expr="//field[@name='invoice_line']/tree//field[@name='price_unit']" position="after">
  16. <field name="price_unit_readonly" attrs="{'readonly': [('product_can_modify_prices','=', False)]}"/>
  17. </xpath>
  18. <!-- make price unit invisible -->
  19. <xpath expr="//field[@name='invoice_line']/tree//field[@name='price_unit']" position="attributes">
  20. <attribute name="invisible">1</attribute>
  21. </xpath>
  22. <!-- add tax readonly -->
  23. <xpath expr="//field[@name='invoice_line']/tree//field[@name='invoice_line_tax_id']" position="after">
  24. <field name="invoice_line_tax_id_readonly" attrs="{'readonly': [('product_can_modify_prices','=', False)]}" context="{'type':parent.type}" domain="[('parent_id','=',False),('company_id', '=', parent.company_id)]" widget="many2many_tags"/>
  25. </xpath>
  26. <!-- make tax invisible -->
  27. <xpath expr="//field[@name='invoice_line']/tree//field[@name='invoice_line_tax_id']" position="attributes">
  28. <attribute name="invisible">1</attribute>
  29. </xpath>
  30. </field>
  31. </record>
  32. </data>
  33. </openerp>