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 ???
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Akuntansi
- Inventaris
- PoS
- Project
- MRP
Pertanyaan ini telah diberikan tanda
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
Menikmati diskusi? Jangan hanya membaca, ikuti!
Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!
DaftarPost Terkait | Replies | Tampilan | Aktivitas | |
---|---|---|---|---|
|
2
Mar 15
|
4966 | ||
Unable to hide fields
Diselesaikan
|
|
2
Mar 15
|
4250 | |
|
0
Mar 15
|
3338 | ||
|
0
Jan 25
|
875 | ||
|
0
Sep 22
|
2885 |