[FIX] sale: update_tax in product_id_change

Thanks to the fix 503820a, when a fiscal position mapped an included
tax on a SO line, the price unit of the product is recomputed.
This fix has been applied in the function product_id_change in
the model "sale.order.line"

Before the fix, when changing the product uom on a SO line, the price
unit of the SO line was reset with the pricelist price without taking
into account the fact that a included tax could be removed on the SO line.

To avoid this kind of problem, the price unit must be recomputed in any
case according to the taxes.
This commit is contained in:
Goffin Simon 2015-12-02 14:47:33 +01:00
parent d9f92ba160
commit 2749f73f9b
1 changed files with 7 additions and 11 deletions

View File

@ -1142,10 +1142,7 @@ class sale_order_line(osv.osv):
fpos = partner.property_account_position or False
else:
fpos = self.pool.get('account.fiscal.position').browse(cr, uid, fiscal_position)
if update_tax: #The quantity only have changed
# The superuser is used by website_sale in order to create a sale order. We need to make
# sure we only select the taxes related to the company of the partner. This should only
# apply if the partner is linked to a company.
if uid == SUPERUSER_ID and context.get('company_id'):
taxes = product_obj.taxes_id.filtered(lambda r: r.company_id.id == context['company_id'])
else:
@ -1209,7 +1206,6 @@ class sale_order_line(osv.osv):
warning_msgs += _("No valid pricelist line found ! :") + warn_msg +"\n\n"
else:
if update_tax:
price = self.pool['account.tax']._fix_tax_included_price(cr, uid, price, taxes, result['tax_id'])
result.update({'price_unit': price})
if context.get('uom_qty_change', False):