summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMustufa Rangwala <mra@mra-laptop>2010-08-25 11:31:16 +0530
committerMustufa Rangwala <mra@mra-laptop>2010-08-25 11:31:16 +0530
commit9b862f511ec6c620ff33f7e4ba122f4ca52ca3c8 (patch)
treee5dd2d9e6f11a82951facda61521b8510bed4a9f
parent851514aa90582fe7da5839763cfb12a30687bf6e (diff)
[IMP] Account: Refund invoice: Replace three button on wizard with seletion box, Improvement accoridingly
bzr revid: mra@mra-laptop-20100825060116-cak2oyugj58fszlp
-rw-r--r--addons/account/test/account_customer_invoice.yml4
-rw-r--r--addons/account/wizard/account_invoice_refund.py22
-rw-r--r--addons/account/wizard/account_invoice_refund_view.xml11
3 files changed, 17 insertions, 20 deletions
diff --git a/addons/account/test/account_customer_invoice.yml b/addons/account/test/account_customer_invoice.yml
index e5920d0caed..f8798d7d9e3 100644
--- a/addons/account/test/account_customer_invoice.yml
+++ b/addons/account/test/account_customer_invoice.yml
@@ -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
diff --git a/addons/account/wizard/account_invoice_refund.py b/addons/account/wizard/account_invoice_refund.py
index e6fc938b2ac..6b496670701 100644
--- a/addons/account/wizard/account_invoice_refund.py
+++ b/addons/account/wizard/account_invoice_refund.py
@@ -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: \ No newline at end of file
diff --git a/addons/account/wizard/account_invoice_refund_view.xml b/addons/account/wizard/account_invoice_refund_view.xml
index 8ee56eacf61..e26eb4e12c9 100644
--- a/addons/account/wizard/account_invoice_refund_view.xml
+++ b/addons/account/wizard/account_invoice_refund_view.xml
@@ -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>