Merge lp:~openerp-dev/openobject-addons/trunk-common-action-controller-jas into lp:openobject-addons

Proposed by ajay javiya (OpenERP)
Status: Work in progress
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-common-action-controller-jas
Merge into: lp:openobject-addons
Diff against target: 443 lines (+224/-4)
13 files modified
account/account_invoice.py (+15/-0)
analytic/analytic.py (+21/-0)
crm/crm_lead.py (+18/-0)
event/event.py (+14/-0)
fleet/fleet.py (+15/-0)
fleet/fleet_view.xml (+4/-0)
hr_holidays/hr_holidays.py (+14/-0)
hr_recruitment/hr_recruitment.py (+24/-0)
mail/controllers/main.py (+15/-0)
mail/mail_thread.py (+50/-4)
mail/views/mail_actions_button.html (+6/-0)
project/project.py (+10/-0)
project_issue/project_issue.py (+18/-0)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-common-action-controller-jas
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+219454@code.launchpad.net
To post a comment you must log in.
9452. By Jamin Shah(OpenERP)

[IMP]: Optimization

9453. By Jamin Shah(OpenERP)

[IMP]: change in _mail_action condition and optimization

9454. By Jamin Shah(OpenERP)

[IMP]: add action_xml_id in _mail_object

9455. By Jamin Shah(OpenERP)

[MERGE]: with Trunk

9456. By Jamin Shah(OpenERP)

[IMP]: changes in write() for sending template

9457. By Jamin Shah(OpenERP)

[IMP]: add _mail_actions in hr_applicant and safe coding in mail write method for calling message_post

9458. By Jamin Shah(OpenERP)

[IMP]: Code Optimization

9459. By Jamin Shah(OpenERP)

[IMP]: Code Optimization

9460. By Jamin Shah(OpenERP)

[MERGE]: with trunk

9461. By Jamin Shah(OpenERP)

[IMP]: Code Optimization

9462. By Jamin Shah(OpenERP)

[IMP]: Code Optimization

Unmerged revisions

9462. By Jamin Shah(OpenERP)

[IMP]: Code Optimization

9461. By Jamin Shah(OpenERP)

[IMP]: Code Optimization

9460. By Jamin Shah(OpenERP)

[MERGE]: with trunk

9459. By Jamin Shah(OpenERP)

[IMP]: Code Optimization

9458. By Jamin Shah(OpenERP)

[IMP]: Code Optimization

9457. By Jamin Shah(OpenERP)

[IMP]: add _mail_actions in hr_applicant and safe coding in mail write method for calling message_post

9456. By Jamin Shah(OpenERP)

[IMP]: changes in write() for sending template

9455. By Jamin Shah(OpenERP)

[MERGE]: with Trunk

9454. By Jamin Shah(OpenERP)

[IMP]: add action_xml_id in _mail_object

9453. By Jamin Shah(OpenERP)

