Reputation: 1135
I have been trying to update multiple fields with the same value but I can't seems to figure out a way to do it.
<field name="credit_limit" readonly="1" attrs="{'invisible':[('check_credit','!=',True)]}"/>
And I want to update the custom_credit which is on the same database res_partner. Is there any easy way that I can do it via xml. My optimum solution would be hidden field that would be take value from above field and update database when the submit button is clicked.
The new field would be like this but it should take value from above credit_limit.
<field name="custom_credit" readonly="1" type="hidden"/>
Upvotes: 0
Views: 56
Reputation: 2825
There is a easy way to update readonly="1"
or invisible="1"
field in odoo form, you have to add the property force_save="1"
to do so. But to keep track of change in check_credit
field, you must write an @api.onchage('check_credit')
function and use that value to set custom_credit
field. Other ways can be inheriting create
or write
function, use compute
property on custom_credit
field, or use related
property.
Upvotes: 1