[FIX] procurement order should have right company

bzr revid: jco@openerp.com-20130513152717-hyazuumdd74ey27z
This commit is contained in:
Josse Colpaert 2013-05-13 17:27:17 +02:00
parent 9a08f7a4ce
commit c01e9b46f6
4 changed files with 9 additions and 2 deletions

View File

@ -67,6 +67,7 @@ class make_procurement(osv.osv_memory):
for proc in self.browse(cr, uid, ids, context=context):
wh = wh_obj.browse(cr, uid, proc.warehouse_id.id, context=context)
print "Company,", wh.company_id
procure_id = procurement_obj.create(cr, uid, {
'name':'INT: '+str(user),
'date_planned': proc.date_planned,
@ -75,6 +76,7 @@ class make_procurement(osv.osv_memory):
'product_uom': proc.uom_id.id,
'location_id': wh.lot_stock_id.id,
'procure_method':'make_to_order',
'company_id': wh.company_id.id,
})
procurement_obj.signal_button_confirm(cr, uid, [procure_id])

View File

@ -1632,9 +1632,9 @@ class stock_move(osv.osv):
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 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))
raise osv.except_osv(_('Error'), _('The company of the source location %s of %s and the company of the stock move %s %s should be the same') % (record.location_id.name, record.location_id.company_id.name, record.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))
raise osv.except_osv(_('Error'), _('The company of the destination location %s of %s and the company of the stock move %s %s should be the same') % (record.location_dest_id.name, record.location_dest_id.company_id.name, record.name, record.company_id.name))
return True
_constraints = [

View File

@ -65,6 +65,8 @@ class procurement_order(osv.osv):
'note': _('Picking for pulled procurement coming from original location %s, pull rule %s, via original Procurement %s (#%d)') % (proc.location_id.name, line.name, proc.name, proc.id),
'invoice_state': line.invoice_state,
})
print "COmpany_id line:", line.company_id
move_id = move_obj.create(cr, uid, {
'name': line.name,
'picking_id': picking_id,

View File

@ -145,6 +145,7 @@
picking_type: out
procure_method: make_to_stock
type_proc: move
company_id: stock.res_company_1
- invoice_state: none
location_id: stock.stock_location_shop1
location_src_id: stock.stock_location_suppliers
@ -153,11 +154,13 @@
picking_type: out
procure_method: make_to_stock
type_proc: move
company_id: stock.res_company_1
- invoice_state: none
location_id: stock.stock_location_suppliers
location_src_id: stock.stock_location_stock
name: E003
type_proc: buy
company_id: base.main_company
property_stock_inventory: stock.location_inventory
property_stock_procurement: stock.location_procurement
property_stock_production: stock.location_production