I am trying to create a fine allocation functionality in hr.employee.This module inherits from hr.employee
. The process is:
- Click the Fine Allocation menu that opens a wizard. The wizard has a many2many relation field called employee_ids related to hr.employee. This should enable you to select batch employees and allocate fines together.
2.There being a field with name fine_amount
, allocate individual fines for employees in each of the lines and then allocate fines by click of a button.
My question is, how do I extend this many2many field with the fine_amount field?
If I extend the hr.employee form with this field, it is not among the selected fields in the many2many lines.
My code looks like this
class FineAllocation(models.TransientModel):
_name = 'fine.allocation'
_description = 'Fine Allocation'
@api.model
def action_allocate_fine(self):
pass
employee_ids = fields.Many2many('hr.employee','hr_employee_group_rel', 'deductions_id' 'Employees')
fine_amount = fields.Float(string='Fine Amount')
And this is for the wizard record view
<record id="employee_fine_allocation_form" model="ir.ui.view">
<field name="name">Employee Fine Allocation Form</field>
<field name="model">fine.allocation</field>
<field name="arch" type="xml">
<form string="Employee Fine Allocation">
<group>
<span colspan="4" nolabel="1">This wizard will allocate fines for all selected employee(s) equalling the input fine amount.</span>
</group>
<group colspan="4">
<separator string="Employees" colspan="4" />
<newline />
<field name="employee_ids" nolabel="1" />
</group>
<footer>
<button name="action_allocate_fine" string="Allocate Fines" type="object" class="btn-primary" />
<button string="Cancel" class="btn-secondary" special="cancel" />
</footer>
</form>
</field>
</record>