From 0e98c08bbb837976f3f74fc3211721bd4e124a77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20L=C3=B3pez?= Date: Sat, 1 Jun 2024 11:56:16 -0400 Subject: [PATCH] [WIP] l10n_do_accounting: v17 migration --- l10n_do_accounting/models/account_move.py | 6 +-- .../wizard/account_debit_note.py | 54 +++++++++---------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/l10n_do_accounting/models/account_move.py b/l10n_do_accounting/models/account_move.py index 7c7b7f715..ffd0e2bd3 100644 --- a/l10n_do_accounting/models/account_move.py +++ b/l10n_do_accounting/models/account_move.py @@ -653,14 +653,14 @@ def _get_debit_line_tax(self, debit_date): if self.move_type == "out_invoice": return ( self.company_id.account_sale_tax_id - or self.env.ref("l10n_do.%s_tax_18_sale" % self.company_id.id) + or self.env.ref("account.%s_tax_18_sale" % self.company_id.id) if (debit_date - self.invoice_date).days <= 30 and self.partner_id.l10n_do_dgii_tax_payer_type != "special" - else self.env.ref("l10n_do.%s_tax_0_sale" % self.company_id.id) or False + else self.env.ref("account.%s_tax_0_sale" % self.company_id.id) or False ) else: return self.company_id.account_purchase_tax_id or self.env.ref( - "l10n_do.%s_tax_0_purch" % self.company_id.id + "account.%s_tax_0_purch" % self.company_id.id ) def _post(self, soft=True): diff --git a/l10n_do_accounting/wizard/account_debit_note.py b/l10n_do_accounting/wizard/account_debit_note.py index c92b64e1d..fe4caa16a 100644 --- a/l10n_do_accounting/wizard/account_debit_note.py +++ b/l10n_do_accounting/wizard/account_debit_note.py @@ -176,37 +176,37 @@ def _prepare_default_values(self, move): ) ) - origin_invoice_id = self.move_ids or self.env["account.move"].browse( - self.env.context.get("active_ids") - ) - taxes = ( - [ + origin_invoice_id = self.move_ids or self.env["account.move"].browse( + self.env.context.get("active_ids") + ) + taxes = ( + [ + ( + 6, + 0, + [origin_invoice_id._get_debit_line_tax(res["invoice_date"]).id], + ) + ] + if self.l10n_do_debit_type + else [(5, 0)] + ) + price_unit = ( + self.l10n_do_amount + if self.l10n_do_debit_type == "fixed_amount" + else origin_invoice_id.amount_untaxed * (self.l10n_do_percentage / 100) + ) + res["invoice_line_ids"] = [ ( - 6, 0, - [origin_invoice_id._get_debit_line_tax(res["invoice_date"]).id], + 0, + { + "name": self.reason or _("Debit"), + "price_unit": price_unit, + "quantity": 1, + "tax_ids": taxes, + }, ) ] - if self.l10n_do_debit_type - else [(5, 0)] - ) - price_unit = ( - self.l10n_do_amount - if self.l10n_do_debit_type == "fixed_amount" - else origin_invoice_id.amount_untaxed * (self.l10n_do_percentage / 100) - ) - res["invoice_line_ids"] = [ - ( - 0, - 0, - { - "name": self.reason or _("Debit"), - "price_unit": price_unit, - "quantity": 1, - "tax_ids": taxes, - }, - ) - ] return res