[MIG] account_move_line_tax_editable: Migration to 17.0

This commit is contained in:
Carlos Roca
2024-07-01 12:54:59 +02:00
parent 13c18260b8
commit ae85b7ae5c
7 changed files with 15 additions and 10 deletions

View File

@@ -61,6 +61,7 @@ Contributors
- `Tecnativa <https://www.tecnativa.com>`__:
- Ernesto Tejeda
- Carlos Roca
- `Sygel <https://www.sygel.es>`__:

View File

@@ -4,7 +4,7 @@
{
"name": "Account Move Line Tax Editable",
"summary": "Allows to edit taxes on non-posted account move lines",
"version": "16.0.1.0.1",
"version": "17.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/account-financial-tools",

View File

@@ -28,19 +28,23 @@ class AccountMoveLine(models.Model):
else:
repartition_lines = rec.tax_line_id.invoice_repartition_line_ids
lines = repartition_lines.filtered(
lambda rl: rl.repartition_type == repartition_type
lambda rl,
repartition_type=repartition_type,
factor_percent=factor_percent: rl.repartition_type == repartition_type
and rl.factor_percent == factor_percent
)
if len(lines) > 1:
lines = (
lines.filtered(
lambda rl: rl.repartition_type == "base"
lambda rl, has_account=has_account: rl.repartition_type
== "base"
or has_account is bool(rl.account_id)
)[:1]
or lines[:1]
)
elif not lines:
lines = repartition_lines.filtered(
lambda rl: rl.repartition_type == repartition_type
lambda rl, repartition_type=repartition_type: rl.repartition_type
== repartition_type
)[:1]
rec.tax_repartition_line_id = lines

View File

@@ -2,6 +2,7 @@
- Benjamin Willig \<<benjamin.willig@acsone.eu>\>
- [Tecnativa](https://www.tecnativa.com):
- Ernesto Tejeda
- Carlos Roca
- [Sygel](https://www.sygel.es):
- Manuel Regidor
- [Factor Libre](https://factorlibre.com):

View File

@@ -406,6 +406,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
<li>Benjamin Willig &lt;<a class="reference external" href="mailto:benjamin.willig&#64;acsone.eu">benjamin.willig&#64;acsone.eu</a>&gt;</li>
<li><a class="reference external" href="https://www.tecnativa.com">Tecnativa</a>:<ul>
<li>Ernesto Tejeda</li>
<li>Carlos Roca</li>
</ul>
</li>
<li><a class="reference external" href="https://www.sygel.es">Sygel</a>:<ul>

View File

@@ -31,7 +31,7 @@ class TestAccountMoveLineTaxEditable(AccountTestInvoicingCommon):
cls.account_expense = cls.company_data["default_account_expense"]
cls.account_tax_sale = cls.company_data["default_account_tax_sale"]
cls.tax_sale = cls.company_data["default_tax_sale"]
cls.tax_sale_copy = cls.tax_sale.copy()
cls.tax_sale_copy = cls.tax_sale.copy({"name": "Test sale tax"})
cls.test_move = cls.env["account.move"].create(
{
"move_type": "entry",

View File

@@ -12,16 +12,14 @@
expr="//field[@name='line_ids']/tree/field[@name='tax_line_id']"
position="before"
>
<field name="is_tax_editable" invisible="1" />
<field name="is_tax_editable" column_invisible="True" />
</xpath>
<xpath
expr="//field[@name='line_ids']/tree/field[@name='tax_line_id']"
position="attributes"
>
<attribute name="invisible">0</attribute>
<attribute
name="attrs"
>{'readonly': [('is_tax_editable', '=', False)]}</attribute>
<attribute name="column_invisible">False</attribute>
<attribute name="readonly">not is_tax_editable</attribute>
<attribute name="optional">hide</attribute>
</xpath>
<xpath