From 5d9d5562a2ec32cc32664305ecdd508d12419262 Mon Sep 17 00:00:00 2001 From: "nch@tinyerp.com" <> Date: Tue, 29 Dec 2009 18:35:00 +0530 Subject: [PATCH 001/196] [ADD,FIX]:Group by customer and shop in sale order and a small bug in stock/product.py bzr revid: nch@tinyerp.com-20091229130500-b3crhavxmrkmni4q --- addons/sale/sale_view.xml | 52 +++++++++++++++++++++++++++++++++++++-- addons/stock/product.py | 2 ++ 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/addons/sale/sale_view.xml b/addons/sale/sale_view.xml index a7535336982..83c847a4ef2 100644 --- a/addons/sale/sale_view.xml +++ b/addons/sale/sale_view.xml @@ -131,7 +131,7 @@ on_change="product_id_change(parent.pricelist_id,product_id,product_uom_qty,product_uom,product_uos_qty,product_uos,name,parent.partner_id, 'lang' in context and context['lang'], False, parent.date_order, product_packaging, parent.fiscal_position)" domain="[('product_id','=',product_id)]" groups="base.group_extended"/> - + @@ -264,6 +264,54 @@ + + + sale.order.gp.tree + sale.order + tree + + + + + + + + + + + + + + + Sale Order Group By Customer + ir.actions.act_window + sale.order + {'group_by':'partner_id'} + tree + form,graph + + + + + Sale Order Group By Shop + ir.actions.act_window + sale.order + {'group_by':'shop_id'} + tree + form,graph + + + + + + + All Sales Order ir.actions.act_window @@ -415,7 +463,7 @@ - + diff --git a/addons/stock/product.py b/addons/stock/product.py index 5c42cdbdab2..544cc1b2789 100644 --- a/addons/stock/product.py +++ b/addons/stock/product.py @@ -175,6 +175,8 @@ class product_product(osv.osv): } def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): res = super(product_product,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu) + if context == None: + context = {} if ('location' in context) and context['location']: location_info = self.pool.get('stock.location').browse(cr, uid, context['location']) fields=res.get('fields',{}) From 90f676823b0514aa3e4ba3b1494558e98bcc98cd Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Mon, 11 Jan 2010 16:05:46 +0530 Subject: [PATCH 002/196] [FIX] Base_report_crearor :Models with _inherits made working lp bug: https://launchpad.net/bugs/503894 fixed bzr revid: jvo@tinyerp.com-20100111103546-9n5nikemxlvv9jb4 --- .../base_report_creator.py | 32 ++++++++++++++++--- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/addons/base_report_creator/base_report_creator.py b/addons/base_report_creator/base_report_creator.py index b4995435d23..34f3b549dae 100644 --- a/addons/base_report_creator/base_report_creator.py +++ b/addons/base_report_creator/base_report_creator.py @@ -226,9 +226,18 @@ class report_creator(osv.osv): from_list = [] where_list = [] filter_list = [] + +# def _add_inherits(obj): +# pool_model = self.pool.get(obj) +# if not model_dict.get(obj,False): +# model_dict[obj] = pool_model._table +# for record in pool_model._inherits.keys(): +# _add_inherits(record) + for model in models: model_dict[model.model] = self.pool.get(model.model)._table - +# _add_inherits(model.model) + model_list = model_dict.keys() reference_model_dict = {} for model in model_dict: @@ -237,10 +246,22 @@ class report_creator(osv.osv): rest_list.remove(model) model_pool = self.pool.get(model) fields_get = model_pool.fields_get(cr,uid) + model_columns = {} + + def _get_inherit_fields(obj): + pool_model = self.pool.get(obj) + #Adding the columns of the model itself + model_columns.update(pool_model._columns) + #Adding the columns of its _inherits + for record in pool_model._inherits.keys(): + _get_inherit_fields(record) + + _get_inherit_fields(model) + fields_filter = dict(filter(lambda x:x[1].get('relation',False) and x[1].get('relation') in rest_list and x[1].get('type')=='many2one' - and not (isinstance(model_pool._columns[x[0]],fields.function) or isinstance(model_pool._columns[x[0]],fields.related)), fields_get.items())) + and not (isinstance(model_columns[x[0]],fields.function) or isinstance(model_columns[x[0]],fields.related)), fields_get.items())) if fields_filter: model in model_list and model_list.remove(model) model_count = reference_model_dict.get(model,False) @@ -255,9 +276,9 @@ class report_creator(osv.osv): reference_model_dict[v.get('relation')] = relation_count+1 else: reference_model_dict[v.get('relation')]=1 - - str_where = model_dict.get(model)+"."+ k + "=" + model_dict.get(v.get('relation'))+'.id' - where_list.append(str_where) + if k in self.pool.get(model)._columns: + str_where = model_dict.get(model)+"."+ k + "=" + model_dict.get(v.get('relation'))+'.id' + where_list.append(str_where) if reference_model_dict: self.model_set_id = model_dict.get(reference_model_dict.keys()[reference_model_dict.values().index(min(reference_model_dict.values()))]) if model_list and not len(model_dict.keys()) == 1: @@ -280,6 +301,7 @@ class report_creator(osv.osv): if where_list: + where_list = list(set(where_list)) ret_str+="\n where \n"+" and\n".join(where_list) ret_str = ret_str.strip() if filter_list: From a4ca4cf7b4dce3f22cad1caf948b51375a3a0fbd Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Mon, 11 Jan 2010 19:05:13 +0530 Subject: [PATCH 003/196] [FIX] Stock : While removing the picking,moves should not call picking's write() lp bug: https://launchpad.net/bugs/499120 fixed bzr revid: jvo@tinyerp.com-20100111133513-0vcvrqelt4fqjdta --- addons/stock/stock.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/addons/stock/stock.py b/addons/stock/stock.py index f3fbfe15950..1460957c4f9 100644 --- a/addons/stock/stock.py +++ b/addons/stock/stock.py @@ -791,6 +791,7 @@ class stock_picking(osv.osv): raise osv.except_osv(_('Error'), _('You cannot remove the picking which is in %s state !')%(pick.state,)) elif pick.state in ['confirmed','assigned']: ids2 = [move.id for move in pick.move_lines] + context.update({'call_unlink':True}) self.pool.get('stock.move').action_cancel(cr, uid, ids2, context) else: continue @@ -1213,14 +1214,14 @@ class stock_move(osv.osv): pickings[move.picking_id.id] = True if move.move_dest_id and move.move_dest_id.state == 'waiting': self.write(cr, uid, [move.move_dest_id.id], {'state': 'assigned'}) - if move.move_dest_id.picking_id: + if context.get('call_unlink',False) and move.move_dest_id.picking_id: wf_service = netsvc.LocalService("workflow") wf_service.trg_write(uid, 'stock.picking', move.move_dest_id.picking_id.id, cr) self.write(cr, uid, ids, {'state': 'cancel', 'move_dest_id': False}) - - for pick in self.pool.get('stock.picking').browse(cr, uid, pickings.keys()): - if all(move.state == 'cancel' for move in pick.move_lines): - self.pool.get('stock.picking').write(cr, uid, [pick.id], {'state': 'cancel'}) + if not context.get('call_unlink',False): + for pick in self.pool.get('stock.picking').browse(cr, uid, pickings.keys()): + if all(move.state == 'cancel' for move in pick.move_lines): + self.pool.get('stock.picking').write(cr, uid, [pick.id], {'state': 'cancel'}) wf_service = netsvc.LocalService("workflow") for id in ids: From 2036a7c651f00c88ea388e80756b7a10d79c531b Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Mon, 11 Jan 2010 19:45:30 +0530 Subject: [PATCH 004/196] [FIX] Purchase : Purchase/user was missing account.tax access rights lp bug: https://launchpad.net/bugs/503741 fixed bzr revid: jvo@tinyerp.com-20100111141530-0666oazti2dzju3x --- addons/purchase/security/ir.model.access.csv | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/purchase/security/ir.model.access.csv b/addons/purchase/security/ir.model.access.csv index 68be681fdf5..5fb968e6ce1 100644 --- a/addons/purchase/security/ir.model.access.csv +++ b/addons/purchase/security/ir.model.access.csv @@ -7,3 +7,4 @@ "access_stock_move_purchase_user","stock.move purchase_user","stock.model_stock_move","purchase.group_purchase_user",1,1,1,1 "access_purchase_order_stock_worker","purchase.order stock_worker","model_purchase_order","stock.group_stock_user",1,0,0,0 "access_purchase_order_line_stock_worker","purchase.order.line stock_worker","model_purchase_order_line","stock.group_stock_user",1,0,0,0 +"access_account_tax_purchase_user","account.tax purchase_user","account.model_account_tax","purchase.group_purchase_user",1,0,0,0 \ No newline at end of file From 926d2b9de8a089460b4d8c2693cc08db7cf5eba9 Mon Sep 17 00:00:00 2001 From: "Rvo (Open ERP)" Date: Tue, 12 Jan 2010 14:50:13 +0530 Subject: [PATCH 005/196] Changes in project/project.py and hr/hr_view.xml bzr revid: rvo@tinyerp.co.in-20100112092013-g0nq8vhxssg1ha1n --- addons/hr/hr_view.xml | 9 ++++++- addons/project/project.py | 53 ++++++++------------------------------- 2 files changed, 19 insertions(+), 43 deletions(-) diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml index dd8a2d3a3fd..45d55d8b785 100644 --- a/addons/hr/hr_view.xml +++ b/addons/hr/hr_view.xml @@ -155,7 +155,7 @@ - + + + + 38 Hours/Week + + + + Fabien Pinckaers + + + + + + + Monday morning + 0 + 08 + 12 + + + + Monday evening + 0 + 13 + 18 + + + + Tuesday morning + 1 + 08 + 12 + + + + Tuesday evening + 1 + 13 + 18 + + + + Wednesday morning + 2 + 08 + 12 + + + + Wednesday evening + 2 + 13 + 18 + + + + Thursday morning + 3 + 08 + 12 + + + + Thursday evening + 13 + 18 + 3 + + + + Friday morning + 4 + 08 + 12 + + + + Friday evening + 4 + 13 + 18 + + + + + diff --git a/addons/resource/hr_department.py b/addons/resource/hr_department.py new file mode 100755 index 00000000000..907bc55a435 --- /dev/null +++ b/addons/resource/hr_department.py @@ -0,0 +1,153 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). +# +# 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 . +# +############################################################################## + +from osv import fields,osv +import tools + +class hr_department(osv.osv): + _name = "hr.department" + _columns = { + 'name': fields.char('Department Name', size=64, required=True), + 'company_id': fields.many2one('res.company', 'Company', select=True, required=True), + 'parent_id': fields.many2one('hr.department', 'Parent Department', select=True), + 'child_ids': fields.one2many('hr.department', 'parent_id', 'Child Departments'), + 'note': fields.text('Note'), + 'manager_id': fields.many2one('res.users', 'Manager', required=True), + 'member_ids': fields.many2many('res.users', 'hr_department_user_rel', 'department_id', 'user_id', 'Members'), + } + def _get_members(self,cr, uid, context={}): + mids = self.search(cr, uid, [('manager_id','=',uid)]) + result = {uid:1} + for m in self.browse(cr, uid, mids, context): + for user in m.member_ids: + result[user.id] = 1 + return result.keys() + def _check_recursion(self, cr, uid, ids): + level = 100 + while len(ids): + cr.execute('select distinct parent_id from hr_department where id in ('+','.join(map(str, ids))+')') + ids = filter(None, map(lambda x:x[0], cr.fetchall())) + if not level: + return False + level -= 1 + return True + + _constraints = [ + (_check_recursion, 'Error! You can not create recursive departments.', ['parent_id']) + ] + +hr_department() + + +class ir_action_window(osv.osv): + _inherit = 'ir.actions.act_window' + + def read(self, cr, uid, ids, fields=None, context=None, + load='_classic_read'): + select = ids + if isinstance(ids, (int, long)): + select = [ids] + res = super(ir_action_window, self).read(cr, uid, select, fields=fields, + context=context, load=load) + for r in res: + mystring = 'department_users_get()' + if mystring in (r.get('domain', '[]') or ''): + r['domain'] = r['domain'].replace(mystring, str( + self.pool.get('hr.department')._get_members(cr, uid))) + if isinstance(ids, (int, long)): + if res: + return res[0] + else: + return False + return res + +ir_action_window() + +class res_users(osv.osv): + _inherit = 'res.users' + _description = 'res.users' + + def _parent_compute(self, cr, uid, ids, name, args, context={}): + result = {} + obj_dept = self.pool.get('hr.department') + for user_id in ids: + ids_dept = obj_dept.search(cr, uid, [('member_ids', 'in', [user_id])]) + parent_ids = [] + if ids_dept: + data_dept = obj_dept.read(cr, uid, ids_dept, ['manager_id']) + parent_ids = map(lambda x: x['manager_id'][0], data_dept) + result[user_id] = parent_ids + return result + + def _parent_search(self, cr, uid, obj, name, args): + parent = [] + for arg in args: + if arg[0] == 'parent_id': + parent = arg[2] + child_ids = self._child_compute(cr, uid, parent,name, args, {}) + if not child_ids: + return [('id', 'in', [0])] + return [('id', 'in', child_ids.get(uid,[]))] + + def _child_compute(self, cr, uid, ids, name, args, context={}): + obj_dept = self.pool.get('hr.department') + obj_user = self.pool.get('res.users') + result = {} + for manager_id in ids: + child_ids = [] + mgnt_dept_ids = obj_dept.search(cr, uid, [('manager_id', '=', manager_id)]) + ids_dept = obj_dept.search(cr, uid, [('id', 'child_of', mgnt_dept_ids)]) + if ids_dept: + data_dept = obj_dept.read(cr, uid, ids_dept, ['member_ids']) + childs = map(lambda x: x['member_ids'], data_dept) + childs = tools.flatten(childs) + childs = obj_user.search(cr, uid, [('id','in',childs),('active','=',True)]) + if manager_id in childs: + childs.remove(manager_id) + + child_ids.extend(tools.flatten(childs)) + set = {} + map(set.__setitem__, child_ids, []) + child_ids = set.keys() + else: + child_ids = [] + result[manager_id] = child_ids + return result + + def _child_search(self, cr, uid, obj, name, args): + parent = [] + for arg in args: + if arg[0] == 'child_ids': + parent = arg[2] + child_ids = self._child_compute(cr, uid, parent,name, args, {}) + if not child_ids: + return [('id', 'in', [0])] + return [('id', 'in', child_ids.get(uid,[]))] + + _columns = { + 'parent_id': fields.function(_parent_compute, relation='res.users',fnct_search=_parent_search, method=True, string="Managers", type='many2many'), + 'child_ids': fields.function(_child_compute, relation='res.users', fnct_search=_child_search,method=True, string="Subordinates", type='many2many'), + } + + +res_users() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/resource/hr_department_demo.xml b/addons/resource/hr_department_demo.xml new file mode 100755 index 00000000000..c7ea68f1dc3 --- /dev/null +++ b/addons/resource/hr_department_demo.xml @@ -0,0 +1,63 @@ + + + + + + Management + + + + + Administration + + + + + + + Technical department + + + + + + + IT + + + + + + + Marketing + + + + + + + Sales + + + + + + + Sales Europe + + + + + + + Sales America + + + + + + + + + + diff --git a/addons/resource/hr_department_view.xml b/addons/resource/hr_department_view.xml new file mode 100755 index 00000000000..fe65d988237 --- /dev/null +++ b/addons/resource/hr_department_view.xml @@ -0,0 +1,79 @@ + + + + + + + hr.department.form + hr.department + form + +
+ + + + + + + + + + + + + + +
+ + hr.department.tree + hr.department + tree + child_ids + + + + + + + + + + Departments + hr.department + tree + [('parent_id','=',False)] + + + + + Departments + hr.department + form + + + + + + + res.users.form + form + res.users + + + + + + + + + + + + + +
+
diff --git a/addons/resource/hr_view.xml b/addons/resource/hr_view.xml new file mode 100755 index 00000000000..abf3c5f023f --- /dev/null +++ b/addons/resource/hr_view.xml @@ -0,0 +1,296 @@ + + + + + + + + + + hr.employee.form + hr.employee + form + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + hr.employee.tree + hr.employee + tree + child_ids + + + + + + + + + + + + Employees Structure + hr.employee + tree + tree,form + + [('parent_id','=',False)] + + + + Employees + hr.employee + form + tree,form + + + + + + + + All Employees + hr.employee + form + tree,form + [] + + + + + + hr.employee.tree + hr.employee + tree + child_ids + + + + + + + + + + + Employee Hierarchy + ir.actions.act_window + hr.employee + [('id','in',active_ids)] + tree + + + + + + + Employees Hierarchy + + + + + + + + + resource.calendar.form + resource.calendar + form + +
+ + + + + + +
+ + Working Time Categories + resource.calendar + form + + + + + + resource.calendar.week.tree + resource.calendar.week + tree + + + + + + + + + + + resource.calendar.week.form + resource.calendar.week + form + +
+ + + + + + + +
+ + + + + hr.employee.category.form + hr.employee.category + form + +
+ + + + +
+ + hr.employee.category.list + hr.employee.category + tree + + + + + + + + + + hr.employee.category.tree + hr.employee.category + tree + child_ids + + + + + + + + Categories of Employee + hr.employee.category + form + tree,form + + + + + Categories structure + hr.employee.category + tree + + [('parent_id','=',False)] + + + + Employees + ir.actions.act_window + hr.employee + form + tree,form + [('category_id','child_of',[active_id])] + {'category_id':active_id} + + + + + + Employees by Categories + + + + + + +
+
diff --git a/addons/resource/resource.py b/addons/resource/resource.py new file mode 100755 index 00000000000..2d225527f0e --- /dev/null +++ b/addons/resource/resource.py @@ -0,0 +1,195 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). +# +# 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 . +# +############################################################################## +import mx.DateTime +import time +import math +from osv import fields, osv +from tools.translate import _ + +class resource_calendar(osv.osv): + _name = "resource.calendar" + _description = "Resource Calendar" + _columns = { + 'name' : fields.char("Name", size=64, required=True), + 'company_id' : fields.many2one('res.company', 'Company', required=True), + 'week_id' : fields.one2many('resource.calendar.week', 'calendar_id', 'Working Time'), + 'manager' : fields.many2one('res.users', 'Workgroup manager'), + } + _defaults = { + 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'resource.calendar', c) + } + def interval_min_get(self, cr, uid, id, dt_from, hours , resource=0): + dt_leave = [] + if not id: + return [(dt_from-mx.DateTime.RelativeDateTime(hours=int(hours)*3), dt_from)] + if resource: + resource_leave_ids = self.pool.get('resource.calendar.leaves').search(cr,uid,[('resource_id','=',resource)]) + if resource_leave_ids: + res_leaves = self.pool.get('resource.calendar.leaves').read(cr,uid,resource_leave_ids,['date_from','date_to']) + print 'Leave Details',res_leaves + for i in range(len(res_leaves)): + dtf = mx.DateTime.strptime(res_leaves[i]['date_from'],'%Y-%m-%d %H:%M:%S') + dtt = mx.DateTime.strptime(res_leaves[i]['date_to'],'%Y-%m-%d %H:%M:%S') + leave_days = ((dtt - dtf).days) + 1 + print 'No Of Leaves:::::::::',int(leave_days) + for x in range(int(leave_days)): + dt_leave.append((dtf + mx.DateTime.RelativeDateTime(days=x)).strftime('%Y-%m-%d')) + dt_leave.sort() + print 'Sorted Leave Dates::::',dt_leave + todo = hours + cycle = 0 + result = [] + maxrecur = 100 + current_hour = dt_from.hour + while (todo>0) and maxrecur: + cr.execute("select hour_from,hour_to from resource_calendar_week where dayofweek='%s' and calendar_id=%s order by hour_from", (dt_from.day_of_week,id)) + for (hour_from,hour_to) in cr.fetchall(): + if (hour_to>current_hour) and (todo>0): + m = max(hour_from, current_hour) + if (hour_to-m)>todo: + hour_to = m+todo + d1 = mx.DateTime.DateTime(dt_from.year,dt_from.month,dt_from.day,int(math.floor(m)),int((m%1) * 60)) + d2 = mx.DateTime.DateTime(dt_from.year,dt_from.month,dt_from.day,int(math.floor(hour_to)),int((hour_to%1) * 60)) + dt1 = d1.strftime('%Y-%m-%d') + dt2 = d2.strftime('%Y-%m-%d') + print 'Date 1',dt1 + print 'Date 2',dt2 + for i in range(len(dt_leave)): + if dt1 == dt_leave[i]: + print 'Leave::::::::' + dt_from += mx.DateTime.RelativeDateTime(days=1) + d1 = mx.DateTime.DateTime(dt_from.year,dt_from.month,dt_from.day,int(math.floor(m)),int((m%1) * 60)) + d2 = mx.DateTime.DateTime(dt_from.year,dt_from.month,dt_from.day,int(math.floor(hour_to)),int((hour_to%1) * 60)) + dt1 = d1.strftime('%Y-%m-%d') + dt2 = d2.strftime('%Y-%m-%d') + result.append((d1, d2)) + current_hour = hour_to + todo -= (hour_to - m) + dt_from += mx.DateTime.RelativeDateTime(days=1) + current_hour = 0 + maxrecur -= 1 + return result + + def interval_get(self, cr, uid, id, dt_from, hours, resource=0, byday=True): + dt_leave = [] + if not id: + return [(dt_from,dt_from+mx.DateTime.RelativeDateTime(hours=int(hours)*3))] + if resource: + resource_leave_ids = self.pool.get('resource.calendar.leaves').search(cr,uid,[('resource_id','=',resource)]) + if resource_leave_ids: + res_leaves = self.pool.get('resource.calendar.leaves').read(cr,uid,resource_leave_ids,['date_from','date_to']) + print 'Leave Details',res_leaves + for i in range(len(res_leaves)): + dtf = mx.DateTime.strptime(res_leaves[i]['date_from'],'%Y-%m-%d %H:%M:%S') + dtt = mx.DateTime.strptime(res_leaves[i]['date_to'],'%Y-%m-%d %H:%M:%S') + no = dtt - dtf + leave_days = no.days + 1 + print 'No Of Leaves:::::::::',int(leave_days) + for x in range(int(leave_days)): + dt_leave.append((dtf + mx.DateTime.RelativeDateTime(days=x)).strftime('%Y-%m-%d')) + dt_leave.sort() + print 'Sorted Leave Dates::::',dt_leave + todo = hours + cycle = 0 + result = [] + maxrecur = 100 + current_hour = dt_from.hour + while (todo>0) and maxrecur: + cr.execute("select hour_from,hour_to from resource_calendar_week where dayofweek='%s' and calendar_id=%s order by hour_from", (dt_from.day_of_week,id)) + for (hour_from,hour_to) in cr.fetchall(): + if (hour_to>current_hour) and (todo>0): + m = max(hour_from, current_hour) + if (hour_to-m)>todo: + hour_to = m+todo + d1 = mx.DateTime.DateTime(dt_from.year,dt_from.month,dt_from.day,int(math.floor(m)),int((m%1) * 60)) + d2 = mx.DateTime.DateTime(dt_from.year,dt_from.month,dt_from.day,int(math.floor(hour_to)),int((hour_to%1) * 60)) + dt1 = d1.strftime('%Y-%m-%d') + dt2 = d2.strftime('%Y-%m-%d') + print 'Date 1',dt1 + print 'Date 2',dt2 + for i in range(len(dt_leave)): + if dt1 == dt_leave[i]: + print 'Leave::::::::' + dt_from += mx.DateTime.RelativeDateTime(days=1) + d1 = mx.DateTime.DateTime(dt_from.year,dt_from.month,dt_from.day,int(math.floor(m)),int((m%1) * 60)) + d2 = mx.DateTime.DateTime(dt_from.year,dt_from.month,dt_from.day,int(math.floor(hour_to)),int((hour_to%1) * 60)) + dt1 = d1.strftime('%Y-%m-%d') + dt2 = d2.strftime('%Y-%m-%d') + result.append((d1, d2)) + current_hour = hour_to + todo -= (hour_to - m) + dt_from += mx.DateTime.RelativeDateTime(days=1) + current_hour = 0 + maxrecur -= 1 + return result + +resource_calendar() + +class resource_calendar_week(osv.osv): + _name = "resource.calendar.week" + _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'), + 'date_from' : fields.date('Starting date'), + 'hour_from' : fields.float('Work from', size=8, required=True), + 'hour_to' : fields.float("Work to", size=8, required=True), + 'calendar_id' : fields.many2one("resource.calendar", "Resource's Calendar", required=True), + } + _order = 'dayofweek, hour_from' +resource_calendar_week() + +class resource_resource(osv.osv): + _name = "resource.resource" + _description = "Resource Detail" + _columns = { + 'name' : fields.char("Name", size=64, required=True), + 'code': fields.char('Code', size=16), + 'active' : fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the resource record without removing it."), + 'company_id' : fields.many2one('res.company', 'Company', required=True), + 'resource_type': fields.selection([('user','Human'),('material','Material')], 'Resource Type', required=True), + 'user_id' : fields.many2one('res.users', 'User'), + 'time_efficiency' : fields.float('Efficiency factor', size=8, help="This field depict the efficency of the ressource to complete tasks. e.g ressource put alone on a phase of 5 days with 5 tasks assigned to him, will show a load of 100% for this phase by default, but if we put a efficency of 200%, then his load will only be 50%."), + 'calendar_id' : fields.many2one("resource.calendar", "Working time", required=True, help="Define the schedule of resource"), + } + _defaults = { + 'resource_type' : lambda *a: 'user', + 'time_efficiency' : lambda *a: 1, + 'active' : lambda *a: True, + 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'resource.resource', c) + } +resource_resource() + +class resource_calendar_leaves(osv.osv): + _name = "resource.calendar.leaves" + _description = "Leave Detail" + _columns = { + 'name' : fields.char("Name", size=64), + 'company_id' : fields.related('calendar_id','company_id',type='many2one',relation='res.company',string="Company",required=True), + #'company_id':fields.many2one('res.company', 'Company', required=True), + 'calendar_id' : fields.many2one("resource.calendar", "Working time"), + 'date_from' : fields.datetime('Start Date', required=True), + 'date_to' : fields.datetime('End Date', required=True), + 'resource_id' : fields.many2one("resource.resource", "Resource", help="If empty, this is a generic holiday for the company. If a resource is set, the holiday/leave is only for this resource"), + + } +resource_calendar_leaves() +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/resource/resource_view.xml b/addons/resource/resource_view.xml new file mode 100755 index 00000000000..80d0650e0c8 --- /dev/null +++ b/addons/resource/resource_view.xml @@ -0,0 +1,174 @@ + + + + + + + + + + resource.calendar.form + resource.calendar + form + +
+ + + + + + + +
+ + Resource Calendar + resource.calendar + form + + + + + + resource.calendar.week.tree + resource.calendar.week + tree + + + + + + + + + + + resource.calendar.week.form + resource.calendar.week + form + +
+ + + + + + + +
+ + + resource.calendar.leaves.calendar + resource.calendar.leaves + calendar + + + + + + + + + + + + + + + + resource.resource.form + resource.resource + form + +
+ + + + + + + + + +
+ + resource.resource.tree + resource.resource + tree + + + + + + + + + + + + + Resources + resource.resource + tree,form + + + + + resource.calendar.leaves.form + resource.calendar.leaves + form + +
+ + + + + + + + +
+ + resource.calendar.leaves.tree + resource.calendar.leaves + tree + + + + + + + + + + + + + Leaves + resource.calendar.leaves + tree,form,calendar + + + + +
+
From ebf3b965270287c284eebcf230181952a213ef97 Mon Sep 17 00:00:00 2001 From: "Rvo (Open ERP)" Date: Tue, 12 Jan 2010 18:15:02 +0530 Subject: [PATCH 008/196] [ADD]:added module project_long_term bzr revid: rvo@tinyerp.co.in-20100112124502-k2adb24jmfixtngm --- addons/project_long_term/__init__.py | 25 ++ addons/project_long_term/__terp__.py | 42 +++ addons/project_long_term/project.py | 119 +++++++++ addons/project_long_term/project_data.xml | 16 ++ .../project_data_scheduler.xml | 23 ++ addons/project_long_term/project_demo.xml | 252 ++++++++++++++++++ addons/project_long_term/project_report.xml | 8 + addons/project_long_term/project_view.xml | 101 +++++++ addons/project_long_term/project_wizard.xml | 8 + 9 files changed, 594 insertions(+) create mode 100644 addons/project_long_term/__init__.py create mode 100644 addons/project_long_term/__terp__.py create mode 100644 addons/project_long_term/project.py create mode 100644 addons/project_long_term/project_data.xml create mode 100644 addons/project_long_term/project_data_scheduler.xml create mode 100644 addons/project_long_term/project_demo.xml create mode 100644 addons/project_long_term/project_report.xml create mode 100644 addons/project_long_term/project_view.xml create mode 100644 addons/project_long_term/project_wizard.xml diff --git a/addons/project_long_term/__init__.py b/addons/project_long_term/__init__.py new file mode 100644 index 00000000000..33adeb520b9 --- /dev/null +++ b/addons/project_long_term/__init__.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). +# +# 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 . +# +############################################################################## + +import project + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/project_long_term/__terp__.py b/addons/project_long_term/__terp__.py new file mode 100644 index 00000000000..1b5dfa348ad --- /dev/null +++ b/addons/project_long_term/__terp__.py @@ -0,0 +1,42 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). +# +# 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 . +# +############################################################################## + + +{ + "name" : "Long Term Project Management", + "version": "1.1", + "author" : "Tiny", + "website" : "http://www.openerp.com", + "category" : "Generic Modules/Projects & Services", + "depends" : ["project"], + "description": """Long Term Project management module that track planning, scheduling, resources allocation. + """, + "init_xml" : [], + "demo_xml" : [#"project_demo.xml" +], + "update_xml": [ + "project_view.xml", + ], + 'installable': True, + 'active': False, + 'certificate': None, +} +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/project_long_term/project.py b/addons/project_long_term/project.py new file mode 100644 index 00000000000..f04e18babfd --- /dev/null +++ b/addons/project_long_term/project.py @@ -0,0 +1,119 @@ +# -*- coding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). +# +# 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 . +# +############################################################################## + +from lxml import etree +from mx import DateTime +from mx.DateTime import now +import time +from tools.translate import _ + +from osv import fields, osv +from tools.translate import _ + +class project_phase(osv.osv): + _name = "project.phase" + _description = "Project Phase" + + def _check_recursion(self,cr,uid,ids): + level = 100 + while len(ids): + cr.execute('select distinct next_phase_id from project_phase_next_rel where phase_id in ('+','.join(map(str, ids))+')') + ids = filter(None, map(lambda x:x[0], cr.fetchall())) + next_ids = ids + while(next_ids): + cr.execute('select distinct prev_phase_id from project_phase_prev_rel where phase_id in ('+','.join(map(str, ids))+')') + prev_ids = filter(None, map(lambda x:x[0], cr.fetchall())) + + return True + + while(ids): + cr.execute('select distinct child_id from account_account_consol_rel where parent_id in ('+','.join(map(str, ids))+')') + child_ids = filter(None, map(lambda x: x[0], cr.fetchall())) + c_ids = child_ids + if (p_id and (p_id in c_ids)) or (obj_self.id in c_ids): + return False + while len(c_ids): + s_ids = self.search(cr, uid, [('parent_id', 'in', c_ids)]) + if p_id and (p_id in s_ids): + return False + c_ids = s_ids + ids = child_ids + return True + + + + _columns = { + 'name': fields.char("Phase Name", size=64, required=True), + 'date_start': fields.datetime('Starting Date'), + 'date_end': fields.datetime('End Date'), + 'constraint_date_start': fields.datetime('Constraint Starting Date'), + 'constraint_date_end': fields.datetime('Constraint End Date'), + 'project_id': fields.many2one('project.project', 'Project', required=True), + 'next_phase_ids': fields.many2many('project.phase', 'project_phase_next_rel', 'phase_id', 'next_phase_id', 'Next Phases'), + 'previous_phase_ids': fields.many2many('project.phase', 'project_phase_previous_rel', 'phase_id', 'prv_phase_id', 'Previous Phases'), + 'duration': fields.float('Duration'), + 'product_uom': fields.many2one('product.uom', 'Duration UoM', help="UoM (Unit of Measure) is the unit of measurement for Duration"), + 'task_ids': fields.one2many('project.task', 'phase_id', "Project Tasks"), + 'resource_ids': fields.one2many('project.resource.allocation', 'phase_id', "Project Resources"), + } + + _defaults = { + 'date_start': lambda *a: time.strftime('%Y-%m-%d'), + } + + _order = "name" + _constraints = [ + (_check_recursion,'Error ! Loops In Phases Not Allowed',['next_phase_ids','previous_phase_ids']) + ] +project_phase() + +class project_resource_allocation(osv.osv): + _name = 'project.resource.allocation' + _description = 'Project Resource Allocation' + _columns = { + 'resource_id': fields.many2one('resource.resource', 'Resource', required=True), + 'phase_id': fields.many2one('project.phase', 'Project Phase', required=True), + 'useability': fields.float('Useability', help="Useability of this ressource for this project phase in percentage (=50%)"), + } + _defaults = { + 'useability': lambda *a: 100, + } +project_resource_allocation() + +class project(osv.osv): + _inherit = "project.project" + + _columns = { + 'phase_ids': fields.one2many('project.phase', 'project_id', "Project Phases") + } + +project() + +class task(osv.osv): + _inherit = "project.task" + + _columns = { + 'phase_id': fields.many2one('project.phase', 'Project Phase') + } + +task() +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + diff --git a/addons/project_long_term/project_data.xml b/addons/project_long_term/project_data.xml new file mode 100644 index 00000000000..2addd68fa19 --- /dev/null +++ b/addons/project_long_term/project_data.xml @@ -0,0 +1,16 @@ + + + + + + Project + project.project + + + Project task + project.task + + + diff --git a/addons/project_long_term/project_data_scheduler.xml b/addons/project_long_term/project_data_scheduler.xml new file mode 100644 index 00000000000..32e74725d58 --- /dev/null +++ b/addons/project_long_term/project_data_scheduler.xml @@ -0,0 +1,23 @@ + + + + + + + Calculate Project Task Length Scheduler + + + 1 + minutes + -1 + + + + + + + + + + diff --git a/addons/project_long_term/project_demo.xml b/addons/project_long_term/project_demo.xml new file mode 100644 index 00000000000..e762d3874ba --- /dev/null +++ b/addons/project_long_term/project_demo.xml @@ -0,0 +1,252 @@ + + + + + + + + + + + Analysis + + + New Feature + + + Quotation + + + Bug + + + + 1 + Open ERP Integration + + + + 1 + 10 + + Study + Prototype + + + + + 20 + + Specific Developements + + + + + 30 + + Install, data import, configuration + + + + + + 38.0 + 38.0 + + + + BoM, After sales returns, interventions. Tracability. + Specific adaptation to MRP + + + 16.0 + 16.0 + + + + Data importation + Doc + + + 16.0 + 16.0 + + + + Modifications asked by the customer. + + + 16.0 + 16.0 + + + 0 + + Customer analysis + Architecture + + + 15 + 8.0 + 8.0 + + + + Internal testing + Software Install + 2008-06-06 + + + 17 + 16.0 + 16.0 + + + 2 + open + + Analysis, Data Importation + + + 20 + 16.0 + 16.0 + open + + + Parameters + + + 20 + 32.0 + 32.0 + + open + + Start of the doc redaction + MRP + + + 25 + 24.0 + 24.0 + + + done + MRP Tests + + + 29 + 24.0 + 24.0 + + + MRP; functionnal layer + done + + + + 30 + 24.0 + 24.0 + + + Products Adaptation + + + 30 + 24.0 + 24.0 + + + Install + Super User Training + + + 30 + 32.0 + 32.0 + + + Customer docs + + + 30 + 24.0 + 24.0 + + + Development of the presentation layer + + + 40 + 32.0 + 32.0 + + + Free Time + + + 40 + 50.0 + 50.0 + + + Specific tests + + + 40 + 24.0 + 24.0 + + + Sale module + + + 40 + 32.0 + 32.0 + + + open + In house training + 2007-06-06 + + + 50 + 24.0 + 24.0 + + + Validation + latest modifications. + + + 50 + 24.0 + 24.0 + + + Adaptations buy module + + + 60 + 16.0 + 16.0 + + + Presentation of the software. + + + 60 + 24.0 + 24.0 + + + Adaptations Stock module + + + 70 + 24.0 + 24.0 + + + Latest in house tests + + + diff --git a/addons/project_long_term/project_report.xml b/addons/project_long_term/project_report.xml new file mode 100644 index 00000000000..c3b681cdd8b --- /dev/null +++ b/addons/project_long_term/project_report.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/addons/project_long_term/project_view.xml b/addons/project_long_term/project_view.xml new file mode 100644 index 00000000000..5afbad59af8 --- /dev/null +++ b/addons/project_long_term/project_view.xml @@ -0,0 +1,101 @@ + + + + + project.resource.allocation.form + project.resource.allocation + form + +
+ + + + + +
+ + project.resource.allocation.list + project.resource.allocation + tree + + + + + + + + + + + project.phase.form + project.phase + form + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+ + project.phase.list + project.phase + tree + + + + + + + + + + + + + + + + Project phases + project.phase + form + + + + + + + +
+
diff --git a/addons/project_long_term/project_wizard.xml b/addons/project_long_term/project_wizard.xml new file mode 100644 index 00000000000..109a003da4a --- /dev/null +++ b/addons/project_long_term/project_wizard.xml @@ -0,0 +1,8 @@ + + + + + + + + From 5fe81283a19b22f102204f539e3d1f30c8e605fe Mon Sep 17 00:00:00 2001 From: "pap (openerp)" Date: Wed, 13 Jan 2010 16:17:23 +0530 Subject: [PATCH 009/196] [IMP]:removed duplicate fields from hr.employee module, put resource_id also while creating resource.calendar.leaves record when hr.holidays record is confirmed bzr revid: pap@tinyerp.co.in-20100113104723-lcpmbsa63nv6ioam --- addons/hr/hr.py | 5 ----- addons/hr_holidays/hr.py | 8 +++++--- addons/resource/resource.py | 23 +++++------------------ 3 files changed, 10 insertions(+), 26 deletions(-) mode change 100644 => 100755 addons/hr/hr.py mode change 100644 => 100755 addons/hr_holidays/hr.py diff --git a/addons/hr/hr.py b/addons/hr/hr.py old mode 100644 new mode 100755 index 181d783d98d..4d77cf715b8 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -57,11 +57,6 @@ class hr_employee(osv.osv): _description = "Employee" _inherits = {'resource.resource':"resource_id"} _columns = { - 'name' : fields.char("Employee's Name", size=128, required=True), - 'active' : fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the employee record without removing it."), - 'company_id': fields.many2one('res.company', 'Company'), - 'user_id' : fields.many2one('res.users', 'Related User', help='Related user name for an employee to manage his access rights.'), - 'country_id' : fields.many2one('res.country', 'Nationality'), 'birthday' : fields.date("Birthday"), 'ssnid': fields.char('SSN No', size=32, help='Social Security Number'), diff --git a/addons/hr_holidays/hr.py b/addons/hr_holidays/hr.py old mode 100644 new mode 100755 index 6c5e12771e1..a77eb046a33 --- a/addons/hr_holidays/hr.py +++ b/addons/hr_holidays/hr.py @@ -242,7 +242,6 @@ class hr_holidays(osv.osv): 'state':'validate', } ids2 = self.pool.get('hr.employee').search(cr, uid, [('user_id','=', uid)]) - if ids2: vals['manager_id'] = ids2[0] else: @@ -272,9 +271,12 @@ class hr_holidays(osv.osv): vals= { 'name':record.name, 'date_from':record.date_from, - 'date_to':record.date_to + 'date_to':record.date_to, + 'calendar_id':record.employee_id.calendar_id.id, + 'company_id':record.employee_id.company_id.id, + 'resource_id':record.employee_id.resource_id.id } - self.pool.get('resource.calendar.leaves').create(cr,uid,vals,context) + self.pool.get('resource.calendar.leaves').create(cr,uid,vals) return True diff --git a/addons/resource/resource.py b/addons/resource/resource.py index 2d225527f0e..dad8aedf5cf 100755 --- a/addons/resource/resource.py +++ b/addons/resource/resource.py @@ -44,16 +44,13 @@ class resource_calendar(osv.osv): resource_leave_ids = self.pool.get('resource.calendar.leaves').search(cr,uid,[('resource_id','=',resource)]) if resource_leave_ids: res_leaves = self.pool.get('resource.calendar.leaves').read(cr,uid,resource_leave_ids,['date_from','date_to']) - print 'Leave Details',res_leaves for i in range(len(res_leaves)): dtf = mx.DateTime.strptime(res_leaves[i]['date_from'],'%Y-%m-%d %H:%M:%S') dtt = mx.DateTime.strptime(res_leaves[i]['date_to'],'%Y-%m-%d %H:%M:%S') leave_days = ((dtt - dtf).days) + 1 - print 'No Of Leaves:::::::::',int(leave_days) for x in range(int(leave_days)): dt_leave.append((dtf + mx.DateTime.RelativeDateTime(days=x)).strftime('%Y-%m-%d')) dt_leave.sort() - print 'Sorted Leave Dates::::',dt_leave todo = hours cycle = 0 result = [] @@ -70,11 +67,8 @@ class resource_calendar(osv.osv): d2 = mx.DateTime.DateTime(dt_from.year,dt_from.month,dt_from.day,int(math.floor(hour_to)),int((hour_to%1) * 60)) dt1 = d1.strftime('%Y-%m-%d') dt2 = d2.strftime('%Y-%m-%d') - print 'Date 1',dt1 - print 'Date 2',dt2 for i in range(len(dt_leave)): if dt1 == dt_leave[i]: - print 'Leave::::::::' dt_from += mx.DateTime.RelativeDateTime(days=1) d1 = mx.DateTime.DateTime(dt_from.year,dt_from.month,dt_from.day,int(math.floor(m)),int((m%1) * 60)) d2 = mx.DateTime.DateTime(dt_from.year,dt_from.month,dt_from.day,int(math.floor(hour_to)),int((hour_to%1) * 60)) @@ -96,17 +90,14 @@ class resource_calendar(osv.osv): resource_leave_ids = self.pool.get('resource.calendar.leaves').search(cr,uid,[('resource_id','=',resource)]) if resource_leave_ids: res_leaves = self.pool.get('resource.calendar.leaves').read(cr,uid,resource_leave_ids,['date_from','date_to']) - print 'Leave Details',res_leaves for i in range(len(res_leaves)): dtf = mx.DateTime.strptime(res_leaves[i]['date_from'],'%Y-%m-%d %H:%M:%S') dtt = mx.DateTime.strptime(res_leaves[i]['date_to'],'%Y-%m-%d %H:%M:%S') no = dtt - dtf leave_days = no.days + 1 - print 'No Of Leaves:::::::::',int(leave_days) for x in range(int(leave_days)): dt_leave.append((dtf + mx.DateTime.RelativeDateTime(days=x)).strftime('%Y-%m-%d')) dt_leave.sort() - print 'Sorted Leave Dates::::',dt_leave todo = hours cycle = 0 result = [] @@ -123,11 +114,8 @@ class resource_calendar(osv.osv): d2 = mx.DateTime.DateTime(dt_from.year,dt_from.month,dt_from.day,int(math.floor(hour_to)),int((hour_to%1) * 60)) dt1 = d1.strftime('%Y-%m-%d') dt2 = d2.strftime('%Y-%m-%d') - print 'Date 1',dt1 - print 'Date 2',dt2 for i in range(len(dt_leave)): if dt1 == dt_leave[i]: - print 'Leave::::::::' dt_from += mx.DateTime.RelativeDateTime(days=1) d1 = mx.DateTime.DateTime(dt_from.year,dt_from.month,dt_from.day,int(math.floor(m)),int((m%1) * 60)) d2 = mx.DateTime.DateTime(dt_from.year,dt_from.month,dt_from.day,int(math.floor(hour_to)),int((hour_to%1) * 60)) @@ -161,14 +149,14 @@ class resource_resource(osv.osv): _name = "resource.resource" _description = "Resource Detail" _columns = { - 'name' : fields.char("Name", size=64, required=True), + 'name' : fields.char("Name", size=64, required=True ), 'code': fields.char('Code', size=16), 'active' : fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the resource record without removing it."), 'company_id' : fields.many2one('res.company', 'Company', required=True), 'resource_type': fields.selection([('user','Human'),('material','Material')], 'Resource Type', required=True), - 'user_id' : fields.many2one('res.users', 'User'), - 'time_efficiency' : fields.float('Efficiency factor', size=8, help="This field depict the efficency of the ressource to complete tasks. e.g ressource put alone on a phase of 5 days with 5 tasks assigned to him, will show a load of 100% for this phase by default, but if we put a efficency of 200%, then his load will only be 50%."), - 'calendar_id' : fields.many2one("resource.calendar", "Working time", required=True, help="Define the schedule of resource"), + 'user_id' : fields.many2one('res.users', 'User',help='Related user name for the resource to manage its access.'), + 'time_efficiency' : fields.float('Efficiency factor', size=8, help="This field depict the efficiency of the resource to complete tasks. e.g resource put alone on a phase of 5 days with 5 tasks assigned to him, will show a load of 100% for this phase by default, but if we put a efficency of 200%, then his load will only be 50%."), + 'calendar_id' : fields.many2one("resource.calendar", "Working time", help="Define the schedule of resource"), } _defaults = { 'resource_type' : lambda *a: 'user', @@ -183,8 +171,7 @@ class resource_calendar_leaves(osv.osv): _description = "Leave Detail" _columns = { 'name' : fields.char("Name", size=64), - 'company_id' : fields.related('calendar_id','company_id',type='many2one',relation='res.company',string="Company",required=True), - #'company_id':fields.many2one('res.company', 'Company', required=True), + 'company_id' : fields.related('calendar_id','company_id',type='many2one',relation='res.company',string="Company",readonly=True), 'calendar_id' : fields.many2one("resource.calendar", "Working time"), 'date_from' : fields.datetime('Start Date', required=True), 'date_to' : fields.datetime('End Date', required=True), From 05a76846f26e4915bba1ef2cd9bd51a1647e158d Mon Sep 17 00:00:00 2001 From: "VRA(OpenERP)" <> Date: Wed, 13 Jan 2010 17:01:10 +0530 Subject: [PATCH 010/196] [FIX] Analytic account report corrected bzr revid: jvo@tinyerp.com-20100113113110-1sl57vr454pi8w4j --- addons/hr_timesheet_invoice/report/cost_ledger.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/hr_timesheet_invoice/report/cost_ledger.py b/addons/hr_timesheet_invoice/report/cost_ledger.py index 584ea3c6acd..a2f3044a190 100644 --- a/addons/hr_timesheet_invoice/report/cost_ledger.py +++ b/addons/hr_timesheet_invoice/report/cost_ledger.py @@ -88,7 +88,7 @@ class account_analytic_cost_ledger(report_sxw.rml_parse): revenue = 0.0 if lines[id].amount < 0 and lines[id].product_id and lines[id].product_uom_id and lines[id].account_id.pricelist_id: ctx = {'uom': lines[id].product_uom_id.id} - price = price_obj.price_get(self.cr, self.uid, [lines[id].pricelist_id.id], lines[id].product_id.id, lines[id].unit_amount, ctx)[lines[id].pricelist_id.id] + price = price_obj.price_get(self.cr, self.uid, [lines[id].account_id.pricelist_id.id], lines[id].product_id.id, lines[id].unit_amount, ctx)[lines[id].account_id.pricelist_id.id] revenue = round(price * lines[id].unit_amount, 2) r['revenue'] = revenue self.sum_revenue[account_id] += revenue From bbd1938bafd7a9002b7f639561f5eacd7c765ba0 Mon Sep 17 00:00:00 2001 From: "Jay (Open ERP)" Date: Wed, 13 Jan 2010 17:08:47 +0530 Subject: [PATCH 011/196] [FIX] l10n_chart_uk_minimal : Demo account.tax.code needed negative sign lp bug: https://launchpad.net/bugs/470815 fixed bzr revid: jvo@tinyerp.com-20100113113847-drrnpcf1tvbap1t4 --- addons/l10n_chart_uk_minimal/account_tax.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/l10n_chart_uk_minimal/account_tax.xml b/addons/l10n_chart_uk_minimal/account_tax.xml index a030925f8fa..42f214e5685 100755 --- a/addons/l10n_chart_uk_minimal/account_tax.xml +++ b/addons/l10n_chart_uk_minimal/account_tax.xml @@ -21,6 +21,7 @@ Input VAT + From b01c37956e666a6df4d6fadfd100705dc497f7b7 Mon Sep 17 00:00:00 2001 From: Quentin De Paoli Date: Wed, 13 Jan 2010 17:02:57 +0100 Subject: [PATCH 012/196] [FIX] l10n_be: fixed data of l10n_be module bzr revid: qdp@cyan-20100113160257-vdfjdx4mfczch12e --- addons/l10n_be/account_pcmn_belgium.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/l10n_be/account_pcmn_belgium.xml b/addons/l10n_be/account_pcmn_belgium.xml index e657d259e60..9281d3c45ac 100644 --- a/addons/l10n_be/account_pcmn_belgium.xml +++ b/addons/l10n_be/account_pcmn_belgium.xml @@ -7021,8 +7021,8 @@ VI 0 percent - - + + sale From 9683d25c9b17a7db402b29375e37ebe27e677100 Mon Sep 17 00:00:00 2001 From: Quentin De Paoli Date: Wed, 13 Jan 2010 17:30:28 +0100 Subject: [PATCH 013/196] [FIX] account: wizard of fiscal year closing fixed: the entries of all previous fiscal years have to be deffered, not only the last one bzr revid: qdp@cyan-20100113163028-13qolk6d2jv5on2s --- addons/account/wizard/wizard_fiscalyear_close.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/addons/account/wizard/wizard_fiscalyear_close.py b/addons/account/wizard/wizard_fiscalyear_close.py index ac9518e006b..97ee5f51a73 100644 --- a/addons/account/wizard/wizard_fiscalyear_close.py +++ b/addons/account/wizard/wizard_fiscalyear_close.py @@ -80,10 +80,12 @@ def _data_save(self, cr, uid, data, context): if move_ids: raise wizard.except_wizard(_('UserError'), _('The opening journal must not have any entry in the new fiscal year !')) - - + query = "SELECT id FROM account_fiscalyear WHERE date_stop < '" + str(new_fyear.date_start) + "'" + cr.execute(query) + result = cr.dictfetchall() + fy_ids = ','.join([str(x['id']) for x in result]) query_line = pool.get('account.move.line')._query_get(cr, uid, - obj='account_move_line', context={'fiscalyear': fy_id}) + obj='account_move_line', context={'fiscalyear': fy_ids}) cr.execute('select id from account_account WHERE active') ids = map(lambda x: x[0], cr.fetchall()) for account in pool.get('account.account').browse(cr, uid, ids, From e39eb0325b4d0a5562e904334212817f284198c4 Mon Sep 17 00:00:00 2001 From: "Vir (Open ERP)" Date: Mon, 18 Jan 2010 11:36:13 +0530 Subject: [PATCH 014/196] [MOD] Modification in menus according to new menu structure bzr revid: vir@tinyerp.com-20100118060613-yobcz6i91l8oay6q --- addons/membership/membership_view.xml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/addons/membership/membership_view.xml b/addons/membership/membership_view.xml index 78c81d77e88..2bc1ac1d48d 100644 --- a/addons/membership/membership_view.xml +++ b/addons/membership/membership_view.xml @@ -82,9 +82,12 @@
+ + sequence="3"/> @@ -144,8 +147,8 @@ form - - @@ -207,7 +210,7 @@ From 4e3bd8db5b1b585ac37a16f18b927c6d6b28ca35 Mon Sep 17 00:00:00 2001 From: "Vir (Open ERP)" Date: Mon, 18 Jan 2010 12:12:51 +0530 Subject: [PATCH 015/196] [MOD] Modification in menu items according to new menu structure bzr revid: vir@tinyerp.com-20100118064251-uxxz2dh40sxqytth --- addons/auction/auction_view.xml | 24 ++++++++++++------------ addons/auction/auction_wizard.xml | 18 +++++++++--------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/addons/auction/auction_view.xml b/addons/auction/auction_view.xml index bc5547a3608..2189253f3ce 100644 --- a/addons/auction/auction_view.xml +++ b/addons/auction/auction_view.xml @@ -2,7 +2,7 @@ - + ======================================================= Auction Management/Configuration/artist @@ -127,7 +127,7 @@ - + ======================================================= Auction Management/Auction Dates/Old Auction Dates @@ -361,10 +361,10 @@ auction.lots form [('state','=','sold')] - + - + @@ -373,7 +373,7 @@ form tree,form [('state','<>','sold')] - + @@ -382,7 +382,7 @@ form tree,form [('auction_id','=', False),('state','=','draft')] - + @@ -392,7 +392,7 @@ auction.lots form [('state','=','unsold')] - + @@ -439,7 +439,7 @@