Skip to content

Commit

Permalink
[FIX] Added more dependend fields for some compute methods as mention…
Browse files Browse the repository at this point in the history
…ed by @DucTruongKomit. Small UI fix.
  • Loading branch information
wpichler committed Feb 27, 2023
1 parent 1aaa235 commit 3cfdd0d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
16 changes: 14 additions & 2 deletions contract/models/contract_line.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,11 @@ class ContractLine(models.Model):
)

@api.depends(
"last_date_invoiced", "date_start", "date_end", "contract_id.last_date_invoiced"
"last_date_invoiced",
"date_start",
"date_end",
"contract_id.last_date_invoiced",
"contract_id.contract_line_ids.last_date_invoiced",
)
# pylint: disable=missing-return
def _compute_next_period_date_start(self):
Expand Down Expand Up @@ -145,7 +149,15 @@ def _compute_termination_notice_date(self):
else:
rec.termination_notice_date = False

@api.depends("is_canceled", "date_start", "date_end", "is_auto_renew")
@api.depends(
"is_canceled",
"date_start",
"date_end",
"is_auto_renew",
"manual_renew_needed",
"termination_notice_date",
"successor_contract_line_id",
)
def _compute_state(self):
today = fields.Date.context_today(self)
for rec in self:
Expand Down
2 changes: 1 addition & 1 deletion contract/models/contract_modification.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ class ContractModification(models.Model):
ondelete="cascade",
index=True,
)
sent = fields.Boolean(default=False)
sent = fields.Boolean()

@api.model_create_multi
def create(self, vals_list):
Expand Down
17 changes: 7 additions & 10 deletions contract/views/abstract_contract_line.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,13 @@
<field name="specific_price" invisible="1" />
<field name="currency_id" invisible="1" />
<field colspan="1" name="product_uom_category_id" invisible="1" />
<label
for="product_id"
attrs="{'invisible': [('display_type', '!=', False)]}"
/>
<field
colspan="1"
name="product_id"
attrs="{'required': [('display_type', '=', 'product')],'invisible': [('display_type', '!=', False)]}"
nolabel="1"
/>
<group>
<field
colspan="1"
name="product_id"
attrs="{'required': [('display_type', '=', 'product')],'invisible': [('display_type', '!=', False)]}"
/>
</group>
<group
col="6"
attrs="{'invisible': [('display_type', '!=', False)]}"
Expand Down

0 comments on commit 3cfdd0d

Please sign in to comment.