diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py
index 700936695b8..d06ba70bf02 100644
--- a/addons/account/account_invoice.py
+++ b/addons/account/account_invoice.py
@@ -178,6 +178,7 @@ class account_invoice(osv.osv):
return invoice_ids
_name = "account.invoice"
+ _inherit = ['mail.thread']
_description = 'Invoice'
_order = "id desc"
@@ -355,12 +356,8 @@ class account_invoice(osv.osv):
context = {}
try:
res = super(account_invoice, self).create(cr, uid, vals, context)
- for inv_id, name in self.name_get(cr, uid, [res], context=context):
- ctx = context.copy()
- if vals.get('type', 'in_invoice') in ('out_invoice', 'out_refund'):
- ctx = self.get_log_context(cr, uid, context=ctx)
- message = _("Invoice '%s' is waiting for validation.") % name
- self.log(cr, uid, inv_id, message, context=ctx)
+ if res:
+ self.create_send_note(cr, uid, [res], context=context)
return res
except Exception, e:
if '"journal_id" viol' in e.args[0]:
@@ -373,9 +370,7 @@ class account_invoice(osv.osv):
if context is None:
context = {}
self.write(cr, uid, ids, {'state':'paid'}, context=context)
- for inv_id, name in self.name_get(cr, uid, ids, context=context):
- message = _("Invoice '%s' is paid.") % name
- self.log(cr, uid, inv_id, message)
+ self.confirm_paid_send_note(cr, uid, ids, context=context)
return True
def unlink(self, cr, uid, ids, context=None):
@@ -943,6 +938,11 @@ class account_invoice(osv.osv):
move_obj.post(cr, uid, [move_id], context=ctx)
self._log_event(cr, uid, ids)
return True
+
+ 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):
return {
@@ -1033,6 +1033,7 @@ class account_invoice(osv.osv):
# will be automatically deleted too
account_move_obj.unlink(cr, uid, move_ids, context=context)
self._log_event(cr, uid, ids, -1.0, 'Cancel Invoice')
+ self.invoice_cancel_send_note(cr, uid, ids, context=context)
return True
###################
@@ -1240,7 +1241,36 @@ class account_invoice(osv.osv):
# Update the stored value (fields.function), so we write to trigger recompute
self.pool.get('account.invoice').write(cr, uid, ids, {}, context=context)
return True
-
+
+ # -----------------------------------------
+ # OpenChatter notifications and need_action
+ # -----------------------------------------
+
+ def _get_document_type(self, type):
+ type_dict = {
+ 'out_invoice': 'Customer invoice',
+ 'in_invoice': 'Supplier invoice',
+ 'out_refund': 'Customer Refund',
+ 'in_refund': 'Supplier Refund',
+ }
+ 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_append_note(cr, uid, [obj.id],body=_("%s created.") % (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 validated.") % (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 paid.") % (self._get_document_type(obj.type)), context=context)
+
+ def invoice_cancel_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 cancelled.") % (self._get_document_type(obj.type)), context=context)
+
account_invoice()
class account_invoice_line(osv.osv):
diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml
index ef6c2510c54..ca8530fb082 100644
--- a/addons/account/account_invoice_view.xml
+++ b/addons/account/account_invoice_view.xml
@@ -243,6 +243,7 @@
+
@@ -338,6 +339,7 @@
+
diff --git a/addons/account/account_invoice_workflow.xml b/addons/account/account_invoice_workflow.xml
index 2af1e192a9b..13db193af8d 100644
--- a/addons/account/account_invoice_workflow.xml
+++ b/addons/account/account_invoice_workflow.xml
@@ -27,7 +27,7 @@
action_date_assign()
action_move_create()
action_number()
-write({'state':'open'})
+invoice_validate()
function
diff --git a/addons/account/i18n/hi.po b/addons/account/i18n/hi.po
index d4672f43932..41be2943728 100644
--- a/addons/account/i18n/hi.po
+++ b/addons/account/i18n/hi.po
@@ -8,20 +8,20 @@ msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME \n"
"POT-Creation-Date: 2012-02-08 00:35+0000\n"
-"PO-Revision-Date: 2010-12-21 08:18+0000\n"
-"Last-Translator: Sanjay Kumar \n"
+"PO-Revision-Date: 2012-04-03 07:14+0000\n"
+"Last-Translator: Vibhav Pant \n"
"Language-Team: Hindi \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2012-02-09 06:19+0000\n"
-"X-Generator: Launchpad (build 14763)\n"
+"X-Launchpad-Export-Date: 2012-04-04 04:41+0000\n"
+"X-Generator: Launchpad (build 15055)\n"
#. module: account
#: view:account.invoice.report:0
#: view:analytic.entries.report:0
msgid "last month"
-msgstr ""
+msgstr "पहले का महिना"
#. module: account
#: model:process.transition,name:account.process_transition_supplierreconcilepaid0
@@ -165,18 +165,18 @@ msgstr "चेतावनी!"
#: code:addons/account/account.py:3112
#, python-format
msgid "Miscellaneous Journal"
-msgstr ""
+msgstr "विविध जर्नल"
#. module: account
#: field:account.fiscal.position.account,account_src_id:0
#: field:account.fiscal.position.account.template,account_src_id:0
msgid "Account Source"
-msgstr ""
+msgstr "खाता श्रोत"
#. module: account
#: model:ir.actions.act_window,name:account.act_acc_analytic_acc_5_report_hr_timesheet_invoice_journal
msgid "All Analytic Entries"
-msgstr ""
+msgstr "सभी विश्लेषणात्मक प्रविष्टियाँ"
#. module: account
#: model:ir.actions.act_window,name:account.action_view_created_invoice_dashboard
@@ -186,7 +186,7 @@ msgstr ""
#. module: account
#: field:accounting.report,label_filter:0
msgid "Column Label"
-msgstr ""
+msgstr "स्तंभ लेबल"
#. module: account
#: code:addons/account/wizard/account_move_journal.py:95
@@ -206,7 +206,7 @@ msgstr ""
#: model:ir.actions.act_window,name:account.action_account_tax_template_form
#: model:ir.ui.menu,name:account.menu_action_account_tax_template_form
msgid "Tax Templates"
-msgstr ""
+msgstr "टैक्स टेम्पलेट्स"
#. module: account
#: model:ir.model,name:account.model_account_tax
diff --git a/addons/account/res_config_view.xml b/addons/account/res_config_view.xml
index 80517d44f88..742b842684a 100644
--- a/addons/account/res_config_view.xml
+++ b/addons/account/res_config_view.xml
@@ -110,6 +110,7 @@
ir.actions.act_window
account.config.settings
form
+ inline