2019-04-25 16:57:45 +02:00
|
|
|
# Copyright 2019 Tecnativa - Ernesto Tejeda
|
|
|
|
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
|
|
|
|
|
|
|
import odoo.tests.common as common
|
2020-01-30 18:23:55 +01:00
|
|
|
from odoo import fields
|
2019-04-25 16:57:45 +02:00
|
|
|
|
|
|
|
|
|
|
|
class TestAccountMoveLineTaxEditable(common.SavepointCase):
|
|
|
|
@classmethod
|
|
|
|
def setUpClass(cls):
|
|
|
|
super(TestAccountMoveLineTaxEditable, cls).setUpClass()
|
|
|
|
|
2020-01-30 18:23:55 +01:00
|
|
|
acc_obj = cls.env["account.account"]
|
|
|
|
account100 = acc_obj.create(
|
|
|
|
{
|
|
|
|
"code": "100",
|
|
|
|
"name": "Account 100",
|
|
|
|
"user_type_id": cls.env.ref("account.data_account_type_receivable").id,
|
|
|
|
"reconcile": True,
|
|
|
|
}
|
|
|
|
)
|
|
|
|
account300 = acc_obj.create(
|
|
|
|
{
|
|
|
|
"code": "300",
|
|
|
|
"name": "Account 300",
|
|
|
|
"user_type_id": cls.env.ref(
|
|
|
|
"account.data_account_type_other_income"
|
|
|
|
).id,
|
|
|
|
}
|
|
|
|
)
|
2019-04-25 16:57:45 +02:00
|
|
|
|
2020-01-30 18:23:55 +01:00
|
|
|
journal = cls.env["account.journal"].create(
|
|
|
|
{"name": "Test journal", "type": "sale", "code": "TEST"}
|
|
|
|
)
|
2019-04-25 16:57:45 +02:00
|
|
|
move_vals = {
|
2020-01-30 18:23:55 +01:00
|
|
|
"journal_id": journal.id,
|
|
|
|
"name": "move test",
|
|
|
|
"date": fields.Date.today(),
|
|
|
|
"line_ids": [
|
|
|
|
(
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
{
|
|
|
|
"name": "move test",
|
|
|
|
"debit": 0.0,
|
|
|
|
"credit": 1000.0,
|
|
|
|
"account_id": account300.id,
|
|
|
|
},
|
|
|
|
),
|
|
|
|
(
|
|
|
|
0,
|
|
|
|
0,
|
|
|
|
{
|
|
|
|
"name": "move test",
|
|
|
|
"debit": 1000.0,
|
|
|
|
"credit": 0.0,
|
|
|
|
"account_id": account100.id,
|
|
|
|
},
|
|
|
|
),
|
|
|
|
],
|
|
|
|
}
|
|
|
|
cls.move = cls.env["account.move"].create(move_vals)
|
2019-04-25 16:57:45 +02:00
|
|
|
|
|
|
|
def test_compute_is_tax_editable(self):
|
2020-01-30 18:23:55 +01:00
|
|
|
self.assertEqual(self.move.line_ids.mapped("is_tax_editable"), [True, True])
|
2019-04-25 16:57:45 +02:00
|
|
|
self.move.post()
|
2020-01-30 18:23:55 +01:00
|
|
|
self.assertEqual(self.move.line_ids.mapped("is_tax_editable"), [False, False])
|