Technical mailing list archives
Re: Some help please - onchangeby
Tried that and get a log warning that onchange needs to be a valid field name whenever using dotted notation.
If you change record, works as expected.
If you create record works as expected.
If you edit an existing record the return value is as expected and the warning message as well.
My guess is that there is something on the js side saying do not update as nothing has changed.
Regards.def custom_id_change(self):@api.onchange('custom_id', 'custom_id.o2m_field', 'custom_id.o2m_field.qty')Hi, Graeme,You have to add subfields in the onchange:
...2017-03-20 5:50 GMT+01:00 Graeme Gellatly <email@example.com>:GraemeThe onchange code has changed significantly as I've hacked at it (different field depends, trying different things like setting dirty flags, clearing caches) but in simplest terms it looks like this when it works for a new record and this also triggers the product_uom_qty onchanges and raises the warning for existing records.When an existing custom model record is edited in a popup modal, the model total updates and on save the onchange is called and I can see uses the correct values however the form or record is never updated. It even triggers the out of stock warning of the product_uom_change with the correct quantity. How to get it to update?When a new custom model is created the onchange is called and product_uom_qty updates correctly along with dependent fields such as subtotal, cascading through onchanges.Custom Model -> Custom Model Lines (o2m)Sale Order Line -> Custom Model (m2o on editable so line)Sale Order -> Sale Order Line (o2m standard sale module)Hi,I have the following design in v10 that I just can't get working right.
- The forms are all standard, with the addition of custom model m2o on the order line part of the sale order form.
- The custom model contains a computed float field called total. This works perfectly as expected.
- The custom model has an onchange on sale order line which updates product_uom_qty.@api.onchange('custom_id')Kind regards,
self.product_uom_qty = self.custom_id.total
Post to: mailto:firstname.lastname@example.org
Post to: mailto:expert-framework@mail.