From 1cfa7169a81bd0aef0f6b60822c563bcbe3e85a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20L=C3=B3pez?= Date: Fri, 16 Feb 2024 15:39:23 -0400 Subject: [PATCH] [REF] l10n_do_accounting: remove bad feature of manual credit note --- l10n_do_accounting/__manifest__.py | 2 +- .../wizard/account_move_reversal.py | 50 ++----------------- 2 files changed, 6 insertions(+), 46 deletions(-) diff --git a/l10n_do_accounting/__manifest__.py b/l10n_do_accounting/__manifest__.py index 7dba1eac1..63fa58d21 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": "15.0.0.13.0", + "version": "15.0.0.14.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 dfa04bc2d..cc3e87822 100644 --- a/l10n_do_accounting/wizard/account_move_reversal.py +++ b/l10n_do_accounting/wizard/account_move_reversal.py @@ -86,33 +86,6 @@ 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("refund_type") def onchange_refund_type(self): if self.refund_type != "full_refund": @@ -161,8 +134,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: @@ -181,19 +157,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()