Here is two functions which are write and create. The write method is working fine. but create method is not triggering.
Can anybody help on this??
#v13.0
class AssetAllocation(models.Model):
_name = 'asset.allocation'
def create(self, values):
for rec in self.asset_id:
if self.state == 'active':
rec.current_employee = self.name
rec.current_branch = self.branch
else:
rec.current_employee = False
rec.current_branch = False
res = super(AssetAllocation, self).create(values)
return res
def write(self, vals):
res = super(AssetAllocation, self).write(vals)
for rec in self.asset_id:
if self.state == 'active':
rec.current_employee = self.name
rec.current_branch = self.branch
else:
rec.current_employee = False
rec.current_branch = False
return res
i have same issue, i think its you already have been create method, i think create method just can call once