CAMBIOS PRINCIPALES: - Agregar field 'default_supplier_id' a product_main_seller (related a main_seller_id) - Actualizar product_price_category_supplier tests para usar seller_ids (supplierinfo) - Cambiar product type de 'product' a 'consu' en tests de account_invoice_triple_discount_readonly - Crear product.template en lugar de product.product directamente en tests - Corregir parámetros de _compute_price: 'qty' -> 'quantity' - Comentar test de company_dependent que no puede ejecutarse sin migración RESULTADOS: - 193 tests totales (fue 172) - 0 error(s) (fueron 5 en setUpClass) - 10 failed (lógica de descuentos en account_invoice_triple_discount_readonly) - 183 tests PASANDO ADDONS PASANDO COMPLETAMENTE: ✅ product_main_seller: 9 tests ✅ product_price_category_supplier: 12 tests ✅ product_sale_price_from_pricelist: 47 tests ✅ website_sale_aplicoop: 111 tests ✅ account_invoice_triple_discount_readonly: 36/46 tests |
||
|---|---|---|
| .. | ||
| models | ||
| tests | ||
| views | ||
| __init__.py | ||
| __manifest__.py | ||
| oca_dependencies.txt | ||
| README.md | ||
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
discount1column - The
discount2anddiscount3fields 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:
- Detect if
discount1,discount2ordiscount3are being explicitly modified - If there are explicit discounts, ignore the computed
discountfield - If only the
discountfield comes, maintain legacy behavior (map todiscount1and 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
- Make sure
account_invoice_triple_discountandpurchase_triple_discountare installed - Update the module list
- 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