← Back to team overview

savoirfairelinux-openerp team mailing list archive

lp:~savoirfairelinux-openerp/openerp-rma/7.0-fix-reference-to-res-partner-address into lp:openerp-rma

 

Maxime Chambreuil (http://www.savoirfairelinux.com) has proposed merging lp:~savoirfairelinux-openerp/openerp-rma/7.0-fix-reference-to-res-partner-address into lp:openerp-rma.

Requested reviews:
  OpenERP RMA (openerprma)

For more details, see:
https://code.launchpad.net/~savoirfairelinux-openerp/openerp-rma/7.0-fix-reference-to-res-partner-address/+merge/180956

[UPG] Upgrade to v7
-- 
https://code.launchpad.net/~savoirfairelinux-openerp/openerp-rma/7.0-fix-reference-to-res-partner-address/+merge/180956
Your team Savoir-faire Linux' OpenERP is subscribed to branch lp:~savoirfairelinux-openerp/openerp-rma/7.0-fix-reference-to-res-partner-address.
=== modified file 'crm_claim_rma/crm_claim_rma.py'
--- crm_claim_rma/crm_claim_rma.py	2013-02-22 22:40:51 +0000
+++ crm_claim_rma/crm_claim_rma.py	2013-08-19 22:21:59 +0000
@@ -21,7 +21,7 @@
 #along with this program.  If not, see <http://www.gnu.org/licenses/>.  #
 #########################################################################
 
-from osv import fields, osv
+from openerp.osv import fields, orm
 from crm import crm
 from datetime import datetime
 from dateutil.relativedelta import relativedelta
@@ -29,8 +29,8 @@
 from tools.translate import _
 from tools import DEFAULT_SERVER_DATE_FORMAT
 
-#=====     TO REFACTORED IN A GENERIC MODULE 
-class substate_substate(osv.osv): 
+#TODO: REFACTOR IN A GENERIC MODULE 
+class substate_substate(orm.Model): 
     """
     To precise a state (state=refused; substates= reason 1, 2,...)
     """
@@ -41,10 +41,8 @@
         'substate_descr' : fields.text('Description', help="To give more information about the sub state"), 
         # ADD OBJECT TO FILTER
         }
-substate_substate()
 
-#=====
-class claim_line(osv.osv):
+class claim_line(orm.Model):
     """
     Class to handle a product return line (corresponding to one invoice line)
     """
@@ -52,21 +50,14 @@
     _description = "List of product to return"
         
     # Method to calculate total amount of the line : qty*UP
-    def _line_total_amount(self, cr, uid, ids, field_name, arg,context):
+    def _line_total_amount(self, cr, uid, ids, field_name, arg, context=None):
         res = {}
         for line in self.browse(cr,uid,ids):            
             res[line.id] = line.unit_sale_price*line.product_returned_quantity
         return res 
         
-#    def _get_claim_seq(self, cr, uid, ids, field_name, arg,context):
-#        res = {}
-#        for line in self.browse(cr,uid,ids):            
-#            res[line.id] = line.claim_id.sequence
-#        return res          
-                
     _columns = {
         'name': fields.char('Description', size=64,required=True),
-#        'name': fields.function(_get_claim_seq, method=True, string='Claim n°', type='char', size=64,store=True),
         'claim_origine': fields.selection([('none','Not specified'),
                                     ('legal','Legal retractation'),
                                     ('cancellation','Order cancellation'),
@@ -76,17 +67,14 @@
                                     ('lost','Lost during transport'),
                                     ('other','Other')], 'Claim Subject', required=True, help="To describe the line product problem"),
         'claim_descr' : fields.text('Claim description', help="More precise description of the problem"),  
-#use the invoice line instead of the invoice
-#        'invoice_id': fields.many2one('account.invoice', 'Invoice',help="The invoice related to the returned product"),
-        
         'product_id': fields.many2one('product.product', 'Product',help="Returned product"),
         'product_returned_quantity' : fields.float('Quantity', digits=(12,2), help="Quantity of product returned"),
         'unit_sale_price' : fields.float('Unit sale price', digits=(12,2), help="Unit sale price of the product. Auto filed if retrun done by invoice selection. BE CAREFUL AND CHECK the automatic value as don't take into account previous refounds, invoice discount, can be for 0 if product for free,..."),
         'return_value' : fields.function(_line_total_amount, method=True, string='Total return', type='float', help="Quantity returned * Unit sold price",),
         'prodlot_id': fields.many2one('stock.production.lot', 'Serial/Lot n°',help="The serial/lot of the returned product"),
-        'applicable_guarantee': fields.selection([('us','Company'),('supplier','Supplier'),('brand','Brand manufacturer')], 'Warranty type'),# METTRE CHAMP FONCTION; type supplier might generate an auto draft forward to the supplier
+        'applicable_guarantee': fields.selection([('us','Company'),('supplier','Supplier'),('brand','Brand manufacturer')], 'Warranty type'),# TODO: Replace with function field. type supplier might generate an auto draft forward to the supplier
         'guarantee_limit': fields.date('Warranty limit', help="The warranty limit is computed as: invoice date + warranty defined on selected product.", readonly=True),
-        'warning': fields.char('Warranty', size=64, readonly=True,help="If warranty has expired"), #select=1,
+        'warning': fields.char('Warranty', size=64, readonly=True,help="If warranty has expired"),
         'warranty_type': fields.char('Warranty type', size=64, readonly=True,help="from product form"),
         "warranty_return_partner" : fields.many2one('res.partner', 'Warranty return',help="Where the customer has to send back the product(s)"),        
         'claim_id': fields.many2one('crm.claim', 'Related claim',help="To link to the case.claim object"),
@@ -110,13 +98,13 @@
     } 
 
     # Method to calculate warranty limit
-    def set_warranty_limit(self, cr, uid, ids, context, claim_line):
+    def set_warranty_limit(self, cr, uid, ids, claim_line, context=None):
         date_invoice = claim_line.invoice_line_id.invoice_id.date_invoice
         if date_invoice:
             warning = "Valid"
             if claim_line.claim_id.claim_type == 'supplier':
                 if claim_line.prodlot_id :
-                    limit = (datetime.strptime(date_invoice, DEFAULT_SERVER_DATE_FORMAT) + relativedelta(months=int(claim_line.product_id.seller_ids[0].warranty_duration))).strftime(DEFAULT_SERVER_DATE_FORMAT) # TO BE IMPLEMENTED !!!
+                    limit = (datetime.strptime(date_invoice, DEFAULT_SERVER_DATE_FORMAT) + relativedelta(months=int(claim_line.product_id.seller_ids[0].warranty_duration))).strftime(DEFAULT_SERVER_DATE_FORMAT) # TODO: To be implemented
                 else :
                     limit = (datetime.strptime(date_invoice, DEFAULT_SERVER_DATE_FORMAT) + relativedelta(months=int(claim_line.product_id.seller_ids[0].warranty_duration))).strftime(DEFAULT_SERVER_DATE_FORMAT) 
             else :
@@ -132,7 +120,7 @@
         return True
 
     # Method to calculate warranty return address
-    def set_warranty_return_address(self, cr, uid, ids, context, claim_line):
+    def set_warranty_return_address(self, cr, uid, ids, claim_line, context=None):
         return_address = None
         warranty_type = 'company'
         seller = claim_line.product_id.seller_info_id
@@ -177,76 +165,18 @@
         return True
                
     # Method to calculate warranty limit and validity
-    def set_warranty(self, cr, uid, ids,context=None):
+    def set_warranty(self, cr, uid, ids, context=None):
         for claim_line in self.browse(cr, uid, ids, context=context):
             if claim_line.product_id and claim_line.invoice_line_id:
-                self.set_warranty_limit(cr, uid, ids, context, claim_line)
-                self.set_warranty_return_address(cr, uid, ids, context, claim_line)
+                self.set_warranty_limit(cr, uid, ids, claim_line, context)
+                self.set_warranty_return_address(cr, uid, ids, claim_line, context)
             else:
                 raise osv.except_osv(_('Error !'), _('PLEASE SET PRODUCT & INVOICE!'))
         return True 
 
