Fix on_change_with_amount when _parent_purchase.currency is False
This commit is contained in:
1 parent
8dd65a03d6
commit
cf9e7f9bb3
1 file changed
+2
-3
+2
-3
@@ -1022,11 +1022,10 @@ class PurchaseLine(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_purchase.currency'), (int, long)):
|
||||
currency = vals.get('_parent_purchase.currency')
|
||||
if currency and isinstance(currency, (int, long)):
|
||||
currency = currency_obj.browse(
|
||||
vals['_parent_purchase.currency'])
|
||||
else:
|
||||
currency = vals['_parent_purchase.currency']
|
||||
amount = Decimal(str(vals.get('quantity') or '0.0')) * \
|
||||
(vals.get('unit_price') or Decimal('0.0'))
|
||||
if currency:
|
||||
|
||||
Reference in new issue
Block a user