[IMP] account_voucher : Removed OpenChatter Notification.

bzr revid: mdi@tinyerp.com-20120612125638-4bw5ymq3ptgz9z8u
This commit is contained in:
Divyesh Makwana (Open ERP)
2012-06-12 18:26:38 +05:30
parent b83d202290
commit 53db6d3822
+1 -33
View File
@@ -248,37 +248,10 @@ class account_voucher(osv.osv):
res[voucher.id] = voucher.amount / rate
return res
# -----------------------------------------
# OpenChatter notifications and need_action
# -----------------------------------------
def _get_document_type(self, type):
type_dict = {
'sale': 'Sales Receipt',
'purchase': 'Purchase Receipt',
'payment': 'Supplier Payment',
'receipt': 'Customer Payment',
}
return type_dict.get(type, 'Payment')
def create(self, cr, uid, vals, context=None):
res = super(account_voucher, self).create(cr, uid, vals, context=context)
self.create_send_note(cr, uid, [res], context=context)
return res
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 <b>created</b>.") % (self._get_document_type(obj.type)), context=context)
def reconcile_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 is <b>reconciled</b>.") % (self._get_document_type(obj.type)), context=context)
_name = 'account.voucher'
_description = 'Accounting Voucher'
_order = "date desc, id desc"
# _rec_name = 'number'
_inherit = ['mail.thread']
_columns = {
'type':fields.selection([
('sale','Sale'),
@@ -1276,17 +1249,12 @@ class account_voucher(osv.osv):
'state': 'posted',
'number': name,
})
message = _("%s '%s' is <b>posted</b>.") % (self._get_document_type(voucher.type), name)
self.message_append_note(cr, uid, [voucher.id], body=message, context=context)
if voucher.journal_id.entry_posted:
move_pool.post(cr, uid, [move_id], context={})
# We automatically reconcile the account move lines.
reconcile = False
for rec_ids in rec_list_ids:
if len(rec_ids) >= 2:
reconcile = move_line_pool.reconcile_partial(cr, uid, rec_ids, writeoff_acc_id=voucher.writeoff_acc_id.id, writeoff_period_id=voucher.period_id.id, writeoff_journal_id=voucher.journal_id.id)
if reconcile:
self.reconcile_send_note(cr, uid, [voucher.id], context=context)
move_line_pool.reconcile_partial(cr, uid, rec_ids, writeoff_acc_id=voucher.writeoff_acc_id.id, writeoff_period_id=voucher.period_id.id, writeoff_journal_id=voucher.journal_id.id)
return True
def copy(self, cr, uid, id, default={}, context=None):