Skip to content Skip to sidebar Skip to footer

How To Add Condition For Particular Class To Show Field Drop -down Except Partner_id From Res.partner Form

I want to access res.partner form in my module. But i want that instead of customer(partner_id) it 'pet_name' in drop-down for only particular class. I applied a function and it's

Solution 1:

We need to pass context and check that context key in name_get() method. If we get that context then fire your logic otherwise core logic execute.

For example:

In XML side update code:

<fieldname="pet"context="{'need_pet': True}">

Now check context key in method.

@api.multidefname_get(self):
    if self._context and self._context.has_key('need_pet'):
        result = []
        for record in self:
            name = '['if record.pet_name:
                name += record.pet_name + ']' + ' ' + record.name
            else:
                name += '] ' + record.name
            result.append((record.id, name))
        return result
    returnsuper(customer_information, self).name_get()

Post a Comment for "How To Add Condition For Particular Class To Show Field Drop -down Except Partner_id From Res.partner Form"