[CLEAN] account, account_voucher: updated subtypes, removed dead code and unnecessary chatter message.

bzr revid: tde@openerp.com-20121219130024-bmf584gyw5p8khrc
This commit is contained in:
Thibault Delavallée 2012-12-19 14:00:24 +01:00
parent 2348a598d5
commit 33ea9c9f73
3 changed files with 4 additions and 25 deletions

View File

@ -1050,13 +1050,12 @@ class account_invoice(osv.osv):
self.write(cr, uid, ids, {})
for obj_inv in self.browse(cr, uid, ids, context=context):
id = obj_inv.id
invtype = obj_inv.type
number = obj_inv.number
move_id = obj_inv.move_id and obj_inv.move_id.id or False
reference = obj_inv.reference or ''
self.write(cr, uid, ids, {'internal_number':number})
self.write(cr, uid, ids, {'internal_number': number})
if invtype in ('in_invoice', 'in_refund'):
if not reference:
@ -1077,13 +1076,6 @@ class account_invoice(osv.osv):
'WHERE account_move_line.move_id = %s ' \
'AND account_analytic_line.move_id = account_move_line.id',
(ref, move_id))
for inv_id, name in self.name_get(cr, uid, [id]):
ctx = context.copy()
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, subtype="account.mt_invoice_validated", context=context)
return True
def action_cancel(self, cr, uid, ids, context=None):
@ -1334,8 +1326,8 @@ class account_invoice(osv.osv):
else:
code = invoice.currency_id.symbol
# TODO: use currency's formatting function
msg = _("Invoice '%s' is paid partially: %s%s of %s%s (%s%s remaining).") % \
(name, pay_amount, code, invoice.amount_total, code, total, code)
msg = _("Invoice partially paid: %s%s of %s%s (%s%s remaining).") % \
(pay_amount, code, invoice.amount_total, code, total, code)
self.message_post(cr, uid, [inv_id], body=msg, context=context)
self.pool.get('account.move.line').reconcile_partial(cr, uid, line_ids, 'manual', context)
@ -1343,19 +1335,6 @@ class account_invoice(osv.osv):
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 = {
# Translation markers will have no effect at runtime, only used to properly flag export
'out_invoice': _('Customer invoice'),
'in_invoice': _('Supplier invoice'),
'out_refund': _('Customer Refund'),
'in_refund': _('Supplier Refund'),
}
return type_dict.get(type, 'Invoice')
class account_invoice_line(osv.osv):

View File

@ -155,7 +155,6 @@
<record id="mt_invoice_validated" model="mail.message.subtype">
<field name="name">Validated</field>
<field name="res_model">account.invoice</field>
<field name="default" eval="False"/>
<field name="description">Invoice &lt;b&gt;validated&lt;/b&gt;</field>
</record>
<record id="mt_invoice_paid" model="mail.message.subtype">

View File

@ -17,6 +17,7 @@
<record id="mt_voucher_state_change" model="mail.message.subtype">
<field name="name">Status Change</field>
<field name="res_model">account.voucher</field>
<field name="description">Status &lt;b&gt;changed&lt;/b&gt;</field>
</record>
</data>