diff --git a/configuration.py b/configuration.py index b63fadb25d..5ade36fd8b 100644 --- a/configuration.py +++ b/configuration.py @@ -12,31 +12,31 @@ class Configuration(ModelSingleton, ModelSQL, ModelView): shipment_in_sequence = fields.Property(fields.Many2One('ir.sequence', 'Supplier Shipment Sequence', domain=[ ('company', 'in', - [Get(Eval('context', {}), 'company'), False]), + [Get(Eval('context', {}), 'company'), None]), ('code', '=', 'stock.shipment.in'), ], required=True)) shipment_in_return_sequence = fields.Property(fields.Many2One( 'ir.sequence', 'Supplier Return Shipment Sequence', domain=[ ('company', 'in', - [Get(Eval('context', {}), 'company'), False]), + [Get(Eval('context', {}), 'company'), None]), ('code', '=', 'stock.shipment.in.return'), ], required=True)) shipment_out_sequence = fields.Property(fields.Many2One( 'ir.sequence', 'Customer Shipment Sequence', domain=[ ('company', 'in', - [Get(Eval('context', {}), 'company'), False]), + [Get(Eval('context', {}), 'company'), None]), ('code', '=', 'stock.shipment.out'), ], required=True)) shipment_out_return_sequence = fields.Property(fields.Many2One( 'ir.sequence', 'Customer Return Shipment Sequence', domain=[ ('company', 'in', - [Get(Eval('context', {}), 'company'), False]), + [Get(Eval('context', {}), 'company'), None]), ('code', '=', 'stock.shipment.out.return'), ], required=True)) shipment_internal_sequence = fields.Property(fields.Many2One( 'ir.sequence', 'Internal Shipment Sequence', domain=[ ('company', 'in', - [Get(Eval('context', {}), 'company'), False]), + [Get(Eval('context', {}), 'company'), None]), ('code', '=', 'stock.shipment.internal'), ], required=True)) diff --git a/inventory.py b/inventory.py index 2bf1eaf3c0..d0270905a8 100644 --- a/inventory.py +++ b/inventory.py @@ -83,14 +83,13 @@ class Inventory(Workflow, ModelSQL, ModelView): return date_obj.today() def default_company(self): - return Transaction().context.get('company') or False + return Transaction().context.get('company') def default_lost_found(self): location_obj = Pool().get('stock.location') location_ids = location_obj.search(self.lost_found.domain) if len(location_ids) == 1: return location_ids[0] - return False @ModelView.button @Workflow.transition('done') @@ -120,7 +119,7 @@ class Inventory(Workflow, ModelSQL, ModelView): default = {} default = default.copy() default['date'] = date_obj.today() - default['lines'] = False + default['lines'] = None new_ids = [] for inventory in self.browse(ids): @@ -128,7 +127,7 @@ class Inventory(Workflow, ModelSQL, ModelView): line_obj.copy([x.id for x in inventory.lines], default={ 'inventory': new_id, - 'move': False, + 'move': None, }) self.complete_lines(new_id) new_ids.append(new_id) @@ -269,7 +268,7 @@ class InventoryLine(ModelSQL, ModelView): }) move_obj.delete([l.move.id for l in lines if l.move]) self.write([l.id for l in lines if l.move], { - 'move': False, + 'move': None, }) def create_move(self, line): diff --git a/location.py b/location.py index d8779b45f3..4a141f0aba 100644 --- a/location.py +++ b/location.py @@ -54,7 +54,7 @@ class Location(ModelSQL, ModelView): ('type','=','storage'), ['OR', ('parent', 'child_of', [Eval('id')]), - ('parent', '=', False), + ('parent', '=', None), ], ], depends=['type', 'active', 'id']) @@ -67,7 +67,7 @@ class Location(ModelSQL, ModelView): domain=[('type','=','storage'), ['OR', ('parent', 'child_of', [Eval('id')]), - ('parent', '=', False)]], + ('parent', '=', None)]], depends=['type', 'active', 'id']) storage_location = fields.Many2One( "stock.location", "Storage", states={ @@ -78,7 +78,7 @@ class Location(ModelSQL, ModelView): domain=[('type','=','storage'), ['OR', ('parent', 'child_of', [Eval('id')]), - ('parent', '=', False)]], + ('parent', '=', None)]], depends=['type', 'active', 'id']) quantity = fields.Function(fields.Float('Quantity'), 'get_quantity') forecast_quantity = fields.Function(fields.Float('Forecast Quantity'), @@ -181,7 +181,7 @@ class Location(ModelSQL, ModelView): trans_context = Transaction().context product_id = trans_context.get('product') if not product_id: - return dict((id, False) for id in ids) + return dict((id, None) for id in ids) cost_values, context = {}, {} if 'stock_date_end' in trans_context: context['_datetime'] = trans_context['stock_date_end'] @@ -270,10 +270,10 @@ class Location(ModelSQL, ModelView): wh_default = default.copy() wh_default['type'] = 'view' - wh_default['input_location'] = False - wh_default['output_location'] = False - wh_default['storage_location'] = False - wh_default['childs'] = False + wh_default['input_location'] = None + wh_default['output_location'] = None + wh_default['storage_location'] = None + wh_default['childs'] = None new_id = super(Location, self).copy(location.id, default=wh_default) diff --git a/move.py b/move.py index d48f398a6b..333d45056e 100644 --- a/move.py +++ b/move.py @@ -190,13 +190,13 @@ class Move(ModelSQL, ModelView): table.index_action('create_date', action='add') def default_planned_date(self): - return Transaction().context.get('planned_date') or False + return Transaction().context.get('planned_date') def default_state(self): return 'draft' def default_company(self): - return Transaction().context.get('company') or False + return Transaction().context.get('company') def default_currency(self): company_obj = Pool().get('company.company') @@ -204,7 +204,6 @@ class Move(ModelSQL, ModelView): if company: company = company_obj.browse(company) return company.currency.id - return False def on_change_with_unit_digits(self, vals): uom_obj = Pool().get('product.uom') @@ -499,7 +498,7 @@ class Move(ModelSQL, ModelView): if 'state' in vals: for move in moves: if vals['state'] == 'cancel': - vals['effective_date'] = False + vals['effective_date'] = None if (move.from_location.type in ('supplier', 'production') and move.to_location.type == 'storage' and move.state != 'cancel' diff --git a/period.py b/period.py index 602a52ea08..09aaef20c8 100644 --- a/period.py +++ b/period.py @@ -77,7 +77,7 @@ class Period(ModelSQL, ModelView): if move_obj.search([ ('state', '=', 'assigned'), ['OR', [ - ('effective_date', '=', False), + ('effective_date', '=', None), ('planned_date', '<=', recent_date), ], ('effective_date', '<=', recent_date), diff --git a/shipment.py b/shipment.py index 0ee83a9c40..fcea4fc982 100644 --- a/shipment.py +++ b/shipment.py @@ -68,7 +68,7 @@ class ShipmentIn(Workflow, ModelSQL, ModelView): incoming_moves = fields.Function(fields.One2Many('stock.move', None, 'Incoming Moves', add_remove=[ - ('shipment_in', '=', False), + ('shipment_in', '=', None), ('from_location', '=', Eval('supplier_location')), ('state', '=', 'draft'), ('to_location', '=', Eval('warehouse_input')), @@ -203,14 +203,13 @@ class ShipmentIn(Workflow, ModelSQL, ModelView): location_ids = location_obj.search(self.warehouse.domain) if len(location_ids) == 1: return location_ids[0] - return False def default_company(self): - return Transaction().context.get('company') or False + return Transaction().context.get('company') def on_change_supplier(self, values): if not values.get('supplier'): - return {'contact_address': False} + return {'contact_address': None} party_obj = Pool().get("party.party") address_id = party_obj.address_get(values['supplier']) return {'contact_address': address_id} @@ -347,8 +346,8 @@ class ShipmentIn(Workflow, ModelSQL, ModelView): if default is None: default = {} default = default.copy() - default['inventory_moves']= False - default['incoming_moves']= False + default['inventory_moves']= None + default['incoming_moves']= None return super(ShipmentIn, self).copy(ids, default=default) def _get_inventory_moves(self, incoming_move): @@ -364,7 +363,7 @@ class ShipmentIn(Workflow, ModelSQL, ModelView): res['state'] = 'draft' # Product will be considered in stock only when the inventory # move will be made: - res['planned_date'] = False + res['planned_date'] = None res['company'] = incoming_move.company.id return res @@ -566,7 +565,7 @@ class ShipmentInReturn(Workflow, ModelSQL, ModelView): return 'draft' def default_company(self): - return Transaction().context.get('company') or False + return Transaction().context.get('company') def _get_move_planned_date(self, shipment): ''' @@ -891,14 +890,13 @@ class ShipmentOut(Workflow, ModelSQL, ModelView): location_ids = location_obj.search(self.warehouse.domain) if len(location_ids) == 1: return location_ids[0] - return False def default_company(self): - return Transaction().context.get('company') or False + return Transaction().context.get('company') def on_change_customer(self, values): if not values.get('customer'): - return {'delivery_address': False} + return {'delivery_address': None} party_obj = Pool().get("party.party") address_id = party_obj.address_get(values['customer'], type='delivery') return {'delivery_address': address_id} @@ -1190,8 +1188,8 @@ class ShipmentOut(Workflow, ModelSQL, ModelView): if default is None: default = {} default = default.copy() - default['inventory_moves']= False - default['outgoing_moves']= False + default['inventory_moves']= None + default['outgoing_moves']= None return super(ShipmentOut, self).copy(ids, default=default) @@ -1397,14 +1395,13 @@ class ShipmentOutReturn(Workflow, ModelSQL, ModelView): location_ids = location_obj.search(self.warehouse.domain) if len(location_ids) == 1: return location_ids[0] - return False def default_company(self): - return Transaction().context.get('company') or False + return Transaction().context.get('company') def on_change_customer(self, values): if not values.get('customer'): - return {'delivery_address': False} + return {'delivery_address': None} party_obj = Pool().get("party.party") address_id = party_obj.address_get(values['customer'], type='delivery') return { @@ -1546,8 +1543,8 @@ class ShipmentOutReturn(Workflow, ModelSQL, ModelView): if default is None: default = {} default = default.copy() - default['inventory_moves']= False - default['incoming_moves']= False + default['inventory_moves']= None + default['incoming_moves']= None return super(ShipmentOutReturn, self).copy(ids, default=default) @@ -1611,7 +1608,7 @@ class ShipmentOutReturn(Workflow, ModelSQL, ModelView): res['state'] = 'draft' # Product will be considered in stock only when the inventory # move will be made: - res['planned_date'] = False + res['planned_date'] = None res['company'] = incoming_move.company.id return res @@ -1829,7 +1826,7 @@ class ShipmentInternal(Workflow, ModelSQL, ModelView): return 'draft' def default_company(self): - return Transaction().context.get('company') or False + return Transaction().context.get('company') def create(self, values): sequence_obj = Pool().get('ir.sequence')