Skip to content

Commit

Permalink
[FIX] account_multic_fix: fix change company with different currency
Browse files Browse the repository at this point in the history
closes #130

Related: ingadhoc/account-financial-tools#456
Signed-off-by: Juan José Scarafía <jjs@adhoc.com.ar>
  • Loading branch information
jjscarafia committed Oct 19, 2023
1 parent 5096923 commit ee2d664
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 @@ -84,3 +84,14 @@ def _check_invoice_state(self):
for inv in self:
if inv.state == 'cancel':
raise UserError(_('It is not possible to change the journal if the invoice is cancelled. You can edit it changing the invoice state to draft.'))

@api.constrains('line_ids', 'fiscal_position_id', 'company_id')
def _validate_taxes_country(self):
# cuando se esta cambiando de compañía con distinto pais da error porque en una primer instancia
# no viene seteada la sincronizacion de amls y viene el check validity false. Nos agarramos de esto ultimo
# para definir que si no estamos chequeando validez (lo vemos en el contexto) entonces no chequeamos tampoco
# esto que en realidad da un falso positivo
# NOTA en 16 ya no se necesita mas ya que cambiamos el approach
if self._context.get('check_move_validity') is False:
return
return super()._validate_taxes_country()

0 comments on commit ee2d664

Please sign in to comment.