Skip to content

Commit

Permalink
[MIG] contract_sale_generation: Migration to 16.0
Browse files Browse the repository at this point in the history
  • Loading branch information
JesusValdez96 committed Jun 2, 2023
1 parent 6876de0 commit d71473a
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion contract_sale_generation/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)",
Expand Down
2 changes: 0 additions & 2 deletions contract_sale_generation/models/contract.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 1 addition & 2 deletions contract_sale_generation/models/contract_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,14 @@ 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])
sale_line_vals.update(
{
"sequence": self.sequence,
"name": name,
"analytic_tag_ids": [(6, 0, self.analytic_tag_ids.ids)],
"price_unit": self.price_unit,
}
)
Expand Down
12 changes: 12 additions & 0 deletions contract_sale_generation/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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")
Expand All @@ -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",
Expand Down Expand Up @@ -89,16 +92,24 @@ 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,
"recurring_rule_type": "monthly",
"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#"
Expand Down Expand Up @@ -133,6 +144,7 @@ def setUpClass(cls):
"recurring_interval": 1,
"date_start": "2018-02-15",
"recurring_next_date": "2018-02-22",
"display_type": False,
},
)
],
Expand Down
1 change: 1 addition & 0 deletions contract_sale_generation/tests/test_contract_sale.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def test_onchange_contract_template_id(self):
"discount": 50,
"recurring_rule_type": "yearly",
"recurring_interval": 1,
"display_type": False,
},
)
],
Expand Down

0 comments on commit d71473a

Please sign in to comment.