From 344dd181f38a9df3e0c2deb9057f0c3da7def2fd Mon Sep 17 00:00:00 2001 From: Fabien Pinckaers Date: Sat, 9 Jan 2010 15:30:02 +0100 Subject: [PATCH] [IMP] new menus bzr revid: fp@tinyerp.com-20100109143002-32gkcy67d18v2gd7 --- addons/crm/crm.py | 111 +----------- addons/crm/crm_job.py | 1 + addons/crm/crm_view.xml | 10 +- addons/hr/hr_department_view.xml | 10 +- addons/hr/hr_view.xml | 59 ++++--- addons/hr_attendance/hr_attendance_view.xml | 5 +- addons/hr_attendance/hr_attendance_wizard.xml | 2 +- addons/hr_contract/hr_contract_view.xml | 29 ++-- addons/hr_expense/hr_expense_view.xml | 54 +++--- addons/hr_holidays/hr_holidays_wizard.xml | 33 ++-- addons/hr_holidays/hr_view.xml | 73 ++++---- addons/hr_holidays/hr_workflow.xml | 164 +++++++++--------- addons/hr_timesheet/hr_timesheet_report.xml | 3 +- addons/hr_timesheet/hr_timesheet_view.xml | 13 +- addons/hr_timesheet/hr_timesheet_wizard.xml | 2 +- .../hr_timesheet_invoice_report.xml | 8 +- .../hr_timesheet_invoice_view.xml | 11 +- .../hr_timesheet_sheet_view.xml | 6 +- addons/mail_gateway/__terp__.py | 3 +- addons/mail_gateway/mail_gateway.py | 9 +- 20 files changed, 255 insertions(+), 351 deletions(-) diff --git a/addons/crm/crm.py b/addons/crm/crm.py index a58a50028a5..ab1a16cfe82 100755 --- a/addons/crm/crm.py +++ b/addons/crm/crm.py @@ -32,12 +32,6 @@ import tools from osv import fields,osv,orm from osv.orm import except_orm - -import email -import netsvc -from poplib import POP3, POP3_SSL -from imaplib import IMAP4, IMAP4_SSL - MAX_LEVEL = 15 AVAILABLE_STATES = [ ('draft','Draft'), @@ -64,17 +58,16 @@ icon_lst = { class crm_case_section(osv.osv): _name = "crm.case.section" _description = "Case Section" + _order = "name" _columns = { 'name': fields.char('Case Section',size=64, required=True, translate=True), 'code': fields.char('Section Code',size=8), 'active': fields.boolean('Active', help="If the active field is set to true, it will allow you to hide the case section without removing it."), 'allow_unlink': fields.boolean('Allow Delete', help="Allows to delete non draft cases"), - 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of case sections."), 'user_id': fields.many2one('res.users', 'Responsible User'), 'reply_to': fields.char('Reply-To', size=64, help="The email address put in the 'Reply-To' of all emails sent by Open ERP about cases in this section"), 'parent_id': fields.many2one('crm.case.section', 'Parent Section'), 'child_ids': fields.one2many('crm.case.section', 'parent_id', 'Child Sections'), - 'calendar' : fields.boolean('Calendar', help='Allows to show calendar'), } _defaults = { 'active': lambda *a: 1, @@ -95,106 +88,6 @@ class crm_case_section(osv.osv): _constraints = [ (_check_recursion, 'Error ! You cannot create recursive sections.', ['parent_id']) ] - - # Mainly used by the wizard - def menu_create_data(self, cr, uid, data, menu_lst, context): - menus = {} - menus[0] = data['menu_parent_id'] - section = self.browse(cr, uid, data['section_id'], context) - for (index, mname, mdomain, latest, view_mode) in menu_lst: - view_mode = data['menu'+str(index)+'_option'] - if view_mode=='no': - menus[index] = data['menu_parent_id'] - continue - icon = icon_lst.get(view_mode.split(',')[0], 'STOCK_JUSTIFY_FILL') - menu_id=self.pool.get('ir.ui.menu').create(cr, uid, { - 'name': data['menu'+str(index)], - 'parent_id': menus[latest], - 'icon': icon - }) - menus[index] = menu_id - action_id = self.pool.get('ir.actions.act_window').create(cr,uid, { - 'name': data['menu'+str(index)], - 'res_model': 'crm.case', - 'domain': mdomain.replace('SECTION_ID', str(data['section_id'])), - 'view_type': 'form', - 'view_mode': view_mode, - }) - seq = 0 - for mode in view_mode.split(','): - self.pool.get('ir.actions.act_window.view').create(cr, uid, { - 'sequence': seq, - 'view_id': data['view_'+mode], - 'view_mode': mode, - 'act_window_id': action_id, - 'multi': True - }) - seq+=1 - self.pool.get('ir.values').create(cr, uid, { - 'name': data['menu'+str(index)], - 'key2': 'tree_but_open', - 'model': 'ir.ui.menu', - 'res_id': menu_id, - 'value': 'ir.actions.act_window,%d'%action_id, - 'object': True - }) - return True - - # - # Used when called from .XML file - # - def menu_create(self, cr, uid, ids, name, menu_parent_id=False, context={}): - menus = {} - menus[-1] = menu_parent_id - for section in self.browse(cr, uid, ids, context): - for (index, mname, mdomain, latest) in [ - (0,'',"[('section_id','=',"+str(section.id)+")]", -1), - (1,'My ',"[('section_id','=',"+str(section.id)+"),('user_id','=',uid)]", 0), - (2,'My Unclosed ',"[('section_id','=',"+str(section.id)+"),('user_id','=',uid), ('state','<>','cancel'), ('state','<>','done')]", 1), - (5,'My Open ',"[('section_id','=',"+str(section.id)+"),('user_id','=',uid), ('state','=','open')]", 2), - (6,'My Pending ',"[('section_id','=',"+str(section.id)+"),('user_id','=',uid), ('state','=','pending')]", 2), - (7,'My Draft ',"[('section_id','=',"+str(section.id)+"),('user_id','=',uid), ('state','=','draft')]", 2), - - (3,'My Late ',"[('section_id','=',"+str(section.id)+"),('user_id','=',uid), ('date_deadline','<=',time.strftime('%Y-%m-%d')), ('state','<>','cancel'), ('state','<>','done')]", 1), - (4,'My Canceled ',"[('section_id','=',"+str(section.id)+"),('user_id','=',uid), ('state','=','cancel')]", 1), - (8,'All ',"[('section_id','=',"+str(section.id)+"),]", 0), - (9,'Unassigned ',"[('section_id','=',"+str(section.id)+"),('user_id','=',False)]", 8), - (10,'Late ',"[('section_id','=',"+str(section.id)+"),('user_id','=',uid), ('date_deadline','<=',time.strftime('%Y-%m-%d')), ('state','<>','cancel'), ('state','<>','done')]", 8), - (11,'Canceled ',"[('section_id','=',"+str(section.id)+"),('state','=','cancel')]", 8), - (12,'Unclosed ',"[('section_id','=',"+str(section.id)+"),('state','<>','cancel'), ('state','<>','done')]", 8), - (13,'Open ',"[('section_id','=',"+str(section.id)+"),('state','=','open')]", 12), - (14,'Pending ',"[('section_id','=',"+str(section.id)+"),('state','=','pending')]", 12), - (15,'Draft ',"[('section_id','=',"+str(section.id)+"),('state','=','draft')]", 12), - (16,'Unassigned ',"[('section_id','=',"+str(section.id)+"),('user_id','=',False),('state','<>','cancel'),('state','<>','done')]", 12), - ]: - view_mode = 'tree,form' - icon = 'STOCK_JUSTIFY_FILL' - if index==0: - view_mode = 'form,tree' - icon = 'STOCK_NEW' - menu_id=self.pool.get('ir.ui.menu').create(cr, uid, { - 'name': mname+name, - 'parent_id': menus[latest], - 'icon': icon - }) - menus[index] = menu_id - action_id = self.pool.get('ir.actions.act_window').create(cr,uid, { - 'name': mname+name+' Cases', - 'res_model': 'crm.case', - 'domain': mdomain, - 'view_type': 'form', - 'view_mode': view_mode, - }) - self.pool.get('ir.values').create(cr, uid, { - 'name': 'Open Cases', - 'key2': 'tree_but_open', - 'model': 'ir.ui.menu', - 'res_id': menu_id, - 'value': 'ir.actions.act_window,%d'%action_id, - 'object': True - }) - return True - def name_get(self, cr, uid, ids, context={}): if not len(ids): return [] @@ -963,4 +856,4 @@ class res_users(osv.osv): res_users() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/crm/crm_job.py b/addons/crm/crm_job.py index 178c3efdade..7f41c6228c6 100644 --- a/addons/crm/crm_job.py +++ b/addons/crm/crm_job.py @@ -31,6 +31,7 @@ from tools.translate import _ import tools from osv import fields,osv,orm from osv.orm import except_orm + class crm_job(osv.osv): _name = "crm.job" _description = "Job Cases" diff --git a/addons/crm/crm_view.xml b/addons/crm/crm_view.xml index 4a5016108ac..ee2a621da17 100644 --- a/addons/crm/crm_view.xml +++ b/addons/crm/crm_view.xml @@ -34,15 +34,11 @@ - - + - - - - - + + diff --git a/addons/hr/hr_department_view.xml b/addons/hr/hr_department_view.xml index fe65d988237..6c2c6408afe 100644 --- a/addons/hr/hr_department_view.xml +++ b/addons/hr/hr_department_view.xml @@ -47,7 +47,10 @@ tree [('parent_id','=',False)] - + Departments @@ -55,7 +58,10 @@ form - + diff --git a/addons/hr/hr_view.xml b/addons/hr/hr_view.xml index a862ac86c0f..5e9a93cc3d9 100644 --- a/addons/hr/hr_view.xml +++ b/addons/hr/hr_view.xml @@ -1,7 +1,10 @@ - + - + sequence="50" groups="group_hr_manager"/> + + + - - - + + + + - - + + diff --git a/addons/hr_holidays/hr_view.xml b/addons/hr_holidays/hr_view.xml index 321541beb92..dedad68b7fd 100644 --- a/addons/hr_holidays/hr_view.xml +++ b/addons/hr_holidays/hr_view.xml @@ -10,18 +10,18 @@ search - - + + - - - - - - - - - + + + + + + + + + @@ -146,12 +146,12 @@ - Leave Request(s) + Leave Request(s) hr.holidays form @@ -159,7 +159,7 @@ - + tree @@ -173,22 +173,22 @@ - + - - Allocation Request(s) - hr.holidays - form - {'type':'add'} - [('type','=','add')] - - + + Allocation Request(s) + hr.holidays + form + {'type':'add'} + [('type','=','add')] + + - + tree @@ -203,10 +203,10 @@ + name="Recuperation Days Requests" + parent="menu_open_ask_holidays" + id="menu_open_allocation_holidays" + action="open_allocation_holidays"/> @@ -236,17 +236,22 @@ - Leave Type + Leaves Type ir.actions.act_window hr.holidays.status form tree,form + + + parent="menu_leaves_config"/> - + - - Leaves Manager - + + Leaves Manager + - + - - hr.wkf.holidays - hr.holidays - True - + + hr.wkf.holidays + hr.holidays + True + - - - True - draft - + + + True + draft + - - - confirm - function - holidays_confirm() - OR - + + + confirm + function + holidays_confirm() + OR + - - - validate - function - holidays_validate() - + + + validate + function + holidays_validate() + - - - refuse - function - holidays_refuse() + + + refuse + function + holidays_refuse() - + - - - cancel - True - stopall - holidays_cancel() - XOR - - - + + + cancel + True + stopall + holidays_cancel() + XOR + + + - - - - confirm - - - - - - validate - - + + + + confirm + + + + + + validate + + - - - - refuse - - + + + + refuse + + - - - - cancel - - + + + + cancel + + - - - - cancel - - + + + + cancel + + - - - - set_to_draft - - + + + + set_to_draft + + diff --git a/addons/hr_timesheet/hr_timesheet_report.xml b/addons/hr_timesheet/hr_timesheet_report.xml index 7d07cb98011..a07afd0551c 100644 --- a/addons/hr_timesheet/hr_timesheet_report.xml +++ b/addons/hr_timesheet/hr_timesheet_report.xml @@ -4,7 +4,8 @@ - + diff --git a/addons/hr_timesheet/hr_timesheet_view.xml b/addons/hr_timesheet/hr_timesheet_view.xml index 0650889f182..a204dd867f2 100644 --- a/addons/hr_timesheet/hr_timesheet_view.xml +++ b/addons/hr_timesheet/hr_timesheet_view.xml @@ -60,19 +60,8 @@ - + - - My Working Hours - ir.actions.act_window - hr.analytic.timesheet - form - tree,form - [('user_id','=',uid)] - - - - Working Hours ir.actions.act_window diff --git a/addons/hr_timesheet/hr_timesheet_wizard.xml b/addons/hr_timesheet/hr_timesheet_wizard.xml index d78c617e9dc..bed128a839e 100644 --- a/addons/hr_timesheet/hr_timesheet_wizard.xml +++ b/addons/hr_timesheet/hr_timesheet_wizard.xml @@ -2,7 +2,7 @@ - + diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml index 1fb04cf8071..3f48aa3b642 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_report.xml @@ -24,10 +24,10 @@ groups="account.group_account_manager"/> + id="print_account_analytic_profit" + parent="hr.menu_hr_reporting" + type="wizard" + groups="hr.group_hr_manager"/> diff --git a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml index 0c89c430c15..9f0a16ae428 100644 --- a/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml +++ b/addons/hr_timesheet_invoice/hr_timesheet_invoice_view.xml @@ -1,7 +1,6 @@ - account.analytic.account.invoice.form account.analytic.account @@ -106,7 +105,10 @@ tree,form [('to_invoice','<>',False)] - + Uninvoiced Entries @@ -164,7 +166,10 @@ form - + diff --git a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml index 8a0f032e4d7..da5d1695bea 100644 --- a/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml +++ b/addons/hr_timesheet_sheet/hr_timesheet_sheet_view.xml @@ -200,9 +200,9 @@ - - +