跳至内容
菜单
此问题已终结
2 回复
71 查看

Hello,

I’ve created a custom form using XML (not the Odoo Website Builder). The form successfully submits data to the CRM model, and all fields are mapped correctly except for the “priority” field, which appears under Internal Notes as additional information rather than being saved to the actual CRM field.

Interestingly, when I create a similar form using the Odoo Website Builder and include the priority field there, it maps correctly to the CRM model.

Is there a way to have the priority field properly linked to the CRM model without relying on the website builder?

Thank you!

形象
丢弃
编写者 最佳答案

I made sure the fields use the proper value. At the moment, if the form is purely through code, the data submits as extra information. As soon as a different form is added through the website builder, the same form created using code now works and submits the value to the priority field.

This is the issue I am facing and I can't seem to find the logic that Odoo uses to activate that automatically.

形象
丢弃
最佳答案

Hi,

The issue occurs because the priority field in Odoo’s CRM model is a selection field that expects specific coded values (such as '0', '1', '2', '3') rather than plain text labels like “Low” or “High.” When your custom XML form sends these labels directly, Odoo doesn’t recognize them and moves the data to the Internal Notes section instead of saving it to the proper field. The Website Builder form, on the other hand, works correctly because it automatically uses the internal codes expected by the CRM model.


To fix this, you can either modify your form to send the correct internal codes by defining the <select> options with values like 0, 1, 2, and 3, or you can add logic in your custom controller to translate user-friendly text into the correct codes before creating the CRM record. For example, you can map “Low” to '0', “Normal” to '1', “High” to '2', and so on.


In summary, your form works except for the priority field because it passes text instead of internal values. Using the proper selection values or preprocessing the input in your controller ensures that the priority is correctly stored in the CRM record rather than appearing as additional notes.


Hope it helps

形象
丢弃
相关帖文 回复 查看 活动
2
5月 25
10426
3
3月 24
6138
1
1月 21
4039
0
1月 25
1887
1
1月 25
2359