Skip to Content
เมนู
คุณต้องลงทะเบียนเพื่อโต้ตอบกับคอมมูนิตี้
คำถามนี้ถูกตั้งค่าสถานะ
5429 มุมมอง

hi,

I cerate a new configuration in employee modules when I trying to save the forum getting an error:

The operation cannot be completed:
- Create/update: a mandatory field is not set.
- Delete: another model requires the record being deleted. If possible, archive it instead.

Model: contract.notification (contract.notification), Field: Contract Reference (name)


here is my code:


class NotificationState(models.Model):
_name = 'contract.notification'
_inherit = 'hr.contract'

struct_id = fields.Many2one('hr.payroll.structure', string='Salary Structure')

contract_notification = fields.Char(string="contract_notification", compute="get_notification")

notification_type = fields.Selection([
('week', 'Week'),
('month', 'Month'),
('day', 'Day'),
], string="notification by", track_visibility="onchange")

@api.depends('struct_id')
def get_notification(self):
for rec in self:
if rec.struct_id:
if rec.struct_id in rec.env['hr.payroll.structure'].search([]):
rec.contract_notification = rec.notification_type
print("israa")


อวตาร
ละทิ้ง

print the type and notification of the value. this error will appear normally trying to update fields with wrong values or unknown records from the same model is getting updated.

Related Posts ตอบกลับ มุมมอง กิจกรรม
3
ต.ค. 23
8792
1
ก.ย. 23
3321
1
พ.ค. 23
2261
2
เม.ย. 23
2819
Inherit Element form kanban View แก้ไขแล้ว
1
มี.ค. 23
2203