From 115182533ec9198af14310e94d4e1d4a7bf6996e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 18 Dec 2008 23:35:35 +0100 Subject: [PATCH] Handle default salable value for issue671 --- sale.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sale.py b/sale.py index 5fabcc03d9..fae7149b96 100644 --- a/sale.py +++ b/sale.py @@ -888,7 +888,8 @@ class SaleLine(OSV): }, on_change=['product', 'unit', 'quantity', 'description', '_parent_sale.party', '_parent_sale.currency'], context="{'locations': [_parent_sale.warehouse], " \ - "'stock_date_end': _parent_sale.sale_date}") + "'stock_date_end': _parent_sale.sale_date, " \ + "'salable': True}") unit_price = fields.Numeric('Unit Price', digits=(16, 4), states={ 'invisible': "type != 'line'", @@ -1256,6 +1257,10 @@ class Template(OSV): on_change_with=['default_uom', 'sale_uom']) def default_salable(self, cursor, user, context=None): + if context is None: + context = {} + if context.get('salable'): + return True return False def on_change_with_sale_uom(self, cursor, user, ids, vals, context=None):