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

can't update to one2many wiget data in openerp

By
Thazin Khaing
on 12/27/13, 7:41 AM 912 views

in sale team onchange function, i want to appear wiget list of customer from res.partner. I already get the list of partner form sale_team_onChange function but i can't update to ony2many wiget.Please tell me knowledeg....Thnaks for advance.

..................python class................. class sale_day_setup(osv.osv): _name = 'sale.plan'

#     on change sale team function ........................

def sale_team_onchange(self, cursor, user, ids, sale_team, context=None):          
    print 'sale team on change function........', sale_team 
    cust_name=[]
    if sale_team :
        cursor.execute("select rp.name from res_partner rp where rp.sale_team = %s", (sale_team,))
        names = cursor.fetchall()
        for name in names:                 
            cust_name.append(name)
            val = {
                 'customers': cust_name,
               }
        print 'customers name;;;;;;;;;',val
    return { 'value': val }


_columns = {
            'name': fields.char('Day Name'),
            'sale_team':fields.many2one('crm.case.section', 'Sale Team'),
            'customers':fields.one2many('res.partner', 'partner_id', 'Customers'),
           }

..................res_partner................. class res_partner(osv.osv): _inherit = 'res.partner' _columns = { 'sale_team': fields.many2one('crm.case.section', 'Sale Team'), 'partner_id':fields.many2one('sale.plan','Sale Plan'), } res_partner()

...................in my view........................ <record id="view_sale_plan_form" model="ir.ui.view"> <field name="name">plan.form</field> <field name="model">sale.plan</field> <field name="arch" type="xml"> <form string="Sale Plans Setup" version="7.0"> <sheet> <group> <field name="name"/> <field name="sale_team" string="Sale Team" on_change="sale_team_onchange(sale_team)"/> </group> <field name="customers" widget="one2many_list" colspan="4" attrs="{'invisible':[('sale_team','=',False)]}"/> </sheet> </form> </field> </record>

Please Answer me...

Thazin Khaing
on 12/28/13, 2:59 AM

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: 12/27/13, 7:41 AM
Seen: 912 times
Last updated: 3/16/15, 8:10 AM