[IMP]: change in _mail_action condition and optimization

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'account/account_invoice.py'
--- account/account_invoice.py 2014-05-07 17:01:12 +0000
+++ account/account_invoice.py 2014-05-20 08:59:26 +0000
@@ -225,6 +225,21 @@
225 'account.mt_invoice_validated': lambda self, cr, uid, obj, ctx=None: obj.state == 'open' and obj.type in ('out_invoice', 'out_refund'),225 'account.mt_invoice_validated': lambda self, cr, uid, obj, ctx=None: obj.state == 'open' and obj.type in ('out_invoice', 'out_refund'),
226 },226 },
227 }227 }
228 _mail_actions = [{
229 'name': 'invoice_validate',
230 'type': 'object',
231 'string': 'Validate',
232 'condition': lambda self, obj, context=None: obj.state == 'draft',
233 'button_type': 'success'
234 },
235 {
236 'name': 'action_cancel',
237 'type': 'object',
238 'string': 'Cancel',
239 'condition': lambda self, obj, context=None: obj.state == 'draft',
240 'button_type': 'warning'
241 }]
242
228 _columns = {243 _columns = {
229 'name': fields.char('Reference/Description', size=64, select=True, readonly=True, states={'draft':[('readonly',False)]}),244 'name': fields.char('Reference/Description', size=64, select=True, readonly=True, states={'draft':[('readonly',False)]}),
230 'origin': fields.char('Source Document', size=64, help="Reference of the document that produced this invoice.", readonly=True, states={'draft':[('readonly',False)]}),245 'origin': fields.char('Source Document', size=64, help="Reference of the document that produced this invoice.", readonly=True, states={'draft':[('readonly',False)]}),
231246
=== modified file 'analytic/analytic.py'
--- analytic/analytic.py 2014-04-01 12:36:57 +0000
+++ analytic/analytic.py 2014-05-20 08:59:26 +0000
@@ -38,6 +38,27 @@
38 'analytic.mt_account_opened': lambda self, cr, uid, obj, ctx=None: obj.state == 'open',38 'analytic.mt_account_opened': lambda self, cr, uid, obj, ctx=None: obj.state == 'open',
39 },39 },
40 }40 }
41 _mail_actions = [{
42 'name': 'set_pending',
43 'type': 'object',
44 'string': 'Renew',
45 'condition': lambda self, obj, context=None: obj.state == 'open',
46 'button_type': 'success'
47 },
48 {
49 'name': 'set_close',
50 'type': 'object',
51 'string': 'Close',
52 'condition': lambda self, obj, context=None: obj.state == 'open' or obj.state == 'pending',
53 'button_type': 'warning'
54 },
55 {
56 'name': 'set_cancel',
57 'type': 'object',
58 'string': 'Cancel',
59 'condition': lambda self, obj, context=None: obj.state == 'open' or obj.state == 'pending',
60 'button_type': 'warning'
61 }]
4162
42 def _compute_level_tree(self, cr, uid, ids, child_ids, res, field_names, context=None):63 def _compute_level_tree(self, cr, uid, ids, child_ids, res, field_names, context=None):
43 currency_obj = self.pool.get('res.currency')64 currency_obj = self.pool.get('res.currency')
4465
=== modified file 'crm/crm_lead.py'
--- crm/crm_lead.py 2014-05-12 11:41:49 +0000
+++ crm/crm_lead.py 2014-05-20 08:59:26 +0000
@@ -79,6 +79,21 @@
79 'crm.mt_lead_lost': lambda self, cr, uid, obj, ctx=None: obj.probability == 0 and obj.stage_id and obj.stage_id.fold and obj.stage_id.sequence > 1,79 'crm.mt_lead_lost': lambda self, cr, uid, obj, ctx=None: obj.probability == 0 and obj.stage_id and obj.stage_id.fold and obj.stage_id.sequence > 1,
80 },80 },
81 }81 }
82 _mail_actions = [{
83 'name': 'set_user',
84 'type': 'object',
85 'string': 'I will manage it',
86 'condition': lambda self, obj, context=None: not obj.user_id,
87 'button_type': 'success'
88 },
89 {
90 'type': 'action',
91 'string': 'Not interested',
92 'condition': lambda self, obj, context=None: not obj.user_id,
93 'button_type': 'warning',
94 'action_xml_id': 'crm_case_category_act_oppor11',
95 'module': 'crm'
96 }]
82 _mail_mass_mailing = _('Leads / Opportunities')97 _mail_mass_mailing = _('Leads / Opportunities')
8398
84 def get_empty_list_help(self, cr, uid, help, context=None):99 def get_empty_list_help(self, cr, uid, help, context=None):
@@ -317,6 +332,9 @@
317 ('check_probability', 'check(probability >= 0 and probability <= 100)', 'The probability of closing the deal should be between 0% and 100%!')332 ('check_probability', 'check(probability >= 0 and probability <= 100)', 'The probability of closing the deal should be between 0% and 100%!')
318 ]333 ]
319334
335 def set_user(self, cr, uid, ids, context=None):
336 self.pool['crm.lead'].write(cr, uid, ids, {'user_id':uid})
337
320 def onchange_stage_id(self, cr, uid, ids, stage_id, context=None):338 def onchange_stage_id(self, cr, uid, ids, stage_id, context=None):
321 if not stage_id:339 if not stage_id:
322 return {'value': {}}340 return {'value': {}}
323341
=== modified file 'event/event.py'
--- event/event.py 2014-05-12 07:23:31 +0000
+++ event/event.py 2014-05-20 08:59:26 +0000
@@ -327,6 +327,20 @@
327 }327 }
328 _order = 'name, create_date desc'328 _order = 'name, create_date desc'
329329
330 _mail_actions = [{
331 'name': 'registration_open',
332 'type': 'object',
333 'string': 'Confirm',
334 'condition': lambda self, obj, context=None: obj.state == 'draft',
335 'button_type': 'success'
336 },
337 {
338 'name': 'button_reg_cancel',
339 'type': 'object',
340 'string': 'Cancel',
341 'condition': lambda self, obj, context=None: obj.state == 'draft' or obj.state == 'open',
342 'button_type': 'warning'
343 }]
330344
331 def _check_seats_limit(self, cr, uid, ids, context=None):345 def _check_seats_limit(self, cr, uid, ids, context=None):
332 for registration in self.browse(cr, uid, ids, context=context):346 for registration in self.browse(cr, uid, ids, context=context):
333347
=== modified file 'fleet/fleet.py'
--- fleet/fleet.py 2014-05-07 07:56:45 +0000
+++ fleet/fleet.py 2014-05-20 08:59:26 +0000
@@ -792,10 +792,25 @@
792 res[contract.id] = totalsum792 res[contract.id] = totalsum
793 return res793 return res
794794
795 _inherit = ['mail.thread']
795 _inherits = {'fleet.vehicle.cost': 'cost_id'}796 _inherits = {'fleet.vehicle.cost': 'cost_id'}
796 _name = 'fleet.vehicle.log.contract'797 _name = 'fleet.vehicle.log.contract'
797 _description = 'Contract information on a vehicle'798 _description = 'Contract information on a vehicle'
798 _order='state desc,expiration_date'799 _order='state desc,expiration_date'
800 _mail_actions = [{
801 'name': 'act_renew_contract',
802 'type': 'object',
803 'string': 'Renew',
804 'condition': lambda self, obj, context=None: obj.state == 'open' or obj.state == 'closed',
805 'button_type': 'success'
806 },
807 {
808 'name': 'contract_close',
809 'type': 'object',
810 'string': 'Terminate',
811 'condition': lambda self, obj, context=None: obj.state == 'open',
812 'button_type': 'warning'
813 }]
799 _columns = {814 _columns = {
800 'name': fields.function(_vehicle_contract_name_get_fnc, type="text", string='Name', store=True),815 'name': fields.function(_vehicle_contract_name_get_fnc, type="text", string='Name', store=True),
801 'start_date': fields.date('Contract Start Date', help='Date when the coverage of the contract begins'),816 'start_date': fields.date('Contract Start Date', help='Date when the coverage of the contract begins'),
802817
=== modified file 'fleet/fleet_view.xml'
--- fleet/fleet_view.xml 2014-03-28 13:30:51 +0000
+++ fleet/fleet_view.xml 2014-05-20 08:59:26 +0000
@@ -502,6 +502,10 @@
502 <field name="notes" nolabel="1" placeholder="Write here all other information relative to this contract" />502 <field name="notes" nolabel="1" placeholder="Write here all other information relative to this contract" />
503 </group>503 </group>
504 </sheet>504 </sheet>
505 <div class="oe_chatter">
506 <field name="message_follower_ids" widget="mail_followers"/>
507 <field name="message_ids" widget="mail_thread"/>
508 </div>
505 </form>509 </form>
506 </field>510 </field>
507 </record>511 </record>
508512
=== modified file 'hr_holidays/hr_holidays.py'
--- hr_holidays/hr_holidays.py 2014-05-07 08:35:56 +0000
+++ hr_holidays/hr_holidays.py 2014-05-20 08:59:26 +0000
@@ -111,6 +111,20 @@
111 'hr_holidays.mt_holidays_confirmed': lambda self, cr, uid, obj, ctx=None: obj.state == 'confirm',111 'hr_holidays.mt_holidays_confirmed': lambda self, cr, uid, obj, ctx=None: obj.state == 'confirm',
112 },112 },
113 }113 }
114 _mail_actions = [{
115 'name': 'holidays_validate',
116 'type': 'object',
117 'string': 'Approve',
118 'condition': lambda self, obj, context=None: obj.state == 'confirm',
119 'button_type': 'success'
120 },
121 {
122 'name': 'holidays_refuse',
123 'type': 'object',
124 'string': 'Refuse',
125 'condition': lambda self, obj, context=None: obj.state == 'confirm' or obj.state == 'validate',
126 'button_type': 'warning'
127 }]
114128
115 def _employee_get(self, cr, uid, context=None): 129 def _employee_get(self, cr, uid, context=None):
116 emp_id = context.get('default_employee_id', False)130 emp_id = context.get('default_employee_id', False)
117131
=== modified file 'hr_recruitment/hr_recruitment.py'
--- hr_recruitment/hr_recruitment.py 2014-05-08 12:35:29 +0000
+++ hr_recruitment/hr_recruitment.py 2014-05-20 08:59:26 +0000
@@ -87,6 +87,20 @@
87 'hr_recruitment.mt_applicant_stage_changed': lambda self, cr, uid, obj, ctx=None: obj.stage_id and obj.stage_id.sequence > 1,87 'hr_recruitment.mt_applicant_stage_changed': lambda self, cr, uid, obj, ctx=None: obj.stage_id and obj.stage_id.sequence > 1,
88 },88 },
89 }89 }
90 _mail_actions = [{
91 'name': 'applicant_first_interview',
92 'type': 'object',
93 'string': 'Approve',
94 'condition': lambda self, obj, context=None: obj.stage_id.name == 'Initial Qualification',
95 'button_type': 'success'
96 },
97 {
98 'name': 'applicant_refused',
99 'type': 'object',
100 'string': 'Refuse',
101 'condition': lambda self, obj, context=None: obj.stage_id.name == 'Initial Qualification',
102 'button_type': 'warning'
103 }]
90 _mail_mass_mailing = _('Applicants')104 _mail_mass_mailing = _('Applicants')
91105
92 def _get_default_department_id(self, cr, uid, context=None):106 def _get_default_department_id(self, cr, uid, context=None):
@@ -240,6 +254,16 @@
240 'stage_id': _read_group_stage_ids254 'stage_id': _read_group_stage_ids
241 }255 }
242256
257 def applicant_first_interview(self, cr, uid, ids, context=None):
258 stage_id = self.pool['hr.recruitment.stage'].search(cr, uid, [('name','=','First Interview')], context=context)
259 if stage_id:
260 self.pool['hr.applicant'].write(cr, uid, ids, {'stage_id':stage_id[0]}, context=context)
261
262 def applicant_refused(self, cr, uid, ids, context=None):
263 stage_id = self.pool['hr.recruitment.stage'].search(cr, uid, [('name','=','Refused')], context=context)
264 if stage_id:
265 self.pool['hr.applicant'].write(cr, uid, ids, {'stage_id':stage_id[0]}, context=context)
266
243 def onchange_job(self, cr, uid, ids, job_id=False, context=None):267 def onchange_job(self, cr, uid, ids, job_id=False, context=None):
244 department_id = False268 department_id = False
245 if job_id:269 if job_id:
246270
=== modified file 'mail/controllers/main.py'
--- mail/controllers/main.py 2014-04-30 11:00:48 +0000
+++ mail/controllers/main.py 2014-05-20 08:59:26 +0000
@@ -1,5 +1,6 @@
1import base641import base64
2import psycopg22import psycopg2
3import werkzeug
34
4import openerp5import openerp
5from openerp import SUPERUSER_ID6from openerp import SUPERUSER_ID
@@ -42,3 +43,17 @@
42 except psycopg2.Error:43 except psycopg2.Error:
43 pass44 pass
44 return True45 return True
46
47 @http.route('/mail_action/<model>/<int:id>', type='http', auth='user')
48 def mail_action(self, model, id, action_name=None, action_type=None, action_id=None):
49 if not request.session.uid:
50 return login_redirect()
51 redirect_url = "/web?db=%s#id=%s&model=%s" %(request.db, id, model)
52 object_pool = request.registry.get(model)
53 if action_type in ['workflow','object']:
54 action = getattr(object_pool,action_name)
55 action(request.cr, request.uid, [id], context=request.context)
56 redirect_url += "&view_type=form"
57 if action_type == 'action':
58 redirect_url += "&action=%s" % action_id
59 return werkzeug.utils.redirect(redirect_url)
4560
=== modified file 'mail/mail_thread.py'
--- mail/mail_thread.py 2014-05-12 10:04:00 +0000
+++ mail/mail_thread.py 2014-05-20 08:59:26 +0000
@@ -24,6 +24,8 @@
24import datetime24import datetime
25import dateutil25import dateutil
26import email26import email
27import jinja2
28import sys
27try:29try:
28 import simplejson as json30 import simplejson as json
29except ImportError:31except ImportError:
@@ -46,6 +48,14 @@
4648
47_logger = logging.getLogger(__name__)49_logger = logging.getLogger(__name__)
4850
51if hasattr(sys, 'frozen'):
52 # When running on compiled windows binary, we don't have access to package loader.
53 path = os.path.realpath(os.path.join(os.path.dirname(__file__), '..', 'views'))
54 loader = jinja2.FileSystemLoader(path)
55else:
56 loader = jinja2.PackageLoader('openerp.addons.mail', "views")
57
58env = jinja2.Environment(loader=loader, autoescape=True)
4959
50def decode_header(message, header, separator=' '):60def decode_header(message, header, separator=' '):
51 return separator.join(map(decode, filter(None, message.get_all(header, []))))61 return separator.join(map(decode, filter(None, message.get_all(header, []))))
@@ -96,6 +106,14 @@
96 # :param obj: is a browse_record106 # :param obj: is a browse_record
97 # :param function lambda: returns whether the tracking should record using this subtype107 # :param function lambda: returns whether the tracking should record using this subtype
98 _track = {}108 _track = {}
109 _default_mail_actions = [{
110 'name': 'message_unsubscribe_users',
111 'type': 'object',
112 'string': 'Mute',
113 'condition': lambda self, obj, context=None: True,
114 'button_type': 'info'
115 }]
116 _mail_actions = []
99117
100 # Mass mailing feature118 # Mass mailing feature
101 _mail_mass_mailing = False119 _mail_mass_mailing = False
@@ -346,6 +364,23 @@
346 res['arch'] = etree.tostring(doc)364 res['arch'] = etree.tostring(doc)
347 return res365 return res
348366
367 def _prepare_body_mail_action(self, cr, uid, obj, context=None):
368 mail_actions = []
369 data_pool = self.pool['ir.model.data']
370 for mail_action in self._mail_actions + self._default_mail_actions:
371 condition_fn = mail_action['condition']
372 if mail_action.get('action_xml_id'):
373 dummy, act_id = data_pool.get_object_reference(cr, uid, mail_action['module'], mail_action['action_xml_id'])
374 mail_action['xml_id'] = act_id
375 if condition_fn(self, obj, context=context):
376 mail_actions.append(mail_action)
377 mail_actions_body = env.get_template("mail_actions_button.html").render({
378 'mail_actions': mail_actions,
379 'model': self._name,
380 'res_id': obj.id
381 })
382 return mail_actions_body
383
349 #------------------------------------------------------384 #------------------------------------------------------
350 # CRUD overrides for automatic subscription and logging385 # CRUD overrides for automatic subscription and logging
351 #------------------------------------------------------386 #------------------------------------------------------
@@ -358,7 +393,6 @@
358 """393 """
359 if context is None:394 if context is None:
360 context = {}395 context = {}
361
362 if context.get('tracking_disable'):396 if context.get('tracking_disable'):
363 return super(mail_thread, self).create(397 return super(mail_thread, self).create(
364 cr, uid, values, context=context)398 cr, uid, values, context=context)
@@ -370,11 +404,17 @@
370 message_follower_ids.append([4, pid])404 message_follower_ids.append([4, pid])
371 values['message_follower_ids'] = message_follower_ids405 values['message_follower_ids'] = message_follower_ids
372 thread_id = super(mail_thread, self).create(cr, uid, values, context=context)406 thread_id = super(mail_thread, self).create(cr, uid, values, context=context)
373407 message_body = ''
408 mail_actions_body = ''
409 if thread_id:
410 obj = self.browse(cr, uid, thread_id, context=context)
411 mail_actions_body = self._prepare_body_mail_action(cr, uid, obj)
374 # automatic logging unless asked not to (mainly for various testing purpose)412 # automatic logging unless asked not to (mainly for various testing purpose)
375 if not context.get('mail_create_nolog'):413 if not context.get('mail_create_nolog'):
376 self.message_post(cr, uid, thread_id, body=_('%s created') % (self._description), context=context)414 message_body +=_('%s created %s') % (self._description, mail_actions_body)
377415 else:
416 message_body += mail_actions_body
417 self.message_post(cr, uid, thread_id, body=message_body, context=context)
378 # auto_subscribe: take values and defaults into account418 # auto_subscribe: take values and defaults into account
379 create_values = dict(values)419 create_values = dict(values)
380 for key, val in context.iteritems():420 for key, val in context.iteritems():
@@ -415,6 +455,12 @@
415 initial_values = dict((record.id, dict((key, getattr(record, key)) for key in tracked_fields))455 initial_values = dict((record.id, dict((key, getattr(record, key)) for key in tracked_fields))
416 for record in records)456 for record in records)
417457
458 if ids:
459 obj = self.browse(cr, uid, ids[0], context=context)
460 mail_actions_body = self._prepare_body_mail_action(cr, uid, obj)
461 message_body = mail_actions_body
462 self.message_post(cr, uid, ids[0], body=message_body, context=context)
463
418 # Perform write, update followers464 # Perform write, update followers
419 result = super(mail_thread, self).write(cr, uid, ids, values, context=context)465 result = super(mail_thread, self).write(cr, uid, ids, values, context=context)
420 self.message_auto_subscribe(cr, uid, ids, values.keys(), context=context, values=values)466 self.message_auto_subscribe(cr, uid, ids, values.keys(), context=context, values=values)
421467
=== added file 'mail/views/mail_actions_button.html'
--- mail/views/mail_actions_button.html 1970-01-01 00:00:00 +0000
+++ mail/views/mail_actions_button.html 2014-05-20 08:59:26 +0000
@@ -0,0 +1,6 @@
1<div name="mail_actions_group">
2 {% set button_style = {'info': 'background: gray', 'warning': 'background: red', 'success': 'background:green'} %}
3 {% for button in mail_actions %}
4 <a class="btn btn-default" name="mail_action" style="color:BLACK;{{ button_style[button.button_type] }}" href="/mail_action/{{ model }}/{{ res_id }}?action_name={{ button.name }}&action_type={{ button.type }}&action_id={{ button.xml_id }}"> {{ button.string }} </a>
5 {% endfor %}
6</div>
07
=== modified file 'project/project.py'
--- project/project.py 2014-05-13 11:18:37 +0000
+++ project/project.py 2014-05-20 08:59:26 +0000
@@ -568,6 +568,13 @@
568 'project.mt_task_ready': lambda self, cr, uid, obj, ctx=None: obj.kanban_state == 'done',568 'project.mt_task_ready': lambda self, cr, uid, obj, ctx=None: obj.kanban_state == 'done',
569 },569 },
570 }570 }
571 _mail_actions = [{
572 'name': 'set_user',
573 'type': 'object',
574 'string': 'I will do it',
575 'condition': lambda self, obj, context=None: not obj.user_id,
576 'button_type': 'success'
577 }]
571578
572 def _get_default_partner(self, cr, uid, context=None):579 def _get_default_partner(self, cr, uid, context=None):
573 project_id = self._get_default_project_id(cr, uid, context)580 project_id = self._get_default_project_id(cr, uid, context)
@@ -666,6 +673,9 @@
666 res[task.id]['progress'] = 100.0673 res[task.id]['progress'] = 100.0
667 return res674 return res
668675
676 def set_user(self, cr, uid, ids, context=None):
677 self.pool['project.task'].write(cr, uid, ids, {'user_id':uid})
678
669 def onchange_remaining(self, cr, uid, ids, remaining=0.0, planned=0.0):679 def onchange_remaining(self, cr, uid, ids, remaining=0.0, planned=0.0):
670 if remaining and not planned:680 if remaining and not planned:
671 return {'value': {'planned_hours': remaining}}681 return {'value': {'planned_hours': remaining}}
672682
=== modified file 'project_issue/project_issue.py'
--- project_issue/project_issue.py 2014-05-08 15:25:36 +0000
+++ project_issue/project_issue.py 2014-05-20 08:59:26 +0000
@@ -60,6 +60,21 @@
60 'project_issue.mt_issue_ready': lambda self, cr, uid, obj, ctx=None: obj.kanban_state == 'done',60 'project_issue.mt_issue_ready': lambda self, cr, uid, obj, ctx=None: obj.kanban_state == 'done',
61 },61 },
62 }62 }
63 _mail_actions = [{
64 'name': 'set_user',
65 'type': 'object',
66 'string': 'I will do it',
67 'condition': lambda self, obj, context=None: not obj.user_id,
68 'button_type': 'success'
69 },
70 {
71 'type': 'action',
72 'string': 'Not interested',
73 'condition': lambda self, obj, context=None: not obj.user_id,
74 'button_type': 'warning',
75 'action_xml_id': 'action_view_issues',
76 'module': 'project_issue'
77 }]
6378
64 def _get_default_partner(self, cr, uid, context=None):79 def _get_default_partner(self, cr, uid, context=None):
65 project_id = self._get_default_project_id(cr, uid, context)80 project_id = self._get_default_project_id(cr, uid, context)
@@ -306,6 +321,9 @@
306 'stage_id': _read_group_stage_ids321 'stage_id': _read_group_stage_ids
307 }322 }
308323
324 def set_user(self, cr, uid, ids, context=None):
325 self.pool['project.issue'].write(cr, uid, ids, {'user_id':uid})
326
309 def copy(self, cr, uid, id, default=None, context=None):327 def copy(self, cr, uid, id, default=None, context=None):
310 issue = self.read(cr, uid, id, ['name'], context=context)328 issue = self.read(cr, uid, id, ['name'], context=context)
311 if not default:329 if not default:

Subscribers

People subscribed via source and target branches

to all changes: