From 2e067e496e5549fa33edf2eaf0d6d79c5df1c07e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Fri, 3 Oct 2008 15:05:33 +0200 Subject: [PATCH] Add on_change_quantity on purchase line for issue409 --- purchase.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/purchase.py b/purchase.py index 8d14bc0009..5c5d623d25 100644 --- a/purchase.py +++ b/purchase.py @@ -728,7 +728,8 @@ class PurchaseLine(OSV): states={ 'invisible': "type != 'line'", 'required': "type == 'line'", - }) + }, on_change=['product', 'quantity', 'unit', + '_parent_purchase.currency', '_parent_purchase.party']) unit = fields.Many2One('product.uom', 'Unit', states={ 'required': "product", @@ -909,7 +910,7 @@ class PurchaseLine(OSV): res['unit_digits'] = product.purchase_uom.digits return res - def on_change_unit(self, cursor, user, ids, vals, context=None): + def on_change_quantity(self, cursor, user, ids, vals, context=None): product_obj = self.pool.get('product.product') if context is None: @@ -933,6 +934,9 @@ class PurchaseLine(OSV): context=ctx2)[vals['product']] return res + def on_change_unit(self, cursor, user, ids, vals, context=None): + return self.on_change_quantity(cursor, user, ids, vals, context=context) + def on_change_with_amount(self, cursor, user, ids, vals, context=None): currency_obj = self.pool.get('currency.currency') if vals.get('type') == 'line':