Friday, August 22, 2025
3 changes · saas-18.4
Enhancements to existing features
Accounting now includes helpers to spread global discounts and returned merchandise across individual invoice lines for electronic invoicing. This improves compliance and accuracy for formats such as Mexico's CFDI, where discounts and returns need to be reflected line by line.
Original PR description
This commit also adds a new helper '_dispatch_global_discount_lines' that can be used to split the global discount lines across the others base lines. That way in EDI like Mexico, the global discount can be reported line by line as a discount per line and no longer a big discount applied on a single line. There is also another helper '_dispatch_return_of_marchandise_lines' that allows to dispatch negative lines using the quantity. For example, if you buy 3 times the same product but one is returned because broken, you will end up with a sell of 2 products instead of 3 but having a discount of 33.33%. This makes the difference when generating the mexican CFDI. --- I confirm I have signed the CLA and read the PR guidelines at www.odoo.com/submit-pr Forward-Port-Of: odoo/odoo#223530
Completing large batches of manufacturing work orders is now much faster. This reduces waiting time for production teams when confirming many work orders, especially when they belong to the same manufacturing order.
Original PR description
### Description: Improves the performance of `button_finish` when confirming many work orders. Previously, the method would update each work order individually, leading to slow performance. This PR changes the way the write is executed to do it by batch, which is much faster, especially when work orders share the same manufacturing order. ### Benchmark (in 18.0): | N° of work orders | Before | After | |-------------------|--------|-------| | 250 | 14s | 610ms | | 500 | 53s | 1s | ### Reference: opw-4957774 Forward-Port-Of: odoo/odoo#223588
This update improves how discounts and negative lines are distributed on Mexican electronic invoices and related POS invoices. It helps produce more accurate compliant invoice totals, especially for refunds or complex discount scenarios.
Original PR description
Forward-Port-Of: odoo/enterprise#92727