← Back to team overview

account-payment-team team mailing list archive

[Merge] lp:~mikel-martin/account-payment/fix-bug-1084559 into lp:account-payment

 

mikel has proposed merging lp:~mikel-martin/account-payment/fix-bug-1084559 into lp:account-payment.

Requested reviews:
  Account Payment (account-payment-team)
Related bugs:
  Bug #1084559 in Additional payment, bank statement and voucher addons for OpenERP: "La posición fiscal y el agente no se arrastra al crear una factura rectificativa"
  https://bugs.launchpad.net/account-payment/+bug/1084559

For more details, see:
https://code.launchpad.net/~mikel-martin/account-payment/fix-bug-1084559/+merge/137501

As explained in https://bugs.launchpad.net/account-payment/+bug/1084559 the refund method from account_invoice was forked. 

Having a look at the code the fork was unnecesary.
-- 
https://code.launchpad.net/~mikel-martin/account-payment/fix-bug-1084559/+merge/137501
Your team Account Payment is requested to review the proposed merge of lp:~mikel-martin/account-payment/fix-bug-1084559 into lp:account-payment.
=== modified file 'account_payment_extension/account_invoice.py'
--- account_payment_extension/account_invoice.py	2012-11-01 21:49:33 +0000
+++ account_payment_extension/account_invoice.py	2012-12-03 08:23:22 +0000
@@ -4,7 +4,7 @@
 #    OpenERP, Open Source Management Solution
 #    Copyright (c) 2008 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
 #                       Jordi Esteve <jesteve@xxxxxxxxxxxxxxx>
-#    AvanzOSC, Avanzed Open Source Consulting 
+#    AvanzOSC, Avanzed Open Source Consulting
 #    Copyright (C) 2011-2012 Iker Coranti (www.avanzosc.com). All Rights Reserved
 #    $Id$
 #
@@ -76,61 +76,4 @@
                     aml_obj.write(cr, uid, move_line_ids, {'partner_bank_id': inv.partner_bank_id.id})
         return ret
 
-    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', 'payment_type'])
-        obj_invoice_line = self.pool.get('account.invoice.line')
-        obj_invoice_tax = self.pool.get('account.invoice.tax')
-        obj_journal = self.pool.get('account.journal')
-        new_ids = []
-        for invoice in invoices:
-            del invoice['id']
-
-            type_dict = {
-                'out_invoice': 'out_refund', # Customer Invoice
-                'in_invoice': 'in_refund',   # Supplier Invoice
-                'out_refund': 'out_invoice', # Customer Refund
-                'in_refund': 'in_invoice',   # Supplier Refund
-            }
-
-            invoice_lines = obj_invoice_line.read(cr, uid, invoice['invoice_line'])
-            invoice_lines = self._refund_cleanup_lines(cr, uid, invoice_lines)
-
-            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)
-            if journal_id:
-                refund_journal_ids = [journal_id]
-            elif invoice['type'] == 'in_invoice':
-                refund_journal_ids = obj_journal.search(cr, uid, [('type','=','purchase_refund')])
-            else:
-                refund_journal_ids = obj_journal.search(cr, uid, [('type','=','sale_refund')])
-
-            if not date:
-                date = time.strftime('%Y-%m-%d')
-            invoice.update({
-                'type': type_dict[invoice['type']],
-                'date_invoice': date,
-                'state': 'draft',
-                'number': False,
-                'invoice_line': invoice_lines,
-                'tax_line': tax_lines,
-                'journal_id': refund_journal_ids
-            })
-            if period_id:
-                invoice.update({
-                    'period_id': period_id,
-                })
-            if description:
-                invoice.update({
-                    'name': description,
-                })
-            # take the id part of the tuple returned for many2one fields
-            for field in ('address_contact_id', 'address_invoice_id', 'partner_id',
-                    'account_id', 'currency_id', 'payment_term', 'journal_id', 'payment_type'):
-                invoice[field] = invoice[field] and invoice[field][0]
-            # create the new invoice
-            new_ids.append(self.create(cr, uid, invoice))
-
-        return new_ids
-
 account_invoice()


Follow ups