Skip to content

Commit

Permalink
[13.0] [FIX] account_multic_fix: Fix a problem when change journal fo…
Browse files Browse the repository at this point in the history
…r lines without product.
  • Loading branch information
nicomacr committed Sep 17, 2021
1 parent 004e328 commit c35cd2d
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions account_multic_fix/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ def _onchange_journal(self):
line.name = name
line.price_unit = price_unit
line.product_uom_id = product_uom

# To prevent the mixen company with account and taxes when the line doesn't have a product,
# we force to choose a new account after change the journal for a different company
if not line.display_type and not line.product_id:
if line.account_id.company_id != line.company_id:
line.account_id = False
if any([line.company_id.id != l.company_id.id for l in line.tax_ids]):
taxes = line._get_computed_taxes()
if taxes and line.move_id.fiscal_position_id:
taxes = line.move_id.fiscal_position_id.map_tax(taxes, partner=line.partner_id)
line.tax_ids = taxes
# we need to force change currency
if self.currency_id != self.company_id.currency_id:
self._onchange_currency()
Expand Down

0 comments on commit c35cd2d

Please sign in to comment.