Odoo Help

0

0
3 Answers
0
Mohan
29/11/17 02:27

Finally i got the Answer Please check and use it:

*****************************************


.py Changes for purchase:

class skit_Partner(models.Model):

    _inherit = 'res.partner'

    def name_get(self):
        result = {}
        if self._context.get('view_customer', False):
            for partner in self: 
                result[partner.id] = str(partner.name) + ' _' + str(partner.supplier_code)
        else:
            for partner in self:
                    result[partner.id] = partner.name
 
        return result.items()

    @api.model
    def name_search(self, name, args=None, operator='ilike', limit=100):
        args = args or []
        recs = self.browse()
        if name:
            recs = self.search((args + ['|', ('supplier_code', 'ilike', name), ('name', 'ilike', name)]),
                               limit=limit)
        if not recs:
            recs = self.search([('name', operator, name)] + args, limit=limit)
        return recs.name_get()

.xml Changes:        
                <xpath expr="//field[@name='partner_id']" position="replace">
                    <field name="partner_id" context="{'view_customer': True}" />
                </xpath>

0
Fatih Piristine
15/9/17 11:40

modify your search fields. include phone, mobile etc columns so you will have changes. but it might slow things down.

adding new indexes might help too.

1 Comment
Mohan
18/9/17 05:59

Its not working!

Ask a Question
Writer
Keep Informed
1 follower(s)
About This Community

This platform 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.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now