Hi guys i am new to Odoo, for now i have 2 model as below:
class HumanResource(models.Model):
_name = 'hr.employee'
_inherit = 'hr.employee'
test = fields.Char('test')
# Profiling Details
food_ids = fields.One2many(
'hr.employee.food',
'food_id',
string='Food Cost'
)
class HrFood(models.Model):
_name = "hr.employee.food"
_description = "Employee Food"
# food_id = fields.Many2one('hr.employee', 'Food', default={'food_id': lambda self, cr, uid, context: context.get('food_id')})
food_id = fields.Many2one('hr.employee', string='Employee Name')
# foodtype = ?to?
food_name = fields.Char(
string='Food Name',
help='Please Enter the Food Name'
)
food_category = fields.Selection(
[('breakfast', 'Breakfast'),
('lunch', 'Lunch'),
('teatime', 'Tea Time'),
('dinner', 'Dinner'),
('supper', 'Supper')],
string='Category',
)
food_cost = fields.Float(
string='Food Amount',
digits=(5, 2)
)
And then i have the view file:
<odoo>
<record id="view_form_hr_employee_food" model="ir.ui.view">
<field name="name">Create Food Cost</field>
<field name="model">hr.employee.food</field>
<field name="arch" type="xml">
<form>
<sheet>
<group>
<field name="food_id" />
<separator string="Reference" />
<field name="food_category" />
<field name="food_name" />
<field name="food_cost" />
</group>
</sheet>
</form>
</field>
</record>
</odoo>
I'm trying to override the modal pop up box that auto generate by the class HrFood.
The view file is what i've tried, also i did add the views into manifest.py
This is the interface, and the food cost is the one2many field enter image description here
This is the pop up modal box that i want to override enter image description here
So what do i missed? Please help me to solve my question, i am newbee in Odoo. And my Odoo version is Odoo 11, Thanks in advance.