Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

2

POS Receipt:How to make new field accessible from widget.pos.company?

By
Anil R. Kesariya
on 3/27/15, 1:48 AM 671 views

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.




1

Anil R. Kesariya

--Anil R. Kesariya--
4321
| 6 5 8
Gandhinagar, India
--Anil R. Kesariya--
ERP Consultant

Key Skill
-
Technical & Functional Expert
Anil R. Kesariya
On 3/27/15, 10:58 PM

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.


Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

1 follower(s)

Stats

Asked: 3/27/15, 1:48 AM
Seen: 671 times
Last updated: 4/15/15, 7:20 AM