← Back to team overview

openerp-community-reviewer team mailing list archive

[Merge] lp:~camptocamp/openerp-rma/rma-fix-lp1311520_rde into lp:openerp-rma

 

Romain Deheele - Camptocamp has proposed merging lp:~camptocamp/openerp-rma/rma-fix-lp1311520_rde into lp:openerp-rma.

Requested reviews:
  OpenERP RMA (openerprma)
Related bugs:
  Bug #1311520 in OpenERP RMA: "In Product Return, link Invoice with a line without product_id raises an error"
  https://bugs.launchpad.net/openerp-rma/+bug/1311520

For more details, see:
https://code.launchpad.net/~camptocamp/openerp-rma/rma-fix-lp1311520_rde/+merge/216839

Hello,

it fixes partially lp:~camptocamp/openerp-rma/rma-fix-lp1311520_rde

Invoice lines without product_id are possible.
We need to manage this case, for example it seems at least relevant to have the possibility to generate a refund.

About actions "new products return" and "new delivery", is there really a functional need when there is no product_id on invoice line?

Regards,

Romain 



-- 
https://code.launchpad.net/~camptocamp/openerp-rma/rma-fix-lp1311520_rde/+merge/216839
Your team OpenERP RMA is requested to review the proposed merge of lp:~camptocamp/openerp-rma/rma-fix-lp1311520_rde into lp:openerp-rma.
=== modified file 'crm_claim_rma/crm_claim_rma.py'
--- crm_claim_rma/crm_claim_rma.py	2014-04-23 07:07:52 +0000
+++ crm_claim_rma/crm_claim_rma.py	2014-04-23 09:24:08 +0000
@@ -259,8 +259,10 @@
         """Compute and return the destination location ID to take
         for a return. Always take 'Supplier' one when return type different
         from company."""
-        prod_obj = self.pool.get('product.product')
-        prod = prod_obj.browse(cr, uid, product_id, context=context)
+        prod = False
+        if product_id:
+            prod_obj = self.pool.get('product.product')
+            prod = prod_obj.browse(cr, uid, product_id, context=context)
         wh_obj = self.pool.get('stock.warehouse')
         wh = wh_obj.browse(cr, uid, warehouse_id, context=context)
         location_dest_id = wh.lot_stock_id.id
@@ -456,14 +458,15 @@
         invoice_lines = invoice_line_obj.browse(cr, uid, invoice_line_ids,
                                                 context=context)
         for invoice_line in invoice_lines:
+            product_id = invoice_line.product_id and invoice_line.product_id.id or False
             location_dest_id = claim_line_obj.get_destination_location(
-                cr, uid, invoice_line.product_id.id,
+                cr, uid, product_id,
                 warehouse_id, context=context)
             claim_lines.append({
                 'name': invoice_line.name,
                 'claim_origine': "none",
                 'invoice_line_id': invoice_line.id,
-                'product_id': invoice_line.product_id.id,
+                'product_id': product_id,
                 'product_returned_quantity': invoice_line.quantity,
                 'unit_sale_price': invoice_line.price_unit,
                 'location_dest_id': location_dest_id,


Follow ups