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

Hello All,

In pos qweb part we can only access the fields of particular model those are passed in PosModel.

For, E.g. in company model it passes only few fields name,phone,email,website, etc those fields are accessible, but,

What if I want to access remaining fields, like, street,street2,fax those are the fields of same model,

How can i append these fields to this widget to make accessible in qweb part.

Thank in advance,

Regards,

Anil.




形象
丢弃
编写者 最佳答案

Hello All,

I found solution for this, its two step process.

1) We need to push the latest dictionary of res.company model in module list.

     module.PosModel.prototype.models.push({

     model: 'res.company',

     fields: [ 'currency_id', 'email', 'website', 'company_registry', 'vat', 'name', 'phone', 'partner_id' , 'country_id', 'fax'],

     ids: function(self){ return [self.user.company_id[0]] },

     loaded: function(self,companies){ self.company = companies[0]; },

     });


Update the new fields in this fields list : fields: [ 'currency_id', 'email', 'website', 'company_registry', 'vat', 'name', 'phone', 'partner_id' , 'country_id', 'fax'],  I have added fax no , In base fax no is not used.


2) Extend the PosModel :


     module.PosModel = module.PosModel.extend({    

      models: [{

      model: 'res.company',

      fields: [ 'currency_id', 'email', 'website', 'company_registry', 'vat', 'name', 'phone', 'partner_id' , 'country_id', 'fax'],

      ids: function(self){ return [self.user.company_id[0]] },

      loaded: function(self,companies){ self.company = companies[0]; },

      },]

      });


This is how I achieved , Now I can access that field in Qweb part of POS. is there any better way to do this?

Thanks.

Anil.


形象
丢弃
相关帖文 回复 查看 活动
0
9月 24
1437
1
8月 24
9623
1
10月 23
2019
0
9月 23
1357
2
7月 23
6428