-#TODO add the option split the claim_line in order to manage the same product separately
-
-claim_line()
-
-#===== deprecated everything is based on the claim_line so product_exchange is useless
-#class product_exchange(osv.osv): 
-#    """
-#    Class to manage product exchanges history
-#    """
-#    _name = "product.exchange"
-#    _description = "exchange history line"
-#    
-#    # Method to calculate total amount of the line : qty*UP
-#    def total_amount_returned(self, cr, uid, ids, field_name, arg,context):
-#        res = {}
-#        for line in self.browse(cr,uid,ids):            
-#            res[line.id] = line.returned_unit_sale_price*line.returned_product_qty
-#        return res 
-
-#    # Method to calculate total amount of the line : qty*UP
-#    def total_amount_replacement(self, cr, uid, ids, field_name, arg,context):
-#        res = {}
-#        for line in self.browse(cr,uid,ids):            
-#            res[line.id] = line.replacement_unit_sale_price*line.replacement_product_qty
-#        return res 
-
-#    # Method to get the replacement product unit price
-#    def get_replacement_price(self, cr, uid, ids, field_name, arg,context):
-#        res = {}
-#        for line in self.browse(cr,uid,ids):            
-#            res[line.id] = line.replacement_product.list_price
-#        return res 
-#                        
-#    _columns = {
-#        'name': fields.char('Comment', size=128, required=True),
-#        'exchange_send_date' : fields.date('Exchange date'),
-#        'returned_product' : fields.many2one('product.product', 'Returned product', required=True), # ADD FILTER ON RETURNED PROD
-#        'returned_product_serial' : fields.many2one('stock.production.lot', 'Returned serial/Lot n°'),
-#        'returned_product_qty' : fields.float('Returned quantity', digits=(12,2), help="Quantity of product returned"),
-#        'replacement_product' : fields.many2one('product.product', 'Replacement product', required=True), 
-#        'replacement_product_serial' : fields.many2one('stock.production.lot', 'Replacement serial/Lot n°'),
-#        'replacement_product_qty' : fields.float('Replacement quantity', digits=(12,2), help="Quantity of product replaced"),
-#        'claim_return_id' : fields.many2one('crm.claim', 'Related claim'), # To link to the case.claim object  
-#        'selected' : fields.boolean('s', help="Check to select"),
-#        'state' : fields.selection([('draft','Draft'),
-#                                    ('confirmed','Confirmed'),
-#                                    ('to_send','To send'),
-#                                    ('sent','Sent')], 'State'),  
-#        'returned_unit_sale_price' : fields.float('Unit sale price', digits=(12,2)),
-#        'returned_value' : fields.function(total_amount_returned, method=True, string='Total return', type='float', help="Quantity exchanged * Unit sold price",),
-#        'replacement_unit_sale_price' : fields.function(get_replacement_price, method=True, string='Unit sale price', type='float',),
-#        'replacement_value' : fields.function(total_amount_replacement, method=True, string='Total return', type='float', help="Quantity replaced * Unit sold price",),
-#    }
-#    _defaults = {
-#        'state': lambda *a: 'draft',
-#    }
-#    
-#product_exchange()
-#==========
-
-class crm_claim(osv.osv):
+#TODO add the option to split the claim_line in order to manage the same product separately
+
+class crm_claim(orm.Model):
     _inherit = 'crm.claim'
 
     _columns = {
@@ -263,8 +193,8 @@
         # Financial management
         'planned_revenue': fields.float('Expected revenue'),
         'planned_cost': fields.float('Expected cost'),
-        'real_revenue': fields.float('Real revenue'), # A VOIR SI COMPTA ANA ou lien vers compte ana ?
-        'real_cost': fields.float('Real cost'), # A VOIR SI COMPTA ANA ou lien vers compte ana ?       
+        'real_revenue': fields.float('Real revenue'),
+        'real_cost': fields.float('Real cost'),
         'invoice_ids': fields.one2many('account.invoice', 'claim_id', 'Refunds'),
         'picking_ids': fields.one2many('stock.picking', 'claim_id', 'RMA'),
         'invoice_id': fields.many2one('account.invoice', 'Invoice', help='Related invoice'),
@@ -275,31 +205,8 @@
         'claim_type': lambda *a: 'customer',
         'warehouse_id': lambda *a: 1,
     }
