Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
1 Відповісти
2683 Переглядів

Hi,

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,

company_id=None, context=None):

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

if res:

res['value'].update({available_quantity':product_data.qty_available})

return res

'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.

 

Аватар
Відмінити