diff --git a/location.py b/location.py index e90d46b6da..21b9e0714b 100644 --- a/location.py +++ b/location.py @@ -44,27 +44,30 @@ class Location(ModelSQL, ModelView): 'readonly': "not active", 'required': "type == 'warehouse'", }, - domain="[('type','=','storage'), ['OR', " \ - "('parent', 'child_of', [active_id]), " \ - "('parent', '=', False)]]") + domain=["('type','=','storage')", + ['OR', + "('parent', 'child_of', [active_id])", + "('parent', '=', False)"]]) output_location = fields.Many2One( "stock.location", "Output", states={ 'invisible': "type != 'warehouse'", 'readonly': "not active", 'required': "type == 'warehouse'", }, - domain="[('type','=','storage'), ['OR', " \ - "('parent', 'child_of', [active_id]), " \ - "('parent', '=', False)]]") + domain=["('type','=','storage')", + ['OR', + "('parent', 'child_of', [active_id])", + "('parent', '=', False)"]]) storage_location = fields.Many2One( "stock.location", "Storage", states={ 'invisible': "type != 'warehouse'", 'readonly': "not active", 'required': "type == 'warehouse'", }, - domain="[('type','=','storage'), ['OR', " \ - "('parent', 'child_of', [active_id]), " \ - "('parent', '=', False)]]") + domain=["('type','=','storage')", + ['OR', + "('parent', 'child_of', [active_id])", + "('parent', '=', False)"]]) quantity = fields.Function('get_quantity', type='float', string='Quantity') forecast_quantity = fields.Function('get_quantity', type='float', string='Forecast Quantity') diff --git a/move.py b/move.py index 0bbef49be2..a26cb71c24 100644 --- a/move.py +++ b/move.py @@ -20,8 +20,8 @@ class Move(ModelSQL, ModelView): 'from_location', 'to_location'], domain=[('type', '!=', 'service')]) uom = fields.Many2One("product.uom", "Uom", required=True, states=STATES, - domain="[('category', '=', " \ - "(product, 'product.default_uom.category'))]", + domain=["('category', '=', " \ + "(product, 'product.default_uom.category'))"], context="{'category': (product, 'product.default_uom.category')}", on_change=['product', 'currency', 'uom', 'company', 'from_location', 'to_location']) @@ -31,12 +31,12 @@ class Move(ModelSQL, ModelView): digits="(16, unit_digits)", states=STATES) from_location = fields.Many2One("stock.location", "From Location", select=1, required=True, states=STATES, - domain="[('type', 'not in', " \ - "('warehouse', 'view'))]") + domain=["('type', 'not in', " \ + "('warehouse', 'view'))"]) to_location = fields.Many2One("stock.location", "To Location", select=1, required=True, states=STATES, - domain="[('type', 'not in', " \ - "('warehouse', 'view'))]") + domain=["('type', 'not in', " \ + "('warehouse', 'view'))"]) packing_in = fields.Many2One('stock.packing.in', 'Supplier Shipment', readonly=True, select=1, ondelete='CASCADE') packing_out = fields.Many2One('stock.packing.out', 'Customer Shipment', @@ -60,7 +60,7 @@ class Move(ModelSQL, ModelView): company = fields.Many2One('company.company', 'Company', required=True, states={ 'readonly': "state != 'draft'", - }, domain="[('id', '=', context.get('company', 0))]") + }, domain=["('id', '=', context.get('company', 0))"]) unit_price = fields.Numeric('Unit Price', digits=(16, 4), states={ 'invisible': "not unit_price_required", diff --git a/packing.py b/packing.py index 371e900d96..4e6fc849e0 100644 --- a/packing.py +++ b/packing.py @@ -31,7 +31,7 @@ class PackingIn(ModelWorkflow, ModelSQL, ModelView): contact_address = fields.Many2One('party.address', 'Contact Address', states={ 'readonly': "state != 'draft'", - }, domain="[('party', '=', supplier)]") + }, domain=["('party', '=', supplier)"]) warehouse = fields.Many2One('stock.location', "Warehouse", required=True, domain=[('type', '=', 'warehouse')], states={ @@ -469,7 +469,7 @@ class PackingOut(ModelWorkflow, ModelSQL, ModelView): 'Delivery Address', required=True, states={ 'readonly': "state != 'draft'", - }, domain="[('party', '=', customer)]") + }, domain=["('party', '=', customer)"]) reference = fields.Char("Reference", size=None, select=1, states={ 'readonly': "state != 'draft'", @@ -859,7 +859,7 @@ class PackingOutReturn(ModelWorkflow, ModelSQL, ModelView): 'Delivery Address', required=True, states={ 'readonly': "state != 'draft'", - }, domain="[('party', '=', customer)]") + }, domain=["('party', '=', customer)"]) reference = fields.Char("Reference", size=None, select=1, states={ 'readonly': "state != 'draft'", @@ -1205,13 +1205,13 @@ class PackingInternal(ModelWorkflow, ModelSQL, ModelView): from_location = fields.Many2One( 'stock.location', "From Location", required=True, states={ 'readonly': "state != 'draft' or bool(moves)", }, - domain="[('type', 'not in', " \ - "('supplier', 'customer', 'warehouse', 'view'))]") + domain=["('type', 'not in', " \ + "('supplier', 'customer', 'warehouse', 'view'))"]) to_location = fields.Many2One('stock.location', "To Location", required=True, states={ 'readonly': "state != 'draft' or bool(moves)", - }, domain="[('type', 'not in', " \ - "('supplier', 'customer', 'warehouse', 'view'))]") + }, domain=["('type', 'not in', " \ + "('supplier', 'customer', 'warehouse', 'view'))"]) moves = fields.One2Many( 'stock.move', 'packing_internal', 'Moves', states={'readonly': "state != 'draft' or "\