[MERGE]:trunk
[odoo/odoo.git] / addons / account / account_invoice.py
index b0671e5..4160403 100644 (file)
@@ -359,8 +359,6 @@ class account_invoice(osv.osv):
             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 @@ class account_invoice(osv.osv):
                 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 @@ class account_invoice(osv.osv):
         }
         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)),