[MIG] account_move_line_tax_editable: Migration to 16.0
Update account_move_line_tax_editable/i18n/es.po Co-authored-by: Yadier-Tecnativa <129773077+Yadier-Tecnativa@users.noreply.github.com>
This commit is contained in:
parent
6479b58d2c
commit
580a8d21c7
@ -4,10 +4,10 @@
|
|||||||
{
|
{
|
||||||
"name": "Account Move Line Tax Editable",
|
"name": "Account Move Line Tax Editable",
|
||||||
"summary": "Allows to edit taxes on non-posted account move lines",
|
"summary": "Allows to edit taxes on non-posted account move lines",
|
||||||
"version": "15.0.1.0.1",
|
"version": "16.0.1.0.0",
|
||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"author": "ACSONE SA/NV, Odoo Community Association (OCA)",
|
"author": "ACSONE SA/NV, Odoo Community Association (OCA)",
|
||||||
"website": "https://github.com/OCA/account-financial-tools",
|
"website": "https://github.com/OCA/account-financial-tools",
|
||||||
"depends": ["account"],
|
"depends": ["account"],
|
||||||
"data": ["views/account_move.xml", "views/account_move_line.xml"],
|
"data": ["views/account_move.xml"],
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ msgstr "Identificación"
|
|||||||
#. module: account_move_line_tax_editable
|
#. module: account_move_line_tax_editable
|
||||||
#: model:ir.model.fields,field_description:account_move_line_tax_editable.field_account_move_line__is_tax_editable
|
#: model:ir.model.fields,field_description:account_move_line_tax_editable.field_account_move_line__is_tax_editable
|
||||||
msgid "Is tax data editable?"
|
msgid "Is tax data editable?"
|
||||||
msgstr ""
|
msgstr "¿Los datos fiscales son editables?"
|
||||||
|
|
||||||
#. module: account_move_line_tax_editable
|
#. module: account_move_line_tax_editable
|
||||||
#: model:ir.model,name:account_move_line_tax_editable.model_account_move_line
|
#: model:ir.model,name:account_move_line_tax_editable.model_account_move_line
|
||||||
|
@ -8,3 +8,7 @@
|
|||||||
* `Sygel <https://www.sygel.es>`_:
|
* `Sygel <https://www.sygel.es>`_:
|
||||||
|
|
||||||
* Manuel Regidor
|
* Manuel Regidor
|
||||||
|
|
||||||
|
* `Factor Libre <https://factorlibre.com>`_:
|
||||||
|
|
||||||
|
* Luis J. Salvatierra <luis.salvatierra@factorlibre.com>
|
||||||
|
@ -1,89 +1,104 @@
|
|||||||
# Copyright 2019 Tecnativa - Ernesto Tejeda
|
# Copyright 2019 Tecnativa - Ernesto Tejeda
|
||||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||||
|
|
||||||
import odoo.tests.common as common
|
|
||||||
from odoo import fields
|
from odoo import fields
|
||||||
|
from odoo.tests import tagged
|
||||||
|
|
||||||
|
from odoo.addons.account.tests.common import AccountTestInvoicingCommon
|
||||||
|
|
||||||
|
|
||||||
class TestAccountMoveLineTaxEditable(common.TransactionCase):
|
@tagged("post_install", "-at_install")
|
||||||
|
class TestAccountMoveLineTaxEditable(AccountTestInvoicingCommon):
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls, chart_template_ref=None):
|
||||||
super().setUpClass()
|
super().setUpClass(chart_template_ref=chart_template_ref)
|
||||||
|
refund_repartitions = cls.company_data[
|
||||||
acc_obj = cls.env["account.account"]
|
"default_tax_sale"
|
||||||
account100 = acc_obj.create(
|
].refund_repartition_line_ids
|
||||||
{
|
tax_repartition_line = refund_repartitions.filtered(
|
||||||
"code": "100",
|
lambda line: line.repartition_type == "tax"
|
||||||
"name": "Account 100",
|
|
||||||
"user_type_id": cls.env.ref("account.data_account_type_receivable").id,
|
|
||||||
"reconcile": True,
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
account300 = acc_obj.create(
|
cls.account_revenue = cls.company_data["default_account_revenue"]
|
||||||
|
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.test_move = cls.env["account.move"].create(
|
||||||
{
|
{
|
||||||
"code": "300",
|
"move_type": "entry",
|
||||||
"name": "Account 300",
|
"date": fields.Date.from_string("2016-01-01"),
|
||||||
"user_type_id": cls.env.ref(
|
"line_ids": [
|
||||||
"account.data_account_type_other_income"
|
(
|
||||||
).id,
|
0,
|
||||||
}
|
None,
|
||||||
)
|
{
|
||||||
|
"name": "revenue line 1",
|
||||||
journal = cls.env["account.journal"].create(
|
"account_id": cls.account_revenue.id,
|
||||||
{"name": "Test journal", "type": "sale", "code": "TEST"}
|
"debit": 500.0,
|
||||||
)
|
"credit": 0.0,
|
||||||
move_vals = {
|
},
|
||||||
"journal_id": journal.id,
|
),
|
||||||
"name": "move test",
|
(
|
||||||
"date": fields.Date.today(),
|
0,
|
||||||
"line_ids": [
|
None,
|
||||||
(
|
{
|
||||||
0,
|
"name": "revenue line 2",
|
||||||
0,
|
"account_id": cls.account_revenue.id,
|
||||||
{
|
"debit": 1000.0,
|
||||||
"name": "move test line 1",
|
"credit": 0.0,
|
||||||
"debit": 0.0,
|
"tax_ids": [(6, 0, cls.tax_sale.ids)],
|
||||||
"credit": 1000.0,
|
},
|
||||||
"account_id": account300.id,
|
),
|
||||||
},
|
(
|
||||||
),
|
0,
|
||||||
(
|
None,
|
||||||
0,
|
{
|
||||||
0,
|
"name": "tax line",
|
||||||
{
|
"account_id": cls.account_tax_sale.id,
|
||||||
"name": "move test line 2",
|
"debit": 150.0,
|
||||||
"debit": 1000.0,
|
"credit": 0.0,
|
||||||
"credit": 0.0,
|
"tax_repartition_line_id": tax_repartition_line.id,
|
||||||
"account_id": account100.id,
|
},
|
||||||
},
|
),
|
||||||
),
|
(
|
||||||
],
|
0,
|
||||||
}
|
None,
|
||||||
cls.move = cls.env["account.move"].create(move_vals)
|
{
|
||||||
cls.tax15 = cls.env["account.tax"].create(
|
"name": "counterpart line",
|
||||||
{
|
"account_id": cls.account_expense.id,
|
||||||
"name": "Test tax 15",
|
"debit": 0.0,
|
||||||
"amount": 15,
|
"credit": 1650.0,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_compute_is_tax_editable(self):
|
def test_compute_is_tax_editable(self):
|
||||||
self.assertEqual(self.move.line_ids.mapped("is_tax_editable"), [True, True])
|
self.assertTrue(all(self.test_move.line_ids.mapped("is_tax_editable")))
|
||||||
self.move.action_post()
|
self.test_move.action_post()
|
||||||
self.assertEqual(self.move.line_ids.mapped("is_tax_editable"), [False, False])
|
self.assertFalse(any(self.test_move.line_ids.mapped("is_tax_editable")))
|
||||||
|
|
||||||
def test_tax_edited(self):
|
def test_tax_edited(self):
|
||||||
line1 = self.move.line_ids[0]
|
tax_line = self.test_move.line_ids.filtered(
|
||||||
line1.tax_line_id = self.tax15.id
|
lambda x: x.account_id == self.account_tax_sale
|
||||||
line2 = self.move.line_ids[1]
|
)
|
||||||
self.move.action_post()
|
self.assertEqual(tax_line.tax_repartition_line_id.tax_id, self.tax_sale)
|
||||||
self.assertEqual(line1.tax_line_id.id, self.tax15.id)
|
self.assertEqual(tax_line.tax_line_id, self.tax_sale)
|
||||||
self.assertEqual(line2.tax_line_id.id, False)
|
tax_line.tax_line_id = self.tax_sale_copy.id
|
||||||
self.assertEqual(line1.tax_repartition_line_id.tax_id.id, self.tax15.id)
|
self.test_move.action_post()
|
||||||
|
self.assertEqual(tax_line.tax_line_id.id, self.tax_sale_copy.id)
|
||||||
|
self.assertEqual(
|
||||||
|
tax_line.tax_repartition_line_id.tax_id.id, self.tax_sale_copy.id
|
||||||
|
)
|
||||||
|
|
||||||
def test_tax_not_edited(self):
|
def test_tax_not_edited(self):
|
||||||
"""In this case we set the tax_repartition_line_id field, simulating that the
|
"""In this case we set the tax_repartition_line_id field, simulating that the
|
||||||
move came from an invoice with tax applied. Thus, tax_line_id should be computed"""
|
move came from an invoice with tax applied. Thus, tax_line_id should be computed"""
|
||||||
line1 = self.move.line_ids[1]
|
tax_line = self.test_move.line_ids.filtered(
|
||||||
line1.tax_repartition_line_id = self.tax15.invoice_repartition_line_ids[1]
|
lambda x: x.account_id == self.account_tax_sale
|
||||||
self.assertEqual(line1.tax_line_id.id, self.tax15.id)
|
)
|
||||||
|
tax_line.tax_line_id = self.tax_sale_copy.id
|
||||||
|
tax_line.tax_repartition_line_id = (
|
||||||
|
self.tax_sale_copy.invoice_repartition_line_ids[1]
|
||||||
|
)
|
||||||
|
self.assertEqual(tax_line.tax_line_id.id, self.tax_sale_copy.id)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
<!-- Copyright 2017 ACSONE SA/NV
|
<!-- Copyright 2017 ACSONE SA/NV
|
||||||
|
Copyright 2022 FactorLibre - Luis J. Salvatierra <luis.salvatierra@factorlibre.com>
|
||||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
||||||
<odoo>
|
<odoo>
|
||||||
<record id="view_move_form" model="ir.ui.view">
|
<record id="view_move_form" model="ir.ui.view">
|
||||||
@ -8,14 +9,28 @@
|
|||||||
<field name="inherit_id" ref="account.view_move_form" />
|
<field name="inherit_id" ref="account.view_move_form" />
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<xpath
|
<xpath
|
||||||
expr="//field[@name='line_ids']/tree/field[@name='name']"
|
expr="//field[@name='line_ids']/tree/field[@name='tax_line_id']"
|
||||||
position="after"
|
position="before"
|
||||||
>
|
>
|
||||||
<field name="is_tax_editable" invisible="1" />
|
<field name="is_tax_editable" invisible="1" />
|
||||||
<field
|
</xpath>
|
||||||
name="tax_line_id"
|
<xpath
|
||||||
attrs="{'readonly': [('is_tax_editable', '=', False)]}"
|
expr="//field[@name='line_ids']/tree/field[@name='tax_line_id']"
|
||||||
optional="hide"
|
position="attributes"
|
||||||
|
>
|
||||||
|
<attribute name="invisible">0</attribute>
|
||||||
|
<attribute
|
||||||
|
name="attrs"
|
||||||
|
>{'readonly': [('is_tax_editable', '=', False)]}</attribute>
|
||||||
|
<attribute name="optional">hide</attribute>
|
||||||
|
</xpath>
|
||||||
|
<xpath
|
||||||
|
expr="//field[@name='line_ids']/tree/field[@name='tax_ids']"
|
||||||
|
position="after"
|
||||||
|
>
|
||||||
|
<xpath
|
||||||
|
expr="//field[@name='line_ids']/tree/field[@name='tax_line_id']"
|
||||||
|
position="move"
|
||||||
/>
|
/>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
|
@ -1,29 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8" ?>
|
|
||||||
<!-- Copyright 2017 ACSONE SA/NV
|
|
||||||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
|
|
||||||
<odoo>
|
|
||||||
<record id="view_move_line_form" model="ir.ui.view">
|
|
||||||
<field
|
|
||||||
name="name"
|
|
||||||
>account.move.line.form (in account_move_line_tax_editable)</field>
|
|
||||||
<field name="model">account.move.line</field>
|
|
||||||
<field name="inherit_id" ref="account.view_move_line_form" />
|
|
||||||
<field name="arch" type="xml">
|
|
||||||
<field name="tax_line_id" position="before">
|
|
||||||
<field name="is_tax_editable" invisible="1" />
|
|
||||||
</field>
|
|
||||||
<field name="tax_line_id" position="attributes">
|
|
||||||
<attribute name="readonly">0</attribute>
|
|
||||||
<attribute
|
|
||||||
name="attrs"
|
|
||||||
>{'readonly': [('is_tax_editable', '=', False)]}</attribute>
|
|
||||||
</field>
|
|
||||||
<field name="tax_ids" position="attributes">
|
|
||||||
<attribute name="readonly">0</attribute>
|
|
||||||
<attribute
|
|
||||||
name="attrs"
|
|
||||||
>{'readonly': [('is_tax_editable', '=', False)]}</attribute>
|
|
||||||
</field>
|
|
||||||
</field>
|
|
||||||
</record>
|
|
||||||
</odoo>
|
|
@ -0,0 +1 @@
|
|||||||
|
../../../../account_move_line_tax_editable
|
6
setup/account_move_line_tax_editable/setup.py
Normal file
6
setup/account_move_line_tax_editable/setup.py
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import setuptools
|
||||||
|
|
||||||
|
setuptools.setup(
|
||||||
|
setup_requires=['setuptools-odoo'],
|
||||||
|
odoo_addon=True,
|
||||||
|
)
|
Loading…
Reference in New Issue
Block a user