Ir al contenido
Menú
Se marcó esta pregunta
1 Responder
140 Vistas

Hello everyone,

I am facing a calculation and display issue on my sales orders that seems to be an internal error. For a correctly configured product (with a defined sales price and cost), the displayed values are inconsistent.

Problem Descriptions:

  1. Incorrect Margin Calculation:
    • Total sales price for the line: 20.00 DT (5 units x 4.00 DT/unit)
    • Total cost for the line: 17.85 DT
    • Expected Margin: 20.00 DT - 17.85 DT = 2.15 DT
    • Displayed Margin: -13.85 DT, which is clearly incorrect.
  2. Incorrect "Excluding Taxes" Total Display:
    • The "Hors taxes" field displays the unit price (4.00 DT) instead of the line total (20.00 DT). The correct total only appears in the "Toutes taxes..." field.

Additional Information:

  • Odoo Version: 
  • Modules: POS, Inevntory and Account
  • Screenshot: 

Have other users encountered this type of problem? If so, how did you solve it?

Thank you in advance for your help.

Avatar
Descartar
Autor

Hello Cybrosys,


I m using Odoo online 19 Entreprise Edition. i didnt customise anything on code

Hi Amine - the so-called "Total cost" is actually the Unit Cost, so the margin calculation is correct. I agree that it is confusing / inconsistent, but I don't think it is "wrong", though you could report this to Odoo support.

Mejor respuesta

Hi,


The issue with the incorrect margin calculation and wrong “Excluding Taxes” total on sales orders in Odoo is likely caused by either a customization error, a misconfigured field dependency, or an incorrect computation formula in your sale order line model or view. When the margin field displays -13.85 DT instead of 2.15 DT, it usually indicates that Odoo is using the wrong base (for example, subtracting cost from untaxed subtotal before taxes are correctly computed, or mixing up signed values).


For the “Hors taxes” (excluding tax) display issue, this often happens when the XML view or widget is showing price_unit instead of price_subtotal. The price_unit field always shows the per-unit price (4.00 DT), while price_subtotal holds the correct total for the line (20.00 DT). Checking and correcting the view to use t-field="line.price_subtotal" will fix the display problem.


To resolve the margin issue, review the compute method for the margin field (usually _compute_margin) or any overridden logic in custom modules. Ensure it’s calculated as margin = price_subtotal - purchase_price * product_uom_qty, and confirm both purchase_price and price_subtotal are correctly stored before computing. After correcting and updating the view and compute logic, your sales line should display the proper untaxed total and accurate profit margin.


Hope it helps

Avatar
Descartar

Is this from AI / LLM?