Kuldeep Joshi(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-openchatter-modification-kjo into 
lp:~openerp-dev/openobject-addons/trunk-openchatter.

Requested reviews:
  Bhumika (OpenERP) (sbh-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-openchatter-modification-kjo/+merge/107752
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-openchatter-modification-kjo/+merge/107752
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-openchatter.
=== modified file 'account/account_invoice.py'
--- account/account_invoice.py	2012-05-23 04:57:07 +0000
+++ account/account_invoice.py	2012-05-29 11:01:19 +0000
@@ -938,7 +938,6 @@
     
     def invoice_validate(self, cr, uid, ids, context=None):
         self.write(cr, uid, ids, {'state':'open'}, context=context)
-        self.invoice_validate_send_note(cr, uid, ids, context=context)
         return True
 
     def line_get_convert(self, cr, uid, x, part, date, context=None):
@@ -1256,10 +1255,6 @@
         for obj in self.browse(cr, uid, ids, context=context):
             self.message_append_note(cr, uid, [obj.id],body=_("%s <b>created</b>.") % (self._get_document_type(obj.type)), context=context)
             
-    def invoice_validate_send_note(self, cr, uid, ids, context=None):
-         for obj in self.browse(cr, uid, ids, context=context):
-            self.message_append_note(cr, uid, [obj.id], body=_("%s <b>validated</b>.") % (self._get_document_type(obj.type)), 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_append_note(cr, uid, [obj.id], body=_("%s <b>paid</b>.") % (self._get_document_type(obj.type)), context=context)

=== modified file 'crm/crm.py'
--- crm/crm.py	2012-05-22 10:37:54 +0000
+++ crm/crm.py	2012-05-29 11:01:19 +0000
@@ -270,7 +270,7 @@
 
     def case_cancel_send_note(self, cr, uid, ids, context=None):
         for id in ids:
-            msg = '%s has been <b>canceled</b>.' % (self.case_get_note_msg_prefix(cr, uid, id, context=context))
+            msg = '%s has been <b>cancelled</b>.' % (self.case_get_note_msg_prefix(cr, uid, id, context=context))
             self.message_append_note(cr, uid, [id], body=msg, context=context)
         return True
 

=== modified file 'crm_claim/crm_claim.py'
--- crm_claim/crm_claim.py	2012-05-23 04:57:07 +0000
+++ crm_claim/crm_claim.py	2012-05-29 11:01:19 +0000
@@ -102,6 +102,13 @@
         self.create_send_note(cr, uid, [obj_id], context=context)
         return obj_id
 
+    def write(self, cr, uid, ids, vals, context=None):
+        if vals.get('stage_id'):
+            stage = self.pool.get('crm.case.stage').browse(cr, uid, vals['stage_id'], context=context)
+            message = _("Stage changed to <b>%s</b>.") % (stage.name)
+            self.message_append_note(cr, uid, ids, body=message, context=context)
+        return super(crm_claim,self).write(cr, uid, ids, vals, context)
+
     def create_send_note(self, cr, uid, ids, context=None):
         msg = '%s has been <b>created</b>.' % (self.case_get_note_msg_prefix(cr, uid, ids, context=context))
         self.message_append_note(cr, uid, ids, body=msg, context=context)

=== modified file 'mail/mail_thread.py'
--- mail/mail_thread.py	2012-04-25 05:42:49 +0000
+++ mail/mail_thread.py	2012-05-29 11:01:19 +0000
@@ -413,7 +413,9 @@
         """ OpenChatter feature: return thread messages
         """
         msg_ids = self.message_load_ids(cr, uid, ids, limit, offset, domain, ascent, root_ids, context=context)
-        return self.pool.get('mail.message').read(cr, uid, msg_ids, context=context)
+        msgs=self.pool.get('mail.message').read(cr, uid, msg_ids, context=context)
+        msgs= sorted(msgs, key=lambda d: (-d['id']))
+        return msgs
 
     def get_pushed_messages(self, cr, uid, ids, limit=100, offset=0, msg_search_domain=[], ascent=False, root_ids=[], context=None):
         """ OpenChatter: wall: get messages to display (=pushed notifications)

=== modified file 'procurement/procurement.py'
--- procurement/procurement.py	2012-05-23 04:57:07 +0000
+++ procurement/procurement.py	2012-05-29 11:01:19 +0000
@@ -277,7 +277,7 @@
             if not res:
                 return False
         return True
-
+    
     def check_buy(self, cr, uid, ids):
         """ Checks product type.
         @return: True or Product Id.
@@ -288,27 +288,35 @@
             if procurement.product_id.product_tmpl_id.supply_method <> 'buy':
                 return False
             if not procurement.product_id.seller_ids:
-                cr.execute('update procurement_order set message=%s where id=%s',
-                        (_('No supplier defined for this product !'), procurement.id))
+                message = _('No supplier defined for this product !')
+                self.procurement_message(cr, uid, [procurement.id], message)
+                cr.execute('update procurement_order set message=%s where id=%s', (message, procurement.id))
                 return False
             partner = procurement.product_id.seller_id #Taken Main Supplier of Product of Procurement.
 
             if not partner:
-                cr.execute('update procurement_order set message=%s where id=%s',
-                           (_('No default supplier defined for this product'), procurement.id))
+                message = _('No default supplier defined for this product')
+                self.procurement_message(cr, uid, [procurement.id], message)
+                cr.execute('update procurement_order set message=%s where id=%s', (message, procurement.id))
                 return False
-
             if user.company_id and user.company_id.partner_id:
                 if partner.id == user.company_id.partner_id.id:
                     return False
 
             address_id = partner_obj.address_get(cr, uid, [partner.id], ['delivery'])['delivery']
             if not address_id:
-                cr.execute('update procurement_order set message=%s where id=%s',
-                        (_('No address defined for the supplier'), procurement.id))
+                message = _('No address defined for the supplier')
+                self.procurement_message(cr, uid, [procurement.id], message)
+                cr.execute('update procurement_order set message=%s where id=%s', (message, procurement.id))
                 return False
         return True
-
+    def procurement_message(self,cr,uid,ids,message,context=None):
+        for proc in self.browse(cr,uid,ids):
+            message_ids=False
+            message_ids= self.pool.get('mail.message').search(cr,uid,[('res_id','=',proc.id),('model','=',self._name),('body_html','=',message)])
+            if not message_ids:
+                self.message_append_note(cr, uid, [proc.id], body=message)
+        return True
     def test_cancel(self, cr, uid, ids):
         """ Tests whether state of move is cancelled or not.
         @return: True or False
@@ -387,8 +395,8 @@
 
                 if message:
                     message = _("Procurement '%s' is in exception: ") % (procurement.name) + message
-                    self.message_append_note(cr, uid, [procurement.id], body=message, context=context)
                     cr.execute('update procurement_order set message=%s where id=%s', (message, procurement.id))
+                    self.procurement_message(cr, uid, [procurement.id], message, context=context)   
         return ok
 
     def action_produce_assign_service(self, cr, uid, ids, context=None):

_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help   : https://help.launchpad.net/ListHelp

Reply via email to