Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • One2One fields in Odoo-9

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 3.30k
    Comment on it

    There is one field that since v6 and above was deleted and no longer used, ie one2one relations field.
    If we tried to make it in v6 the error will definitely occurs. OpenERP provides a solution 'combine' to the field many2one but here there is little difference. If the automatic update feature table one2one is a 'destination' when we enter from the table 'source' while it did not happen on the field many2one.

    For example you can see below code -

    class hr_employee(osv.osv):
        _inherit = 'hr.employee'
        _columns = {
            'partner_id': fields.many2one('res.partner','Partner'),
        }
     
        def onchange_partner_id(self, cr, uid, ids, partner, context=None):
            self.pool.get('res.partner').write(cr, uid, [partner], {'employee_id': ids[0]})
            return True
         
    hr_employee()
     
     
    class partner(osv.osv):
        _inherit = 'res.partner'
        _columns = {
                    'employee_id': fields.many2one('hr.employee','Employee'),
        }
         
    partner()

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: