Skip to Content
Menu
This question has been flagged
2 Replies
889 Views

Dear all,

trying to custom change decimal precision for spesific UoM like below:


@api.onchange('product_uom')
@api.multi
def _onchange_uom(self):
for record in self:
if record.product_uom.name == 'M3':
record.product_qty = fields.Float(string='Quantity',digits=(2,6), required=True)
but got error :

TypeError: float() argument must be a string or a number, not 'Float'
can anyone here give me clue to solve this problem,

kind regards




Avatar
Discard
Author Best Answer

Dear Jagdish,

Thank you for your answering.

i use onchange method, because i need when user change Product item in the Purchase order line with the UoM "M3" then the decimal precision will change automatically. 

for example:

UoM M3 => decimal precission (2,6) 

but other UoM => decimal precision (2,4)


kind regards

Giri

Avatar
Discard
Best Answer

Hello Girianto

You can not change the field by using onchange method, use the fields_view_get method, or override this field in your custom module.

Avatar
Discard