Skip to Content
Menu
This question has been flagged

I'm working on a module in Openerp, and I'd like to inherit a class from another module, but I don't need every single column that's in the other class.

This is my class:

class BookingManagement(orm.Model):
    _name = 'booking.management'

    _inherit = 'res.partner.address.contact'

    _description = 'Booking management'

    _columns = {
        'guests': fields.integer('Number of guests', required=True),
        'check_in': fields.date('From', required=True),
        'check_out': fields.date('To', required=True),
        'special_requests': fields.text('Special requests')
    }

And this is res.partner.address.contact

class res_partner_address_contact(orm.Model):
    _name = "res.partner.address.contact"

    _description = "Address Contact"

    def [...]

    def [...]

    _columns = {
        'complete_name': fields.function(_name_get_full, string='Name', size=64, type="char", store=False, select=True),
        'name': fields.char('Name', size=64, ),
        'last_name': fields.char('Last Name', size=64, required=True),
        'first_name': fields.char('First Name', size=64),
        'mobile': fields.char('Mobile', size=64),
        'fisso': fields.char('Phone', size=64),
        'title': fields.many2one('res.partner.title', 'Title', domain=[('domain', '=', 'contact')]),
        'website': fields.char('Website', size=120),
        'address_id': fields.many2one('res.partner.address', 'Address'),
        'partner_id': fields.related(
            'address_id', 'partner_id', type='many2one', relation='res.partner', string='Main Employer'),
        'lang_id': fields.many2one('res.lang', 'Language'),
        'country_id': fields.many2one('res.country', 'Nationality'),
        'birthdate': fields.char('Birthdate', size=64),
        'active': fields.boolean('Active', help="If the active field is set to False,\
                 it will allow you to hide the partner contact without removing it."),
        'email': fields.char('E-Mail', size=240),
        'comment': fields.text('Notes', translate=True),
        'photo': fields.binary('Photo'),
        'function': fields.char("Function", size=64),
        'function_id': fields.many2one('res.contact.function', 'Function'),
    }

    def [...]

Let's say that the only columns I need are 'last_name', 'first_name', 'email' and 'mobile'.
How do I do that?

Thank you!

Avatar
Discard
Best Answer

Create a new view and put your required fields in new view or you can make invisible those fields which are not required in your requirements.

Avatar
Discard
Related Posts Replies Views Activity
3
Jul 18
2604
0
Jan 22
1527
1
Jul 15
2846
0
Mar 15
4155
2
Mar 15
5286