addons-cm/account_invoice_triple_discount_readonly
snt 6fbc7b9456 [FIX] website_sale_aplicoop: Remove redundant string= attributes and fix OCA linting warnings
- Remove redundant string= from 17 field definitions where name matches string value (W8113)
- Convert @staticmethod to instance methods in selection methods for proper self.env._() access
- Fix W8161 (prefer-env-translation) by using self.env._() instead of standalone _()
- Fix W8301/W8115 (translation-not-lazy) by proper placement of % interpolation outside self.env._()
- Remove unused imports of odoo._ from group_order.py and sale_order_extension.py
- All OCA linting warnings in website_sale_aplicoop main models are now resolved

Changes:
- website_sale_aplicoop/models/group_order.py: 21 field definitions cleaned
- website_sale_aplicoop/models/sale_order_extension.py: 5 field definitions cleaned + @staticmethod conversion
- Consistent with OCA standards for addon submission
2026-02-18 17:54:43 +01:00
..
models update pylint10, corrije authors manifest 2026-02-12 17:15:33 +01:00
tests [FIX] website_sale_aplicoop: Remove redundant string= attributes and fix OCA linting warnings 2026-02-18 17:54:43 +01:00
views [18.0][MIG] account_invoice_triple_discount_readonly: Port to Odoo 18.0 2026-02-10 23:22:50 +01:00
__init__.py Criptomart/red-supermercados-coop#17 add account_invoice_triple_discount_readonly: fix write discount2 and dicount3 columns. Make discount (total) readonly 2025-12-04 14:01:50 +01:00
__manifest__.py update pylint10, corrije authors manifest 2026-02-12 17:15:33 +01:00
oca_dependencies.txt [18.0][MIG] account_invoice_triple_discount_readonly: Port to Odoo 18.0 2026-02-10 23:22:50 +01:00
README.md Criptomart/red-supermercados-coop#17 add account_invoice_triple_discount_readonly: fix write discount2 and dicount3 columns. Make discount (total) readonly 2025-12-04 14:01:50 +01:00

Account Invoice Triple Discount Readonly

Description

This module fixes a bug in account_invoice_triple_discount when combined with purchase_triple_discount.

Original Problem

In purchase orders, when configuring a discount in the discount2 or discount3 columns, upon saving:

  • All discounts were accumulated in the discount1 column
  • The discount2 and discount3 fields were reset to zero

This occurred because the original mixin's write method always reset discount2 and discount3 to 0 when the computed discount field was included in the write (which happens when any discount is modified).

Solution

The module overrides the write method of triple.discount.mixin to:

  1. Detect if discount1, discount2 or discount3 are being explicitly modified
  2. If there are explicit discounts, ignore the computed discount field
  3. If only the discount field comes, maintain legacy behavior (map to discount1 and reset the rest)

Additionally, it makes the discount field (total discount) readonly in:

  • Partner form view (res.partner)
  • Supplier info in product form (product.supplierinfo)
  • Base mixin (triple.discount.mixin)

This forces users to work only with the discount1, discount2 and discount3 columns, avoiding confusion.

Installation

  1. Make sure account_invoice_triple_discount and purchase_triple_discount are installed
  2. Update the module list
  3. Install account_invoice_triple_discount_readonly

Usage

After installation:

  • The total discount field will be readonly and automatically calculated
  • Users must use discount1, discount2, and discount3 fields to set discounts
  • When saving, the individual discount values will be preserved correctly

Bug Tracker

Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported.

Credits

Contributors

  • Coop Makers

Maintainers

This module is maintained by the OCA.

Compatibility

  • Odoo 16.0
  • account_invoice_triple_discount
  • purchase_triple_discount