[FIX] stock: multicompany reception
When a picking is confirmed, the generated account.move(.line) should take the company, accounts, journals and period with the same company as the picking, not the one of the current user. This was problematic if a user in a company confirm a picking linked to a purchase order done in another company. For real time valuations, the generated accounting entries were mixing both companies. Fixes #3466
This commit is contained in:
parent
7f4c4a5e8a
commit
cf488682c8
|
@ -2355,6 +2355,9 @@ class stock_move(osv.osv):
|
|||
context = {}
|
||||
src_company_ctx = dict(context,force_company=move.location_id.company_id.id)
|
||||
dest_company_ctx = dict(context,force_company=move.location_dest_id.company_id.id)
|
||||
# do not take the company of the one of the user
|
||||
# used to select the correct period
|
||||
company_ctx = dict(context, company_id=move.company_id.id)
|
||||
account_moves = []
|
||||
# Outgoing moves (or cross-company output part)
|
||||
if move.location_id.company_id \
|
||||
|
@ -2386,7 +2389,8 @@ class stock_move(osv.osv):
|
|||
{
|
||||
'journal_id': j_id,
|
||||
'line_id': move_lines,
|
||||
'ref': move.picking_id and move.picking_id.name}, context=context)
|
||||
'company_id': move.company_id.id,
|
||||
'ref': move.picking_id and move.picking_id.name}, context=company_ctx)
|
||||
|
||||
def action_done(self, cr, uid, ids, context=None):
|
||||
""" Makes the move done and if all moves are done, it will finish the picking.
|
||||
|
|
Loading…
Reference in New Issue