[MIG] account_financial_report: Migration to 14.0
Since v14, Odoo defines the `__slots__` attribute in the `BaseModel` class (ea3e39506a)
This makes it impossible to add attributes to an instance like it was done here in v13.
The use of the `report_data` dictionary passed between method is the closes and simples solution to this "issue".
TT26415
Co-authored-by: Alex Cuellar <acuellar@grupoyacck.com>
This commit is contained in:
@@ -86,7 +86,7 @@ class TestGeneralLedgerReport(common.TransactionCase):
|
||||
],
|
||||
}
|
||||
move = self.env["account.move"].create(move_vals)
|
||||
move.post()
|
||||
move.action_post()
|
||||
|
||||
def _get_report_lines(self, with_partners=False):
|
||||
centralize = True
|
||||
|
||||
@@ -215,15 +215,15 @@ class TestJournalReport(TransactionCase):
|
||||
res_data = self.JournalLedgerReport._get_report_values(wiz, data)
|
||||
self.check_report_journal_debit_credit(res_data, 0, 0)
|
||||
|
||||
move1.post()
|
||||
move1.action_post()
|
||||
res_data = self.JournalLedgerReport._get_report_values(wiz, data)
|
||||
self.check_report_journal_debit_credit(res_data, 100, 100)
|
||||
|
||||
move2.post()
|
||||
move2.action_post()
|
||||
res_data = self.JournalLedgerReport._get_report_values(wiz, data)
|
||||
self.check_report_journal_debit_credit(res_data, 100, 100)
|
||||
|
||||
move3.post()
|
||||
move3.action_post()
|
||||
res_data = self.JournalLedgerReport._get_report_values(wiz, data)
|
||||
self.check_report_journal_debit_credit(res_data, 200, 200)
|
||||
|
||||
@@ -234,7 +234,7 @@ class TestJournalReport(TransactionCase):
|
||||
|
||||
def test_02_test_taxes_out_invoice(self):
|
||||
move_form = Form(
|
||||
self.env["account.move"].with_context(default_type="out_invoice")
|
||||
self.env["account.move"].with_context(default_move_type="out_invoice")
|
||||
)
|
||||
move_form.partner_id = self.partner_2
|
||||
move_form.journal_id = self.journal_sale
|
||||
@@ -252,7 +252,7 @@ class TestJournalReport(TransactionCase):
|
||||
line_form.tax_ids.add(self.tax_15_s)
|
||||
line_form.tax_ids.add(self.tax_20_s)
|
||||
invoice = move_form.save()
|
||||
invoice.post()
|
||||
invoice.action_post()
|
||||
|
||||
wiz = self.JournalLedgerReportWizard.create(
|
||||
{
|
||||
@@ -269,42 +269,8 @@ class TestJournalReport(TransactionCase):
|
||||
self.check_report_journal_debit_credit_taxes(res_data, 0, 300, 0, 50)
|
||||
|
||||
def test_03_test_taxes_in_invoice(self):
|
||||
# invoice_values = {
|
||||
# "journal_id": self.journal_purchase.id,
|
||||
# "partner_id": self.partner_2.id,
|
||||
# "type": "in_invoice",
|
||||
# "invoice_line_ids": [
|
||||
# (
|
||||
# 0,
|
||||
# 0,
|
||||
# {
|
||||
# "quantity": 1.0,
|
||||
# "price_unit": 100,
|
||||
# "account_id": self.payable_account.id,
|
||||
# "name": "Test",
|
||||
# "tax_ids": [(6, 0, [self.tax_15_p.id])],
|
||||
# },
|
||||
# ),
|
||||
# (
|
||||
# 0,
|
||||
# 0,
|
||||
# {
|
||||
# "quantity": 1.0,
|
||||
# "price_unit": 100,
|
||||
# "account_id": self.payable_account.id,
|
||||
# "name": "Test",
|
||||
# "tax_ids": [
|
||||
# (6, 0, [self.tax_15_p.id, self.tax_20_p.id])
|
||||
# ],
|
||||
# },
|
||||
# ),
|
||||
# ],
|
||||
# }
|
||||
# invoice = self.InvoiceObj.create(invoice_values)
|
||||
# invoice.post()
|
||||
|
||||
move_form = Form(
|
||||
self.env["account.move"].with_context(default_type="in_invoice")
|
||||
self.env["account.move"].with_context(default_move_type="in_invoice")
|
||||
)
|
||||
move_form.partner_id = self.partner_2
|
||||
move_form.journal_id = self.journal_purchase
|
||||
@@ -322,7 +288,7 @@ class TestJournalReport(TransactionCase):
|
||||
line_form.tax_ids.add(self.tax_15_p)
|
||||
line_form.tax_ids.add(self.tax_20_p)
|
||||
invoice = move_form.save()
|
||||
invoice.post()
|
||||
invoice.action_post()
|
||||
|
||||
wiz = self.JournalLedgerReportWizard.create(
|
||||
{
|
||||
|
||||
@@ -10,13 +10,12 @@ class TestTrialBalanceReport(common.TransactionCase):
|
||||
def setUp(self):
|
||||
super(TestTrialBalanceReport, self).setUp()
|
||||
group_obj = self.env["account.group"]
|
||||
acc_obj = self.env["account.account"]
|
||||
self.group1 = group_obj.create({"code_prefix": "1", "name": "Group 1"})
|
||||
self.group1 = group_obj.create({"code_prefix_start": "1", "name": "Group 1"})
|
||||
self.group11 = group_obj.create(
|
||||
{"code_prefix": "11", "name": "Group 11", "parent_id": self.group1.id}
|
||||
{"code_prefix_start": "11", "name": "Group 11", "parent_id": self.group1.id}
|
||||
)
|
||||
self.group2 = group_obj.create({"code_prefix": "2", "name": "Group 2"})
|
||||
self.account100 = acc_obj.create(
|
||||
self.group2 = group_obj.create({"code_prefix_start": "2", "name": "Group 2"})
|
||||
self.account100 = self._create_account_account(
|
||||
{
|
||||
"code": "100",
|
||||
"name": "Account 100",
|
||||
@@ -35,7 +34,7 @@ class TestTrialBalanceReport(common.TransactionCase):
|
||||
],
|
||||
limit=1,
|
||||
)
|
||||
self.account200 = acc_obj.create(
|
||||
self.account200 = self._create_account_account(
|
||||
{
|
||||
"code": "200",
|
||||
"name": "Account 200",
|
||||
@@ -45,7 +44,7 @@ class TestTrialBalanceReport(common.TransactionCase):
|
||||
).id,
|
||||
}
|
||||
)
|
||||
self.account300 = acc_obj.create(
|
||||
self.account300 = self._create_account_account(
|
||||
{
|
||||
"code": "300",
|
||||
"name": "Account 300",
|
||||
@@ -54,7 +53,7 @@ class TestTrialBalanceReport(common.TransactionCase):
|
||||
).id,
|
||||
}
|
||||
)
|
||||
self.account301 = acc_obj.create(
|
||||
self.account301 = self._create_account_account(
|
||||
{
|
||||
"code": "301",
|
||||
"name": "Account 301",
|
||||
@@ -82,6 +81,12 @@ class TestTrialBalanceReport(common.TransactionCase):
|
||||
limit=1,
|
||||
)
|
||||
|
||||
def _create_account_account(self, vals):
|
||||
item = self.env["account.account"].create(vals)
|
||||
if "group_id" in vals:
|
||||
item.group_id = vals["group_id"]
|
||||
return item
|
||||
|
||||
def _add_move(
|
||||
self,
|
||||
date,
|
||||
@@ -151,7 +156,7 @@ class TestTrialBalanceReport(common.TransactionCase):
|
||||
],
|
||||
}
|
||||
move = self.env["account.move"].create(move_vals)
|
||||
move.post()
|
||||
move.action_post()
|
||||
|
||||
def _get_report_lines(self, with_partners=False, hierarchy_on="computed"):
|
||||
company = self.env.ref("base.main_company")
|
||||
@@ -671,7 +676,7 @@ class TestTrialBalanceReport(common.TransactionCase):
|
||||
],
|
||||
}
|
||||
move = self.env["account.move"].create(move_vals)
|
||||
move.post()
|
||||
move.action_post()
|
||||
# Generate the trial balance line
|
||||
company = self.env.ref("base.main_company")
|
||||
trial_balance = self.env["trial.balance.report.wizard"].create(
|
||||
@@ -723,7 +728,7 @@ class TestTrialBalanceReport(common.TransactionCase):
|
||||
],
|
||||
}
|
||||
move = self.env["account.move"].create(move_vals)
|
||||
move.post()
|
||||
move.action_post()
|
||||
# Re Generate the trial balance line
|
||||
trial_balance = self.env["trial.balance.report.wizard"].create(
|
||||
{
|
||||
@@ -775,7 +780,7 @@ class TestTrialBalanceReport(common.TransactionCase):
|
||||
],
|
||||
}
|
||||
move = self.env["account.move"].create(move_vals)
|
||||
move.post()
|
||||
move.action_post()
|
||||
# Re Generate the trial balance line
|
||||
trial_balance = self.env["trial.balance.report.wizard"].create(
|
||||
{
|
||||
|
||||
@@ -149,7 +149,7 @@ class TestVATReport(common.TransactionCase):
|
||||
)
|
||||
|
||||
move_form = common.Form(
|
||||
self.env["account.move"].with_context(default_type="out_invoice")
|
||||
self.env["account.move"].with_context(default_move_type="out_invoice")
|
||||
)
|
||||
move_form.partner_id = self.env.ref("base.res_partner_2")
|
||||
move_form.invoice_date = time.strftime("%Y-%m-03")
|
||||
@@ -160,10 +160,10 @@ class TestVATReport(common.TransactionCase):
|
||||
line_form.account_id = self.income_account
|
||||
line_form.tax_ids.add(self.tax_10)
|
||||
invoice = move_form.save()
|
||||
invoice.post()
|
||||
invoice.action_post()
|
||||
|
||||
move_form = common.Form(
|
||||
self.env["account.move"].with_context(default_type="out_invoice")
|
||||
self.env["account.move"].with_context(default_move_type="out_invoice")
|
||||
)
|
||||
move_form.partner_id = self.env.ref("base.res_partner_2")
|
||||
move_form.invoice_date = time.strftime("%Y-%m-04")
|
||||
@@ -174,7 +174,7 @@ class TestVATReport(common.TransactionCase):
|
||||
line_form.account_id = self.income_account
|
||||
line_form.tax_ids.add(self.tax_20)
|
||||
invoice = move_form.save()
|
||||
invoice.post()
|
||||
invoice.action_post()
|
||||
|
||||
def _get_report_lines(self, taxgroups=False):
|
||||
based_on = "taxtags"
|
||||
|
||||
Reference in New Issue
Block a user