Skip to content

Commit

Permalink
[WIP] l10n_do_accounting: v17 migration
Browse files Browse the repository at this point in the history
  • Loading branch information
jose-pcg committed Jun 1, 2024
1 parent 2da5bff commit 0e98c08
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 30 deletions.
6 changes: 3 additions & 3 deletions l10n_do_accounting/models/account_move.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
54 changes: 27 additions & 27 deletions l10n_do_accounting/wizard/account_debit_note.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 0e98c08

Please sign in to comment.