From fda60ddb2fd033c29d628961749c6f33fe8f286f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 18 Dec 2008 23:35:58 +0100 Subject: [PATCH] Handle default purchasable value for issue671 --- purchase.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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,