Fix on_change_with_amount when _parent_sale.currency is False

This commit is contained in:
Cédric Krier
2010-11-14 00:31:00 +01:00
parent 76138fb3e1
commit 2ae91c9fe7
+2 -3
View File
@@ -1101,10 +1101,9 @@ class SaleLine(ModelSQL, ModelView):
def on_change_with_amount(self, vals):
currency_obj = self.pool.get('currency.currency')
if vals.get('type') == 'line':
if isinstance(vals.get('_parent_sale.currency'), (int, long)):
currency = vals.get('_parent_sale.currency')
if currency and isinstance(currency, (int, long)):
currency = currency_obj.browse(vals['_parent_sale.currency'])
else:
currency = vals['_parent_sale.currency']
amount = Decimal(str(vals.get('quantity') or '0.0')) * \
(vals.get('unit_price') or Decimal('0.0'))
if currency: