Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[17.0][FIX] product_contract: Compute date_start and date_end correctly. Make fields computed #1188

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[IMP] product_contract: Make computed fields as precompute to be able…
… to use them on _compute_name method
CarlosRoca13 committed Jan 28, 2025
commit 79b2708b3b652b3e993fd526d3d10daa5d8dec42
11 changes: 9 additions & 2 deletions product_contract/models/sale_order_line.py
Original file line number Diff line number Diff line change
@@ -39,8 +39,12 @@ class SaleOrderLine(models.Model):
recurring_invoicing_type = fields.Selection(
related="product_id.recurring_invoicing_type"
)
date_start = fields.Date(compute="_compute_date_start", readonly=False, store=True)
date_end = fields.Date(compute="_compute_date_end", readonly=False, store=True)
date_start = fields.Date(
compute="_compute_date_start", readonly=False, store=True, precompute=True
)
date_end = fields.Date(
compute="_compute_date_end", readonly=False, store=True, precompute=True
)
contract_line_id = fields.Many2one(
comodel_name="contract.line",
string="Contract Line to replace",
@@ -51,6 +55,7 @@ class SaleOrderLine(models.Model):
compute="_compute_auto_renew",
store=True,
readonly=False,
precompute=True,
)
auto_renew_interval = fields.Integer(
default=1,
@@ -59,6 +64,7 @@ class SaleOrderLine(models.Model):
store=True,
readonly=False,
help="Renew every (Days/Week/Month/Year)",
precompute=True,
)
auto_renew_rule_type = fields.Selection(
[
@@ -73,6 +79,7 @@ class SaleOrderLine(models.Model):
readonly=False,
string="Renewal type",
help="Specify Interval for automatic renewal.",
precompute=True,
)
contract_start_date_method = fields.Selection(
related="product_id.contract_start_date_method"