Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to use classical inheritance in OpenERP/Odoo ?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 432
    Comment on it

    If you want to use classical inheritance in OpenERP use below code -

    class subscription_document(osv.osv):
        _name = "subscription.document"
        _description = "Subscription Document"
        _columns = {
            'name': fields.char('Name', size=60, required=True),
            'active': fields.boolean('Active', help="If the active field is set to False, it will allow you to hide the subscription document without removing it."),
            'model': fields.many2one('ir.model', 'Object', required=True),
            'field_ids': fields.one2many('subscription.document.fields', 'document_id', 'Fields')
        }
        _defaults = {
            'active' : lambda *a: True,
        }
    subscription_document()
    
    class subscription_document_fields(osv.osv):
        _name = "subscription.document.fields"
        _description = "Subscription Document Fields"
        _rec_name = 'field'
        _columns = {
            'field': fields.many2one('ir.model.fields', 'Field', domain="[('model_id', '=', parent.model)]", required=True),
            'value': fields.selection([('false','False'),('date','Current Date')], 'Default Value', size=40, help="Default value is considered for field when new document is generated."),
            'document_id': fields.many2one('subscription.document', 'Subscription Document', ondelete='cascade'),
        }
        _defaults = {}
    subscription_document_fields()

 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: