I have used onchange to add a new field in the invoice line the pb when I click on save it return to zero
here is my code:
def product_id_change(self, cr, uid, ids, product, uom_id, qty=0, name='', type='out_invoice',
partner_id=False, fposition_id=False, price_unit=False, currency_id=False,
res = super(invoice_line, self).product_id_change(cr, uid, ids, product, uom_id, qty=qty, name=name, type=type, partner_id=partner_id,fposition_id=fposition_id, price_unit=price_unit, currency_id=currency_id, company_id=company_id, context=context)
for product_data in self.pool.get('product.product').browse(cr, uid,[product], context=context):
'available_quantity' : fields.float('Quantité disponible',readonly=True),
Could you help me to figure out what is the pb ???
The value of available_quantity field is not changed because it is readonly. If field is readonly, then we can't set value of that field in onchange.
If you want to change value of readonly field in onchange, then install module web_readonly_bypass. You can download it from link : https://apps.openerp.com/apps/modules/8.0/web_readonly_bypass/
By Installing this module and setting parameter as per explain in module, you can change the value of readonly field in onchange method.
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
|Asked: 3/30/16, 4:27 AM|
|Seen: 339 times|
|Last updated: 6/8/16, 4:10 AM|