Mayur Maheshwari(OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/trunk-addons_issue12_sales-mma into 
lp:openobject-addons.

Requested reviews:
  Purnendu Singh (OpenERP) (psi-tinyerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons_issue12_sales-mma/+merge/128216

Hello 

    I have fixed the issue of when no product in sale order line and invoice 
based on delivery at the time invoice is created for that line . 

Thanks
Mayur
   
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/trunk-addons_issue12_sales-mma/+merge/128216
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/trunk-addons_issue12_sales-mma.
=== modified file 'sale/sale.py'
--- sale/sale.py	2012-10-02 20:40:23 +0000
+++ sale/sale.py	2012-10-05 13:05:25 +0000
@@ -735,13 +735,13 @@
         if (line.order_id.invoice_quantity=='order'):
             if line.product_uos:
                 return line.product_uos_qty or 0.0
-            return line.product_uom_qty
+        return line.product_uom_qty
 
     def _get_line_uom(self, cr, uid, line, context=None):
         if (line.order_id.invoice_quantity=='order'):
             if line.product_uos:
                 return line.product_uos.id
-            return line.product_uom.id
+        return line.product_uom.id
 
     def _prepare_order_line_invoice_line(self, cr, uid, line, account_id=False, context=None):
         """Prepare the dict of values to create the new invoice line for a

=== modified file 'sale_stock/stock.py'
--- sale_stock/stock.py	2012-07-26 20:56:59 +0000
+++ sale_stock/stock.py	2012-10-05 13:05:25 +0000
@@ -153,13 +153,14 @@
                 inv_name = picking.sale_id.client_order_ref + " : " + invoice_created.name
                 invoice_obj.write(cursor, user, [invoice_created.id], {'name': inv_name}, context=context)
             for sale_line in sale_lines:
+                account_id = False
+                if not type:
+                    type = context.get('inv_type', False)
+                if group:
+                    name = picking.name + '-' + sale_line.name
+                else:
+                    name = sale_line.name
                 if sale_line.product_id.type == 'service' and sale_line.invoiced == False:
-                    if not type:
-                        type = context.get('inv_type', False)
-                    if group:
-                        name = picking.name + '-' + sale_line.name
-                    else:
-                        name = sale_line.name
                     if type in ('out_invoice', 'out_refund'):
                         account_id = sale_line.product_id.product_tmpl_id.\
                                 property_account_income.id
@@ -173,16 +174,16 @@
                             account_id = sale_line.product_id.categ_id.\
                                     property_account_expense_categ.id
 
-                    vals = order_line_obj._prepare_order_line_invoice_line(cursor, user, sale_line, account_id, context)
-                    if vals: #note: in some cases we may not want to include all service lines as invoice lines
-                        vals['name'] = name
-                        vals['account_analytic_id'] = self._get_account_analytic_invoice(cursor, user, picking, sale_line)
-                        vals['invoice_id'] = invoices[result[picking.id]].id
-                        invoice_line_id = invoice_line_obj.create(cursor, user, vals, context=context)
-                        order_line_obj.write(cursor, user, [sale_line.id], {
-                            'invoiced': True,
-                            'invoice_lines': [(6, 0, [invoice_line_id])],
-                        })
+                vals = order_line_obj._prepare_order_line_invoice_line(cursor, user, sale_line, account_id, context)
+                if vals: #note: in some cases we may not want to include all service lines as invoice lines
+                    vals['name'] = name
+                    vals['account_analytic_id'] = self._get_account_analytic_invoice(cursor, user, picking, sale_line)
+                    vals['invoice_id'] = invoices[result[picking.id]].id
+                    invoice_line_id = invoice_line_obj.create(cursor, user, vals, context=context)
+                    order_line_obj.write(cursor, user, [sale_line.id], {
+                        'invoiced': True,
+                        'invoice_lines': [(6, 0, [invoice_line_id])],
+                    })
         return result
 
 # Redefinition of the new field in order to update the model stock.picking.out in the orm

_______________________________________________
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