mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
[IMP] Add better support to OepnERP chatter on claim. When replying to a customer, the reply-to is now the one of the team
This commit is contained in:
@@ -43,6 +43,8 @@ It mainly contains the following features:
|
||||
* product refund
|
||||
* access to related customer data (orders, invoices, refunds, picking
|
||||
in/out) from a claim
|
||||
* use the OpenERP chatter within team like in opportunity (reply to refer to
|
||||
the team, not a person)
|
||||
|
||||
Using this module makes the logistic flow of return this way:
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ from dateutil.relativedelta import relativedelta
|
||||
from openerp.tools import (DEFAULT_SERVER_DATE_FORMAT,
|
||||
DEFAULT_SERVER_DATETIME_FORMAT)
|
||||
from openerp.tools.translate import _
|
||||
|
||||
from openerp import SUPERUSER_ID
|
||||
|
||||
class substate_substate(orm.Model):
|
||||
""" To precise a state (state=refused; substates= reason 1, 2,...) """
|
||||
@@ -450,3 +450,20 @@ class crm_claim(orm.Model):
|
||||
'state': 'draft',
|
||||
})
|
||||
return {'value': {'claim_line_ids': claim_lines}}
|
||||
|
||||
def message_get_reply_to(self, cr, uid, ids, context=None):
|
||||
""" Override to get the reply_to of the parent project. """
|
||||
return [claim.section_id.message_get_reply_to()[0] if claim.section_id else False
|
||||
for claim in self.browse(cr, SUPERUSER_ID, ids, context=context)]
|
||||
|
||||
def message_get_suggested_recipients(self, cr, uid, ids, context=None):
|
||||
recipients = super(crm_claim, self).message_get_suggested_recipients(cr, uid, ids, context=context)
|
||||
try:
|
||||
for claim in self.browse(cr, uid, ids, context=context):
|
||||
if claim.partner_id:
|
||||
self._message_add_suggested_recipient(cr, uid, recipients, claim, partner=claim.partner_id, reason=_('Customer'))
|
||||
elif claim.email_from:
|
||||
self._message_add_suggested_recipient(cr, uid, recipients, claim, email=claim.email_from, reason=_('Customer Email'))
|
||||
except (osv.except_osv, orm.except_orm): # no read access rights -> just ignore suggested recipients because this imply modifying followers
|
||||
pass
|
||||
return recipients
|
||||
|
||||
Reference in New Issue
Block a user