Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: OCA/contract
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a3b606d139f91344fd08f28f585b07986f43779e
Choose a base ref
..
head repository: OCA/contract
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 90dcd82caa9616b4ec5fd40234fc48ffffc8bad0
Choose a head ref
Showing with 5 additions and 6 deletions.
  1. +1 −2 product_contract/models/sale_order_line.py
  2. +4 −4 product_contract/tests/test_sale_order.py
3 changes: 1 addition & 2 deletions product_contract/models/sale_order_line.py
Original file line number Diff line number Diff line change
@@ -90,7 +90,7 @@ def _compute_contract_template_id(self):
rec.order_id.company_id
).property_contract_template_id

@api.depends("product_id", "order_id.date_order")
@api.depends("product_id")
def _compute_date_start(self):
for sol in self:
if sol.contract_start_date_method == "start_this":
@@ -123,7 +123,6 @@ def _compute_date_start(self):
sol.date_start = False

@api.depends(
"order_id.date_order",
"is_auto_renew",
"date_start",
"auto_renew_interval",
8 changes: 4 additions & 4 deletions product_contract/tests/test_sale_order.py
Original file line number Diff line number Diff line change
@@ -109,7 +109,7 @@ def test_compute_is_contract(self):
def test_action_confirm(self):
"""It should create a contract for each contract template used in
order_line"""
self.order_line1._compute_auto_renew()
self.order_line1.is_auto_renew = True
self.sale.action_confirm()
contracts = self.sale.order_line.mapped("contract_id")
self.assertEqual(len(contracts), 2)
@@ -155,7 +155,7 @@ def test_action_confirm_without_contract_creation(self):
"""It should create a contract for each contract template used in
order_line"""
self.sale.company_id.create_contract_at_sale_order_confirmation = False
self.order_line1._compute_auto_renew()
self.order_line1.is_auto_renew = True
self.sale.action_confirm()
self.assertEqual(len(self.sale.order_line.mapped("contract_id")), 0)
self.assertTrue(self.sale.need_contract_creation)
@@ -174,14 +174,14 @@ def test_action_confirm_without_contract_creation(self):
def test_sale_contract_count(self):
"""It should count contracts as many different contract template used
in order_line"""
self.order_line1._compute_auto_renew()
self.order_line1.is_auto_renew = True
self.sale.action_confirm()
self.assertEqual(self.sale.contract_count, 2)

def test_onchange_product(self):
"""It should get recurrence invoicing info to the sale line from
its product"""
self.order_line1._compute_auto_renew()
self.order_line1.is_auto_renew = True
self.assertEqual(
self.order_line1.recurring_rule_type,
self.product1.recurring_rule_type,