openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #07432
[Merge] lp:~initos.com/openerp-hr/7.0-change-public-holiday into lp:openerp-hr
Nikolina Nikolova Todorova has proposed merging lp:~initos.com/openerp-hr/7.0-change-public-holiday into lp:openerp-hr.
Requested reviews:
HR Core Editors (hr-core-editors)
For more details, see:
https://code.launchpad.net/~initos.com/openerp-hr/7.0-change-public-holiday/+merge/224610
In the module hr_public_holidays were added field 'country_id' in the 'hr.holidays.public', and field 'state_ids' in the 'hr.holidays.public.line'.
The reason is that we can have multi country companies and each country has different holidays as well as in some countries there are different holidays for each state.
By adding these fields we can configure different list of holidays for every country, and add list of states to every holiday.
--
https://code.launchpad.net/~initos.com/openerp-hr/7.0-change-public-holiday/+merge/224610
Your team HR Core Editors is requested to review the proposed merge of lp:~initos.com/openerp-hr/7.0-change-public-holiday into lp:openerp-hr.
=== modified file 'hr_public_holidays/hr_public_holidays.py'
--- hr_public_holidays/hr_public_holidays.py 2013-09-23 13:55:07 +0000
+++ hr_public_holidays/hr_public_holidays.py 2014-06-26 12:50:56 +0000
@@ -3,6 +3,8 @@
#
# Copyright (C) 2011,2013 Michael Telahun Makonnen <mmakonnen@xxxxxxxxx>.
# All Rights Reserved.
+# Copyright (C) 2014 initOS GmbH & Co. KG (<http://www.initos.com>).
+# Author Nikolina Todorova <nikolina.todorova@xxxxxxxxxx>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
@@ -32,13 +34,14 @@
_columns = {
'year': fields.char("calendar Year", required=True),
'line_ids': fields.one2many('hr.holidays.public.line', 'holidays_id', 'Holiday Dates'),
+ 'country_id': fields.many2one('res.country', 'Country'),
}
_rec_name = 'year'
_order = "year"
_sql_constraints = [
- ('year_unique', 'UNIQUE(year)', _('Duplicate year!')),
+ ('year_unique', 'UNIQUE(year,country_id)', _('Duplicate year and country!')),
]
def is_public_holiday(self, cr, uid, dt, context=None):
@@ -78,6 +81,7 @@
'date': fields.date('Date', required=True),
'holidays_id': fields.many2one('hr.holidays.public', 'Holiday Calendar Year'),
'variable': fields.boolean('Date may change'),
+ 'state_ids': fields.many2many('res.country.state', 'hr_holiday_public_state_rel', 'line_id', 'state_id', 'Related states')
}
_order = "date, name desc"
=== modified file 'hr_public_holidays/hr_public_holidays_view.xml'
--- hr_public_holidays/hr_public_holidays_view.xml 2013-08-12 09:07:07 +0000
+++ hr_public_holidays/hr_public_holidays_view.xml 2014-06-26 12:50:56 +0000
@@ -8,6 +8,7 @@
<field name="arch" type="xml">
<tree string="Public Holidays">
<field name="year"/>
+ <field name="country_id"/>
</tree>
</field>
</record>
@@ -19,6 +20,7 @@
<form string="Public Holidays">
<group>
<field name="year"/>
+ <field name="country_id"/>
</group>
<newline/>
<group string="Public Holidays" colspan="4" col="1">
@@ -32,14 +34,28 @@
<field name="name">hr.holidays.public.line.tree</field>
<field name="model">hr.holidays.public.line</field>
<field name="arch" type="xml">
- <tree string="Public Holidays" editable="top">
+ <tree string="Public Holidays">
<field name="date"/>
<field name="name"/>
+ <field name="state_ids"/>
<field name="variable"/>
</tree>
</field>
</record>
+ <record id="view_public_holiday_line_form" model="ir.ui.view">
+ <field name="name">hr.holidays.public.line.form</field>
+ <field name="model">hr.holidays.public.line</field>
+ <field name="arch" type="xml">
+ <form string="Public Holidays">
+ <field name="date"/>
+ <field name="name"/>
+ <field name="holidays_id" invisible="1"/>
+ <field name="state_ids" domain = "[('country_id','=',parent.country_id)]"/>
+ </form>
+ </field>
+ </record>
+
<record id="open_public_holidays_view" model="ir.actions.act_window">
<field name="name">Public Holidays</field>
<field name="res_model">hr.holidays.public</field>
Follow ups