Khushboo Bhatt(openerp) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-hr_resource-jam-add_resource_management-kbh
 into lp:~openerp-dev/openobject-addons/trunk-hr_resource-jam.

Requested reviews:
  Jigar Amin  (OpenERP) (jam-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-hr_resource-jam-add_resource_management-kbh/+merge/84568

hello,
 
 - create new module "hr_resource_management".
 - create one Scheduler to check for the Attendance Rules.

thanks.
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-hr_resource-jam-add_resource_management-kbh/+merge/84568
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-hr_resource-jam.
=== added directory 'hr_resource_management'
=== added file 'hr_resource_management/__init__.py'
--- hr_resource_management/__init__.py	1970-01-01 00:00:00 +0000
+++ hr_resource_management/__init__.py	2011-12-06 06:28:26 +0000
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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 the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import resource_attendance_rule
+
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'hr_resource_management/__openerp__.py'
--- hr_resource_management/__openerp__.py	1970-01-01 00:00:00 +0000
+++ hr_resource_management/__openerp__.py	2011-12-06 06:28:26 +0000
@@ -0,0 +1,49 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+#    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 the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+{
+    "name" : "Resource Attendance Rule",
+    "version" : "1.1",
+    "author" : "OpenERP SA",
+    "category" : "Hidden",
+    "website" : "http://www.openerp.com";,
+    "description": """
+Module for resource attendance rule management.
+===============================
+
+A HR resource rule management represent something that can be automate
+HR process to undertime or overtime of the employee based on predefined rule.
+This module helps admin to define attendance rules on resource.
+
+    """,
+    'author': 'OpenERP SA',
+    'website': 'http://www.openerp.com',
+    'depends': ['hr_timesheet_sheet', 'hr_holidays'],
+    'init_xml': [
+        'hr_resource_management_data.xml'
+    ],
+    'update_xml': [
+       'resource_attendance_rule.xml'
+    ],
+    'installable': True,
+    'active': False,
+
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== added file 'hr_resource_management/hr_resource_management_data.xml'
--- hr_resource_management/hr_resource_management_data.xml	1970-01-01 00:00:00 +0000
+++ hr_resource_management/hr_resource_management_data.xml	2011-12-06 06:28:26 +0000
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data noupdate="1">
+
+        <record id="ir_cron_crm_action" model="ir.cron">
+            <field name="name">Check Resource Attendance Rules</field>
+            <field name="interval_number">4</field>
+            <field name="interval_type">hours</field>
+            <field name="numbercall">-1</field>
+            <field eval="False" name="doall"/>
+            <field eval="'resource.attendance.rule'" name="model"/>
+            <field eval="'_check'" name="function"/>
+            <field eval="'()'" name="args"/>
+        </record>
+
+    </data>
+</openerp>

=== added file 'hr_resource_management/resource_attendance_rule.py'
--- hr_resource_management/resource_attendance_rule.py	1970-01-01 00:00:00 +0000
+++ hr_resource_management/resource_attendance_rule.py	2011-12-06 06:28:26 +0000
@@ -0,0 +1,52 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+#    OpenERP, Open Source Management Solution
+#    Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
+#
+#    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 the Free Software Foundation, either version 3 of the
+#    License, or (at your option) any later version.
+#
+#    This program is distributed in the hope that it will be useful,
+#    but WITHOUT ANY WARRANTY; without even the implied warranty of
+#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#    GNU Affero General Public License for more details.
+#
+#    You should have received a copy of the GNU Affero General Public License
+#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+from osv import osv
+from osv import fields
+
+
+class resource_attendance_rule(osv.osv):
+    _name = "resource.attendance.rule"
+    _description = "Resource Attendance Rule"
+    _columns = {
+        'name' : fields.char("Short Description", size=64, required=True),
+        'rule_type' : fields.selection([('attendance','Resource Attendance')], 'Rule Type',required=True),
+        'operator' : fields.selection([('<','Less Than(<)'),('>','Greater Than(>)'),('=','Equal To(=)'),('<=','Less Than Equal To(<=)'),('>=','Greater Than Equal To(>=)')], 'Resource Type', required=True),
+        'uom' : fields.selection([('hours','Hours'),('minutes','Minutes')],'Unit of Measure',required=True),
+        'val' : fields.float('Value', digits=(16, 2)),
+        'server_action_id' : fields.many2one('ir.actions.server', 'Server Action'),
+    }
+
+    def _check(self, cr, uid, automatic=False, use_new_cursor=False, \
+                       context=None):
+        """
+        This Function is call by scheduler.
+        """
+        rule_pool = self.pool.get('resource.attendance.rule')
+        return True
+
+
+class resource_reosurce(osv.osv):
+    _name = "resource.resource"
+    _inherit = "resource.resource"
+    _description = "Resource Detail"
+    _columns = {
+        'rule_ids': fields.many2many('resource.attendance.rule', "resource_rule_rel",'resource_id', "rule_id", 'Resource Rules'),
+    }
\ No newline at end of file

=== added file 'hr_resource_management/resource_attendance_rule.xml'
--- hr_resource_management/resource_attendance_rule.xml	1970-01-01 00:00:00 +0000
+++ hr_resource_management/resource_attendance_rule.xml	2011-12-06 06:28:26 +0000
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+    <data>
+        <record id="view_resource_resource_form_inherit" model="ir.ui.view">
+            <field name="name">resource.attendance.form.inherit.rule</field>
+            <field name="model">resource.resource</field>
+            <field name="inherit_id" ref="resource.resource_resource_form"/>
+            <field name="arch" type="xml">
+                <xpath expr="//field[@name='time_efficiency']" position="after">
+                   <group colspan="6" groups="base.group_extended" >
+                        <separator string="Resource Attendance Rules" colspan="6"/>
+                        <field name="rule_ids" nolabel="1" colspan="8" height="500">
+                            <tree string="Resource Attendance Rules">
+                                <field name="name"/>
+                                <field name="rule_type"/>
+                                <field name="uom" />
+                                <field name="operator"/>
+                                <field name="val"/>
+                            </tree>
+                            <form string="Resource Attendance Rule">
+                                <field name="name" colspan="4" required="1"/>
+                                <separator string="Condition" colspan="4"/>
+                                <newline/>
+                                <field name="rule_type" colspan="2"/>
+                                <field name="uom" colspan="2"/>
+                                <field name="operator" colspan="2" required="1"/>
+                                <field name="val" colspan="2"/>
+                                <separator string="Action" colspan="4"/>
+                                <field name="server_action_id" colspan="4"/>
+                            </form>
+                        </field>
+                   </group>
+                </xpath>
+            </field>
+        </record>
+
+
+       <menuitem id="menu_hr_resource1" name="Resources" parent="hr.menu_hr_configuration" sequence="4" />
+
+       <menuitem id="menu_resource_rule_config"
+                 name="Resource"
+                 action="resource.action_resource_resource_tree"
+                 parent="menu_hr_resource1"
+                 groups="base.group_extended"/>
+       <menuitem id="menu_resource_cal_config"
+                 name="Resource calendar"
+                 action="resource.action_resource_calendar_form"
+                 parent="menu_hr_resource1"
+                 groups="base.group_extended"/>
+       <menuitem id="menu_resource_cal_leave_config"
+                 name="Resource calendar Leaves"
+                 action="resource.action_resource_calendar_leave_tree"
+                 parent="menu_hr_resource1"
+                 groups="base.group_extended"/>
+
+    </data>
+</openerp>

=== modified file 'resource/resource.py'
--- resource/resource.py	2011-11-11 13:46:12 +0000
+++ resource/resource.py	2011-12-06 06:28:26 +0000
@@ -53,7 +53,7 @@
         for working_day in resource_calendar_id.attendance_ids:
             if (int(working_day.dayofweek) + 1) == day.isoweekday():
                 res += working_day.hour_to - working_day.hour_from
-        return res 
+        return res
 
     def _get_leaves(self, cr, uid, id, resource):
         resource_cal_leaves = self.pool.get('resource.calendar.leaves')
@@ -211,7 +211,7 @@
 class resource_calendar_attendance(osv.osv):
     _name = "resource.calendar.attendance"
     _description = "Work Detail"
-    
+
     _columns = {
         'name' : fields.char("Name", size=64, required=True),
         'dayofweek': fields.selection([('0','Monday'),('1','Tuesday'),('2','Wednesday'),('3','Thursday'),('4','Friday'),('5','Saturday'),('6','Sunday')], 'Day of week', required=True),
@@ -220,9 +220,9 @@
         'hour_to' : fields.float("Work to", size=8, required=True, help="Working time will end at"),
         'calendar_id' : fields.many2one("resource.calendar", "Resource's Calendar", required=True),
     }
-    
+
     _order = 'dayofweek, hour_from'
-    
+
     _defaults = {
         'dayofweek' : '0'
     }
@@ -256,7 +256,7 @@
         'company_id': lambda self, cr, uid, context: self.pool.get('res.company')._company_default_get(cr, uid, 'resource.resource', context=context)
     }
 
-    
+
     def copy(self, cr, uid, id, default=None, context=None):
         if default is None:
             default = {}
@@ -321,7 +321,7 @@
         """
         if not calendar_id:
             # Calendar is not specified: working days: 24/7
-            return [('fri', '8:0-12:0','13:0-17:0'), ('thu', '8:0-12:0','13:0-17:0'), ('wed', '8:0-12:0','13:0-17:0'), 
+            return [('fri', '8:0-12:0','13:0-17:0'), ('thu', '8:0-12:0','13:0-17:0'), ('wed', '8:0-12:0','13:0-17:0'),
                    ('mon', '8:0-12:0','13:0-17:0'), ('tue', '8:0-12:0','13:0-17:0')]
         resource_attendance_pool = self.pool.get('resource.calendar.attendance')
         time_range = "8:00-8:00"

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to