I have a model that inherits from "hr.employee" and I have an action that will display only the employees which are in a special department.
I would like that the "Create" button on top of that list allows me to create a record in hr.employee with the department field already set to that special department.
Of course the other "Create" button, from the standard "hr" module, should not set a default value for the department.
Here's the model:
# -*- coding: utf-8 -*-
from openerp import models, fields
class Patient(models.Model):
_inherit = 'hr.employee'
date_debut_contrat = fields.Date('Début Contrat de Prise en Charge')
date_fin_contrat = fields.Date('Fin Contrat de Prise en Charge')
And here's the action:
<record id="action_liste_patients" model="ir.actions.act_window">
<field name="name">Patients</field>
<field name="res_model">hr.employee</field>
<field name="view_mode">kanban,tree,form</field>
<field name="domain">[('department_id.is_patients', '=', 'true')]</field>
</record>
Do I have a way to tell Odoo that from that action, the department_id field should have a default value, without changing the behaviour of the standard action ?
Many thanks to all.
Marc