From 0e47cad6e28366fcc995f2df973688e7639e7cef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20Krier?= Date: Thu, 20 Nov 2008 18:49:52 +0100 Subject: [PATCH] Set readonly on field that use _parent_purchase when _parent_purchase is not set --- purchase.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/purchase.py b/purchase.py index 57eb0c15ac..cdf58bb738 100644 --- a/purchase.py +++ b/purchase.py @@ -745,12 +745,14 @@ class PurchaseLine(OSV): states={ 'invisible': "type != 'line'", 'required': "type == 'line'", + 'readonly': "not globals().get('_parent_purchase')", }, on_change=['product', 'quantity', 'unit', '_parent_purchase.currency', '_parent_purchase.party']) unit = fields.Many2One('product.uom', 'Unit', states={ 'required': "product", 'invisible': "type != 'line'", + 'readonly': "not globals().get('_parent_purchase')", }, domain="[('category', '=', " \ "(product, 'product.default_uom.category'))]", context="{'category': (product, 'product.default_uom.category')}", @@ -762,6 +764,7 @@ class PurchaseLine(OSV): domain=[('purchasable', '=', True)], states={ 'invisible': "type != 'line'", + 'readonly': "not globals().get('_parent_purchase')", }, on_change=['product', 'unit', 'quantity', 'description', '_parent_purchase.party', '_parent_purchase.currency'], context="{'locations': [_parent_purchase.warehouse], " \ @@ -775,6 +778,7 @@ class PurchaseLine(OSV): digits="(16, _parent_purchase.currency_digits)", states={ 'invisible': "type not in ('line', 'subtotal')", + 'readonly': "not globals().get('_parent_purchase')", }, on_change_with=['type', 'quantity', 'unit_price', '_parent_purchase.currency']) description = fields.Char('Description', size=None, required=True)