Hardik Ansodariya (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-usability-po_assign_reference-han into 
lp:~openerp-dev/openobject-addons/trunk-usability.

Requested reviews:
  Hardik Ansodariya (OpenERP) (han-tinyerp)
  Amit (Open ERP) (apa-tiny)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-usability-po_assign_reference-han/+merge/74566
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-usability-po_assign_reference-han/+merge/74566
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-usability.
=== modified file 'purchase/wizard/purchase_line_invoice.py'
--- purchase/wizard/purchase_line_invoice.py	2011-01-18 01:55:29 +0000
+++ purchase/wizard/purchase_line_invoice.py	2011-09-08 09:31:24 +0000
@@ -55,18 +55,6 @@
             invoice_line_obj=self.pool.get('account.invoice.line')
             account_jrnl_obj=self.pool.get('account.journal')
 
-            def multiple_order_invoice_name(orders):
-                name = "PO";
-                for order in orders:
-                    name += "-%d" % order.id
-                return name
-
-            def multiple_order_invoice_reference(partner, orders):
-                reference = "P%dPO" % partner.id
-                for order in orders:
-                    reference += "-%d" % order.id
-                return reference
-
             def multiple_order_invoice_notes(orders):
                 notes = ""
                 for order in orders:
@@ -82,6 +70,7 @@
                     @param orders : The set of orders to add in the invoice
                     @param lines : The list of line's id
                 """
+                name = orders and orders[0].name or ''
                 journal_id = account_jrnl_obj.search(cr, uid, [('type', '=', 'purchase')], context=None)
                 journal_id = journal_id and journal_id[0] or False
                 a = partner.property_account_payable.id
@@ -90,11 +79,11 @@
                 else:
                     pay_term = False
                 inv = {
-                    'name': multiple_order_invoice_name(orders),
-                    'origin': multiple_order_invoice_name(orders),
+                    'name': name,
+                    'origin': name,
                     'type': 'in_invoice',
                     'journal_id':journal_id,
-                    'reference': multiple_order_invoice_reference(partner, orders),
+                    'reference' : partner.ref,
                     'account_id': a,
                     'partner_id': partner.id,
                     'address_invoice_id': orders[0].partner_address_id.id,

_______________________________________________
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

Reply via email to