Sanjay Gohel (Open ERP) has proposed merging lp:~openerp-dev/openobject-addons/trunk-mail-subtype-apa into lp:openobject-addons.
Requested reviews: Thibault Delavallée (OpenERP) (tde-openerp) For more details, see: https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-mail-subtype-apa/+merge/136128 -- https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-mail-subtype-apa/+merge/136128 Your team OpenERP R&D Team is subscribed to branch lp:~openerp-dev/openobject-addons/trunk-mail-subtype-apa.
=== modified file 'account/account_invoice.py' --- account/account_invoice.py 2012-11-21 10:21:37 +0000 +++ account/account_invoice.py 2012-11-26 10:27:50 +0000 @@ -359,8 +359,6 @@ context = {} try: res = super(account_invoice, self).create(cr, uid, vals, context) - if res: - self.create_send_note(cr, uid, [res], context=context) return res except Exception, e: if '"journal_id" viol' in e.args[0]: @@ -1065,7 +1063,7 @@ if obj_inv.type in ('out_invoice', 'out_refund'): ctx = self.get_log_context(cr, uid, context=ctx) message = _("Invoice '%s' is validated.") % name - self.message_post(cr, uid, [inv_id], body=message, context=context) + self.message_post(cr, uid, [inv_id], body=message, subtype="account.mt_invoice_validated", context=context) return True def action_cancel(self, cr, uid, ids, *args): @@ -1316,11 +1314,6 @@ } return type_dict.get(type, 'Invoice') - def create_send_note(self, cr, uid, ids, context=None): - for obj in self.browse(cr, uid, ids, context=context): - self.message_post(cr, uid, [obj.id], body=_("%s <b>created</b>.") % (self._get_document_type(obj.type)), - subtype="account.mt_invoice_new", context=context) - def confirm_paid_send_note(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids, context=context): self.message_post(cr, uid, [obj.id], body=_("%s <b>paid</b>.") % (self._get_document_type(obj.type)), === modified file 'account/data/account_data.xml' --- account/data/account_data.xml 2012-10-19 05:14:38 +0000 +++ account/data/account_data.xml 2012-11-26 10:27:50 +0000 @@ -562,12 +562,13 @@ </record> <!-- mail: subtypes --> - <record id="mt_invoice_new" model="mail.message.subtype"> - <field name="name">created</field> + <record id="mt_invoice_validated" model="mail.message.subtype"> + <field name="name">Validated</field> <field name="res_model">account.invoice</field> + <field name="default" eval="False"/> </record> <record id="mt_invoice_paid" model="mail.message.subtype"> - <field name="name">paid</field> + <field name="name">Paid</field> <field name="res_model">account.invoice</field> </record> </data> === modified file 'analytic/__openerp__.py' --- analytic/__openerp__.py 2012-09-30 14:16:38 +0000 +++ analytic/__openerp__.py 2012-11-26 10:27:50 +0000 @@ -38,8 +38,7 @@ 'security/analytic_security.xml', 'security/ir.model.access.csv', 'analytic_sequence.xml', - 'analytic_view.xml', - 'analytic_data.xml' + 'analytic_view.xml' ], 'demo': [], 'installable': True, === modified file 'analytic/analytic.py' --- analytic/analytic.py 2012-11-15 12:38:51 +0000 +++ analytic/analytic.py 2012-11-26 10:27:50 +0000 @@ -313,7 +313,7 @@ if obj.partner_id: message = _("Contract for <em>%s</em> has been <b>created</b>.") % (obj.partner_id.name,) self.message_post(cr, uid, [obj.id], body=message, - subtype="analytic.mt_account_status", context=context) + context=context) account_analytic_account() === removed file 'analytic/analytic_data.xml' --- analytic/analytic_data.xml 2012-10-02 20:40:23 +0000 +++ analytic/analytic_data.xml 1970-01-01 00:00:00 +0000 @@ -1,12 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<openerp> - <data noupdate="1"> - - <!-- mail: subtypes --> - <record id="mt_account_status" model="mail.message.subtype"> - <field name="name">Status Change</field> - <field name="res_model">account.analytic.account</field> - </record> - - </data> -</openerp> === modified file 'crm/crm_lead.py' --- crm/crm_lead.py 2012-11-24 17:53:19 +0000 +++ crm/crm_lead.py 2012-11-26 10:27:50 +0000 @@ -846,7 +846,7 @@ def stage_set_send_note(self, cr, uid, ids, stage_id, context=None): """ Override of the (void) default notification method. """ stage_name = self.pool.get('crm.case.stage').name_get(cr, uid, [stage_id], context=context)[0][1] - return self.message_post(cr, uid, ids, body=_("Stage changed to <b>%s</b>.") % (stage_name), subtype="mt_crm_stage", context=context) + return self.message_post(cr, uid, ids, body= _("Stage changed to <b>%s</b>.") % (stage_name), subtype="crm.mt_lead_stage", context=context) def case_get_note_msg_prefix(self, cr, uid, lead, context=None): if isinstance(lead, (int, long)): @@ -861,11 +861,11 @@ def case_mark_lost_send_note(self, cr, uid, ids, context=None): message = _("Opportunity has been <b>lost</b>.") - return self.message_post(cr, uid, ids, body=message, subtype="mt_crm_lost", context=context) + return self.message_post(cr, uid, ids, body=message, subtype="crm.mt_lead_lost", context=context) def case_mark_won_send_note(self, cr, uid, ids, context=None): message = _("Opportunity has been <b>won</b>.") - return self.message_post(cr, uid, ids, body=message, subtype="mt_crm_won", context=context) + return self.message_post(cr, uid, ids, body=message, subtype="crm.mt_lead_won", context=context) def schedule_phonecall_send_note(self, cr, uid, ids, phonecall_id, action, context=None): phonecall = self.pool.get('crm.phonecall').browse(cr, uid, [phonecall_id], context=context)[0] @@ -882,7 +882,7 @@ def convert_opportunity_send_note(self, cr, uid, lead, context=None): message = _("Lead has been <b>converted to an opportunity</b>.") - lead.message_post(body=message) + lead.message_post(body=message, subtype="crm.mt_lead_convert_to_opportunity") return True def onchange_state(self, cr, uid, ids, state_id, context=None): @@ -891,4 +891,10 @@ return {'value':{'country_id':country_id}} return {} + def _get_subscription_data(self, cr, uid, ids, name, args, context=None): + res = super(crm_lead,self)._get_subscription_data(cr, uid, ids, name, args, context=context) + for subtype in self.browse(cr, uid, ids,context=context): + if subtype.type == 'opportunity': + del res[subtype.id]['message_subtype_data']['Convert to Opportunity'] + return res # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: === modified file 'crm/crm_lead_data.xml' --- crm/crm_lead_data.xml 2012-11-16 09:50:41 +0000 +++ crm/crm_lead_data.xml 2012-11-26 10:27:50 +0000 @@ -154,21 +154,56 @@ <field name="object_id" search="[('model','=','crm.lead')]" model="ir.model"/> </record> - <!-- mail subtype --> - <record id="mail.mt_crm_won" model="mail.message.subtype"> - <field name="name">Won</field> - <field name="res_model">crm.lead</field> - </record> - <record id="mail.mt_crm_lost" model="mail.message.subtype"> - <field name="name">Lost</field> + <record id="mt_lead_convert_to_opportunity" model="mail.message.subtype"> + <field name="name">Convert to Opportunity</field> <field name="res_model">crm.lead</field> <field name="default" eval="False"/> </record> - <record id="mail.mt_crm_stage" model="mail.message.subtype"> + + <record id="mt_lead_stage" model="mail.message.subtype"> <field name="name">Stage Changed</field> <field name="res_model">crm.lead</field> <field name="default" eval="False"/> </record> + <record id="mt_lead_lost" model="mail.message.subtype"> + <field name="name">Lost</field> + <field name="res_model">crm.lead</field> + <field name="default" eval="False"/> + </record> + + <record id="mt_lead_won" model="mail.message.subtype"> + <field name="name">Won</field> + <field name="res_model">crm.lead</field> + </record> + + <record id="mt_salesteam_lead" model="mail.message.subtype"> + <field name="name">Leads Created</field> + <field name="res_model">crm.case.section</field> + <field name="default" eval="False"/> + </record> + + <record id="mt_salesteam_lead_opportunity" model="mail.message.subtype"> + <field name="name">Leads to Opportunity</field> + <field name="res_model">crm.case.section</field> + <field name="default" eval="False"/> + </record> + + <record id="mt_salesteam_stage" model="mail.message.subtype"> + <field name="name">Leads Stage Changed</field> + <field name="res_model">crm.case.section</field> + <field name="default" eval="False"/> + </record> + + <record id="mt_salesteam_lost" model="mail.message.subtype"> + <field name="name">Opportunity Lost</field> + <field name="res_model">crm.case.section</field> + <field name="default" eval="False"/> + </record> + + <record id="mt_salesteam_won" model="mail.message.subtype"> + <field name="name">Opportunity Won</field> + <field name="res_model">crm.case.section</field> + </record> </data> </openerp> === modified file 'crm/crm_view.xml' --- crm/crm_view.xml 2012-11-26 07:45:10 +0000 +++ crm/crm_view.xml 2012-11-26 10:27:50 +0000 @@ -131,7 +131,7 @@ </page> </notebook> <div class="oe_chatter"> - <field name="message_follower_ids" widget="mail_followers" help="Followers of this salesteam follow automatically all opportunities related to this salesteam."/> + <field name="message_follower_ids" widget="mail_followers" help="Follow this salesteam to automatically track the events associated to users of this team."/> <field name="message_ids" widget="mail_thread"/> </div> </form> === modified file 'hr_expense/hr_expense.py' --- hr_expense/hr_expense.py 2012-11-15 12:38:51 +0000 +++ hr_expense/hr_expense.py 2012-11-26 10:27:50 +0000 @@ -127,6 +127,7 @@ for expense in self.browse(cr, uid, ids): if expense.employee_id and expense.employee_id.parent_id.user_id: self.message_subscribe_users(cr, uid, [expense.id], user_ids=[expense.employee_id.parent_id.user_id.id]) + self.expense_toapprove_notificate(cr, uid, ids) self.write(cr, uid, ids, { 'state':'confirm', 'date_confirm': time.strftime('%Y-%m-%d') @@ -134,6 +135,7 @@ return True def expense_accept(self, cr, uid, ids, *args): + self.expense_approve_notificate(cr, uid, ids) self.write(cr, uid, ids, { 'state':'accepted', 'date_valid':time.strftime('%Y-%m-%d'), @@ -142,6 +144,7 @@ return True def expense_canceled(self, cr, uid, ids, *args): + self.expense_refuse_notificate(cr, uid, ids) self.write(cr, uid, ids, {'state':'cancelled'}) return True @@ -234,6 +237,21 @@ } return result + def expense_toapprove_notificate(self, cr, uid, ids, context=None): + for obj in self.browse(cr, uid, ids): + self.message_post(cr, uid, [obj.id], + _("The request is <b>waiting for Approval</b>"), subtype="hr_expense.mt_expense_approve", context=context) + + def expense_approve_notificate(self, cr, uid, ids, context=None): + for obj in self.browse(cr, uid, ids): + self.message_post(cr, uid, [obj.id], + _("The request has been <b>approved</b>"), subtype="hr_expense.mt_expense_approved", context=context) + + def expense_refuse_notificate(self, cr, uid, ids, context=None): + for obj in self.browse(cr, uid, ids): + self.message_post(cr, uid, [obj.id], + _("Request <b>refused</b>"), subtype="hr_expense.mt_expense_refused", context=context) + hr_expense_expense() class product_product(osv.osv): === modified file 'hr_expense/hr_expense_data.xml' --- hr_expense/hr_expense_data.xml 2012-11-14 11:55:04 +0000 +++ hr_expense/hr_expense_data.xml 2012-11-26 10:27:50 +0000 @@ -17,5 +17,24 @@ <field name="parent_id" ref="product.product_category_all"/> <field name="name">Expenses</field> </record> + + <!--subtype for expense --> + <record id="mt_expense_approve" model="mail.message.subtype"> + <field name="name">To Approve</field> + <field name="res_model">hr.expense.expense</field> + <field name="default" eval="False"/> + </record> + + <record id="mt_expense_approved" model="mail.message.subtype"> + <field name="name">Approved</field> + <field name="res_model">hr.expense.expense</field> + <field name="default" eval="False"/> + </record> + + <record id="mt_expense_refused" model="mail.message.subtype"> + <field name="name">Refused</field> + <field name="res_model">hr.expense.expense</field> + <field name="default" eval="False"/> + </record> </data> </openerp> === modified file 'hr_holidays/hr_holidays.py' --- hr_holidays/hr_holidays.py 2012-11-20 13:29:26 +0000 +++ hr_holidays/hr_holidays.py 2012-11-26 10:27:50 +0000 @@ -431,7 +431,7 @@ def holidays_confirm_notificate(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids): self.message_post(cr, uid, [obj.id], - _("Request <b>submitted</b>, waiting for validation by the manager."), context=context) + _("Request <b>submitted</b>, waiting for validation by the manager."), subtype="hr_holidays.mt_approve", context=context) def holidays_first_validate_notificate(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids, context=context): @@ -445,12 +445,12 @@ _("Request <b>validated</b>."), context=context) else: self.message_post(cr, uid, [obj.id], - _("The request has been <b>approved</b>."), context=context) + _("The request has been <b>approved</b>."), subtype="hr_holidays.mt_approved", context=context) def holidays_refuse_notificate(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids): self.message_post(cr, uid, [obj.id], - _("Request <b>refused</b>"), context=context) + _("Request <b>refused</b>"), subtype="hr_holidays.mt_refused", context=context) class resource_calendar_leaves(osv.osv): === modified file 'hr_holidays/hr_holidays_data.xml' --- hr_holidays/hr_holidays_data.xml 2012-11-14 11:55:04 +0000 +++ hr_holidays/hr_holidays_data.xml 2012-11-26 10:27:50 +0000 @@ -44,5 +44,25 @@ <field name="limit">True</field> <field name="color_name">brown</field> </record> + + <!--subtype for leaves --> + <record id="mt_approve" model="mail.message.subtype"> + <field name="name">To Approve</field> + <field name="res_model">hr.holidays</field> + <field name="default" eval="False"/> + </record> + + <record id="mt_approved" model="mail.message.subtype"> + <field name="name">Approved</field> + <field name="res_model">hr.holidays</field> + <field name="default" eval="False"/> + </record> + + <record id="mt_refused" model="mail.message.subtype"> + <field name="name">Refused</field> + <field name="res_model">hr.holidays</field> + <field name="default" eval="False"/> + </record> + </data> </openerp> === modified file 'hr_recruitment/hr_recruitment.py' --- hr_recruitment/hr_recruitment.py 2012-11-19 14:42:36 +0000 +++ hr_recruitment/hr_recruitment.py 2012-11-26 10:27:50 +0000 @@ -469,12 +469,6 @@ # OpenChatter methods and notifications # ------------------------------------------------------- - def stage_set_send_note(self, cr, uid, ids, stage_id, context=None): - """ Override of the (void) default notification method. """ - if not stage_id: return True - stage_name = self.pool.get('hr.recruitment.stage').name_get(cr, uid, [stage_id], context=context)[0][1] - return self.message_post(cr, uid, ids, body=_("Stage changed to <b>%s</b>.") % (stage_name), context=context) - def case_get_note_msg_prefix(self, cr, uid, id, context=None): return 'Applicant' @@ -487,18 +481,18 @@ context = {} for applicant in self.browse(cr, uid, ids, context=context): if applicant.job_id: - self.pool.get('hr.job').message_post(cr, uid, [applicant.job_id.id], body=_('New employee joined the company %s.')%(applicant.name,), subtype="hr_recruitment.mt_hired", context=context) + self.pool.get('hr.job').message_post(cr, uid, [applicant.job_id.id], body=_('New employee joined the company %s.')%(applicant.name,), context=context) if applicant.emp_id: message = _("Applicant has been <b>hired</b> and created as an employee.") - self.message_post(cr, uid, [applicant.id], body=message, context=context) + self.message_post(cr, uid, [applicant.id], body=message, subtype="hr_recruitment.mt_applicant_hired", context=context) else: message = _("Applicant has been <b>hired</b>.") - self.message_post(cr, uid, [applicant.id], body=message, context=context) + self.message_post(cr, uid, [applicant.id], body=message, subtype="hr_recruitment.mt_applicant_hired", context=context) return True def case_cancel_send_note(self, cr, uid, ids, context=None): msg = 'Applicant <b>refused</b>.' - return self.message_post(cr, uid, ids, body=msg, context=context) + return self.message_post(cr, uid, ids, body=msg, subtype="hr_recruitment.mt_applicant_refused",context=context) def case_reset_send_note(self, cr, uid, ids, context=None): message =_("Applicant has been set as <b>new</b>.") === modified file 'hr_recruitment/hr_recruitment_data.xml' --- hr_recruitment/hr_recruitment_data.xml 2012-11-15 15:09:45 +0000 +++ hr_recruitment/hr_recruitment_data.xml 2012-11-26 10:27:50 +0000 @@ -462,13 +462,39 @@ </record> <!-- mail: subtypes --> - <record id="mt_hired" model="mail.message.subtype"> - <field name="name">Employee Hired</field> - <field name="res_model">hr.job</field> - </record> <record id="mt_applicant_new" model="mail.message.subtype"> <field name="name">New Applicant</field> <field name="res_model">hr.job</field> </record> + <record id="mt_job_stage_changed" model="mail.message.subtype"> + <field name="name">Stage Changed</field> + <field name="res_model">hr.job</field> + <field name="default" eval="False"/> + </record> + <record id="mt_job_applicant_hired" model="mail.message.subtype"> + <field name="name">Applicant Hired</field> + <field name="res_model">hr.job</field> + <field name="default" eval="False"/> + </record> + <record id="mt_job_applicant_refused" model="mail.message.subtype"> + <field name="name">Refused</field> + <field name="res_model">hr.job</field> + <field name="default" eval="False"/> + </record> + <record id="mt_stage_changed" model="mail.message.subtype"> + <field name="name">Stage Changed</field> + <field name="res_model">hr.applicant</field> + <field name="default" eval="False"/> + </record> + <record id="mt_applicant_hired" model="mail.message.subtype"> + <field name="name">Applicant Hired</field> + <field name="res_model">hr.applicant</field> + <field name="default" eval="False"/> + </record> + <record id="mt_applicant_refused" model="mail.message.subtype"> + <field name="name">Applicant Refused</field> + <field name="res_model">hr.applicant</field> + <field name="default" eval="False"/> + </record> </data> </openerp> === modified file 'hr_timesheet_invoice/hr_timesheet_invoice.py' --- hr_timesheet_invoice/hr_timesheet_invoice.py 2012-11-03 13:45:12 +0000 +++ hr_timesheet_invoice/hr_timesheet_invoice.py 2012-11-26 10:27:50 +0000 @@ -101,19 +101,19 @@ def set_cancel(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state': 'cancelled'}, context=context) message = _("Contract has been <b>canceled</b>.") - self.message_post(cr, uid, ids, body=message, subtype="hr_timesheet_invoice.mt_account_canceled", context=context) + self.message_post(cr, uid, ids, body=message, context=context) return True def set_open(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state': 'open'}, context=context) message = _("Contract has been <b>opened</b>.") - self.message_post(cr, uid, ids, body=message, context=context) + self.message_post(cr, uid, ids, body=message, subtype="hr_timesheet_invoice.mt_account_renewed", context=context) return True def set_pending(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'state': 'pending'}, context=context) message = _("Contract has been set as <b>pending</b>.") - self.message_post(cr, uid, ids, body=message, context=context) + self.message_post(cr, uid, ids, body=message, subtype="hr_timesheet_invoice.mt_account_renew", context=context) return True account_analytic_account() === modified file 'hr_timesheet_invoice/hr_timesheet_invoice_data.xml' --- hr_timesheet_invoice/hr_timesheet_invoice_data.xml 2012-11-02 08:36:12 +0000 +++ hr_timesheet_invoice/hr_timesheet_invoice_data.xml 2012-11-26 10:27:50 +0000 @@ -23,13 +23,32 @@ </record> <!-- mail: subtypes --> + <record id="mt_account_renew" model="mail.message.subtype"> + <field name="name">Contract to Renew</field> + <field name="res_model">account.analytic.account</field> + </record> <record id="mt_account_closed" model="mail.message.subtype"> - <field name="name">finished</field> - <field name="res_model">account.analytic.account</field> - </record> - <record id="mt_account_canceled" model="mail.message.subtype"> - <field name="name">canceled</field> - <field name="res_model">account.analytic.account</field> + <field name="name">Contract Finished</field> + <field name="res_model">account.analytic.account</field> + </record> + <record id="mt_account_renewed" model="mail.message.subtype"> + <field name="name">Contract Renewed</field> + <field name="res_model">account.analytic.account</field> + </record> + <record id="mt_salesteam_renew" model="mail.message.subtype"> + <field name="name">Contract to Renew</field> + <field name="res_model">crm.case.section</field> + <field name="default" eval="False"/> + </record> + <record id="mt_salesteam_finished" model="mail.message.subtype"> + <field name="name">Contract Finished</field> + <field name="res_model">crm.case.section</field> + <field name="default" eval="False"/> + </record> + <record id="mt_salesteam_renewed" model="mail.message.subtype"> + <field name="name">Contract Renewed</field> + <field name="res_model">crm.case.section</field> + <field name="default" eval="False"/> </record> </data> === modified file 'mail/static/src/js/mail_followers.js' --- mail/static/src/js/mail_followers.js 2012-11-20 16:24:34 +0000 +++ mail/static/src/js/mail_followers.js 2012-11-26 10:27:50 +0000 @@ -184,7 +184,6 @@ /** Fetch subtypes, only if current user is follower */ fetch_subtypes: function () { - var subtype_list_ul = this.$('.oe_subtype_list').empty(); if (! this.message_is_follower) return; var context = new session.web.CompoundContext(this.build_context(), {}); this.ds_model.call('message_get_subscription_data', [[this.view.datarecord.id], context]).then(this.proxy('display_subtypes')); @@ -193,14 +192,25 @@ /** Display subtypes: {'name': default, followed} */ display_subtypes:function (data) { var self = this; + var subtype = []; var subtype_list_ul = this.$('.oe_subtype_list'); subtype_list_ul.empty(); var records = data[this.view.datarecord.id || this.view.dataset.ids[0]].message_subtype_data; + var count = 0; + subtype_list_ul.empty().hide(); _(records).each(function (record, record_name) { + count++; record.name = record_name; record.followed = record.followed || undefined; - $(session.web.qweb.render('mail.followers.subtype', {'record': record})).appendTo( self.$('.oe_subtype_list') ); + subtype.push(record); + }) + subtype.sort(function(a,b){return a.id - b.id}); + _(subtype).each(function (record) { + $(session.web.qweb.render('mail.followers.subtype', {'record': record})).appendTo( subtype_list_ul ); }); + if (count > 1) { + subtype_list_ul.show(); + } }, do_follow: function () { @@ -228,7 +238,9 @@ checklist.push(parseInt($(record).data('id'))); } }); - + if (!checklist.length) { + return self.do_unfollow(); + } var context = new session.web.CompoundContext(this.build_context(), {}); return this.ds_model.call('message_subscribe_users', [[this.view.datarecord.id], [this.session.uid], this.message_is_follower ? checklist : undefined, context]) .then(this.proxy('read_value')); === modified file 'mail/static/src/xml/mail_followers.xml' --- mail/static/src/xml/mail_followers.xml 2012-10-29 13:09:37 +0000 +++ mail/static/src/xml/mail_followers.xml 2012-11-26 10:27:50 +0000 @@ -12,11 +12,12 @@ <span class="oe_unfollow">Unfollow</span> <span class="oe_following">Following</span> </button> + <t t-if="widget.comment"> + <h5 class="oe_comment"><t t-raw="widget.comment"/></h5> + </t> <div class="oe_subtype_list"></div> </div> - <t t-if="widget.comment"> - <h5 class="oe_comment"><t t-raw="widget.comment"/></h5> - </t> + <hr size="2"></hr> <div class='oe_follower_title_box'> <h4 class='oe_follower_title'>Followers</h4> <a href='#' class="oe_invite">Invite others</a> === modified file 'project/project.py' --- project/project.py 2012-11-19 13:25:09 +0000 +++ project/project.py 2012-11-26 10:27:50 +0000 @@ -311,7 +311,6 @@ task_ids = task_obj.search(cr, uid, [('project_id', 'in', ids), ('state', '!=', 'done')]) task_obj.case_cancel(cr, uid, task_ids, context=context) self.write(cr, uid, ids, {'state':'cancelled'}, context=context) - self.set_cancel_send_note(cr, uid, ids, context=context) return True def set_pending(self, cr, uid, ids, context=None): @@ -556,9 +555,6 @@ def set_pending_send_note(self, cr, uid, ids, context=None): return self.message_post(cr, uid, ids, body=_("Project is now <b>pending</b>."), context=context) - def set_cancel_send_note(self, cr, uid, ids, context=None): - return self.message_post(cr, uid, ids, body=_("Project has been <b>canceled</b>."), context=context) - def set_close_send_note(self, cr, uid, ids, context=None): return self.message_post(cr, uid, ids, body=_("Project has been <b>closed</b>."), context=context) @@ -1012,7 +1008,6 @@ self._check_child_task(cr, uid, ids, context=context) for task in tasks: self.case_set(cr, uid, [task.id], 'cancelled', {'remaining_hours': 0.0}, context=context) - self.case_cancel_send_note(cr, uid, [task.id], context=context) return True def do_open(self, cr, uid, ids, context=None): @@ -1105,11 +1100,13 @@ def set_kanban_state_blocked(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'kanban_state': 'blocked'}, context=context) - return False + self.case_block_send_note(cr, uid, ids, context=context) + return True def set_kanban_state_normal(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'kanban_state': 'normal'}, context=context) - return False + self.case_open_send_note(cr, uid, ids, context=context) + return True def set_kanban_state_done(self, cr, uid, ids, context=None): self.write(cr, uid, ids, {'kanban_state': 'done'}, context=context) @@ -1178,7 +1175,6 @@ #raise osv.except_osv(_('Warning!'), _('Stage is not defined in the project.')) write_vals = vals_reset_kstate if t.stage_id != new_stage else vals super(task, self).write(cr, uid, [t.id], write_vals, context=context) - self.stage_set_send_note(cr, uid, [t.id], new_stage, context=context) result = True else: result = super(task, self).write(cr, uid, ids, vals, context=context) @@ -1288,15 +1284,22 @@ res = super(task, self).message_get_monitored_follower_fields(cr, uid, ids, context=context) return res + ['user_id', 'manager_id'] + def create_send_note(self, cr, uid, ids, context=None): + return self.message_post(cr, uid, ids, body=_("Task has been <b>created</b>."), subtype="project.mt_task_new", context=context) def stage_set_send_note(self, cr, uid, ids, stage_id, context=None): """ Override of the (void) default notification method. """ stage_name = self.pool.get('project.task.type').name_get(cr, uid, [stage_id], context=context)[0][1] return self.message_post(cr, uid, ids, body=_("Stage changed to <b>%s</b>.") % (stage_name), context=context) - - def create_send_note(self, cr, uid, ids, context=None): - return self.message_post(cr, uid, ids, body=_("Task has been <b>created</b>."), context=context) - + def case_open_send_note(self, cr, uid, ids, context=None): + return self.message_post(cr, uid, ids, body=_("Task has been <b>started</b>."), subtype="project.mt_task_started", context=context) + + def case_close_send_note(self, cr, uid, ids, context=None): + return self.message_post(cr, uid, ids, body=_("Task has been <b>done</b>."), subtype="project.mt_task_closed", context=context) + + def case_block_send_note(self, cr, uid, ids, context=None): + return self.message_post(cr, uid, ids, body=_("Task has been <b>blocked</b>."), subtype="project.mt_task_blocked", context=context) + def case_draft_send_note(self, cr, uid, ids, context=None): return self.message_post(cr, uid, ids, body=_('Task has been set as <b>draft</b>.'), context=context) === modified file 'project/project_data.xml' --- project/project_data.xml 2012-11-22 23:54:55 +0000 +++ project/project_data.xml 2012-11-26 10:27:50 +0000 @@ -80,37 +80,35 @@ <!-- mail: subtypes --> <record id="mt_project_new" model="mail.message.subtype"> - <field name="name">New</field> + <field name="name">Task Created</field> <field name="res_model">project.project</field> <field name="default" eval="False"/> </record> + <record id="mt_project_started" model="mail.message.subtype"> + <field name="name">Task Started</field> + <field name="res_model">project.project</field> + </record> <record id="mt_project_closed" model="mail.message.subtype"> - <field name="name">Closed</field> - <field name="res_model">project.project</field> - </record> - <record id="mt_project_canceled" model="mail.message.subtype"> - <field name="name">Canceled</field> - <field name="res_model">project.project</field> - </record> - <record id="mt_project_stage" model="mail.message.subtype"> - <field name="name">Stage Changed</field> - <field name="res_model">project.project</field> - </record> - + <field name="name">Task Done</field> + <field name="res_model">project.project</field> + </record> + <record id="mt_task_new" model="mail.message.subtype"> - <field name="name">New</field> - <field name="res_model">project.task</field> + <field name="name">Task Created</field> + <field name="res_model">project.task</field> + <field name="default" eval="False"/> + </record> + <record id="mt_task_started" model="mail.message.subtype"> + <field name="name">Task Started</field> + <field name="res_model">project.task</field> + </record> + <record id="mt_task_blocked" model="mail.message.subtype"> + <field name="name">Task Blocked</field> + <field name="res_model">project.task</field> + <field name="default" eval="False"/> </record> <record id="mt_task_closed" model="mail.message.subtype"> - <field name="name">Closed</field> - <field name="res_model">project.task</field> - </record> - <record id="mt_task_canceled" model="mail.message.subtype"> - <field name="name">Canceled</field> - <field name="res_model">project.task</field> - </record> - <record id="mt_task_change" model="mail.message.subtype"> - <field name="name">Stage Changed</field> + <field name="name">Task Done</field> <field name="res_model">project.task</field> </record> === modified file 'project/project_view.xml' --- project/project_view.xml 2012-11-21 16:27:53 +0000 +++ project/project_view.xml 2012-11-26 10:27:50 +0000 @@ -152,7 +152,7 @@ </notebook> </sheet> <div class="oe_chatter"> - <field name="message_follower_ids" widget="mail_followers" help="Follow this project to automatically follow all related tasks and issues."/> + <field name="message_follower_ids" widget="mail_followers" help="Follow this project to automatically track the events associated to tasks and issues of this project."/> <field name="message_ids" widget="mail_thread"/> </div> </form> === modified file 'project_issue/project_issue.py' --- project_issue/project_issue.py 2012-11-02 16:07:34 +0000 +++ project_issue/project_issue.py 2012-11-26 10:27:50 +0000 @@ -396,7 +396,7 @@ self._subscribe_project_followers_to_issue(cr, uid, id, context=context) return super(project_issue, self).write(cr, uid, ids, vals, context) - + def onchange_task_id(self, cr, uid, ids, task_id, context=None): if not task_id: return {'value': {}} @@ -457,7 +457,6 @@ def case_cancel(self, cr, uid, ids, context=None): """ Cancels case """ self.case_set(cr, uid, ids, 'cancelled', {'active': True}, context=context) - self.case_cancel_send_note(cr, uid, ids, context=context) return True def case_escalate(self, cr, uid, ids, context=None): @@ -535,12 +534,11 @@ # ------------------------------------------------------- # OpenChatter methods and notifications # ------------------------------------------------------- - def stage_set_send_note(self, cr, uid, ids, stage_id, context=None): """ Override of the (void) default notification method. """ stage_name = self.pool.get('project.task.type').name_get(cr, uid, [stage_id], context=context)[0][1] - return self.message_post(cr, uid, ids, body= _("Stage changed to <b>%s</b>.") % (stage_name), subtype="mt_issue_new", context=context) - + return self.message_post(cr, uid, ids, body= _("Stage changed to <b>%s</b>.") % (stage_name), context=context) + def case_get_note_msg_prefix(self, cr, uid, id, context=None): """ Override of default prefix for notifications. """ return 'Project issue' @@ -548,7 +546,7 @@ def convert_to_task_send_note(self, cr, uid, ids, context=None): message = _("Project issue <b>converted</b> to task.") return self.message_post(cr, uid, ids, body=message, context=context) - + def create_send_note(self, cr, uid, ids, context=None): message = _("Project issue <b>created</b>.") return self.message_post(cr, uid, ids, body=message, subtype="mt_issue_new", context=context) @@ -563,6 +561,9 @@ obj.message_post(body=message) return True + def case_close_send_note(self, cr, uid, ids, context=None): + return self.message_post(cr, uid, ids, body=_("Project issue has been <b>done</b>."), subtype="mail.mt_issue_closed", context=context) + project_issue() class project(osv.osv): === modified file 'project_issue/project_issue_data.xml' --- project_issue/project_issue_data.xml 2012-11-15 15:09:45 +0000 +++ project_issue/project_issue_data.xml 2012-11-26 10:27:50 +0000 @@ -45,21 +45,30 @@ <!-- Mail subtypes --> <record id="mail.mt_issue_new" model="mail.message.subtype"> - <field name="name">New</field> + <field name="name">Issue Created</field> + <field name="res_model">project.issue</field> + </record> + <record id="mail.mt_issue_change" model="mail.message.subtype"> + <field name="name">Issue Started</field> <field name="res_model">project.issue</field> </record> <record id="mail.mt_issue_closed" model="mail.message.subtype"> - <field name="name">Closed</field> - <field name="res_model">project.issue</field> - </record> - <record id="mail.mt_issue_canceled" model="mail.message.subtype"> - <field name="name">Canceled</field> - <field name="res_model">project.issue</field> - </record> - <record id="mail.mt_issue_change" model="mail.message.subtype"> - <field name="name">Stage Changed</field> + <field name="name">Issue Closed</field> <field name="res_model">project.issue</field> </record> + <record id="mail.mt_prj_issue_new" model="mail.message.subtype"> + <field name="name">Issue Created</field> + <field name="res_model">project.project</field> + </record> + <record id="mail.mt_prj_issue_started" model="mail.message.subtype"> + <field name="name">Issue Started</field> + <field name="res_model">project.project</field> + </record> + <record id="mail.mt_prj_issue_closed" model="mail.message.subtype"> + <field name="name">Issue Closed</field> + <field name="res_model">project.project</field> + </record> + </data> </openerp> === modified file 'purchase/purchase.py' --- purchase/purchase.py 2012-11-20 11:36:00 +0000 +++ purchase/purchase.py 2012-11-26 10:27:50 +0000 @@ -790,7 +790,7 @@ def confirm_send_note(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids, context=context): - self.message_post(cr, uid, [obj.id], body=_("Quotation for <em>%s</em> <b>converted</b> to a Purchase Order of %s %s.") % (obj.partner_id.name, obj.amount_total, obj.pricelist_id.currency_id.symbol), context=context) + self.message_post(cr, uid, [obj.id], body=_("Quotation for <em>%s</em> <b>converted</b> to a Purchase Order of %s %s.") % (obj.partner_id.name, obj.amount_total, obj.pricelist_id.currency_id.symbol), subtype="purchase.mt_rfq_confirmed", context=context) def shipment_send_note(self, cr, uid, ids, picking_id, context=None): for order in self.browse(cr, uid, ids, context=context): === modified file 'purchase/purchase_data.xml' --- purchase/purchase_data.xml 2012-11-14 11:55:04 +0000 +++ purchase/purchase_data.xml 2012-11-26 10:27:50 +0000 @@ -49,5 +49,16 @@ model="ir.values" name="set"/> + <record id="mt_rfq_confirmed" model="mail.message.subtype"> + <field name="name">RFQ Confirmed</field> + <field name="res_model">purchase.order</field> + <field name="default" eval="False"/> + </record> + + <record id="mt_rfq_approved" model="mail.message.subtype"> + <field name="name">RFQ Approved</field> + <field name="res_model">purchase.order</field> + <field name="default" eval="False"/> + </record> </data> </openerp> === modified file 'sale/sale.py' --- sale/sale.py 2012-11-21 10:21:37 +0000 +++ sale/sale.py 2012-11-26 10:27:50 +0000 @@ -682,7 +682,7 @@ def confirm_send_note(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids, context=context): - self.message_post(cr, uid, [obj.id], body=_("Quotation for <em>%s</em> <b>converted</b> to Sale Order of %s %s.") % (obj.partner_id.name, obj.amount_total, obj.pricelist_id.currency_id.symbol), context=context) + self.message_post(cr, uid, [obj.id], body=_("Quotation for <em>%s</em> <b>converted</b> to Sale Order of %s %s.") % (obj.partner_id.name, obj.amount_total, obj.pricelist_id.currency_id.symbol), subtype="sale.mt_order_confirmed", context=context) def cancel_send_note(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids, context=context): === modified file 'sale/sale_data.xml' --- sale/sale_data.xml 2012-11-15 15:09:45 +0000 +++ sale/sale_data.xml 2012-11-26 10:27:50 +0000 @@ -43,5 +43,28 @@ <field name="body"><![CDATA[<p>This application lets you create and send quotations and process your sales orders; from delivery to invoicing.</p> <p>If you need to manage your sales pipeline (leads, opportunities, phonecalls), the <i>CRM</i> application may be useful. Use the Settings menu to install it.</p>]]></field> </record> + + <!-- Subtype: sale.order --> + <record id="mt_quotation_sent" model="mail.message.subtype"> + <field name="name">Quotation sent</field> + <field name="res_model">sale.order</field> + </record> + + <record id="mt_order_confirmed" model="mail.message.subtype"> + <field name="name">Sale Order Confirmed</field> + <field name="res_model">sale.order</field> + </record> + + <record id="mt_salesteam_sent" model="mail.message.subtype"> + <field name="name">Quotation sent</field> + <field name="res_model">crm.case.section</field> + <field name="default" eval="False"/> + </record> + + <record id="mt_salesteam_confirmed" model="mail.message.subtype"> + <field name="name">Sale Order Confirmed</field> + <field name="res_model">crm.case.section</field> + <field name="default" eval="False"/> + </record> </data> </openerp>
_______________________________________________ Mailing list: https://launchpad.net/~openerp-dev-gtk Post to : openerp-dev-gtk@lists.launchpad.net Unsubscribe : https://launchpad.net/~openerp-dev-gtk More help : https://help.launchpad.net/ListHelp