diff --git a/contract_sale_generation/__manifest__.py b/contract_sale_generation/__manifest__.py index 663a1d1822..7cee130530 100644 --- a/contract_sale_generation/__manifest__.py +++ b/contract_sale_generation/__manifest__.py @@ -5,7 +5,7 @@ { "name": "Contracts Management - Recurring Sales", - "version": "15.0.1.0.3", + "version": "16.0.1.0.0", "category": "Contract Management", "license": "AGPL-3", "author": "ACSONE SA/NV, PESOL, Odoo Community Association (OCA)", diff --git a/contract_sale_generation/models/contract.py b/contract_sale_generation/models/contract.py index 80ba905b74..e9ab9b1620 100644 --- a/contract_sale_generation/models/contract.py +++ b/contract_sale_generation/models/contract.py @@ -32,8 +32,6 @@ def _prepare_sale(self, date_ref): sale.payment_term_id = self.payment_term_id.id if self.fiscal_position_id: sale.fiscal_position_id = self.fiscal_position_id.id - # Get other sale values from partner onchange - sale.onchange_partner_id() return sale._convert_to_write(sale._cache) def _get_related_sales(self): diff --git a/contract_sale_generation/models/contract_line.py b/contract_sale_generation/models/contract_line.py index ebbb327491..1837e91e79 100644 --- a/contract_sale_generation/models/contract_line.py +++ b/contract_sale_generation/models/contract_line.py @@ -40,7 +40,7 @@ def _prepare_sale_line(self, order_id=False, sale_values=False): ) order_line.order_id = sale # Get other order line values from product onchange - order_line.product_id_change() + order_line._onchange_product_id_warning() sale_line_vals = order_line._convert_to_write(order_line._cache) # Insert markers name = self._insert_markers(dates[0], dates[1]) @@ -48,7 +48,6 @@ def _prepare_sale_line(self, order_id=False, sale_values=False): { "sequence": self.sequence, "name": name, - "analytic_tag_ids": [(6, 0, self.analytic_tag_ids.ids)], "price_unit": self.price_unit, } ) diff --git a/contract_sale_generation/tests/common.py b/contract_sale_generation/tests/common.py index fe100b02fa..123822cc89 100644 --- a/contract_sale_generation/tests/common.py +++ b/contract_sale_generation/tests/common.py @@ -22,6 +22,7 @@ def setUpClass(cls): cls.analytic_account = cls.env["account.analytic.account"].create( { "name": "Contracts", + "plan_id": cls.env.ref("analytic.analytic_plan_internal").id, } ) cls.payment_term_id = cls.env.ref( @@ -42,6 +43,7 @@ def setUpClass(cls): "property_product_pricelist": cls.pricelist.id, "property_payment_term_id": cls.payment_term_id.id, "property_account_position_id": cls.fiscal_position_id.id, + "user_id": cls.env.user.id, } ) cls.product_1 = cls.env.ref("product.product_product_1") @@ -58,6 +60,7 @@ def setUpClass(cls): "discount": 50, "recurring_rule_type": "yearly", "recurring_interval": 1, + "display_type": False, } cls.template_vals = { "name": "Test Contract Template", @@ -89,6 +92,8 @@ def setUpClass(cls): ) cls.line_vals = { "name": "Services from #START# to #END#", + "product_id": cls.product_1.id, + "uom_id": cls.product_1.uom_id.id, "quantity": 1, "price_unit": 100, "discount": 50, @@ -96,9 +101,15 @@ def setUpClass(cls): "recurring_interval": 1, "date_start": "2020-01-01", "recurring_next_date": "2020-01-15", + "display_type": False, } + discount_line_group_id = cls.env.ref("product.group_discount_per_so_line") + uom_group_id = cls.env.ref("uom.group_uom") + cls.env.user.groups_id = [(4, discount_line_group_id.id), (4, uom_group_id.id)] + with Form(cls.contract) as contract_form, freeze_time(contract_date): contract_form.contract_template_id = cls.template + contract_form.line_recurrence = True with contract_form.contract_line_ids.new() as line_form: line_form.product_id = cls.product_1 line_form.name = "Services from #START# to #END#" @@ -133,6 +144,7 @@ def setUpClass(cls): "recurring_interval": 1, "date_start": "2018-02-15", "recurring_next_date": "2018-02-22", + "display_type": False, }, ) ], diff --git a/contract_sale_generation/tests/test_contract_sale.py b/contract_sale_generation/tests/test_contract_sale.py index a5eaf65009..2668dad664 100644 --- a/contract_sale_generation/tests/test_contract_sale.py +++ b/contract_sale_generation/tests/test_contract_sale.py @@ -64,6 +64,7 @@ def test_onchange_contract_template_id(self): "discount": 50, "recurring_rule_type": "yearly", "recurring_interval": 1, + "display_type": False, }, ) ],