Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
In the python the field is defined like this :
property_account_payable_id = fields.Many2one('account.account', company_dependent=True,
string="Account Payable", oldname="property_account_payable",
domain="[('internal_type', '=', 'payable'), ('deprecated', '=', False)]",
help="This account will be used instead of the default one as the payable account for the current partner",
So when I log in with a user of company1 I see one value, if I log in with a user from company2 for this field I see other value.
I'm changing the workflow of sale order and I need to know how to read this value for each company that I've.
I manage to do this, like this:
user_company2 = self.env['res.users'].search( [('id','=',6)])
But I wanted to read the information base on the changing of the company not the changing of the user !
Is there away to read this depending on the company
Now I know that this is a Property Field:
There is some use cases where value of the field must change depending of the current company.
To activate such behavior you can now use the company_dependent option.
A notable evolution in new API is that “property fields” are now searchable.
My question now, is how do I search this field in order to have all information mapped by company?
In database the information is like this:
"2";"";;"2016-02-08 17:43:44.125127";"property_account_receivable_id";1;"many2one";1;1;2552;"";"<binary data>";"2016-02-08 17:43:44.125127";"account.account,9";;""
"25";"";;"2016-02-26 16:35:43.02136";"property_account_receivable_id";1;"many2one";4;1;2552;"";"<binary data>";"2016-02-26 16:35:43.02136";"account.account,388";;""
"32";"";;"2016-02-26 16:36:04.669278";"property_account_receivable_id";1;"many2one";6;1;2552;"";"<binary data>";"2016-02-26 16:36:04.669278";"account.account,767";;""
Maybe there is a function already implemented that is possible to search all values possible to a field depending on the company?
I'm not 100% sure but you *could* try to evaluate it with 'force_company' in the context:
Again, this might not work given ir_rules (maybe your user need the multi company group + have that specific company set as available to its user). But it's my best bet.
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 platform 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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 3/15/16, 8:13 AM|
|Seen: 680 times|
|Last updated: 3/23/16, 10:16 AM|