跳至內容
選單
此問題已被標幟
1 回覆
3262 瀏覽次數

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  

頭像
捨棄
最佳答案

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

頭像
捨棄
作者

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

相關帖文 回覆 瀏覽次數 活動
1
5月 23
3197
0
2月 20
58
2
3月 18
5124
3
12月 23
4944
1
8月 23
3365