[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
This commit is contained in:
@@ -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'):
|
||||
|
||||
Reference in New Issue
Block a user