mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
[FIX] website_rma: controller implementation
It was assumed that this method (used for any model) always had an RMA in return, which wasn't correct at all and could lead to cross-model and cross-customer subscripting if an RMA id matched the one of the form model creating (eg.: `crm.lead` in 'Contact Us' form)
This commit is contained in:
@@ -9,11 +9,11 @@ from odoo.http import request
|
|||||||
class WebsiteForm(WebsiteForm):
|
class WebsiteForm(WebsiteForm):
|
||||||
|
|
||||||
def insert_record(self, request, model, values, custom, meta=None):
|
def insert_record(self, request, model, values, custom, meta=None):
|
||||||
if model.model == 'rma':
|
if model.model != 'rma':
|
||||||
values['partner_id'] = request.env.user.partner_id.id
|
return super().insert_record(request, model, values, custom, meta)
|
||||||
values['origin'] = 'Website form'
|
values['partner_id'] = request.env.user.partner_id.id
|
||||||
res = super(WebsiteForm, self).insert_record(
|
values['origin'] = 'Website form'
|
||||||
request, model, values, custom, meta)
|
res = super().insert_record(request, model, values, custom, meta)
|
||||||
# Add the customer to the followers, the same as when creating
|
# Add the customer to the followers, the same as when creating
|
||||||
# an RMA from a sales order in the portal.
|
# an RMA from a sales order in the portal.
|
||||||
rma = request.env['rma'].browse(res).sudo()
|
rma = request.env['rma'].browse(res).sudo()
|
||||||
|
|||||||
Reference in New Issue
Block a user