mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
[ADD] security to crm_claim_rma
[ADD] claim type to crm_claim_rma [UPDATE] location in picking_from_returned_lines.py
This commit is contained in:
@@ -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': [
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -267,6 +267,7 @@
|
||||
<field name="arch" type="xml">
|
||||
<field name="date_deadline" position="after">
|
||||
<field name="sequence"/>
|
||||
<field name="claim_type"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
7
crm_claim_rma/security/ir.model.access.csv
Normal file
7
crm_claim_rma/security/ir.model.access.csv
Normal file
@@ -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
|
||||
|
@@ -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',
|
||||
})
|
||||
|
||||
|
||||
@@ -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',
|
||||
|
||||
@@ -31,6 +31,7 @@
|
||||
<field position="after" name="delay">
|
||||
<field name="warranty_duration"/>
|
||||
<field name="warranty_return_partner"/>
|
||||
<field name="active_supplier"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
@@ -45,6 +46,7 @@
|
||||
<field position="after" name="delay">
|
||||
<field name="warranty_duration"/>
|
||||
<field name="warranty_return_partner" readonly="0"/>
|
||||
<field name="active_supplier"/>
|
||||
</field>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
Reference in New Issue
Block a user