Handle default purchasable value for issue671

This commit is contained in:
Cédric Krier committed 2008-12-18 23:35:58 +01:00
1 parent fcca38814c
commit fda60ddb2f
1 file changed
+6 -1
+6 -1
View File
@@ -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,