Merge lp:~openerp-dev/openobject-addons/trunk-bug-1083276-kbh into lp:openobject-addons

Proposed by Khushboo Bhatt(openerp)
Status: Needs review
Proposed branch: lp:~openerp-dev/openobject-addons/trunk-bug-1083276-kbh
Merge into: lp:openobject-addons
Diff against target: 68 lines (+8/-4)
2 files modified
account/account_invoice.py (+3/-2)
account/account_invoice_view.xml (+5/-2)
To merge this branch: bzr merge lp:~openerp-dev/openobject-addons/trunk-bug-1083276-kbh
Reviewer Review Type Date Requested Status
qdp (OpenERP) Disapprove
Review via email: mp+140368@code.launchpad.net

Description of the change

Hello,

 account:fixed the issue of customer/supplier invoice continuously refund as many times as user wants.

Thank you,
Khushboo.

To post a comment you must log in.
Revision history for this message
Mustufa Rangwala (Open ERP) (mra-tinyerp) wrote :

Suggestion:

First of all I think we can raise refund invoice of already refund order and If its not the case any time we can improve the fix by using "type" field on invoice. No need to create separate field on invoice.

Please check that possibility.

Thanks,
Mustufa Rangwala

Revision history for this message
qdp (OpenERP) (qdp) wrote :

please see my comment on the bug

thanks

review: Disapprove

Unmerged revisions

8375. By Khushboo Bhatt(openerp)

[FIX]account:infinite refund of invoice issue

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account/account_invoice.py'
2--- account/account_invoice.py 2012-12-17 15:23:03 +0000
3+++ account/account_invoice.py 2012-12-18 09:01:24 +0000
4@@ -279,7 +279,8 @@
5 'payment_ids': fields.function(_compute_lines, relation='account.move.line', type="many2many", string='Payments'),
6 'move_name': fields.char('Journal Entry', size=64, readonly=True, states={'draft':[('readonly',False)]}),
7 'user_id': fields.many2one('res.users', 'Salesperson', readonly=True, states={'draft':[('readonly',False)]}),
8- 'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position', readonly=True, states={'draft':[('readonly',False)]})
9+ 'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position', readonly=True, states={'draft':[('readonly',False)]}),
10+ 'refund_invoice': fields.boolean("Refund Invoice"),
11 }
12 _defaults = {
13 'type': _get_type,
14@@ -1216,7 +1217,7 @@
15 invoice[field] = invoice[field] and invoice[field][0]
16 # create the new invoice
17 new_ids.append(self.create(cr, uid, invoice))
18-
19+ self.write(cr, uid, ids, {'refund_invoice': True})
20 return new_ids
21
22 def pay_and_reconcile(self, cr, uid, ids, pay_amount, pay_account_id, period_id, pay_journal_id, writeoff_acc_id, writeoff_period_id, writeoff_journal_id, context=None, name=''):
23
24=== modified file 'account/account_invoice_view.xml'
25--- account/account_invoice_view.xml 2012-12-15 16:44:49 +0000
26+++ account/account_invoice_view.xml 2012-12-18 09:01:24 +0000
27@@ -144,7 +144,7 @@
28 <form string="Supplier Invoice" version="7.0">
29 <header>
30 <button name="invoice_open" states="draft,proforma2" string="Validate" class="oe_highlight" groups="account.group_account_invoice"/>
31- <button name="%(action_account_invoice_refund)d" type='action' string='Ask Refund' states='open,paid' groups="account.group_account_invoice"/>
32+ <button name="%(action_account_invoice_refund)d" type='action' string='Ask Refund' attrs="{'invisible':['|', ('state', 'not in', ('open', 'paid')), ('refund_invoice', '=', True)]}" groups="account.group_account_invoice"/>
33 <button name="invoice_cancel" states="draft,proforma2,sale,open" string="Cancel" groups="base.group_no_one"/>
34 <button name="action_cancel_draft" states="cancel" string="Set to Draft" type="object" groups="account.group_account_invoice"/>
35 <button name='%(action_account_state_open)d' type='action' string='Re-Open' groups="account.group_account_invoice" attrs="{'invisible':['|', ('state','&lt;&gt;','paid'), ('reconciled', '=', True)]}" help="This button only appears when the state of the invoice is 'paid' (showing that it has been fully reconciled) and auto-computed boolean 'reconciled' is False (depicting that it's not the case anymore). In other words, the invoice has been dereconciled and it does not fit anymore the 'paid' state. You should press this button to re-open it and let it continue its normal process after having resolved the eventual exceptions it may have created."/>
36@@ -161,6 +161,7 @@
37 </h1>
38 </div>
39 <field name="type" invisible="1"/>
40+ <field name="refund_invoice" invisible="1"/>
41 <group>
42 <group>
43 <field string="Supplier" name="partner_id"
44@@ -291,6 +292,7 @@
45 <field name="arch" type="xml">
46 <form string="Invoice" version="7.0">
47 <header>
48+
49 <button name="action_invoice_sent" type="object" string="Send by Email" attrs="{'invisible':['|',('sent','=',True), ('state', '!=', 'open')]}" class="oe_highlight" groups="base.group_user"/>
50 <button name="invoice_print" string="Print" type="object" attrs="{'invisible':['|',('sent','=',True), ('state', '!=', 'open')]}" class="oe_highlight" groups="base.group_user"/>
51 <button name="action_invoice_sent" type="object" string="Send by Email" attrs="{'invisible':['|',('sent','=',False), ('state', '!=', 'open')]}" groups="base.group_user"/>
52@@ -298,7 +300,7 @@
53 <button name="invoice_open" states="draft" string="Validate" class="oe_highlight" groups="base.group_user"/>
54 <button name="invoice_open" states="proforma2" string="Validate" groups="base.group_user"/>
55 <button name="invoice_proforma2" states="draft" string="PRO-FORMA" groups="account.group_proforma_invoices"/>
56- <button name="%(action_account_invoice_refund)d" type='action' string='Refund Invoice' states='open,proforma2,paid' groups="base.group_user"/>
57+ <button name="%(action_account_invoice_refund)d" type='action' string='Refund Invoice' attrs="{'invisible':['|', ('state', 'not in', ('open', 'proforma2', 'paid')), ('refund_invoice', '=', True)]}" groups="base.group_user"/>
58 <button name="invoice_cancel" states="draft,proforma2,open" string="Cancel" groups="base.group_no_one"/>
59 <button name="action_cancel_draft" states="cancel" string="Reset to Draft" type="object" groups="base.group_user"/>
60 <button name='%(action_account_state_open)d' type='action' string='Re-Open' groups="account.group_account_invoice" attrs="{'invisible':['|', ('state','&lt;&gt;','paid'), ('reconciled', '=', True)]}" help="This button only appears when the state of the invoice is 'paid' (showing that it has been fully reconciled) and auto-computed boolean 'reconciled' is False (depicting that it's not the case anymore). In other words, the invoice has been dereconciled and it does not fit anymore the 'paid' state. You should press this button to re-open it and let it continue its normal process after having resolved the eventual exceptions it may have created."/>
61@@ -315,6 +317,7 @@
62 <field name="number" readonly="1" class="oe_inline"/>
63 </h1>
64 <field name="type" invisible="1"/>
65+ <field name="refund_invoice" invisible="1"/>
66 <group>
67 <group>
68 <field string="Customer" name="partner_id"

Subscribers

People subscribed via source and target branches

to all changes: