Skip to content

Commit

Permalink
Merge PR #744 into 16.0
Browse files Browse the repository at this point in the history
Signed-off-by sbidoul
  • Loading branch information
OCA-git-bot committed Feb 28, 2025
2 parents 7a56c15 + 2f8094f commit 04e9657
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions hr_timesheet_name_customer/models/hr_timesheet_name_customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
class NameCustomer(models.Model):
_inherit = "account.analytic.line"

name_customer = fields.Char(string="Customer Description")
"""override create method, initialize name_customer"""
name_customer = fields.Char(
string="Customer Description",
compute="_compute_name_customer",
store=True,
readonly=False,
)

@api.model_create_multi
def create(self, vals_list):
for vals in vals_list:
if not vals.get("name_customer"):
vals["name_customer"] = vals["name"]
return super(NameCustomer, self).create(vals_list)
@api.depends("name")
def _compute_name_customer(self):
for rec in self:
if not rec.name_customer and rec.name:
rec.name_customer = rec.name

0 comments on commit 04e9657

Please sign in to comment.