From c6f2ac2dc41b94252725b1077f946cb345e6260d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20L=C3=B3pez?= Date: Fri, 16 Feb 2024 15:42:21 -0400 Subject: [PATCH] [REF] l10n_do_accounting: remove bad feature of manual credit note (#1140) --- l10n_do_accounting/__manifest__.py | 2 +- .../wizard/account_move_reversal.py | 56 +++---------------- 2 files changed, 9 insertions(+), 49 deletions(-) diff --git a/l10n_do_accounting/__manifest__.py b/l10n_do_accounting/__manifest__.py index b34d3620e..9a8f2be28 100644 --- a/l10n_do_accounting/__manifest__.py +++ b/l10n_do_accounting/__manifest__.py @@ -8,7 +8,7 @@ "category": "Localization", "license": "LGPL-3", "website": "https://github.com/odoo-dominicana", - "version": "16.0.1.4.0", + "version": "16.0.1.5.0", # any module necessary for this one to work correctly "depends": ["l10n_latam_invoice_document", "l10n_do"], # always loaded diff --git a/l10n_do_accounting/wizard/account_move_reversal.py b/l10n_do_accounting/wizard/account_move_reversal.py index 985f057f4..825a902a5 100644 --- a/l10n_do_accounting/wizard/account_move_reversal.py +++ b/l10n_do_accounting/wizard/account_move_reversal.py @@ -86,36 +86,9 @@ def _compute_l10n_latam_manual_document_number(self): AccountMoveReversal, self - l10n_do_recs )._compute_l10n_latam_manual_document_number() - @api.model - def default_get(self, fields): - res = super(AccountMoveReversal, self).default_get(fields) - move_ids = ( - self.env["account.move"].browse(self.env.context["active_ids"]) - if self.env.context.get("active_model") == "account.move" - else self.env["account.move"] - ) - move_ids_use_document = move_ids.filtered( - lambda move: move.l10n_latam_use_documents - and move.company_id.country_code == "DO" - ) - - if len(move_ids_use_document) > 1: - raise UserError( - _( - "You cannot create Credit Notes from multiple " - "documents at a time." - ) - ) - if move_ids_use_document: - res["is_ecf_invoice"] = move_ids_use_document[ - 0 - ].company_id.l10n_do_ecf_issuer - - return res - - @api.onchange("l10n_do_refund_type") - def onchange_l10n_do_refund_type(self): - if self.l10n_do_refund_type != "full_refund": + @api.onchange("refund_type") + def onchange_refund_type(self): + if self.refund_type != "full_refund": self.refund_method = "refund" @api.onchange("l10n_do_refund_action") @@ -191,8 +164,11 @@ def _compute_document_type(self): % ", ".join(move_ids_use_document.mapped("name")) ) else: - record.l10n_latam_use_documents = ( - record.journal_id.l10n_latam_use_documents + record.write( + { + "l10n_latam_use_documents": record.journal_id.l10n_latam_use_documents, + "is_ecf_invoice": record.company_id.l10n_do_ecf_issuer, + } ) if record.l10n_latam_use_documents: @@ -211,19 +187,3 @@ def _compute_document_type(self): refund.l10n_latam_available_document_type_ids ) super(AccountMoveReversal, self - do_wizard)._compute_document_type() - - @api.depends("l10n_latam_document_type_id") - def _compute_l10n_latam_manual_document_number(self): - self.l10n_latam_manual_document_number = False - do_wizard = self.filtered( - lambda w: w.journal_id - and w.journal_id.l10n_latam_use_documents - and w.country_code == "DO" - and w.move_ids - ) - for rec in do_wizard: - if rec.journal_id and rec.journal_id.l10n_latam_use_documents: - rec.l10n_latam_manual_document_number = True if rec.journal_id.type == 'purchase' else False - super( - AccountMoveReversal, self - do_wizard - )._compute_l10n_latam_manual_document_number()