Amit Dodiya (OpenERP) has proposed merging 
lp:~openerp-dev/openobject-addons/6.0-opw-381524-ado into 
lp:openobject-addons/6.0.

Requested reviews:
  Naresh(OpenERP) (nch-openerp)

For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-381524-ado/+merge/88646

Hello,

"[FIX] return product contains scrapped line also added into invoice"

Steps to Reproduce:

1). Create a delivery order with product = cpu1
2). Process and Validate the order
3). Return product with Invoicing = To be refunded/invoiced, it will create 
return picking
4). Scrap the line, now two lines in picking
5). Process it, Validate and create invoice from button, It will show you both 
line.

Thanks,
Amit
-- 
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-381524-ado/+merge/88646
Your team OpenERP R&D Team is subscribed to branch 
lp:~openerp-dev/openobject-addons/6.0-opw-381524-ado.
=== modified file 'stock/stock.py'
--- stock/stock.py	2012-01-10 12:52:13 +0000
+++ stock/stock.py	2012-01-16 09:12:26 +0000
@@ -1081,20 +1081,22 @@
                 account_id = self.pool.get('account.fiscal.position').map_account(cr, uid, partner.property_account_position, account_id)
                 if move_line.price_unit != 0 and price_unit != move_line.price_unit:
                     price_unit = move_line.price_unit
-                invoice_line_id = invoice_line_obj.create(cr, uid, {
-                    'name': name,
-                    'origin': origin,
-                    'invoice_id': invoice_id,
-                    'uos_id': uos_id,
-                    'product_id': move_line.product_id.id,
-                    'account_id': account_id,
-                    'price_unit': price_unit,
-                    'discount': discount,
-                    'quantity': move_line.product_uos_qty or move_line.product_qty,
-                    'invoice_line_tax_id': [(6, 0, tax_ids)],
-                    'account_analytic_id': account_analytic_id,
-                }, context=context)
-                self._invoice_line_hook(cr, uid, move_line, invoice_line_id)
+                
+                if not move_line.location_dest_id.scrap_location:
+                    invoice_line_id = invoice_line_obj.create(cr, uid, {
+                        'name': name,
+                        'origin': origin,
+                        'invoice_id': invoice_id,
+                        'uos_id': uos_id,
+                        'product_id': move_line.product_id.id,
+                        'account_id': account_id,
+                        'price_unit': price_unit,
+                        'discount': discount,
+                        'quantity': move_line.product_uos_qty or move_line.product_qty,
+                        'invoice_line_tax_id': [(6, 0, tax_ids)],
+                        'account_analytic_id': account_analytic_id,
+                    }, context=context)
+                    self._invoice_line_hook(cr, uid, move_line, invoice_line_id)
 
             invoice_obj.button_compute(cr, uid, [invoice_id], context=context,
                     set_total=(inv_type in ('in_invoice', 'in_refund')))

_______________________________________________
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