[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:
João Marques
2021-01-25 15:43:26 +00:00
committed by chaule97
parent e250c0583d
commit 12034178bb
30 changed files with 762 additions and 649 deletions

View File

@@ -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(
{