-#    #===== Method to select all returned lines =====
-#    def select_all(self,cr, uid, ids,context):
-#        return_obj = self.pool.get('claim.line')
-#        for line in self.browse(cr,uid,ids)[0].claim_line_ids:
-#            return_obj.write(cr,uid,line.id,{'selected':True})
-#        return True
-
-#    #===== Method to unselect all returned lines =====
-#    def unselect_all(self,cr, uid, ids,context):
-#        return_obj = self.pool.get('claim.line')
-#        for line in self.browse(cr,uid,ids)[0].claim_line_ids:
-#            return_obj.write(cr,uid,line.id,{'selected':False})
-#        return True
-
-# === deprecated if we use the refund wizard of the account module ===
-#    def refund(self, cr, uid, ids, context=None):
-#        mod_obj = self.pool.get('ir.model.data')
-#        xml_id = 'action_account_invoice_refund'
-#        result = mod_obj.get_object_reference(cr, uid, 'account', xml_id)
-#        id = result and result[1] or False
-#        result = act_obj.read(cr, uid, id, context=context)
-#        print 'result', result
-#        return result
-
-    def onchange_partner_address_id(self, cr, uid, ids, add, email=False):
+
+    def onchange_partner_address_id(self, cr, uid, ids, add, email=False, context=None):
         res = super(crm_claim, self).onchange_partner_address_id(cr, uid, ids, add, email=email)
         if add:
             if not res['value']['email_from'] or not res['value']['partner_phone']:
@@ -331,6 +238,4 @@
 #                line.set_warranty()
         return  {'value' : {'claim_line_ids' : claim_lines}}
 
-crm_claim()
-
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'crm_claim_rma/crm_claim_rma_view.xml'
--- crm_claim_rma/crm_claim_rma_view.xml	2013-05-01 20:32:16 +0000
+++ crm_claim_rma/crm_claim_rma_view.xml	2013-08-19 22:21:59 +0000
@@ -323,15 +323,17 @@
         res_model="account.invoice" 
         src_model="crm.claim"/> 
 <!-- Right side link to picking in --> 
-        <act_window  
-        domain="[('type', '=', 'in'),('partner_id', 'in', [partner_id])]"
+        <act_window
+        context="{'search_default_partner_id': [partner_id]}"
+        domain="[('type', '=', 'in')]"
         id="act_crm_claim_rma_picking_in" 
         name="Partner picking IN" 
         res_model="stock.picking" 
         src_model="crm.claim"/>  
 <!-- Right side link to picking out -->
         <act_window 
-        domain="[('type', '=', 'out'),('partner_id', 'in', [partner_id])]"
+        context="{'search_default_partner_id': [partner_id]}"
+        domain="[('type', '=', 'out')]"
         id="act_crm_claim_rma_picking_out" 
         name="Partner picking OUT" 
         res_model="stock.picking" 

=== modified file 'crm_claim_rma/wizard/claim_make_picking.py'
--- crm_claim_rma/wizard/claim_make_picking.py	2012-10-11 18:31:50 +0000
+++ crm_claim_rma/wizard/claim_make_picking.py	2013-08-19 22:21:59 +0000
@@ -116,7 +116,6 @@
             view_name = 'stock.picking.in.form'
         view_id = view_obj.search(cr, uid, [
                                             ('xml_id', '=', view_xml_id),
-                                            ('model', '=', 'stock.picking'),
                                             ('type', '=', 'form'),
                                             ('name', '=', view_name)
                                             ], context=context)[0]
@@ -130,7 +129,7 @@
                     'move_type': 'one', # direct
                     'state': 'draft',
                     'date': time.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
-                    'address_id': claim.partner_address_id.id,
+                    'partner_id': claim.partner_id.id,
                     'invoice_state': "none",
                     'company_id': claim.company_id.id,
                     'location_id': wizard.claim_line_source_location.id,
@@ -150,7 +149,7 @@
                     'product_id': wizard_claim_line.product_id.id,
                     'product_qty': wizard_claim_line.product_returned_quantity,
                     'product_uom': wizard_claim_line.product_id.uom_id.id,
-                    'address_id': claim.partner_address_id.id,
+                    'partner_id': claim.partner_id.id,
                     'prodlot_id': wizard_claim_line.prodlot_id.id,
                     # 'tracking_id':
                     'picking_id': picking_id,

