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

How to load fields in odoo 16 point of sale. In odoo 14 I use load_fields. But with Odoo 16 I get an error. << load_fields is not defined >>

頭像
捨棄
最佳答案

Hi,

To load fields in the Odoo 16 Point of Sale (POS) module, you can use the 'fields_get' method of the 'models' class. This method returns a dictionary containing information about all the fields of a model, including their type, string label, and whether or not they are required.

Here is an example of how you can use the 'fields_get' method to load fields in the POS module:

from odoo import models

class PosSession(models.Model):
_inherit = 'pos.session'

fields_get(self, allfields=None, attributes=None):
fields = super().fields_get(allfields=allfields, attributes=attributes)
# add additional fields here
return fields

Regards

頭像
捨棄

I am a beginner and have used odoo from front end only. I could do this in Odoo 15 by modifying the code as mentioned at https://www.odoo.com/forum/help-1/add-custom-field-in-pos-customer-search-207560

how to do in odoo 16. Where should i write the above code?

相關帖文 回覆 瀏覽次數 活動
5
9月 25
23070
3
8月 25
3420
1
5月 25
3329
1
4月 25
4244
1
4月 25
5052