Odoo Help

1

how can i fill the note field automatically in product_id_change()

By
mohamed abdelwahed
on 5/19/13, 2:15 PM 3,392 views

hello everybody , i want to know how can i put some notes in the "note" fields in sale.order obj from the product_id_change() function ???

5

ClueLogics Technologies Pvt. Ltd.

--ClueLogics Technologies Pvt. Ltd.--
6143
| 6 5 8
Delhi NCR, India
--ClueLogics Technologies Pvt. Ltd.--

 ClueLogics Technologies Pvt Ltd is a Software product and services provider. We are positioned to deliver robust, rapid and reliable Information Technology solutions that work. What we succeed upon is Technology and Technical Expertise. The industry review of ClueLogics has been commendable for the past years as most of its business comes from repeat orders by highly satisfied clients.

ClueLogics Technologies Pvt. Ltd.
On 5/20/13, 3:37 AM

Hi mohamed abdelwahed

you can override method product_id_change as like below

example:

def product_id_change(self, cr, uid, ids, uom_id,uom_po_id, context=None):
   vals = super(sale_order, self).product_id_change(cr, uid, ids, uom_id, uom_po_id)
   note = "Mys Notes"
   vals['value'].update({'note':note})
   return vals

Good Luck Thanks

i inherit the "sale.order.line" and i override the product_id_change() but nothing seems to work :/

mohamed abdelwahed
on 5/20/13, 7:54 AM

i gave an example , in real case you should use the place of vals.update({'note':note}) to vals['value'].update({'note':note})

ClueLogics Technologies Pvt. Ltd.
on 5/20/13, 7:58 AM

for your information , there is no field note in sale.order.line object

ClueLogics Technologies Pvt. Ltd.
on 5/20/13, 8:01 AM

i know that there is no field "note" in "sale.order.line" but my question is to know if there is a trick that allow me to access the "sale.order" field from "sale.order.line"

mohamed abdelwahed
on 5/20/13, 9:14 AM
2
le_dilem
On 5/20/13, 7:47 AM

Hi you can not use product_id_change in sale.order. Because it is in sale.order.line

Sale.order = the header Sale.order.line = a detail

So in sale.order.line you generates a field with product_id_change ans in sale.order you change your field note in function.

the principle of this function :

she travels sale.order.line your field x_discount, and affect in the header "note".

thanks le dilem for all your support but i'm a newbie in openerp and python so i can't understand your solution :/ i'm really stacked

mohamed abdelwahed
on 5/20/13, 10:12 AM

ok step by step : http://help.openerp.com/question/16336/how-i-can-create-module-openerp-7/

le_dilem
on 5/20/13, 10:31 AM

can you add me on facebook so we can speak french please here is my profile facebook.com/looser87

mohamed abdelwahed
on 5/20/13, 10:35 AM
1

Keyur

--Keyur--
1205
| 4 4 8
Ahmedabad, India
--Keyur--

Odoo Expert

Keyur
On 5/20/13, 3:29 AM

You can set note field of sale.order model by overriding product_id_change() method.

Here is the example,

def product_id_change(self, cr, uid, ids, .. ):
    vals = super(your_class, self).product_id_change(cr, uid, ids, uom_id, uom_po_id)
    note = "My Sale Order note"
    vals = {'value':{'note':note}}
    return vals
0
mohamed abdelwahed
On 5/20/13, 7:37 AM

thank you sir but here is my code and it dont seems to work

class sale_order(osv.osv):

_name='sale.order'
_inherit='sale.order'

def product_id_change(self, cr, uid, ids, pricelist, product, qty=0,
    uom=False, qty_uos=0, uos=False, name='', partner_id=False,
    lang=False, update_tax=True, date_order=False, packaging=False, fiscal_position=False, flag=False, context=None):
    vals = super(sale_order, self).product_id_change(cr, uid, ids, pricelist, product, qty=qty,
    uom=uom, qty_uos=qty_uos, uos=uos, name=name, partner_id=partner_id,
    lang=lang, update_tax=update_tax, date_order=date_order, packaging=packaging, fiscal_position=fiscal_position, flag=flag, context=context)
    note = "Mys Notes"
    vals.update({'note':note})
    return vals

sale_order()

Please add your query in comment section not in answer section & product_id_change method is not of sale.order model. It is of sale.order.line model. Hope now it will work. Thanks

Keyur
on 5/20/13, 7:47 AM

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 E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

2 follower(s)

Stats

Asked: 5/19/13, 2:15 PM
Seen: 3392 times
Last updated: 3/16/15, 8:10 AM