Skip to Content
Menu
This question has been flagged
1 Reply
1362 Views

Hi all,

I am fighting with product packaging module. 

I defined my ProductPackaging class as follow:  

class ProductPackaging(models.Model):
    _inherit = "product.packaging"
    
    @api.onchange("package_carrier_type")
    def _onchange_package_type(self):   
            self.length = 11
The field length is defined in delivery module. I can see that the onchange method is executed and that the correct value is written in the json response:

{"jsonrpc": "2.0", "id": 844470882, "result": {"value": {"length": 11}}}
But the value is not updated in the view and not stored in the backend. 

What am I doing wrong? 

Thanks
Avatar
Discard
Best Answer

I think it's due to the field name "length"  python don't have a problem but when it's come to the javascript framework every object has build it length property so javascript treat it as length property instead of a field and you didn't get aspected result on view 

try different field name like box_length as a field name 

Avatar
Discard
Author

Hi Ravi! It seem's to be the cause! Thanks a lot!