diff --git a/addons/stock/procurement.py b/addons/stock/procurement.py index 7701b6b8383..a52289c130f 100644 --- a/addons/stock/procurement.py +++ b/addons/stock/procurement.py @@ -56,12 +56,14 @@ class procurement_rule(osv.osv): 'route_sequence': fields.related('route_id', 'sequence', string='Route Sequence', store={'stock.location.route': (_get_rules, ['sequence'], 10)}), 'sequence': fields.integer('Sequence'), 'picking_type_id': fields.many2one('stock.picking.type', 'Picking Type', - help="Picking Type determines the way the picking should be shown in the view, reports, ...") + help="Picking Type determines the way the picking should be shown in the view, reports, ..."), + 'active': fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the rule without removing it."), } _defaults = { 'procure_method': 'make_to_stock', 'sequence': 20, + 'active': True, } class procurement_order(osv.osv): diff --git a/addons/stock/stock.py b/addons/stock/stock.py index af0f09acc4b..1f2b7530f14 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -96,7 +96,7 @@ class stock_location(osv.osv): """, select = True), 'complete_name': fields.function(_complete_name, type='char', string="Location Name", - store={'stock.location': (_get_sublocations, ['name', 'location_id'], 10)}), + store={'stock.location': (_get_sublocations, ['name', 'location_id', 'active'], 10)}), 'location_id': fields.many2one('stock.location', 'Parent Location', select=True, ondelete='cascade'), 'child_ids': fields.one2many('stock.location', 'location_id', 'Contains'), @@ -2114,6 +2114,7 @@ class stock_warehouse(osv.osv): 'company_id': fields.many2one('res.company', 'Company', required=True, select=True), 'partner_id': fields.many2one('res.partner', 'Address'), 'lot_stock_id': fields.many2one('stock.location', 'Location Stock', required=True, domain=[('usage', '=', 'internal')]), + 'code': fields.char('Warehouse Unique Identifier', size=5, required=True, help="Short name used to identify your warehouse"), } def _default_stock_id(self, cr, uid, context=None): @@ -2124,6 +2125,10 @@ class stock_warehouse(osv.osv): 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'stock.inventory', context=c), 'lot_stock_id': _default_stock_id, } + _sql_constraints = [ + ('warehouse_name_uniq', 'unique (name, company_id)', 'The name of the warehouse must be unique per company!'), + ('warehouse_code_uniq', 'unique (code, company_id)', 'The code of the warehouse must be unique per company !'), + ] # ------------------------- diff --git a/addons/stock/stock_view.xml b/addons/stock/stock_view.xml index 95d7b1b702a..716d627ddbc 100644 --- a/addons/stock/stock_view.xml +++ b/addons/stock/stock_view.xml @@ -503,11 +503,12 @@
-