Divyesh Makwana(OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/trunk-bug-896462-mdi into
lp:openobject-addons.
Requested reviews:
OpenERP Core Team (openerp)
Related bugs:
Bug #896462 in OpenERP Addons: "[trunk & 6.0] [account] [wizard
account.invoice.refund] Invoice refund wizard make error with other relational
fields"
https://bugs.launchpad.net/openobject-addons/+bug/896462
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-896462-mdi/+merge/84734
Hello Sir,
I have fix the issue: https://bugs.launchpad.net/openobject-addons/+bug/896462
"[trunk & 6.0] [account] [wizard account.invoice.refund] Invoice refund wizard
make error with other relational fields".
Thanks and Regards,
Divyesh Makwana(MDI)
--
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-bug-896462-mdi/+merge/84734
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/trunk-bug-896462-mdi.
=== modified file 'account/account_invoice.py'
--- account/account_invoice.py 2011-11-30 15:51:56 +0000
+++ account/account_invoice.py 2011-12-07 10:47:31 +0000
@@ -1075,17 +1075,6 @@
ids = self.search(cr, user, [('name',operator,name)] + args, limit=limit, context=context)
return self.name_get(cr, user, ids, context)
- def _refund_cleanup_lines(self, cr, uid, lines):
- for line in lines:
- del line['id']
- del line['invoice_id']
- for field in ('company_id', 'partner_id', 'account_id', 'product_id',
- 'uos_id', 'account_analytic_id', 'tax_code_id', 'base_code_id'):
- line[field] = line.get(field, False) and line[field][0]
- if 'invoice_line_tax_id' in line:
- line['invoice_line_tax_id'] = [(6,0, line.get('invoice_line_tax_id', [])) ]
- return map(lambda x: (0,0,x), lines)
-
def refund(self, cr, uid, ids, date=None, period_id=None, description=None, journal_id=None):
invoices = self.read(cr, uid, ids, ['name', 'type', 'number', 'reference', 'comment', 'date_due', 'partner_id', 'address_contact_id', 'address_invoice_id', 'partner_contact', 'partner_insite', 'partner_ref', 'payment_term', 'account_id', 'currency_id', 'invoice_line', 'tax_line', 'journal_id'])
obj_invoice_line = self.pool.get('account.invoice.line')
@@ -1103,11 +1092,15 @@
}
invoice_lines = obj_invoice_line.read(cr, uid, invoice['invoice_line'])
- invoice_lines = self._refund_cleanup_lines(cr, uid, invoice_lines)
+ inv_list = []
+ for inv_line in invoice_lines:
+ inv_list.append(obj_invoice_line.copy_data(cr, uid, inv_line['id']))
tax_lines = obj_invoice_tax.read(cr, uid, invoice['tax_line'])
- tax_lines = filter(lambda l: l['manual'], tax_lines)
- tax_lines = self._refund_cleanup_lines(cr, uid, tax_lines)
+ tax_list = []
+ for tax_line in tax_lines:
+ tax_list.append(obj_invoice_tax.copy_data(cr, uid, tax_line['id']))
+
if journal_id:
refund_journal_ids = [journal_id]
elif invoice['type'] == 'in_invoice':
@@ -1122,8 +1115,8 @@
'date_invoice': date,
'state': 'draft',
'number': False,
- 'invoice_line': invoice_lines,
- 'tax_line': tax_lines,
+ 'invoice_line': inv_list[0],
+ 'tax_line': tax_list[0],
'journal_id': refund_journal_ids
})
if period_id:
@@ -1141,6 +1134,14 @@
# create the new invoice
new_ids.append(self.create(cr, uid, invoice))
+ for inv in inv_list:
+ inv['invoice_id'] = new_ids[0]
+ obj_invoice_line.create(cr, uid, inv)
+
+ for tax in tax_list:
+ tax['invoice_id'] = new_ids[0]
+ obj_invoice_tax.create(cr, uid, tax)
+
return new_ids
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=''):
=== modified file 'account/wizard/account_invoice_refund.py'
--- account/wizard/account_invoice_refund.py 2011-11-11 08:44:51 +0000
+++ account/wizard/account_invoice_refund.py 2011-12-07 10:47:31 +0000
@@ -182,16 +182,20 @@
invoice = invoice[0]
del invoice['id']
invoice_lines = inv_line_obj.read(cr, uid, invoice['invoice_line'], context=context)
- invoice_lines = inv_obj._refund_cleanup_lines(cr, uid, invoice_lines)
+ inv_list = []
+ for inv_line in invoice_lines:
+ inv_list.append(inv_line_obj.copy_data(cr, uid, inv_line['id']))
tax_lines = inv_tax_obj.read(cr, uid, invoice['tax_line'], context=context)
- tax_lines = inv_obj._refund_cleanup_lines(cr, uid, tax_lines)
+ tax_list = []
+ for tax_line in tax_lines:
+ tax_list.append(inv_tax_obj.copy_data(cr, uid, tax_line['id']))
invoice.update({
'type': inv.type,
'date_invoice': date,
'state': 'draft',
'number': False,
- 'invoice_line': invoice_lines,
- 'tax_line': tax_lines,
+ 'invoice_line': inv_list[0],
+ 'tax_line': tax_list[0],
'period_id': period,
'name': description
})
=== modified file 'account_anglo_saxon/invoice.py'
--- account_anglo_saxon/invoice.py 2011-10-16 01:28:00 +0000
+++ account_anglo_saxon/invoice.py 2011-12-07 10:47:31 +0000
@@ -1,8 +1,8 @@
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
-# Copyright (C)
-# 2004-2010 Tiny SPRL (<http://tiny.be>).
+# Copyright (C)
+# 2004-2010 Tiny SPRL (<http://tiny.be>).
# 2009-2010 Veritos (http://veritos.nl).
# All Rights Reserved
#
@@ -17,7 +17,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@@ -159,26 +159,4 @@
account_invoice_line()
-class account_invoice(osv.osv):
- _inherit = "account.invoice"
-
- def _refund_cleanup_lines(self, cr, uid, lines):
- for line in lines:
- inv_id = line['invoice_id']
- inv_obj = self.browse(cr, uid, inv_id[0])
- if inv_obj.type == 'in_invoice':
- if line.get('product_id',False):
- product_obj = self.pool.get('product.product').browse(cr, uid, line['product_id'][0])
- oa = product_obj.property_stock_account_output and product_obj.property_stock_account_output.id
- if not oa:
- oa = product_obj.categ_id.property_stock_account_output_categ and product_obj.categ_id.property_stock_account_output_categ.id
- if oa:
- fpos = inv_obj.fiscal_position or False
- a = self.pool.get('account.fiscal.position').map_account(cr, uid, fpos, oa)
- account_data = self.pool.get('account.account').read(cr, uid, [a], ['name'])[0]
- line.update({'account_id': (account_data['id'],account_data['name'])})
- res = super(account_invoice,self)._refund_cleanup_lines(cr, uid, lines)
- return res
-
-account_invoice()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp