← Back to team overview

account-payment-team team mailing list archive

[Merge] lp:~pablocm/account-payment/7.0-account-payment-extension-fix-invoice-field into lp:account-payment/7.0

 

PabloCM has proposed merging lp:~pablocm/account-payment/7.0-account-payment-extension-fix-invoice-field into lp:account-payment/7.0.

Requested reviews:
  Pedro Manuel Baeza (pedro.baeza)

For more details, see:
https://code.launchpad.net/~pablocm/account-payment/7.0-account-payment-extension-fix-invoice-field/+merge/203948

[FIX] Fixed _invoice parameter names and redefined the invoice field so that the new _invoice and _invoice_search get called
[FIX] Removed unused variable

-- 
https://code.launchpad.net/~pablocm/account-payment/7.0-account-payment-extension-fix-invoice-field/+merge/203948
Your team Account Payment is subscribed to branch lp:account-payment/7.0.
=== modified file 'account_payment_extension/account_move_line.py'
--- account_payment_extension/account_move_line.py	2013-11-10 17:00:26 +0000
+++ account_payment_extension/account_move_line.py	2014-01-30 12:34:27 +0000
@@ -31,7 +31,7 @@
 class account_move_line(orm.Model):
     _inherit = 'account.move.line'
 
-    def _invoice(self, cr, uid, ids, name, arg, context=None):
+    def _invoice(self, cursor, user, ids, name, arg, context=None):
         invoice_obj = self.pool.get('account.invoice')
         res = {}
         for line_id in ids:
@@ -43,8 +43,7 @@
                        'left join account_move_line p on l.reconcile_partial_id=p.reconcile_partial_id and l.id<>p.id ' \
                        'where (i.move_id = l.move_id or i.move_id = r.move_id or i.move_id = p.move_id) ' \
                        'AND l.id IN %s',
-                        (tuple(ids),))
-        invoice_ids = []        
+                        (tuple(ids),))       
  
         for line_id, invoice_id in cursor.fetchall():
             name = invoice_obj.name_get(cursor, user, [invoice_id], context=context)
@@ -195,6 +194,8 @@
         'payment_type': fields.function(_payment_type_get,
             type="many2one", relation="payment.type", method=True,
             string="Payment type", fnct_search=_payment_type_search),
+        'invoice': fields.function(_invoice, string='Invoice',
+            type='many2one', relation='account.invoice', fnct_search=_invoice_search),
     }
 
     def write(self, cr, uid, ids, vals, context=None,


Follow ups