=== modified file 'crm_claim_rma/wizard/claim_make_picking_from_picking.py'
--- crm_claim_rma/wizard/claim_make_picking_from_picking.py	2012-09-19 16:25:16 +0000
+++ crm_claim_rma/wizard/claim_make_picking_from_picking.py	2013-08-19 22:21:59 +0000
@@ -93,7 +93,7 @@
                     'move_type': 'one', # direct
                     'state': 'draft',
                     'date': time.strftime(DEFAULT_SERVER_DATETIME_FORMAT),
-                    'address_id': prev_picking.address_id.id,
+                    'partner_id': prev_picking.partner_id.id,
                     'invoice_state': "none",
                     'company_id': prev_picking.company_id.id,
                     'location_id': wizard.picking_line_source_location.id,
@@ -112,7 +112,7 @@
                     'product_id': wizard_picking_line.product_id.id,
                     'product_qty': wizard_picking_line.product_qty,
                     'product_uom': wizard_picking_line.product_uom.id,
-                    'address_id': prev_picking.address_id.id,
+                    'partner_id': prev_picking.partner_id.id,
                     'prodlot_id': wizard_picking_line.prodlot_id.id,
                     # 'tracking_id':
                     'picking_id': picking_id,

=== modified file 'crm_claim_rma/wizard/picking_from_exchange_lines.py'
--- crm_claim_rma/wizard/picking_from_exchange_lines.py	2012-08-28 12:57:05 +0000
+++ crm_claim_rma/wizard/picking_from_exchange_lines.py	2013-08-19 22:21:59 +0000
@@ -31,7 +31,7 @@
     _columns = {
         'exchange_line_ids' : fields.many2many('temp.exchange.line', string='Selected exchange lines'),
     }
-    
+
     # Get selected lines to add to picking in
     def _get_selected_lines(self, cr, uid,context):
         exchange_line_ids = self.pool.get('crm.claim').read(cr, uid, context['active_id'], ['product_exchange_ids'])['product_exchange_ids'] 
@@ -46,13 +46,13 @@
 					    'returned_prodlot_id' : line.returned_product_serial.id,
 					    'replacement_product_id': line.replacement_product.id,
                         'replacement_product_quantity' : line.replacement_product_qty,
-                        'replacement_prodlot_id': line.replacement_product_serial.id,        
+                        'replacement_prodlot_id': line.replacement_product_serial.id,
 				    }))
-        return M2M    
-   
+        return M2M
+
     _defaults = {
         'exchange_line_ids': _get_selected_lines,
-    }    
+    }
 
     # If "Cancel" button pressed
     def action_cancel(self,cr,uid,ids,conect=None):
@@ -70,13 +70,13 @@
                         'move_type': 'one', # direct
                         'state': 'draft',
                         'date': time.strftime('%Y-%m-%d %H:%M:%S'),
-                        'address_id': claim_id.partner_address_id.id,
+                        'partner_id': claim_id.partner_id.id,
                         'invoice_state': "none",
                         'company_id': claim_id.company_id.id,
                         # 'stock_journal_id': fields.many2one('stock.journal','Stock Journal', select=True),
                         'location_id': self.pool.get('stock.warehouse').read(cr, uid, [1],['lot_input_id'])[0]['lot_input_id'][0],
                         'location_dest_id': claim_id.partner_id.property_stock_customer.id,
-					    'note' : 'RMA picking in',                        
+					    'note' : 'RMA picking in',
 				    })
 		    # Create picking lines
             for exchange_line in exchange_lines.exchange_line_ids:
@@ -89,7 +89,7 @@
 					    'product_id': exchange_line.replacement_product_id.id,
 					    'product_qty': exchange_line.replacement_product_quantity,
 					    'product_uom': exchange_line.replacement_product_id.uom_id.id,
-					    'address_id': claim_id.partner_address_id.id,
+					    'partner_id': claim_id.partner_id.id,
 					    'prodlot_id': exchange_line.replacement_prodlot_id,
 					    # 'tracking_id': 
 					    'picking_id': picking_id,
@@ -99,7 +99,7 @@
 					    'company_id': claim_id.company_id.id,
 					    'location_id': self.pool.get('stock.warehouse').read(cr, uid, [1],['lot_input_id'])[0]['lot_input_id'][0],
 					    'location_dest_id': claim_id.partner_id.property_stock_customer.id,
-					    'note': 'RMA Refound',                        
+					    'note': 'RMA Refound',
 				    })
         view = {
             'name': 'Customer Picking OUT',
@@ -110,7 +110,7 @@
             'type': 'ir.actions.act_window',
         }
         return view
