[MIG] account_tax_repartition_line_tax_group_account: Migration to 17.0

This commit is contained in:
JasminSForgeFlow
2024-03-04 15:17:22 +05:30
parent 9fe7e2580c
commit 73f985ca6a
4 changed files with 8 additions and 12 deletions

View File

@@ -3,7 +3,7 @@
{
"name": "Account Tax Repartition Line Tax Group Account",
"summary": "Set a default account from tax group to tax repartition lines",
"version": "13.0.1.0.0",
"version": "17.0.1.0.0",
"category": "Accounting",
"website": "https://github.com/OCA/account-financial-tools",
"author": "ForgeFlow," "Odoo Community Association (OCA)",

View File

@@ -10,15 +10,13 @@ class AccountTaxRepartitionLine(models.Model):
@api.model
def create(self, vals):
account_id = vals.get("account_id", "")
invoice_tax_id = vals.get("invoice_tax_id", "")
refund_tax_id = vals.get("refund_tax_id", "")
repartition_type = vals.get("repartition_type", "")
tax_id = invoice_tax_id or refund_tax_id
tax_id = vals.get("tax_id", "")
if not account_id and tax_id and repartition_type == "tax":
tax = self.env["account.tax"].browse(tax_id)
def_acc = tax.tax_group_id.with_context(
force_company=tax.company_id.id
def_acc = tax.tax_group_id.with_company(
tax.company_id
).property_repartition_line_account_id
if def_acc:
vals["account_id"] = def_acc.id
return super(AccountTaxRepartitionLine, self).create(vals)
return super().create(vals)

View File

@@ -13,11 +13,9 @@ class TestAccountTaxRepartitionLineTaxGroupAccount(common.TransactionCase):
)
self.sales_tax_account = self.env["account.account"].create(
{
"code": "sales_tax",
"code": "salestax",
"name": "sales_tax",
"user_type_id": self.env.ref(
"account.data_account_type_current_liabilities"
).id,
"account_type": "liability_current",
"reconcile": False,
}
)

View File

@@ -5,7 +5,7 @@
<field name="model">account.tax.group</field>
<field name="inherit_id" ref="account.view_tax_group_tree" />
<field name="arch" type="xml">
<field name="property_advance_tax_payment_account_id" position="after">
<field name="advance_tax_payment_account_id" position="after">
<field name="property_repartition_line_account_id" />
</field>
</field>