From e72fdb19959f4891ff26e647d58e038720f43ef7 Mon Sep 17 00:00:00 2001 From: Xavier Codinas Date: Wed, 19 Oct 2016 23:07:20 +0200 Subject: [PATCH] Add start and end dates on employee issue4435 review21181002 --- CHANGELOG | 2 ++ company.py | 15 +++++++++++++++ view/employee_form.xml | 4 ++++ view/employee_tree.xml | 2 ++ 4 files changed, 23 insertions(+) diff --git a/CHANGELOG b/CHANGELOG index 577b063709..339437b9bd 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,5 @@ +* Add start and end dates on employee + Version 4.0.0 - 2016-05-02 * Bug fixes (see mercurial logs for details) * Add Python3 support diff --git a/company.py b/company.py index 8f39425e30..3223270225 100644 --- a/company.py +++ b/company.py @@ -1,6 +1,7 @@ # This file is part of Tryton. The COPYRIGHT file at the top level of # this repository contains the full copyright notices and license terms. import copy + from trytond.model import ModelView, ModelSQL, fields from trytond.wizard import Wizard, StateView, Button, StateTransition from trytond.report import Report @@ -61,6 +62,20 @@ class Employee(ModelSQL, ModelView): _rec_name = 'party' party = fields.Many2One('party.party', 'Party', required=True) company = fields.Many2One('company.company', 'Company', required=True) + start_date = fields.Date('Start Date', + domain=[If((Eval('start_date')) & (Eval('end_date')), + ('start_date', '<=', Eval('end_date')), + (), + ) + ], + depends=['end_date']) + end_date = fields.Date('End Date', + domain=[If((Eval('start_date')) & (Eval('end_date')), + ('end_date', '>=', Eval('start_date')), + (), + ) + ], + depends=['start_date']) @staticmethod def default_company(): diff --git a/view/employee_form.xml b/view/employee_form.xml index f8000de26f..af0da7a19e 100644 --- a/view/employee_form.xml +++ b/view/employee_form.xml @@ -6,4 +6,8 @@ this repository contains the full copyright notices and license terms. -->