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.

0

How to Map Company -> Estate --> Division [Closed]

By
priyankahdp
on 3/22/13, 2:14 AM 1,322 views

The Question has been closed

by
priyankahdp
on 04/30/2013 10:20:00

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()
2

Mustufa Rangwala (mra)

--Mustufa Rangwala (mra)--
Tiny ERP Pvt Ltd
http://www.odoo.com
853
| 2 1 4
Ahmedabad, India
--Mustufa Rangwala (mra)--

- Around 7+ years of strong experience in Odoo (Formerly OpenERP) which is world's largest Open Source Business Applications driven by CEO Fabien Pinckaers. - Played key role in developing and maintaining various Odoo Product modules and integrating them on Open Source ERP Environment. - Experience on Scrum methodology for project management - Experience in Team Building - Quick Start Implementations. - Worked on almost all versions (4.0, 5.0, 6.0, 6.1, 7.0, SAAS, Trunk(8.0)...) of Odoo (Formerly OpenERP) . Specialities: Odoo Business Process And OpenERP Implementation. Odoo Application Support and Maintenance. Odoo Technical & Functional Training. Business Process Mapping & Gap Analysis (Functional and Technical Analysis)

Mustufa Rangwala (mra)
On 3/22/13, 3:57 AM

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

priyankahdp
on 3/22/13, 4:18 AM

About This Community

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

Question tools

0 follower(s)

Stats

Asked: 3/22/13, 2:14 AM
Seen: 1322 times
Last updated: 3/16/15, 8:10 AM