[18.0][MIG] account_invoice_triple_discount_readonly: Port to Odoo 18.0

* Update module version to 18.0.1.0.0
* Remove view modifications as they are handled by parent modules
* Add comprehensive test suite (34 tests):
  - Test triple discount mixin write() method behavior
  - Test account.move.line with triple discounts
  - Test purchase.order.line with triple discounts
* Add oca_dependencies.txt with required OCA repositories
* Fix write() method to handle explicit discounts correctly
This commit is contained in:
snt 2026-02-10 23:22:50 +01:00
parent 67554c95f5
commit 123aabb775
10 changed files with 602 additions and 77 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- Make discount field readonly in invoice lines -->
<!-- Make discount field readonly in invoice lines form view -->
<record id="invoice_triple_discount_readonly" model="ir.ui.view">
<field name="name">account.invoice.triple.discount.readonly</field>
<field name="model">account.move</field>
@ -10,12 +10,7 @@
ref="account_invoice_triple_discount.invoice_triple_discount_form_view"
/>
<field name="arch" type="xml">
<xpath
expr="//field[@name='invoice_line_ids']//tree//field[@name='discount']"
position="attributes"
>
<attribute name="readonly">1</attribute>
</xpath>
<!-- Make the total discount field readonly in form view to force users to use discount1/2/3 -->
<xpath
expr="//field[@name='invoice_line_ids']//form//field[@name='discount']"
position="attributes"

View file

@ -1,32 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- Make discount field readonly in supplier info form view -->
<record model="ir.ui.view" id="product_supplierinfo_form_view_readonly_discount">
<field name="model">product.supplierinfo</field>
<field
name="inherit_id"
ref="purchase_triple_discount.product_supplierinfo_form_view"
/>
<field name="arch" type="xml">
<xpath expr="//field[@name='discount']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
</field>
</record>
<!-- Make discount field readonly in supplier info tree view -->
<record model="ir.ui.view" id="product_supplierinfo_tree_view_readonly_discount">
<field name="model">product.supplierinfo</field>
<field
name="inherit_id"
ref="purchase_triple_discount.product_supplierinfo_tree_view"
/>
<field name="arch" type="xml">
<xpath expr="//field[@name='discount']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
</field>
</record>
<!-- No need to modify product.supplierinfo views as purchase_triple_discount already hides discount field -->
</odoo>

View file

@ -1,28 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- Make discount field readonly in purchase order lines -->
<record id="purchase_order_triple_discount_readonly" model="ir.ui.view">
<field name="name">purchase.order.triple.discount.readonly</field>
<field name="model">purchase.order</field>
<field
name="inherit_id"
ref="purchase_triple_discount.purchase_order_triple_discount_form_view"
/>
<field name="arch" type="xml">
<xpath
expr="//field[@name='order_line']//tree//field[@name='discount']"
position="attributes"
>
<attribute name="readonly">1</attribute>
</xpath>
<xpath
expr="//field[@name='order_line']//form//field[@name='discount']"
position="attributes"
>
<attribute name="readonly">1</attribute>
</xpath>
</field>
</record>
<!-- No need to modify purchase.order views as purchase_triple_discount already hides discount field -->
</odoo>

View file

@ -1,18 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<!-- Make default_supplierinfo_discount readonly in partner form view -->
<record model="ir.ui.view" id="res_partner_form_view_readonly_discount">
<field name="model">res.partner</field>
<field
name="inherit_id"
ref="purchase_triple_discount.res_partner_form_view"
/>
<field name="arch" type="xml">
<field name="default_supplierinfo_discount" position="attributes">
<attribute name="invisible">1</attribute>
</field>
</field>
</record>
<!-- No need to modify partner view as purchase_triple_discount already uses discount1/2/3 fields -->
</odoo>