diff --git a/crm_claim_rma/__openerp__.py b/crm_claim_rma/__openerp__.py index ae9ce9bd..e5882af9 100644 --- a/crm_claim_rma/__openerp__.py +++ b/crm_claim_rma/__openerp__.py @@ -52,11 +52,6 @@ on this branch : https://code.launchpad.net/~akretion-team/openobject-addons/ope 'wizard/claim_make_picking_view.xml', 'wizard/claim_make_picking_from_picking_view.xml', 'wizard/returned_lines_from_serial_wizard_view.xml', -# 'wizard/returned_lines_from_invoice_wizard_view.xml', -# 'wizard/picking_from_returned_lines_wizard_view.xml', -# 'wizard/refund_from_returned_lines_wizard_view.xml', -# 'wizard/exchange_from_returned_lines_wizard_view.xml', -# 'wizard/picking_from_exchange_lines_wizard_view.xml', 'wizard/get_empty_serial_view.xml', 'crm_claim_rma_view.xml', 'security/ir.model.access.csv', diff --git a/crm_claim_rma/account_invoice.py b/crm_claim_rma/account_invoice.py index 61408c76..9cf41215 100644 --- a/crm_claim_rma/account_invoice.py +++ b/crm_claim_rma/account_invoice.py @@ -4,7 +4,7 @@ # # ######################################################################### # # -# Copyright (C) 2009-2011 Akretion, Raphaël Valyi, Sébastien Beau, # +# Copyright (C) 2009-2011 Akretion, Raphaël Valyi, Sébastien Beau, # # Emmanuel Samyn, Benoît Guillot # # # #This program is free software: you can redistribute it and/or modify # @@ -21,14 +21,13 @@ #along with this program. If not, see . # ######################################################################### -from osv import fields, osv +from openerp.osv import fields, orm, osv from tools.translate import _ -class account_invoice(osv.osv): +class account_invoice(orm.Model): _inherit = "account.invoice" - _columns = { 'claim_id': fields.many2one('crm.claim', 'Claim'), } @@ -40,18 +39,28 @@ class account_invoice(osv.osv): def _refund_cleanup_lines(self, cr, uid, lines, context=None): if context is None: context = {} + inv_line_obj = self.pool.get('account.invoice.line') + claim_line_obj = self.pool.get('claim.line') new_lines = [] - if context.get('claim_line_ids') and lines and 'product_id' in lines[0]:#check if is an invoice_line + if context.get('claim_line_ids') and lines and 'product_id' in lines[0]:#check if there is an invoice_line for claim_line_id in context.get('claim_line_ids'): - claim_info = self.pool.get('claim.line').read(cr, uid, claim_line_id[1], ['invoice_line_id', 'product_returned_quantity', 'refund_line_id'], context=context) + claim_info = claim_line_obj.read(cr, uid, + claim_line_id[1], + ['invoice_line_id', + 'product_returned_quantity', + 'refund_line_id'], + context=context) if not claim_info['refund_line_id']: - invoice_line_info = self.pool.get('account.invoice.line').read(cr, uid, claim_info['invoice_line_id'][0], context=context) + invoice_line_info =inv_line_obj.read(cr, uid, + claim_info['invoice_line_id'][0], + context=context) invoice_line_info['quantity'] = claim_info['product_returned_quantity'] invoice_line_info['claim_line_id'] = [claim_line_id[1]] new_lines.append(invoice_line_info) if not new_lines: #TODO use custom states to show button of this wizard or not instead of raise an error - raise osv.except_osv(_('Error !'), _('A refund has already been created for this claim !')) + raise osv.except_osv(_('Error !'), + _('A refund has already been created for this claim !')) lines = new_lines result = super(account_invoice, self)._refund_cleanup_lines(cr, uid, lines, context=context) return result @@ -62,8 +71,8 @@ class account_invoice(osv.osv): result['claim_id'] = kwargs['context']['claim_id'] return result -class account_invoice_line(osv.osv): +class account_invoice_line(orm.Model): _inherit = "account.invoice.line" def create(self, cr, uid, vals, context=None): @@ -71,7 +80,10 @@ class account_invoice_line(osv.osv): if vals.get('claim_line_id'): claim_line_id = vals['claim_line_id'] del vals['claim_line_id'] - line_id = super(account_invoice_line, self).create(cr, uid, vals, context=context) + line_id = super(account_invoice_line, self).create(cr, uid, vals, + context=context) if claim_line_id: - self.pool.get('claim.line').write(cr, uid, claim_line_id, {'refund_line_id': line_id}, context=context) + self.pool.get('claim.line').write(cr, uid, claim_line_id, + {'refund_line_id': line_id}, + context=context) return line_id diff --git a/crm_claim_rma/crm_claim_rma.py b/crm_claim_rma/crm_claim_rma.py index 363225cf..eacaffec 100644 --- a/crm_claim_rma/crm_claim_rma.py +++ b/crm_claim_rma/crm_claim_rma.py @@ -4,8 +4,9 @@ # # ######################################################################### # # -# Copyright (C) 2009-2011 Akretion, Raphaël Valyi, Sébastien Beau, # -# Emmanuel Samyn # +# Copyright (C) 2009-2013 Akretion # +# @ Authors : Raphaël Valyi, Sébastien Beau, Emmanuel Samyn, # +# Benoît GUILLOT # # # #This program is free software: you can redistribute it and/or modify # #it under the terms of the GNU General Public License as published by # @@ -21,7 +22,7 @@ #along with this program. If not, see . # ######################################################################### -from osv import fields, osv +from openerp.osv import fields, orm, osv from crm import crm from datetime import datetime from dateutil.relativedelta import relativedelta @@ -29,8 +30,9 @@ import time from tools.translate import _ from tools import DEFAULT_SERVER_DATE_FORMAT -#===== TO REFACTORED IN A GENERIC MODULE -class substate_substate(osv.osv): + +#===== TO REFACTORED IN A GENERIC MODULE +class substate_substate(orm.Model): """ To precise a state (state=refused; substates= reason 1, 2,...) """ @@ -38,97 +40,134 @@ class substate_substate(osv.osv): _description = "substate that precise a given state" _columns = { 'name': fields.char('Sub state', size=128, required=True), - 'substate_descr' : fields.text('Description', help="To give more information about the sub state"), + '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) """ _name = "claim.line" _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): res = {} - for line in self.browse(cr,uid,ids): + for line in self.browse(cr,uid,ids): res[line.id] = line.unit_sale_price*line.product_returned_quantity - return res - + return res + # def _get_claim_seq(self, cr, uid, ids, field_name, arg,context): # res = {} -# for line in self.browse(cr,uid,ids): +# for line in self.browse(cr,uid,ids): # res[line.id] = line.claim_id.sequence -# return res - +# 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'), - ('damaged','Damaged delivered product'), + ('damaged','Damaged delivered product'), ('error','Shipping error'), ('exchange','Exchange request'), ('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 - '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, - 'warranty_type': fields.char('Warranty type', size=64, readonly=True,help="from product form"), - "warranty_return_partner" : fields.many2one('res.partner.address', '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"), + ('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"), + '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 + '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, + 'warranty_type': fields.char('Warranty type', size=64, readonly=True, + help="from product form"), + "warranty_return_partner" : fields.many2one('res.partner.address', + '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"), 'state' : fields.selection([('draft','Draft'), ('refused','Refused'), ('confirmed','Confirmed, waiting for product'), ('in_to_control','Received, to control'), ('in_to_treate','Controlled, to treate'), ('treated','Treated')], 'State'), - 'substate_id': fields.many2one('substate.substate', 'Sub state',help="Select a sub state to precise the standard state. Example 1: state = refused; substate could be warranty over, not in warranty, no problem,... . Example 2: state = to treate; substate could be to refund, to exchange, to repair,..."), - 'last_state_change': fields.date('Last change', help="To set the last state / substate change"), - 'invoice_line_id': fields.many2one('account.invoice.line', 'Invoice Line', help='The invoice line related to the returned product'), - 'refund_line_id': fields.many2one('account.invoice.line', 'Refund Line', help='The refund line related to the returned product'), - 'move_in_id': fields.many2one('stock.move', 'Move Line from picking in', help='The move line related to the returned product'), - 'move_out_id': fields.many2one('stock.move', 'Move Line from picking out', help='The move line related to the returned product'), + 'substate_id': fields.many2one('substate.substate', 'Sub state', + help="Select a sub state to precise the " + "standard state. Example 1: state = refused; " + "substate could be warranty over, not in warranty, " + "no problem,... . Example 2: state = to treate; " + "substate could be to refund, to exchange, to repair,..."), + 'last_state_change': fields.date('Last change', + help="To set the last state / substate change"), + 'invoice_line_id': fields.many2one('account.invoice.line', 'Invoice Line', + help="The invoice line related to the " + "returned product"), + 'refund_line_id': fields.many2one('account.invoice.line', 'Refund Line', + help="The refund line related to the " + "returned product"), + 'move_in_id': fields.many2one('stock.move', 'Move Line from picking in', + help='The move line related to the returned product'), + 'move_out_id': fields.many2one('stock.move', 'Move Line from picking out', + help='The move line related to the returned product'), } _defaults = { 'state': lambda *a: 'draft', 'name': lambda *a: 'none', - } + } # Method to calculate warranty limit def set_warranty_limit(self, cr, uid, ids, context, claim_line): 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 !!! - 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) + if not date_invoice: + raise osv.except_osv(_('Error !'), _('Cannot find any date for invoice ! ' + 'Must be a validated invoice !')) + warning = "Valid" + if claim_line.claim_id.claim_type == 'supplier': + warranty_duration = claim_line.product_id.seller_ids[0].warranty_duration + if claim_line.prodlot_id : + limit = (datetime.strptime(date_invoice, + DEFAULT_SERVER_DATE_FORMAT) + \ + relativedelta(months=int(warranty_duration))).strftime(DEFAULT_SERVER_DATE_FORMAT) # TO BE IMPLEMENTED !!! else : - limit = (datetime.strptime(date_invoice, DEFAULT_SERVER_DATE_FORMAT) + relativedelta(months=int(claim_line.product_id.warranty))).strftime(DEFAULT_SERVER_DATE_FORMAT) - if limit < claim_line.claim_id.date: - warning = 'Expired' - self.write(cr,uid,ids,{ - 'guarantee_limit' : limit, - 'warning' : warning, - }) - else: - raise osv.except_osv(_('Error !'), _('Cannot find any date for invoice ! Must be a validated invoice !')) + limit = (datetime.strptime(date_invoice, + DEFAULT_SERVER_DATE_FORMAT) + \ + relativedelta(months=int(warranty_duration))).strftime(DEFAULT_SERVER_DATE_FORMAT) + else : + limit = (datetime.strptime(date_invoice, + DEFAULT_SERVER_DATE_FORMAT) + \ + relativedelta(months=int(claim_line.product_id.warranty))).strftime(DEFAULT_SERVER_DATE_FORMAT) + if limit < claim_line.claim_id.date: + warning = 'Expired' + self.write(cr,uid,ids,{ + 'guarantee_limit' : limit, + 'warning' : warning, + }) return True # Method to calculate warranty return address @@ -143,7 +182,7 @@ class claim_line(osv.osv): else: warranty_type = 'company' return_address = seller.warranty_return_address.id -# if return_partner == 'company': +# if return_partner == 'company': # return_address = self._get_partner_address(cr, uid, ids, context,claim_line.claim_id.company_id.partner_id)[0] # elif return_partner == 'supplier': # return_address = self._get_partner_address(cr, uid, ids, context,claim_line.product_id.seller_ids[0].name)[0] @@ -162,7 +201,7 @@ class claim_line(osv.osv): # return True #raise osv.except_osv(_('Error !'), _('Cannot find any warranty return partner for this product !')) - else : + else : warranty_type = 'company' if claim_line.claim_id.company_id.crm_return_address_id: return_address = [claim_line.claim_id.company_id.crm_return_address_id.id] @@ -172,10 +211,11 @@ class claim_line(osv.osv): #TODO fix me use default address # self.write(cr,uid,ids,{'warranty_return_partner':1,'warranty_type': 'company'}) # return True - #raise osv.except_osv(_('Error !'), _('Cannot find any supplier for this product !')) - self.write(cr,uid,ids,{'warranty_return_partner':return_address,'warranty_type':warranty_type}) + #raise osv.except_osv(_('Error !'), _('Cannot find any supplier for this product !')) + self.write(cr,uid,ids,{'warranty_return_partner': return_address, + 'warranty_type': warranty_type}) return True - + # Method to calculate warranty limit and validity def set_warranty(self, cr, uid, ids,context=None): for claim_line in self.browse(cr, uid, ids, context=context): @@ -184,79 +224,32 @@ class claim_line(osv.osv): self.set_warranty_return_address(cr, uid, ids, context, claim_line) else: raise osv.except_osv(_('Error !'), _('PLEASE SET PRODUCT & INVOICE!')) - return True + 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): +class crm_claim(orm.Model): _inherit = 'crm.claim' _columns = { - 'number': fields.char('Number', size=128,readonly=True,states={'draft': [('readonly', False)]},required=True, help="Company internal claim unique number"), + 'number': fields.char('Number', size=128, + readonly=True, + states={'draft': [('readonly', False)]}, + required=True, + help="Company internal claim unique number"), 'claim_type': fields.selection([('customer','Customer'), - ('supplier','Supplier'), - ('other','Other')], 'Claim type', required=True, help="customer = from customer to company ; supplier = from company to supplier"), + ('supplier','Supplier'), + ('other','Other')], + 'Claim type', required=True, + help="customer = from customer to company ; " + "supplier = from company to supplier"), 'claim_line_ids' : fields.one2many('claim.line', 'claim_id', 'Return lines'), - 'product_exchange_ids': fields.one2many('product.exchange', 'claim_return_id', 'Product exchanges'), - # Aftersale outsourcing + 'product_exchange_ids': fields.one2many('product.exchange', + 'claim_return_id', + 'Product exchanges'), + # Aftersale outsourcing # 'in_supplier_picking_id': fields.many2one('stock.picking', 'Return To Supplier Picking', required=False, select=True), # 'out_supplier_picking_id': fields.many2one('stock.picking', 'Return From Supplier Picking', required=False, select=True), @@ -264,56 +257,50 @@ class crm_claim(osv.osv): '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_cost': fields.float('Real cost'), # A VOIR SI COMPTA ANA ou lien vers compte ana ? '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'), - 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', required=True), + 'invoice_id': fields.many2one('account.invoice', 'Invoice', + help='Related invoice'), + 'warehouse_id': fields.many2one('stock.warehouse', 'Warehouse', + required=True), } _defaults = { 'number': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'crm.claim'), '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_id(self, cr, uid, ids, part, email=False): + res = super(crm_claim, self).onchange_partner_id(cr, uid, ids, part, email=email) + if not part: + return res + part_type = self.pool['res.partner'].read(cr, uid, part, + ['customer', 'supplier']) + if part_type['customer']: + res['value']['claim_type'] = 'customer' + elif part_type['supplier']: + res['value']['claim_type'] = 'supplier' + return res def onchange_partner_address_id(self, cr, uid, ids, add, email=False): 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']: - address = self.pool.get('res.partner.address').browse(cr, uid, add) - for other_add in address.partner_id.address: - if other_add.email and not res['value']['email_from']: - res['value']['email_from'] = other_add.email - if other_add.phone and not res['value']['partner_phone']: - res['value']['partner_phone'] = other_add.phone + if not add: + return res + if not res['value']['email_from'] or not res['value']['partner_phone']: + address = self.pool.get('res.partner.address').browse(cr, uid, add) + for other_add in address.partner_id.address: + if other_add.email and not res['value']['email_from']: + res['value']['email_from'] = other_add.email + if other_add.phone and not res['value']['partner_phone']: + res['value']['partner_phone'] = other_add.phone return res def onchange_invoice_id(self, cr, uid, ids, invoice_id, context=None): invoice_line_obj = self.pool.get('account.invoice.line') - invoice_line_ids = invoice_line_obj.search(cr, uid, [('invoice_id', '=', invoice_id)]) + invoice_line_ids = invoice_line_obj.search(cr, uid, + [('invoice_id', '=', invoice_id)], + context=context) claim_lines = [] for invoice_line in invoice_line_obj.browse(cr,uid,invoice_line_ids): # claim_line_obj = self.pool.get('claim.line') @@ -331,6 +318,3 @@ class crm_claim(osv.osv): # line.set_warranty() return {'value' : {'claim_line_ids' : claim_lines}} -crm_claim() - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/crm_claim_rma/crm_claim_rma_view.xml b/crm_claim_rma/crm_claim_rma_view.xml index 65749ca1..cd42f456 100644 --- a/crm_claim_rma/crm_claim_rma_view.xml +++ b/crm_claim_rma/crm_claim_rma_view.xml @@ -50,7 +50,7 @@ - + @@ -82,7 +82,7 @@ - + @@ -102,7 +102,7 @@ - + @@ -155,10 +155,10 @@
- + - - + + @@ -225,32 +225,38 @@ - -