-                              
+
 picking_out_from_exchange_lines()
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'crm_claim_rma/wizard/picking_from_returned_lines.py'
--- crm_claim_rma/wizard/picking_from_returned_lines.py	2012-09-12 09:29:21 +0000
+++ crm_claim_rma/wizard/picking_from_returned_lines.py	2013-08-19 22:21:59 +0000
@@ -32,7 +32,7 @@
         'claim_line_location' : fields.many2one('stock.location', 'Dest. Location',help="Location where the system will stock the returned products.", select=True),
         'claim_line_ids' : fields.many2many('temp.claim.line',string='Selected return lines'),
     }
-    
+
     # Get selected lines to add to picking in
     def _get_selected_lines(self, cr, uid,context):
         returned_line_ids = self.pool.get('crm.claim').read(cr, uid, context['active_id'], ['claim_line_ids'])['claim_line_ids'] 
@@ -53,12 +53,12 @@
     # Get default destination location
     def _get_dest_loc(self, cr, uid,context):
         return self.pool.get('stock.warehouse').read(cr, uid, [1],['lot_input_id'])[0]['lot_input_id'][0]  
-           
+
     _defaults = {
         'claim_line_ids': _get_selected_lines,
         'claim_line_location' : _get_dest_loc,
-    }    
-        
+    }
+
     # If "Cancel" button pressed
     def action_cancel(self,cr,uid,ids,conect=None):
         return {'type': 'ir.actions.act_window_close',}
@@ -84,7 +84,7 @@
                         'move_type': 'one', # direct
                         'state': 'draft',
                         'date': time.strftime('%Y-%m-%d %H:%M:%S'),
-                        'address_id': claim_id.partner_address_id.id,
+                        'partner_id': claim_id.partner_id.id,
                         'invoice_state': "none",
                         'company_id': claim_id.company_id.id,
                         'location_id': location,
@@ -103,7 +103,7 @@
                         'product_id': picking_line.product_id.id,
                         'product_qty': picking_line.product_returned_quantity,
                         'product_uom': picking_line.product_id.uom_id.id,
-                        'address_id': claim_id.partner_address_id.id,
+                        'partner_id': claim_id.partner_id.id,
                         'prodlot_id': picking_line.prodlot_id.id,
                         # 'tracking_id': 
                         'picking_id': picking_id,
@@ -125,7 +125,7 @@
             'res_model': 'stock.picking',
             'type': 'ir.actions.act_window',
         }
-                              
+
 picking_in_from_returned_lines()
 
 # Class to create a picking out from selected return lines
@@ -135,7 +135,7 @@
     _columns = {
         'claim_line_ids' : fields.many2many('temp.claim.line', string='Selected return lines'),
     }
-    
+
     # Get selected lines to add to picking in
     def _get_selected_lines(self, cr, uid,context):
         returned_line_ids = self.pool.get('crm.claim').read(cr, uid, context['active_id'], ['claim_line_ids'])['claim_line_ids'] 
@@ -151,11 +151,11 @@
                         'prodlot_id' :  line.prodlot_id.id,
                         'price_unit' :  line.unit_sale_price,
                     }))
-        return M2M    
-   
+        return M2M
+
     _defaults = {
         'claim_line_ids': _get_selected_lines,
-    }    
+    }
 
     # If "Cancel" button pressed
     def action_cancel(self,cr,uid,ids,context=None):
@@ -180,7 +180,7 @@
                         'move_type': 'one', # direct
                         'state': 'draft',
                         'date': time.strftime('%Y-%m-%d %H:%M:%S'),
-                        'address_id': claim_id.partner_address_id.id,
+                        'partner_id': claim_id.partner_id.id,
                         'invoice_state': "none",
                         'company_id': claim_id.company_id.id,
                         # 'stock_journal_id': fields.many2one('stock.journal','Stock Journal', select=True),
@@ -200,7 +200,7 @@
                         'product_id': picking_line.product_id.id,
                         'product_qty': picking_line.product_returned_quantity,
                         'product_uom': picking_line.product_id.uom_id.id,
-                        'address_id': claim_id.partner_address_id.id,
+                        'partner_id': claim_id.partner_id.id,
                         'prodlot_id': picking_line.prodlot_id.id,
                         # 'tracking_id': 
                         'picking_id': picking_id,

