summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin (OpenERP) <qdp-launchpad@openerp.com>2014-01-30 10:32:30 +0100
committerQuentin (OpenERP) <qdp-launchpad@openerp.com>2014-01-30 10:32:30 +0100
commitfc90a100d0b1e9f511b2cf6d740dce64310c4641 (patch)
tree57d8ed54e068962a0dfc669a62d787abe0a96ea6
parent2dd1e8094c2cf5cea53fc81454662d4c7cbad475 (diff)
parentf2d62ab2a46a4b6f70834c5efc5a2776c2acec65 (diff)
[MERGE] stock: fixing the choice of itself as resupply warehouse
lp bug: https://launchpad.net/bugs/1273591 fixed bzr revid: qdp-launchpad@openerp.com-20140130093230-bngkb73n6h07ggch
-rw-r--r--addons/stock/stock.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/addons/stock/stock.py b/addons/stock/stock.py
index 261d7165040..f72af2a4911 100644
--- a/addons/stock/stock.py
+++ b/addons/stock/stock.py
@@ -2461,7 +2461,6 @@ class stock_warehouse(osv.osv):
_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!'),
- ('default_resupply_wh_diff', 'check (id != default_resupply_wh_id)', 'The default resupply warehouse should be different that the warehouse itself!'),
]
def _get_partner_locations(self, cr, uid, ids, context=None):
@@ -2926,6 +2925,8 @@ class stock_warehouse(osv.osv):
#not implemented
pass
if 'default_resupply_wh_id' in vals:
+ if vals.get('default_resupply_wh_id') == warehouse.id:
+ raise osv.except_osv(_('Warning'),_('The default resupply warehouse should be different than the warehouse itself!'))
if warehouse.default_resupply_wh_id:
#remove the existing resupplying route on all products
to_remove_route_ids = route_obj.search(cr, uid, [('supplied_wh_id', '=', warehouse.id), ('supplier_wh_id', '=', warehouse.default_resupply_wh_id.id)], context=context)