mirror of
https://github.com/OCA/rma.git
synced 2025-02-16 17:11:47 +02:00
[MIG] website_rma: Migration to 13.0
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from . import ir_model
|
||||
from . import res_config_settings
|
||||
from . import rma
|
||||
from . import website
|
||||
|
||||
20
website_rma/models/res_config_settings.py
Normal file
20
website_rma/models/res_config_settings.py
Normal file
@@ -0,0 +1,20 @@
|
||||
# Copyright 2020 Tecnativa - Ernesto Tejeda
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class ResConfigSettings(models.TransientModel):
|
||||
_inherit = "res.config.settings"
|
||||
|
||||
rma_default_team_id = fields.Many2one(
|
||||
comodel_name="rma.team",
|
||||
related="website_id.rma_default_team_id",
|
||||
readonly=False,
|
||||
)
|
||||
rma_default_user_id = fields.Many2one(
|
||||
comodel_name="res.users",
|
||||
related="website_id.rma_default_user_id",
|
||||
readonly=False,
|
||||
help="Default responsible for new leads created through the "
|
||||
"'Request RMA' form.",
|
||||
)
|
||||
16
website_rma/models/rma.py
Normal file
16
website_rma/models/rma.py
Normal file
@@ -0,0 +1,16 @@
|
||||
# Copyright 2020 Tecnativa - Ernesto Tejeda
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import models
|
||||
|
||||
|
||||
class Rma(models.Model):
|
||||
_inherit = "rma"
|
||||
|
||||
def website_form_input_filter(self, request, values):
|
||||
values.update(
|
||||
team_id=values.get("team_id") or request.website.rma_default_team_id.id,
|
||||
user_id=values.get("user_id") or request.website.rma_default_user_id.id,
|
||||
partner_id=values.get("partner_id") or request.env.user.partner_id.id,
|
||||
)
|
||||
return values
|
||||
21
website_rma/models/website.py
Normal file
21
website_rma/models/website.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# Copyright 2020 Tecnativa - Ernesto Tejeda
|
||||
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
|
||||
|
||||
from odoo import fields, models
|
||||
|
||||
|
||||
class Website(models.Model):
|
||||
_inherit = "website"
|
||||
|
||||
rma_default_team_id = fields.Many2one(
|
||||
comodel_name="rma.team",
|
||||
string="Default Team",
|
||||
help="Default team for new RMAs created through the 'Request RMA' form.",
|
||||
)
|
||||
rma_default_user_id = fields.Many2one(
|
||||
comodel_name="res.users",
|
||||
string="Default Responsible",
|
||||
domain=[("share", "=", False)],
|
||||
help="Default responsible for new leads created through the "
|
||||
"'Request RMA' form.",
|
||||
)
|
||||
Reference in New Issue
Block a user