[ADD] website_sale: new module

This module adds a website form to allows to create an RMA from scratch
This commit is contained in:
Ernesto Tejeda
2020-09-03 09:11:45 -04:00
committed by iwkse
parent bceffe0107
commit a3a68af04e
22 changed files with 749 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
# Copyright 2020 Tecnativa - Ernesto Tejeda
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
from odoo import api, models
class IrModel(models.Model):
_inherit = 'ir.model'
@api.model
def get_authorized_fields(self, model_name):
"""Hack this method to force some rma fields to be authorized in
creating an object from a web form using the website_form module.
Those fields are readonly in all states except 'draft' state,
but the main method get_authorized_fields interprets them as
readonly always.
"""
res = super().get_authorized_fields(model_name)
if model_name == 'rma':
auth_fields = ['product_uom_qty', 'product_uom', 'partner_id']
res.update(self.env[model_name].fields_get(auth_fields))
return res