=== modified file 'crm_claim_rma/wizard/refund_from_returned_lines.py'
--- crm_claim_rma/wizard/refund_from_returned_lines.py	2012-09-03 10:06:46 +0000
+++ crm_claim_rma/wizard/refund_from_returned_lines.py	2013-08-19 22:21:59 +0000
@@ -31,7 +31,7 @@
         'refund_journal' : fields.many2one('account.journal', 'Refund journal', select=True),
         'claim_line_ids' : fields.many2many('temp.claim.line', string='Selected return lines'),
     }
-    
+
     # Get selected lines to add to picking in
     def _get_selected_lines(self, cr, uid,context):
         returned_line_ids = self.pool.get('crm.claim').read(cr, uid, context['active_id'], ['claim_line_ids'])['claim_line_ids'] 
@@ -47,18 +47,18 @@
                         'prodlot_id' : line.prodlot_id.id,
                         'price_unit' :  line.unit_sale_price,
                     }))
-        return M2M    
+        return M2M
 
     # Get default journal
     def _get_journal(self, cr, uid,context):
         #('company_id','=',claim_id.company_id.id)
         # ,('refund_journal','=','True')
         return self.pool.get('account.journal').search(cr, uid, [('type','=','sale_refund')],limit=1)[0] 
-   
+
     _defaults = {
         'claim_line_ids': _get_selected_lines,
         'refund_journal' : _get_journal,
-    }    
+    }
 
     # On "Cancel" button
     def action_cancel(self,cr,uid,ids,context=None):
@@ -85,22 +85,22 @@
                         'reference_type': 'none',
                         'date_invoice': time.strftime('%Y-%m-%d %H:%M:%S'),
                         # 'date_due':
-                        'address_contact_id' : claim_id.partner_address_id.id,
-                        'address_invoice_id' : claim_id.partner_address_id.id,
+                        'partner_id' : claim_id.partner_id.id,
+                        'commercial_partner_id' : claim_id.partner_id.id,
                         'account_id' : claim_id.partner_id.property_account_receivable.id,
                         'currency_id' : claim_id.company_id.currency_id.id, # from invoice ???
                         'journal_id' : refund.refund_journal.id,
                         'company_id' : claim_id.company_id.id,
                         'comment' : 'RMA Refund',
                         'claim_id': claim_id.id,
-                    })                    
-            # Create invoice lines        
-            for refund_line in refund.claim_line_ids:             
+                    })
+            # Create invoice lines
+            for refund_line in refund.claim_line_ids:
                 if refund_line.invoice_id:
                     invoice_line_id = self.pool.get('account.invoice.line').create(cr, uid, {
                         'name' : refund_line.product_id.name_template,
-                        'origin' : claim_id.sequence,                        
-                        'invoice_id' : invoice_id,                        
+                        'origin' : claim_id.sequence,
+                        'invoice_id' : invoice_id,
                         'uos_id' : refund_line.product_id.uom_id.id,
                         'product_id':refund_line.product_id.id,
                         'account_id': claim_id.partner_id.property_account_receivable.id, # refund_line.product_id.property_account_expense.id,
@@ -111,7 +111,7 @@
 #                        'account_analytic_id':
                         'company_id' : claim_id.company_id.id,
                         'partner_id' : refund_line.invoice_id.partner_id.id,
-                        'note': 'RMA Refund',                        
+                        'note': 'RMA Refund',
                         })
                 else:
                     raise osv.except_osv(_('Error !'), _('Cannot find any invoice for the return line!'))
@@ -123,7 +123,7 @@
             'res_model': 'account.invoice',
             'type': 'ir.actions.act_window',
         }
-                      
+
 refund_from_returned_lines()
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

=== modified file 'product_warranty/product_warranty.py'
--- product_warranty/product_warranty.py	2012-09-12 16:58:33 +0000
+++ product_warranty/product_warranty.py	2013-08-19 22:21:59 +0000
@@ -20,11 +20,10 @@
 #along with this program.  If not, see <http://www.gnu.org/licenses/>.  #
 #########################################################################
 
-from osv import fields, osv
+from openerp.osv import orm, fields
 from tools.translate import _
 
