OCA / margin-analysis

Odoo Financial Controlling (margin, costs, ...)
https://odoo-community.org/project/9
GNU Affero General Public License v3.0
71 stars 161 forks source link

[16.0][FIX] sale_margin_delivered: Avoid rounding error #214

Closed lmignon closed 2 months ago

lmignon commented 3 months ago

'price_reduce' is deprecated and removed into the next version. Compute the prirce_reduct from the price_subotal / product_uom_qty. We might be tempted to use the 'price_reduce_taxecl' field from the sale order line but this field is rounded by default to the monetary precision.

As an additional benefit this change ensures the compatibility with the 'sale_triple_discount' addon. Indeed, when 'sale_triple_discount' is installed, the discount field is not used as an aggregation of all the applied discount. It's only use to store the first discount applied. Therefore, the field is not properly computed since it doesn't include the second and third discount.

OCA-git-bot commented 3 months ago

Hi @sergio-teruel, some modules you are maintaining are being modified, check this out!

lmignon commented 3 months ago

@Shide @yajo Can you take a look at this one plz?

lmignon commented 3 months ago

@shide I'll change this since price_reduce_taxexcl is rounded and therefore the margin is not properly computed when we've more than 1 product.

lmignon commented 3 months ago

@Shide @yajo @Gelojr @fcvalgar In Odoo standard margin in % is expressed as a decimal... 1 = 100%, 0.5=50% ... In this module margin % is expressed as 100 = 1000%, 50 = 50%... what's the motivation. It's strange to store precentage value in a different way than Odoo. Can I change this and provide a migration script?

Shide commented 3 months ago

@Shide @yajo @Gelojr @fcvalgar In Odoo standard margin in % is expressed as a decimal... 1 = 100%, 0.5=50% ... In this module margin % is expressed as 100 = 1000%, 50 = 50%... what's the motivation. It's strange to store precentage value in a different way than Odoo. Can I change this and provide a migration script?

Sure!

rafaelbn commented 3 months ago

@Shide @yajo @Gelojr @fcvalgar In Odoo standard margin in % is expressed as a decimal... 1 = 100%, 0.5=50% ... In this module margin % is expressed as 100 = 1000%, 50 = 50%... what's the motivation. It's strange to store precentage value in a different way than Odoo. Can I change this and provide a migration script?

This would be an amazing great contribution @lmignon ! 💪🏼 😄 Thank you!

Shide commented 2 months ago

Could be closed in favor of https://github.com/OCA/margin-analysis/pull/215

lmignon commented 2 months ago

included into #215