diff --git a/purchase.py b/purchase.py index 83de728435..932ef5f2d4 100644 --- a/purchase.py +++ b/purchase.py @@ -780,7 +780,8 @@ class PurchaseLine(OSV): }, on_change=['product', 'unit', 'quantity', 'description', '_parent_purchase.party', '_parent_purchase.currency'], context="{'locations': [_parent_purchase.warehouse], " \ - "'stock_date_end': _parent_purchase.purchase_date}") + "'stock_date_end': _parent_purchase.purchase_date, " \ + "'purchasable': True}") unit_price = fields.Numeric('Unit Price', digits=(16, 4), states={ 'invisible': "type != 'line'", @@ -1166,6 +1167,10 @@ class Template(OSV): on_change_with=['default_uom', 'purchase_uom']) def default_purchasable(self, cursor, user, context=None): + if context is None: + context = {} + if context.get('purchasable'): + return True return False def on_change_with_purchase_uom(self, cursor, user, ids, vals,