Skip to Content
Menu
This question has been flagged

Hello, 

I am facing this error when trying to create an action in the mgmtsystem .


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: Action (mgmtsystem.action), Field: Reference (reference)

May anyone help me  

Avatar
Discard
Best Answer

Hi,

Such an error message is thrown from the system, when a value for  required field is not passed in create/write method.

In your case, you have to pass the value for field name reference.

For more, see this: https://www.youtube.com/watch?v=bP2IsIgzhfU&list=PLqRRLx0cl0hoiTewSTzSQ3HJ-Vqhh43k0

Thanks

Avatar
Discard
Author

The code differs as you can see my code below I don't know where to add this command:.
'refrence : self.refrence' because he added 'patient_id : self.patient_id.id'

@api.model_create_multi
def create(self, vals_list):
for one_vals in vals_list:
if one_vals.get("reference", _("New")) == _("New"):
Sequence = self.env["ir.sequence"]
one_vals["reference"] = Sequence.next_by_code("mgmtsystem.action")
actions = super().create(vals_list)
actions.send_mail_for_action()
return actions

Related Posts Replies Views Activity
1
May 23
1707
0
Feb 20
58
2
Mar 18
4107
3
Dec 23
1555
1
Aug 23
1644