diff --git a/account_financial_amount/models/account_move_line.py b/account_financial_amount/models/account_move_line.py index 786ecbf78..2432c7533 100644 --- a/account_financial_amount/models/account_move_line.py +++ b/account_financial_amount/models/account_move_line.py @@ -22,6 +22,8 @@ class AccountMoveLine(models.Model): @api.depends('debit', 'credit') def _compute_financial_amounts(self): date = fields.Date.today() + if self._context.get('date_account', False): + date = self._context.get('date_account') for line in self: financial_amount = ( line.currency_id and line.currency_id._convert( diff --git a/account_ux/models/account_move_line.py b/account_ux/models/account_move_line.py index aa7ff8b89..05d6f0009 100644 --- a/account_ux/models/account_move_line.py +++ b/account_ux/models/account_move_line.py @@ -41,23 +41,23 @@ def action_open_related_document(self): 'res_id': res_id, } - def _reconcile_lines(self, debit_moves, credit_moves, field): - """ Modificamos contexto para que odoo solo concilie el metodo - auto_reconcile_lines teniendo en cuenta la moneda de cia si la cuenta - no tiene moneda. - Va de la mano de la modificación de "create" en - account.partial.reconcile - Para que este cambio funcione bien es ademas importante este parche en odoo - https://github.com/odoo/odoo/pull/63390 - """ - if self and self[0].company_id.country_id == self.env.ref('base.ar') and not self[0].account_id.currency_id: - field = 'amount_residual' - return super()._reconcile_lines(debit_moves, credit_moves, field) - - def reconcile(self, writeoff_acc_id=False, writeoff_journal_id=False): - """ This is needed if you reconcile, for eg, 1 USD to 1 USD but in an ARS account, by default - odoo make a full reconcile and exchange - """ - if self and self[0].company_id.country_id == self.env.ref('base.ar') and not self[0].account_id.currency_id: - self = self.with_context(no_exchange_difference=True) - return super().reconcile(writeoff_acc_id=writeoff_acc_id, writeoff_journal_id=writeoff_journal_id) + # def _reconcile_lines(self, debit_moves, credit_moves, field): + # """ Modificamos contexto para que odoo solo concilie el metodo + # auto_reconcile_lines teniendo en cuenta la moneda de cia si la cuenta + # no tiene moneda. + # Va de la mano de la modificación de "create" en + # account.partial.reconcile + # Para que este cambio funcione bien es ademas importante este parche en odoo + # https://github.com/odoo/odoo/pull/63390 + # """ + # if self and self[0].company_id.country_id == self.env.ref('base.ar') and not self[0].account_id.currency_id: + # field = 'amount_residual' + # return super()._reconcile_lines(debit_moves, credit_moves, field) + + # def reconcile(self, writeoff_acc_id=False, writeoff_journal_id=False): + # """ This is needed if you reconcile, for eg, 1 USD to 1 USD but in an ARS account, by default + # odoo make a full reconcile and exchange + # """ + # if self and self[0].company_id.country_id == self.env.ref('base.ar') and not self[0].account_id.currency_id: + # self = self.with_context(no_exchange_difference=True) + # return super().reconcile(writeoff_acc_id=writeoff_acc_id, writeoff_journal_id=writeoff_journal_id) diff --git a/account_ux/models/account_partial_reconcile.py b/account_ux/models/account_partial_reconcile.py index 7fc357569..c1738b4ed 100644 --- a/account_ux/models/account_partial_reconcile.py +++ b/account_ux/models/account_partial_reconcile.py @@ -4,15 +4,16 @@ class AccountPartialReconcile(models.Model): _inherit = "account.partial.reconcile" - @api.model - def create(self, vals): - """ ademas de mandar en el contexto en el metodo reconcile, hacemos - que el partial reconcile que crea el metodo auto_reconcile_lines - no tenga moneda en la misma situación (podriamos ). - Va de la mano de la modificacion de "def reconcile" en aml - """ - if vals.get('currency_id'): - account = self.env['account.move.line'].browse(vals.get('debit_move_id')).account_id - if account.company_id.country_id == self.env.ref('base.ar') and not account.currency_id: - vals.update({'currency_id': False, 'amount_currency': 0.0}) - return super().create(vals) + #TODO revisar la compatibilidad de esta funcion con el diferencial de cambio + # @API.MODEL + # DEF CREATE(SELF, VALS): + # """ ADEMAS DE MANDAR EN EL CONTEXTO EN EL METODO RECONCILE, HACEMOS + # QUE EL PARTIAL RECONCILE QUE CREA EL METODO AUTO_RECONCILE_LINES + # NO TENGA MONEDA EN LA MISMA SITUACIÓN (PODRIAMOS ). + # VA DE LA MANO DE LA MODIFICACION DE "DEF RECONCILE" EN AML + # """ + # IF VALS.GET('CURRENCY_ID'): + # ACCOUNT = SELF.ENV['ACCOUNT.MOVE.LINE'].BROWSE(VALS.GET('DEBIT_MOVE_ID')).ACCOUNT_ID + # IF ACCOUNT.COMPANY_ID.COUNTRY_ID == SELF.ENV.REF('BASE.AR') AND NOT ACCOUNT.CURRENCY_ID: + # VALS.UPDATE({'CURRENCY_ID': FALSE, 'AMOUNT_CURRENCY': 0.0}) + # RETURN SUPER().CREATE(VALS)