[IMP]account_voucher : added a class in button of inherited view , added a openchater for reconcile

bzr revid: mma@tinyerp.com-20120605133140-36mp7y50z3wwzq5s
This commit is contained in:
Mayur Maheshwari (OpenERP) 2012-06-05 19:01:40 +05:30
parent 64c8931d2b
commit f088d75d6f
2 changed files with 18 additions and 6 deletions

View File

@ -1250,14 +1250,18 @@ class account_voucher(osv.osv):
'state': 'posted',
'number': name,
})
message = _("voucher '%s' is posted.") % 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:
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)
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)
return True
def create(self, cr, uid, vals, context=None):
@ -1287,12 +1291,18 @@ class account_voucher(osv.osv):
type_dict = {
'payment': 'Supplier Payment',
'purchase': 'Purchase Receipt',
'sale': 'Sales Receipt',
'receipt': 'Customer Payment',
}
return type_dict.get(type, 'Invoice')
return type_dict.get(type, 'payment')
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 <b>Reconciled</b>.") % (self._get_document_type(obj.type)), context=context)
account_voucher()

View File

@ -18,9 +18,11 @@
<field name="type">form</field>
<field name="inherit_id" ref="account.invoice_supplier_form"/>
<field name="arch" type="xml">
<button name="invoice_open" position="after">
<button name="invoice_pay_customer" type="object" string="Pay" states="open"/>
</button>
<xpath expr="//button[@name='invoice_open']" position="after">
<div>
<button name="invoice_pay_customer" type="object" string="Pay" states="open" class="oe_form_button_hi"/>
</div>
</xpath>
</field>
</record>
</data>