From 50d67b6461474f2a62af2071b23fbc0a573cdc92 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Mon, 23 Dec 2013 15:53:29 +0530 Subject: [PATCH 001/134] [IMP] post welcome employee message only if employee created from applicant. bzr revid: tpa@tinyerp.com-20131223102329-147mo4x9o1mc59lq --- addons/hr/hr.py | 23 ----------------------- addons/hr_recruitment/hr_recruitment.py | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/addons/hr/hr.py b/addons/hr/hr.py index 37d1bae7fea..a7c1efc9e8e 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -229,29 +229,6 @@ class hr_employee(osv.osv): 'color': 0, } - def create(self, cr, uid, data, context=None): - if context is None: - context = {} - create_ctx = dict(context, mail_create_nolog=True) - employee_id = super(hr_employee, self).create(cr, uid, data, context=create_ctx) - employee = self.browse(cr, uid, employee_id, context=context) - if employee.user_id: - res_users = self.pool['res.users'] - # send a copy to every user of the company - # TODO: post to the `Whole Company` mail.group when we'll be able to link to the employee record - _model, group_id = self.pool['ir.model.data'].get_object_reference(cr, uid, 'base', 'group_user') - user_ids = res_users.search(cr, uid, [('company_id', '=', employee.user_id.company_id.id), - ('groups_id', 'in', group_id)]) - partner_ids = list(set(u.partner_id.id for u in res_users.browse(cr, uid, user_ids, context=context))) - else: - partner_ids = [] - self.message_post(cr, uid, [employee_id], - body=_('Welcome to %s! Please help him/her take the first steps with OpenERP!') % (employee.name), - partner_ids=partner_ids, - subtype='mail.mt_comment', context=context - ) - return employee_id - def unlink(self, cr, uid, ids, context=None): resource_ids = [] for employee in self.browse(cr, uid, ids, context=context): diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index c293c689a5b..7386893b296 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -437,6 +437,7 @@ class hr_applicant(osv.Model): hr_employee = self.pool.get('hr.employee') model_data = self.pool.get('ir.model.data') act_window = self.pool.get('ir.actions.act_window') + res_users = self.pool['res.users'] emp_id = False for applicant in self.browse(cr, uid, ids, context=context): address_id = contact_name = False @@ -453,6 +454,21 @@ class hr_applicant(osv.Model): 'work_email': applicant.department_id and applicant.department_id.company_id and applicant.department_id.company_id.email or False, 'work_phone': applicant.department_id and applicant.department_id.company_id and applicant.department_id.company_id.phone or False, }) + partner_ids = [] + create_ctx = dict(context, mail_create_nolog=True) + employee = hr_employee.browse(cr, uid, emp_id, context=context) + if employee.user_id: + # send a copy to every user of the company + # TODO: post to the `Whole Company` mail.group when we'll be able to link to the employee record + _model, group_id = self.pool['ir.model.data'].get_object_reference(cr, uid, 'base', 'group_user') + user_ids = res_users.search(cr, uid, [('company_id', '=', employee.user_id.company_id.id), + ('groups_id', 'in', group_id)], context=context) + partner_ids = list(set(u.partner_id.id for u in res_users.browse(cr, uid, user_ids, context=context))) + hr_employee.message_post(cr, uid, [emp_id], + body=_('Welcome to %s! Please help him/her take the first steps with OpenERP!') % (employee.name), + partner_ids=partner_ids, + subtype='mail.mt_comment', context=context + ) self.write(cr, uid, [applicant.id], {'emp_id': emp_id}, context=context) else: raise osv.except_osv(_('Warning!'), _('You must define an Applied Job and a Contact Name for this applicant.')) From d133efb0077dc9a598f53c99c4ac9604912077c1 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Fri, 27 Dec 2013 18:32:34 +0530 Subject: [PATCH 002/134] [IMP] improved log at creation time bzr revid: tpa@tinyerp.com-20131227130234-bmem1riolid98kk6 --- addons/hr_recruitment/hr_recruitment.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index 7386893b296..3d37b29f449 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -446,6 +446,7 @@ class hr_applicant(osv.Model): contact_name = self.pool.get('res.partner').name_get(cr, uid, [applicant.partner_id.id])[0][1] if applicant.job_id and (applicant.partner_name or contact_name): applicant.job_id.write({'no_of_recruitment': applicant.job_id.no_of_recruitment - 1}) + create_ctx = dict(context, mail_create_nolog=True) emp_id = hr_employee.create(cr, uid, {'name': applicant.partner_name or contact_name, 'job_id': applicant.job_id.id, 'address_home_id': address_id, @@ -453,9 +454,8 @@ class hr_applicant(osv.Model): 'address_id': applicant.company_id and applicant.company_id.partner_id and applicant.company_id.partner_id.id or False, 'work_email': applicant.department_id and applicant.department_id.company_id and applicant.department_id.company_id.email or False, 'work_phone': applicant.department_id and applicant.department_id.company_id and applicant.department_id.company_id.phone or False, - }) + }, context=create_ctx) partner_ids = [] - create_ctx = dict(context, mail_create_nolog=True) employee = hr_employee.browse(cr, uid, emp_id, context=context) if employee.user_id: # send a copy to every user of the company From 07746868f66cd1c54fed0c16b49fc57154fc8252 Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Fri, 3 Jan 2014 18:12:34 +0530 Subject: [PATCH 003/134] [FIX] improved code to serch users of company based on eployees company intead of using company of related user of employee bzr revid: tpa@tinyerp.com-20140103124234-a3euvu0e6bs1n14q --- addons/hr_recruitment/hr_recruitment.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index 3d37b29f449..a9f14564aa9 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -455,15 +455,13 @@ class hr_applicant(osv.Model): 'work_email': applicant.department_id and applicant.department_id.company_id and applicant.department_id.company_id.email or False, 'work_phone': applicant.department_id and applicant.department_id.company_id and applicant.department_id.company_id.phone or False, }, context=create_ctx) - partner_ids = [] employee = hr_employee.browse(cr, uid, emp_id, context=context) - if employee.user_id: - # send a copy to every user of the company - # TODO: post to the `Whole Company` mail.group when we'll be able to link to the employee record - _model, group_id = self.pool['ir.model.data'].get_object_reference(cr, uid, 'base', 'group_user') - user_ids = res_users.search(cr, uid, [('company_id', '=', employee.user_id.company_id.id), - ('groups_id', 'in', group_id)], context=context) - partner_ids = list(set(u.partner_id.id for u in res_users.browse(cr, uid, user_ids, context=context))) + # send a copy to every user of the company + # TODO: post to the `Whole Company` mail.group when we'll be able to link to the employee record + _model, group_id = self.pool['ir.model.data'].get_object_reference(cr, uid, 'base', 'group_user') + user_ids = res_users.search(cr, uid, [('company_id', '=', employee.company_id.id), + ('groups_id', 'in', group_id)], context=context) + partner_ids = list(set(u.partner_id.id for u in res_users.browse(cr, uid, user_ids, context=context))) hr_employee.message_post(cr, uid, [emp_id], body=_('Welcome to %s! Please help him/her take the first steps with OpenERP!') % (employee.name), partner_ids=partner_ids, From 181aee3c506c5ccac3dd9cbcbe7f85c1c693855b Mon Sep 17 00:00:00 2001 From: "Turkesh Patel (Open ERP)" Date: Wed, 5 Feb 2014 11:35:00 +0530 Subject: [PATCH 004/134] [IMP] as per TDE's suggetion dont move code of posting message in hr_recruitment just do it based on context key bzr revid: tpa@tinyerp.com-20140205060500-v70n8oy9rm1dflwf --- addons/hr/hr.py | 26 +++++++++++++++++++++++++ addons/hr_recruitment/hr_recruitment.py | 15 +------------- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/addons/hr/hr.py b/addons/hr/hr.py index 5b38676d459..e07fdbf1a5b 100644 --- a/addons/hr/hr.py +++ b/addons/hr/hr.py @@ -227,6 +227,32 @@ class hr_employee(osv.osv): 'color': 0, } + def create(self, cr, uid, data, context=None): + if context is None: + context = {} + if context.get("mail_broadcast"): + create_ctx = dict(context, mail_create_nolog=True) + employee_id = super(hr_employee, self).create(cr, uid, data, context=create_ctx) + employee = self.browse(cr, uid, employee_id, context=context) + if employee.user_id: + res_users = self.pool['res.users'] + # send a copy to every user of the company + # TODO: post to the `Whole Company` mail.group when we'll be able to link to the employee record + _model, group_id = self.pool['ir.model.data'].get_object_reference(cr, uid, 'base', 'group_user') + user_ids = res_users.search(cr, uid, [('company_id', '=', employee.user_id.company_id.id), + ('groups_id', 'in', group_id)], context=context) + partner_ids = list(set(u.partner_id.id for u in res_users.browse(cr, uid, user_ids, context=context))) + else: + partner_ids = [] + self.message_post(cr, uid, [employee_id], + body=_('Welcome to %s! Please help him/her take the first steps with OpenERP!') % (employee.name), + partner_ids=partner_ids, + subtype='mail.mt_comment', context=context + ) + else: + employee_id = super(hr_employee, self).create(cr, uid, data, context=context) + return employee_id + def unlink(self, cr, uid, ids, context=None): resource_ids = [] for employee in self.browse(cr, uid, ids, context=context): diff --git a/addons/hr_recruitment/hr_recruitment.py b/addons/hr_recruitment/hr_recruitment.py index a6c1dd30249..57fd37bf509 100644 --- a/addons/hr_recruitment/hr_recruitment.py +++ b/addons/hr_recruitment/hr_recruitment.py @@ -437,7 +437,6 @@ class hr_applicant(osv.Model): hr_employee = self.pool.get('hr.employee') model_data = self.pool.get('ir.model.data') act_window = self.pool.get('ir.actions.act_window') - res_users = self.pool['res.users'] emp_id = False for applicant in self.browse(cr, uid, ids, context=context): address_id = contact_name = False @@ -446,7 +445,7 @@ class hr_applicant(osv.Model): contact_name = self.pool.get('res.partner').name_get(cr, uid, [applicant.partner_id.id])[0][1] if applicant.job_id and (applicant.partner_name or contact_name): applicant.job_id.write({'no_of_recruitment': applicant.job_id.no_of_recruitment - 1}) - create_ctx = dict(context, mail_create_nolog=True) + create_ctx = dict(context, mail_broadcast=True) emp_id = hr_employee.create(cr, uid, {'name': applicant.partner_name or contact_name, 'job_id': applicant.job_id.id, 'address_home_id': address_id, @@ -455,18 +454,6 @@ class hr_applicant(osv.Model): 'work_email': applicant.department_id and applicant.department_id.company_id and applicant.department_id.company_id.email or False, 'work_phone': applicant.department_id and applicant.department_id.company_id and applicant.department_id.company_id.phone or False, }, context=create_ctx) - employee = hr_employee.browse(cr, uid, emp_id, context=context) - # send a copy to every user of the company - # TODO: post to the `Whole Company` mail.group when we'll be able to link to the employee record - _model, group_id = self.pool['ir.model.data'].get_object_reference(cr, uid, 'base', 'group_user') - user_ids = res_users.search(cr, uid, [('company_id', '=', employee.company_id.id), - ('groups_id', 'in', group_id)], context=context) - partner_ids = list(set(u.partner_id.id for u in res_users.browse(cr, uid, user_ids, context=context))) - hr_employee.message_post(cr, uid, [emp_id], - body=_('Welcome to %s! Please help him/her take the first steps with OpenERP!') % (employee.name), - partner_ids=partner_ids, - subtype='mail.mt_comment', context=context - ) self.write(cr, uid, [applicant.id], {'emp_id': emp_id}, context=context) else: raise osv.except_osv(_('Warning!'), _('You must define an Applied Job and a Contact Name for this applicant.')) From 1f21989bbbd3e63ea1aea7d0698afa8cfb306620 Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Mon, 10 Feb 2014 17:41:13 +0100 Subject: [PATCH 005/134] [FIX] website_livechat: add res_config file for configuration of the channel bzr revid: chm@openerp.com-20140210164113-41vl0ftlk9eybnlw --- addons/website_livechat/__openerp__.py | 7 ++---- addons/website_livechat/models/website.py | 9 +++++++- addons/website_livechat/views/res_config.xml | 22 +++++++++++++++++++ .../views/website_livechat.xml | 16 -------------- 4 files changed, 32 insertions(+), 22 deletions(-) create mode 100644 addons/website_livechat/views/res_config.xml diff --git a/addons/website_livechat/__openerp__.py b/addons/website_livechat/__openerp__.py index 0ab7781b7ab..5220fc47bb6 100644 --- a/addons/website_livechat/__openerp__.py +++ b/addons/website_livechat/__openerp__.py @@ -12,10 +12,7 @@ OpenERP Website LiveChat 'depends': ['website', 'im_livechat'], 'installable': True, 'data': [ - 'views/website_livechat.xml' + 'views/website_livechat.xml', + 'views/res_config.xml' ], - 'demo': [ ], - 'js': [], - 'qweb': [], - 'css': [], } diff --git a/addons/website_livechat/models/website.py b/addons/website_livechat/models/website.py index 7e86042a67a..3e3df1c5bdc 100644 --- a/addons/website_livechat/models/website.py +++ b/addons/website_livechat/models/website.py @@ -5,4 +5,11 @@ class website(osv.osv): _columns = { 'channel_id': fields.many2one('im_livechat.channel', string="Channel"), - } \ No newline at end of file + } + +class website_config_settings(osv.osv_memory): + _inherit = 'website.config.settings' + + _columns = { + 'channel_id': fields.related('website_id', 'channel_id', type='many2one', relation='im_livechat.channel', string='Live Chat Channel'), + } diff --git a/addons/website_livechat/views/res_config.xml b/addons/website_livechat/views/res_config.xml new file mode 100644 index 00000000000..ac69929ca63 --- /dev/null +++ b/addons/website_livechat/views/res_config.xml @@ -0,0 +1,22 @@ + + + + + + Website livechat settings + website.config.settings + + + + + + + + + diff --git a/addons/website_livechat/views/website_livechat.xml b/addons/website_livechat/views/website_livechat.xml index d4da07f2bf0..374e0d5dd16 100644 --- a/addons/website_livechat/views/website_livechat.xml +++ b/addons/website_livechat/views/website_livechat.xml @@ -2,22 +2,6 @@ - - website.form - website - - - -
- - - - -
-
-
-
-