diff --git a/contract_section/models/account_analytic_account.py b/contract_section/models/account_analytic_account.py index 348fd596..c6ba5a42 100644 --- a/contract_section/models/account_analytic_account.py +++ b/contract_section/models/account_analytic_account.py @@ -12,6 +12,6 @@ class AccountAnalyticAccount(models.Model): invoice_line_vals = super(AccountAnalyticAccount, self). \ _prepare_invoice_line(line, invoice_id) invoice_line_vals.update({ - 'layout_category_id': line.layout_category_id.id, + 'display_type': line.display_type, }) return invoice_line_vals diff --git a/contract_section/models/account_analytic_contract_line.py b/contract_section/models/account_analytic_contract_line.py index 576ffa5c..62bb9b52 100644 --- a/contract_section/models/account_analytic_contract_line.py +++ b/contract_section/models/account_analytic_contract_line.py @@ -7,7 +7,9 @@ from odoo import fields, models class AccountAnalyticContractLine(models.Model): _inherit = 'account.analytic.contract.line' - layout_category_id = fields.Many2one( - 'sale.layout_category', - string='Section' + display_type = fields.Selection([ + ('line_section', "Section"), + ('line_note', "Note")], + default=False, + help="Technical field for UX purpose." ) diff --git a/contract_section/tests/test_contract.py b/contract_section/tests/test_contract.py index 61c09bce..521f60c3 100644 --- a/contract_section/tests/test_contract.py +++ b/contract_section/tests/test_contract.py @@ -13,14 +13,8 @@ class TestContract(TestContractBase): # contract line super(TestContract, cls).setUpClass() cls.acct_line.unlink() - cls.section = cls.env['sale.layout_category'].create({ - 'name': 'Services', - 'subtotal': True, - 'pagebreak': True, - 'sequence': 1 - }) cls.line_vals.update({ - 'layout_category_id': cls.section.id, + 'display_type': 'line_section', }) cls.acct_line = cls.env['account.analytic.invoice.line'].create( cls.line_vals, @@ -32,5 +26,5 @@ class TestContract(TestContractBase): self.contract.recurring_create_invoice() invoice_id = self.env['account.invoice'].search( [('contract_id', '=', self.contract.id)]) - self.assertEqual(invoice_id.invoice_line_ids.layout_category_id.id, - self.line_vals['layout_category_id']) + self.assertEqual(invoice_id.invoice_line_ids.display_type, + self.line_vals['display_type']) diff --git a/contract_section/views/account_analytic_account.xml b/contract_section/views/account_analytic_account.xml index 4b6bdff1..4d5bca78 100644 --- a/contract_section/views/account_analytic_account.xml +++ b/contract_section/views/account_analytic_account.xml @@ -7,7 +7,7 @@ - + diff --git a/contract_section/views/account_analytic_contract.xml b/contract_section/views/account_analytic_contract.xml index f998743e..5f7aa169 100644 --- a/contract_section/views/account_analytic_contract.xml +++ b/contract_section/views/account_analytic_contract.xml @@ -7,7 +7,7 @@ - +