How To Inherit And Add Field which has computed function to Existing Views and get input In Odoo
Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:
- CRM
- e-Commerce
- Accounting
- Inventory
- PoS
- Project management
- MRP
This question has been flagged
4
Replies
4507
Views
deduct_leave_value = fields.Float(string='Deduct Leave (Day)', compute='_compute_deduct_leave', store=True)
write a compute function for it with 'compute deduct leave' name. After that go to your xml file and add
<record id = "Your custom id" model="ir.ui.view">
<field name="name">your custom name</field>
<field name="model">model name</field>
<field name="inherit_id" ref="your form external id"/>
<xpath expr="//field[@name='field_name']" position="after">
<field name="deduct_leave_value"/>
</xpath>
</field>
</record>
In this code you are using xpath to go into the required form grab a field and put your own field before , after or in replacement to that.
Hi,
Refer https://www.youtube.com/watch?v=z1Tx7EGkPy0&list=PLqRRLx0cl0hoJhjFWkFYowveq2Zn55dhM&index=9
Thanks.
Enjoying the discussion? Don't just read, join in!
Create an account today to enjoy exclusive features and engage with our awesome community!
Sign up
Inheritance in model and views: https://goo.gl/4Zyc9d