[IMP] Account: Refund invoice: Replace three button on wizard with seletion box, Improvement accoridingly

bzr revid: mra@mra-laptop-20100825060116-cak2oyugj58fszlp
This commit is contained in:
Mustufa Rangwala 2010-08-25 11:31:16 +05:30
parent 851514aa90
commit 9b862f511e
3 changed files with 17 additions and 20 deletions

View File

@ -47,7 +47,7 @@
-
!assert {model: account.invoice, id: account_invoice_customer0}:
- state == 'open'
-
I check that now there is a move attached to the invoice
-
@ -126,7 +126,7 @@
acc_id=self.browse(cr, uid, ref("account_invoice_customer0"))
assert(acc_id.move_id)
-
I refund the invoice Using Credit Note
I refund the invoice Using Refund Button
-
!record {model: account.invoice.refund, id: account_invoice_refund_0}:
description: Refund To China Export

View File

@ -36,6 +36,7 @@ class account_invoice_refund(osv.osv_memory):
'period': fields.many2one('account.period', 'Force period'),
'journal_id': fields.many2one('account.journal', 'Refund Journal', help='You can select here the journal to use for the refund invoice that will be created. If you leave that field empty, it will use the same journal as the current invoice.'),
'description': fields.char('Description', size=128, required=True),
'filter_refund': fields.selection([('modify', 'Modify'), ('refund', 'Refund'), ('cancel', 'Cancel')], "Refund Type", required=True, help='Refund invoice base on this type'),
}
def _get_journal(self, cr, uid, context=None):
@ -50,7 +51,8 @@ class account_invoice_refund(osv.osv_memory):
_defaults = {
'date': time.strftime('%Y-%m-%d'),
'journal_id': _get_journal
'journal_id': _get_journal,
'filter_refund': 'modify',
}
def compute_refund(self, cr, uid, ids, mode='refund', context=None):
@ -66,6 +68,8 @@ class account_invoice_refund(osv.osv_memory):
mod_obj = self.pool.get('ir.model.data')
act_obj = self.pool.get('ir.actions.act_window')
wf_service = netsvc.LocalService('workflow')
inv_tax_obj = self.pool.get('account.invoice.tax')
inv_line_obj = self.pool.get('account.invoice.line')
if context is None:
context = {}
@ -153,10 +157,9 @@ class account_invoice_refund(osv.osv_memory):
'journal_id', 'period_id'], context=context)
invoice = invoice[0]
del invoice['id']
invoice_lines = self.pool.get('account.invoice.line').read(cr, uid, invoice['invoice_line'], context=context)
invoice_lines = inv_line_obj.read(cr, uid, invoice['invoice_line'], context=context)
invoice_lines = inv_obj._refund_cleanup_lines(cr, uid, invoice_lines)
tax_lines = self.pool.get('account.invoice.tax').read(
cr, uid, invoice['tax_line'], context=context)
tax_lines = inv_tax_obj.read(cr, uid, invoice['tax_line'], context=context)
tax_lines = inv_obj._refund_cleanup_lines(cr, uid, tax_lines)
invoice.update({
@ -196,14 +199,9 @@ class account_invoice_refund(osv.osv_memory):
return result
def invoice_refund(self, cr, uid, ids, context=None):
return self.compute_refund(cr, uid, ids, 'refund', context=context)
def invoice_cancel(self, cr, uid, ids, context=None):
return self.compute_refund(cr, uid, ids, 'cancel', context=context)
def invoice_modify(self, cr, uid, ids, context=None):
return self.compute_refund(cr, uid, ids, 'modify', context=context)
data_refund = self.read(cr, uid, ids, [] ,context=context)[0]['filter_refund']
return self.compute_refund(cr, uid, ids, data_refund, context=context)
account_invoice_refund()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -14,19 +14,18 @@
<field name="journal_id"/>
<field name="date"/>
<field name="period"/>
<field name="filter_refund"/>
</group>
<separator colspan="4"/>
<group col="4" colspan="4" fill="1">
<label align="0.0" width="300" string="Refund Invoice: creates the refund invoice, ready for editing."/>
<label align="0.0" width="500" colspan="4" string="Cancel Invoice: creates the refund invoice, validate and reconcile it to cancel the current invoice."/>
<label align="0.0" width="550" colspan="4" string="Modify Invoice: cancels the current invoice and creates a new copy of it ready for editing."/>
<label align="0.0" width="550" colspan="4" string="Modify Invoice: Cancels the current invoice and creates a new copy of it ready for editing."/>
<label align="0.0" width="300" string="Refund Invoice: Creates the refund invoice, ready for editing."/>
<label align="0.0" width="500" colspan="4" string="Cancel Invoice: Creates the refund invoice, validate and reconcile it to cancel the current invoice."/>
</group>
<separator colspan="4"/>
<group colspan="4" col="6">
<button icon="gtk-cancel" special="cancel" string="Cancel"/>
<button icon="gtk-redo" string="Refund Invoice" name="invoice_refund" type="object"/>
<button icon="gtk-ok" string="Cancel Invoice" name="invoice_cancel" type="object"/>
<button icon="gtk-undo" string="Modify Invoice" name="invoice_modify" type="object"/>
<button string='Refund' icon="gtk-execute" name="invoice_refund" type="object"/>
</group>
</form>
</field>