콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
4 답글
8256 화면

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 ???

아바타
취소
베스트 답변

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 :/

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

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

작성자

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"

베스트 답변

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

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

작성자

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

베스트 답변

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
아바타
취소
작성자 베스트 답변

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

관련 게시물 답글 화면 활동
2
3월 15
5040
2
3월 15
4381
0
3월 15
3419
0
1월 25
1049
0
9월 22
3018