Odoo Help

Welcome!

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

0

Is it possible to set a partner default based on a tag?

By
Josh Stover
on 5/20/13, 4:28 PM 975 views

I would like to create a tag such as "blind dropship" that would represent a partner that we are not supposed to contact, but that we just ship to for another reseller. Upon selecting "blind dropship" as the tag, I would like the opt-out to become true, and the customer and supplier checkboxes to become false. Is this possible?

0

Borni DHIFI

--Borni DHIFI--
5102
| 6 8 9
Tunis, Tunisia
--Borni DHIFI--

Techno Functional Consultant Odoo(OpenERP) 

http://www.linkedin.com/in/borni

Skype : dhifi.borni

Borni DHIFI
On 5/20/13, 7:10 PM

Hi,

must be create a new module inherit of res.partner for add a onchange() methode to category_id field.

in your file.xml

<field name="category_id" 
                        on_change="onchange_category(category_id)"
                        widget="many2many_tags" placeholder="Tags..."/>

in your file.py

 def onchange_category(self, cr, uid, ids, value):              
       for category_id  in value[0][2]  : 
           category_name = self.pool.get('res.partner.category').browse(cr, uid, category_id).name
           if category_name == 'blind dropship' :
               return {'value':{'customer':False,'supplier':False,'opt_out':True}}
               break
       return {}

Thank you.

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 5/20/13, 4:28 PM
Seen: 975 times
Last updated: 3/16/15, 8:10 AM