From 0f7e6f4097b6759f4c5419eea71e85f9d6064a3a Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Mon, 22 Feb 2016 17:33:46 +0100 Subject: [PATCH] [FIX] account: Missing Partner in account move line When creating account move lines from an account move, the partner set on the account move lines has to be the same than the one on the account move. opw:668322 --- addons/account/models/account_move.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index af0bfab855a..69df6717fbd 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -96,7 +96,7 @@ class AccountMove(models.Model): @api.model def create(self, vals): - move = super(AccountMove, self.with_context(check_move_validity=False)).create(vals) + move = super(AccountMove, self.with_context(check_move_validity=False, partner_id=vals.get('partner_id'))).create(vals) move.assert_balanced() return move @@ -894,7 +894,8 @@ class AccountMoveLine(models.Model): MoveObj = self.env['account.move'] context = dict(self._context or {}) amount = vals.get('debit', 0.0) - vals.get('credit', 0.0) - + if not vals.get('partner_id') and context.get('partner_id'): + vals['partner_id'] = context.get('partner_id') if vals.get('move_id', False): move = MoveObj.browse(vals['move_id']) if move.date and not vals.get('date'):