Odoo Help
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.
How to Map Company -> Estate --> Division [Closed]
I'm going to create above mapping.need to many2one fieds & if i select company then need to come to second combo relevant estate for that companies.please help me to sort this issue.
I checked 'related' filed type also in developer guide.but haven't idea to implement in that way.check this code & advice me to sort this issue. thanks
class bpl_company_registration(osv.osv):
_name = "bpl.company.registration"
_description = "BPL Company registration"
_columns = {
'name': fields.char('Company', size=50, help='Company'),
}
bpl_company_registration()
class bpl_estate_registration(osv.osv):
_name = "bpl.estate.registration"
_description = "BPL Estate registration"
_columns = {
'name': fields.char('Estate', size=50, help='Estate'),
}
bpl_estate_registration()
class bpl_division_registration(osv.osv):
_name = "bpl.division.registration"
_description = "BPL Division registration"
_columns = {
'name': fields.char('Division', size=50, help='Division'),
}
bpl_division_registration()
class company_estate_division(osv.osv):
_name = "bpl.company.estate.division"
_description = "Company Estate Division Mapping"
_columns = {
'bpl_company_id':fields.many2one('bpl.company.registration', 'Company', help='Company'),
'bpl_estate_id':fields.many2one('bpl.estate.registration', 'Estate', help='Estate'),
'bpl_division_id':fields.many2one('bpl.division.registration', 'Division', help='Division'),
}
company_estate_division()
Another method
class company_estate_division(osv.osv):
_name = "bpl.company.estate.division"
_description = "Company Estate Division Mapping"
_columns = {
'bpl_company_id': fields.function(_get_company_data, fnct_inv=_set_estate_data, type='one2many', relation='hr.department', string="Company"),
'bpl_estate_id': fields.function(_get_estate_data, fnct_inv=_set_estate_data, type='one2many', relation='hr.department', string="Company"),
'bpl_division_id': fields.function(_get_estate_data, fnct_inv=_set_estate_data, type='many2one', relation='hr.department', string="Company"),
}
company_estate_division()
Did you check onchange event on many2one field?
I think if you want like company change in company_estate_division class will assign automically estate and its division than you should have both estate and division fields on bpl_company_registration class, then only you can use onchange or related field.
i change my code to another procedure.seems this may be complex another way also posted below in my post.giv me a suggestion for that
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.
RegisterOdoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.
Test it nowQuestion tools
Stats
Asked: 3/22/13, 2:14 AM |
Seen: 1868 times |
Last updated: 3/16/15, 8:10 AM |