diff --git a/crm_claim_rma/__openerp__.py b/crm_claim_rma/__openerp__.py index 3336a73d..32fd0eb8 100644 --- a/crm_claim_rma/__openerp__.py +++ b/crm_claim_rma/__openerp__.py @@ -52,8 +52,7 @@ THIS MODULE REPLACES Akretion stock_rma from V6.0 'wizard/picking_from_exchange_lines_wizard_view.xml', 'wizard/get_empty_serial_view.xml', 'crm_claim_rma_view.xml', - -# 'security/ir.model.access.csv', +# 'security/ir.model.access.csv', # 'report/crm_claim_report_view.xml', ], 'demo_xml': [ diff --git a/crm_claim_rma/crm_claim_rma.py b/crm_claim_rma/crm_claim_rma.py index 4d4542a1..c0da5ff1 100644 --- a/crm_claim_rma/crm_claim_rma.py +++ b/crm_claim_rma/crm_claim_rma.py @@ -238,6 +238,9 @@ class crm_claim_product_return(osv.osv): _inherit = 'crm.claim' _columns = { 'sequence': fields.char('Sequence', size=128, required=True,readonly=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"), 'return_line_ids' : fields.one2many('return.line', 'claim_id', 'Return lines'), 'product_exchange_ids': fields.one2many('product.exchange', 'claim_return_id', 'Product exchanges'), # Aftersale outsourcing @@ -251,7 +254,8 @@ class crm_claim_product_return(osv.osv): 'real_cost': fields.float('Real cost'), # A VOIR SI COMPTA ANA ou lien vers compte ana ? } _defaults = { - 'sequence': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'crm.claim.rma'),} + 'sequence': lambda obj, cr, uid, context: obj.pool.get('ir.sequence').get(cr, uid, 'crm.claim.rma'), + 'claim_type': lambda *a: 'customer',} #===== Method to select all returned lines ===== def select_all(self,cr, uid, ids,context): diff --git a/crm_claim_rma/crm_claim_rma_view.xml b/crm_claim_rma/crm_claim_rma_view.xml index 1b22c48c..6859cba1 100644 --- a/crm_claim_rma/crm_claim_rma_view.xml +++ b/crm_claim_rma/crm_claim_rma_view.xml @@ -267,6 +267,7 @@ + diff --git a/crm_claim_rma/security/ir.model.access.csv b/crm_claim_rma/security/ir.model.access.csv new file mode 100644 index 00000000..24fb514d --- /dev/null +++ b/crm_claim_rma/security/ir.model.access.csv @@ -0,0 +1,7 @@ +"id","name","model_id:id","group_id:id","perm_read","perm_write","perm_create","perm_unlink" +"access_substate_substate_user","substate.substate.user","model_crm_claim_substate_substate","base.group_sale_salesman",1,1,1,1 +"access_return_line_user","return.line.user","return_line","base.group_sale_salesman",1,1,1,1 +"access_product_exchange_user","product.exchange.user","product_exchange","base.group_sale_salesman",1,1,1,1 +"access_substate_substate_manager","substate.substate.manager","substate_substate","base.group_sale_manager",1,1,1,1 +"access_return_line_manager","return.line.manager","return_line","base.group_sale_manager",1,1,1,1 +"access_product_exchange_manager","product.exchange.manager","product_exchange","base.group_sale_manager",1,1,1,1 diff --git a/crm_claim_rma/wizard/picking_from_returned_lines.py b/crm_claim_rma/wizard/picking_from_returned_lines.py index 12da1f83..b44f9e76 100644 --- a/crm_claim_rma/wizard/picking_from_returned_lines.py +++ b/crm_claim_rma/wizard/picking_from_returned_lines.py @@ -69,6 +69,12 @@ class picking_in_from_returned_lines(osv.osv_memory): for picking in self.browse(cr, uid,ids): claim_id = self.pool.get('crm.claim').browse(cr, uid, context['active_id']) partner_id = claim_id.partner_id.id + # location type + location = -1 + if claim_id.claim_type == "customer": + location = claim_id.partner_id.property_stock_customer.id + else: + location = claim_id.partner_id.property_stock_supplier.id # create picking picking_id = self.pool.get('stock.picking').create(cr, uid, { 'origin': "RMA/"+`claim_id.id`, @@ -79,7 +85,7 @@ class picking_in_from_returned_lines(osv.osv_memory): 'address_id': claim_id.partner_address_id.id, 'invoice_state': "none", 'company_id': claim_id.company_id.id, - 'location_id': claim_id.partner_id.property_stock_customer.id, + 'location_id': location, 'location_dest_id': picking.return_line_location.id, 'note' : 'RMA picking in', }) @@ -102,7 +108,7 @@ class picking_in_from_returned_lines(osv.osv_memory): 'price_unit': picking_line.price_unit, # 'price_currency_id': claim_id.company_id.currency_id.id, # from invoice ??? 'company_id': claim_id.company_id.id, - 'location_id': claim_id.partner_id.property_stock_customer.id, + 'location_id': location, 'location_dest_id': picking.return_line_location.id, #self.pool.get('stock.warehouse').read(cr, uid, [1],['lot_input_id'])[0]['lot_input_id'][0], 'note': 'RMA Refound', @@ -158,6 +164,12 @@ class picking_out_from_returned_lines(osv.osv_memory): for picking in self.browse(cr, uid,ids): claim_id = self.pool.get('crm.claim').browse(cr, uid, context['active_id']) partner_id = claim_id.partner_id.id + # location type + location = -1 + if claim_id.claim_type == "customer": + location = claim_id.partner_id.property_stock_customer.id + else: + location = claim_id.partner_id.property_stock_supplier.id # create picking picking_id = self.pool.get('stock.picking').create(cr, uid, { 'origin': "RMA/"+`claim_id.id`, @@ -170,7 +182,7 @@ class picking_out_from_returned_lines(osv.osv_memory): '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, + 'location_dest_id': location, 'note' : 'RMA picking in', }) @@ -194,7 +206,7 @@ class picking_out_from_returned_lines(osv.osv_memory): # 'price_currency_id': claim_id.company_id.currency_id.id, # from invoice ??? '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, + 'location_dest_id': location, 'note': 'RMA Refound', }) diff --git a/product_warranty/product_warranty.py b/product_warranty/product_warranty.py index 41a11212..f7132704 100644 --- a/product_warranty/product_warranty.py +++ b/product_warranty/product_warranty.py @@ -41,6 +41,7 @@ class product_supplierinfo(osv.osv): _columns = { "warranty_duration" : fields.float('Warranty', help="Warranty in month for this product/supplier relation. Only for company/supplier relation (purchase order) ; the customer/company relation (sale order) always use the product main warranty field"), "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"), + 'active_supplier' : fields.boolean('Active supplier', help=""), } _defaults = { 'warranty_return_partner': lambda *a: 'company', diff --git a/product_warranty/product_warranty_view.xml b/product_warranty/product_warranty_view.xml index 99272e82..3069ea1f 100644 --- a/product_warranty/product_warranty_view.xml +++ b/product_warranty/product_warranty_view.xml @@ -31,6 +31,7 @@ + @@ -45,6 +46,7 @@ +