unit_price and quantity could be None during on_change calls
issue2740 (transplanted from e51f8556416e21590b6bf534fb43691934ccafd0)
This commit is contained in:
1 parent
1ac1a53039
commit
b1d93b003b
1 file changed
+4
-4
@@ -425,8 +425,8 @@ class Sale(Workflow, ModelSQL, ModelView):
|
||||
tax_list = ()
|
||||
with Transaction().set_context(self.get_tax_context(vals)):
|
||||
tax_list = tax_obj.compute(line.get('taxes', []),
|
||||
line.get('unit_price', Decimal('0.0')),
|
||||
line.get('quantity', 0.0))
|
||||
line.get('unit_price') or Decimal('0.0'),
|
||||
line.get('quantity') or 0.0)
|
||||
for tax in tax_list:
|
||||
key, val = invoice_obj._compute_tax(tax, 'out_invoice')
|
||||
if not key in taxes:
|
||||
@@ -1203,7 +1203,7 @@ class SaleLine(ModelSQL, ModelView):
|
||||
with Transaction().set_context(
|
||||
self._get_context_sale_price(product, vals)):
|
||||
res['unit_price'] = product_obj.get_sale_price([product.id],
|
||||
vals.get('quantity', 0))[product.id]
|
||||
vals.get('quantity') or 0)[product.id]
|
||||
if res['unit_price']:
|
||||
res['unit_price'] = res['unit_price'].quantize(
|
||||
Decimal(1) / 10 ** self.unit_price.digits[1])
|
||||
@@ -1268,7 +1268,7 @@ class SaleLine(ModelSQL, ModelView):
|
||||
with Transaction().set_context(
|
||||
self._get_context_sale_price(product, vals)):
|
||||
res['unit_price'] = product_obj.get_sale_price([vals['product']],
|
||||
vals.get('quantity', 0))[vals['product']]
|
||||
vals.get('quantity') or 0)[vals['product']]
|
||||
if res['unit_price']:
|
||||
res['unit_price'] = res['unit_price'].quantize(
|
||||
Decimal(1) / 10 ** self.unit_price.digits[1])
|
||||
|
||||
Reference in new issue
Block a user