Quantcast
Channel: OpenERP Help - Individual question feed
Viewing all articles
Browse latest Browse all 6389

onchange product_id_change function in sales order line: Help!

$
0
0
Hi All, Working with OpenERP V6 on windows. I have created a module that adds a field to the product form to indicate what type of label should go on each product. This label type is also to display on the sales order line tree&form and eventually on the delivery order stock move tree&form so that warehouse knows what label to print on the box. I am trying to create on_change function for the sales order line and delivery order so that when a product is selected the label type is displayed in its field, the same applies to the delivery form. The module loads and runs without product_id_change function in the xml code but the on_change function is required for this module to be useful. I get this error when I select product from sales order line. Please what am i doing wrongly? Thanks in advance. Any help is very much appreciated. Error is: Traceback (most recent call last): File "C:\Program Files (x86)\OpenERP 6.1-1\server\.\openerp\osv\osv.py", line 121, in wrapper File "C:\Program Files (x86)\OpenERP 6.1-1\server\.\openerp\osv\osv.py", line 176, in execute File "C:\Program Files (x86)\OpenERP 6.1-1\server\.\openerp\osv\osv.py", line 164, in execute_cr TypeError: product_id_change() takes at most 19 arguments (20 given) 2013-09-02 12:38:53,305 1012 ERROR ? openerp.netsvc: product_id_change() takes at most 19 arguments (20 given) python code: from osv import fields,osv class sale_order_line(osv.osv): _name = 'sale.order.line' _inherit = 'sale.order.line' _columns = { 'order_line_label': fields.many2one('label.maker','Label',select=True, help='select the right label for the product and partner'), } 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, order_line_label=False, flag=False, context=None): context = context or {} res = super(sale_order_line, 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) product_obj = self.pool.get('product.product') product_obj = product_obj.browse(cr, uid, product, context=context) res['value'].update({'order_line_label': product_obj.labelnid or False}) return res sale_order_line() class sale_order(osv.osv): _name = 'sale.order' _inherit = 'sale.order' def _prepare_order_line_move(self, cr, uid, order, line, picking_id, date_planned, context=None): res = super(sale_order, self)._prepare_order_line_move(cr, uid, order=order, line=line, picking_id=picking_id, date_planned=date_planned, context=context) res['order_line_label'] = line.labelnid return res sale_order() xml is: sale.order.form.sale.labelsale.orderorder.line.treesale.orderproduct.product.formproduct.productform

Viewing all articles
Browse latest Browse all 6389

Trending Articles