Commits

Guillem Barba (NaN·tic) committed 030df50

sales shop field readonly if there is lines or reference

Comments (0)

Files changed (1)

 from trytond.model import fields
 from trytond.transaction import Transaction
 from trytond.pool import Pool, PoolMeta
-from trytond.pyson import Bool, Eval
+from trytond.pyson import Bool, Eval, Or
 
 __all__ = ['Sale']
 __metaclass__ = PoolMeta
         on_change=['shop', 'company', 'invoice_method', 'shipment_method',
             'warehouse', 'price_list', 'payment_term'],
         states={
-            'readonly': Bool(Eval('reference')),
-            }, depends=['reference'])
+            'readonly': Or(Bool(Eval('reference')), Bool(Eval('lines'))),
+            }, depends=['reference', 'lines'])
     shop_address = fields.Function(fields.Many2One('party.address',
             'Shop Address', on_change_with=['shop']),
         'on_change_with_shop_address')