From fbf5815a8bfca18571301b899022f330ff567f6e Mon Sep 17 00:00:00 2001 From: Cedric Snauwaert Date: Thu, 26 Sep 2013 17:37:25 +0200 Subject: [PATCH] [WIP]stock warehouse configuration in form view, automatically create routes, picking, location and switch between them if needed. Also corrected stock_location yml test by removing invoice state which is in account_stock and not dependant from stock_location bzr revid: csn@openerp.com-20130926153725-00gwbo2q1ok9pj21 --- addons/stock/procurement.py | 4 +- addons/stock/stock.py | 7 +- addons/stock/stock_view.xml | 5 +- addons/stock_location/__init__.py | 1 - addons/stock_location/__openerp__.py | 3 +- addons/stock_location/stock_location.py | 448 +++++++++++++++++- addons/stock_location/stock_location_view.xml | 21 +- .../test/stock_location_pull_flow.yml | 9 +- addons/stock_location/wizard/__init__.py | 1 - addons/stock_location/wizard/configure_wh.py | 274 ----------- .../wizard/configure_wh_view.xml | 39 -- 11 files changed, 479 insertions(+), 333 deletions(-) delete mode 100644 addons/stock_location/wizard/__init__.py delete mode 100644 addons/stock_location/wizard/configure_wh.py delete mode 100644 addons/stock_location/wizard/configure_wh_view.xml 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 @@
-