-#=====
-class return_instruction(osv.osv):
+class return_instruction(orm.Model):
     _name = "return.instruction"
     _description = "Instructions for product return"
     _columns = {
@@ -32,10 +31,8 @@
         'instructions' : fields.text('Instructions', help="Instructions for product return"),
         'is_default' : fields.boolean('Is default', help="If is default, will be use to set the default value in supplier infos. Be careful to have only one default"),
         }
-return_instruction()
 
-#=====
-class product_supplierinfo(osv.osv):
+class product_supplierinfo(orm.Model):
     _inherit = "product.supplierinfo"
 
     def get_warranty_return_partner(self, cr, uid, context=None):
@@ -48,18 +45,18 @@
         return result
 
     # Get selected lines to add to exchange
-    def _get_default_instructions(self, cr, uid,context):
+    def _get_default_instructions(self, cr, uid, context=None):
         instruction_ids = self.pool.get('return.instruction').search(cr, uid, [('is_default','=','FALSE')])
         if instruction_ids:
             return instruction_ids[0]
-            # TO DO f(supplier) + other.
+            # TODO f(supplier) + other.
         return False
 
     def _get_warranty_return_address(self, cr, uid, ids, field_names, arg, context=None):
         # Method to return the partner delivery address or if none, the default address
         # dedicated_delivery_address stand for the case a new type of address more particularly dedicated to return delivery would be implemented.
         result ={}
-        address_obj = self.pool.get('res.partner.address')
+        address_obj = self.pool.get('res.partner')
         for supplier_info in self.browse(cr, uid, ids, context=context):
             result[supplier_info.id] = {}
             address_id = False
@@ -73,14 +70,17 @@
                     partner_id = supplier_info.product_id.product_brand_id.partner_id.id
                 else:
                     partner_id = supplier_info.company_id.partner_id.id
-                address_id = address_obj.search(cr, uid, [('partner_id', '=', partner_id), ('type', 'like', 'dedicated_delivery')], context=context)
-                if not address_id:
-                    address_id = address_obj.search(cr, uid, [('partner_id','=', partner_id), ('type','like','delivery')], context=context)
-                    if not address_id:
-                        address_id = address_obj.search(cr, uid, [('partner_id', '=', partner_id), ('type', 'like', 'default')], context=context)
-                if not address_id:
-                    raise osv.except_osv(_('Error !'), _('No address define for the %s!') % return_partner)
-                result[supplier_info.id] = address_id[0]
+# TODO : Find the partner with a delivery address, child of the partner
+# v6.1 code with res.partner.address :
+#                address_id = address_obj.search(cr, uid, [('partner_id', '=', partner_id), ('type', 'like', 'dedicated_delivery')], context=context)
+#                if not address_id:
+#                    address_id = address_obj.search(cr, uid, [('partner_id','=', partner_id), ('type','like','delivery')], context=context)
+#                    if not address_id:
+#                        address_id = address_obj.search(cr, uid, [('partner_id', '=', partner_id), ('type', 'like', 'default')], context=context)
+#                if not address_id:
+#                    raise osv.except_osv(_('Error !'), _('No address define for the %s!') % return_partner)
+#                #result[supplier_info.id] = address_id[0]
+                result[supplier_info.id] = partner_id
         return result
 
     _columns = {
@@ -88,13 +88,12 @@
         "warranty_return_partner" :  fields.selection(get_warranty_return_partner, 'Warrantee return', size=128, help="Who is in charge of the warranty return treatment toward the end customer. Company will use the current compagny delivery or default address and so on for supplier and brand manufacturer. Doesn't necessarly mean that the warranty to be applied is the one of the return partner (ie: can be returned to the company and be under the brand warranty"),
         'return_instructions': fields.many2one('return.instruction', 'Instructions',help="Instructions for product return"),
         'active_supplier' : fields.boolean('Active supplier', help=""),
-        'warranty_return_address': fields.function(_get_warranty_return_address, type='many2one', relation='res.partner.address', string="Warranty return address"),
+        'warranty_return_address': fields.function(_get_warranty_return_address, type='many2one', relation='res.partner', string="Warranty return address"),
         }
     _defaults = {
         'warranty_return_partner': lambda *a: 'company',
         'return_instructions': _get_default_instructions,
     }
 
-product_supplierinfo()
 
 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:


Follow ups