From 9a08f7a4ce44a45b2fef216e3cdaa15321ebdb69 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Mon, 13 May 2013 15:35:35 +0200 Subject: [PATCH] [FIX] Adding stock move constraint and changing warehouse in purchase requisition test meanwhile bzr revid: jco@openerp.com-20130513133535-0g1e5pxfqzess7n9 --- .../purchase_requisition/test/purchase_requisition.yml | 2 +- addons/stock/stock.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/addons/purchase_requisition/test/purchase_requisition.yml b/addons/purchase_requisition/test/purchase_requisition.yml index 808b2eb5350..791dc02f895 100644 --- a/addons/purchase_requisition/test/purchase_requisition.yml +++ b/addons/purchase_requisition/test/purchase_requisition.yml @@ -8,7 +8,7 @@ product_id: product.product_product_13 qty: 15 uom_id: product.product_uom_unit - warehouse_id: stock.stock_warehouse_shop0 + warehouse_id: stock.warehouse0 - !python {model: make.procurement}: | self.make_procurement(cr, uid, [ref('procurement_product_hdd3')], context) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index 5c56e143539..7b1c6e0dd84 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -1630,11 +1630,11 @@ class stock_move(osv.osv): return True #TODO: change demo data for this to be possible def _check_company_location(self, cr, uid, ids, context=None): -# for record in self.browse(cr, uid, ids, context=context): -# if record.location_id.company_id and (record.company_id.id != record.location_id.company_id.id): -# raise osv.except_osv(_('Error'), _('The company of the source location %s and the company of the stock move should be the same') % record.location_id.name) -# if record.location_dest_id.company_id and (record.company_id.id != record.location_dest_id.company_id.id): -# raise osv.except_osv(_('Error'), _('The company of the destination location %s and the company of the stock move should be the same') % record.location_dest_id.name) + for record in self.browse(cr, uid, ids, context=context): + if record.location_id.company_id and (record.company_id.id != record.location_id.company_id.id): + raise osv.except_osv(_('Error'), _('The company of the source location %s of %s and the company of the stock move %s should be the same') % (record.location_id.name, record.location_id.company_id.name, record.company_id)) + if record.location_dest_id.company_id and (record.company_id.id != record.location_dest_id.company_id.id): + raise osv.except_osv(_('Error'), _('The company of the destination location %s of %s and the company of the stock move %s should be the same') % (record.location_dest_id.name, record.location_dest_id.company_id.name, record.company_id.name)) return True _constraints = [