mirror of
https://github.com/OCA/account-financial-tools.git
synced 2025-02-02 12:47:26 +02:00
[MIG] account_move_line_tax_editable: Migration to 17.0
This commit is contained in:
@@ -61,6 +61,7 @@ Contributors
|
||||
- `Tecnativa <https://www.tecnativa.com>`__:
|
||||
|
||||
- Ernesto Tejeda
|
||||
- Carlos Roca
|
||||
|
||||
- `Sygel <https://www.sygel.es>`__:
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -406,6 +406,7 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
||||
<li>Benjamin Willig <<a class="reference external" href="mailto:benjamin.willig@acsone.eu">benjamin.willig@acsone.eu</a>></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>
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user