[MOV] sale_quotation_builder: split sale_order_template.py

Part-of: odoo/odoo#91222
This commit is contained in:
Victor Feyens
2022-05-12 17:34:52 +02:00
parent 8d6beeaf26
commit e5e4ca6554
4 changed files with 66 additions and 54 deletions
@@ -7,3 +7,5 @@ from . import sale_order
from . import sale_order_line
from . import sale_order_option
from . import sale_order_template
from . import sale_order_template_line
from . import sale_order_template_option
@@ -1,12 +1,12 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
from odoo import fields, models
from odoo.tools.translate import html_translate
class SaleOrderTemplate(models.Model):
_inherit = "sale.order.template"
_inherit = 'sale.order.template'
website_description = fields.Html(
string="Website Description",
@@ -20,55 +20,3 @@ class SaleOrderTemplate(models.Model):
'target': 'self',
'url': '/sale_quotation_builder/template/%d' % self.id
}
class SaleOrderTemplateLine(models.Model):
_inherit = "sale.order.template.line"
# FIXME ANVFE why are the sanitize_* attributes different between this field
# and the one on option lines, doesn't make any sense ???
website_description = fields.Html(
string="Website Description",
compute='_compute_website_description',
store=True, readonly=False,
translate=html_translate,
sanitize_form=False)
@api.depends('product_id')
def _compute_website_description(self):
for line in self:
if not line.product_id:
continue
line.website_description = line.product_id.quotation_description
#=== BUSINESS METHODS ===#
def _prepare_order_line_values(self):
res = super()._prepare_order_line_values()
res['website_description'] = self.website_description
return res
class SaleOrderTemplateOption(models.Model):
_inherit = "sale.order.template.option"
website_description = fields.Html(
string="Website Description",
compute="_compute_website_description",
store=True, readonly=False,
translate=html_translate,
sanitize_attributes=False)
@api.depends('product_id')
def _compute_website_description(self):
for option in self:
if not option.product_id:
continue
option.website_description = option.product_id.quotation_description
#=== BUSINESS METHODS ===#
def _prepare_option_line_values(self):
res = super()._prepare_option_line_values()
res['website_description'] = self.website_description
return res
@@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
from odoo.tools.translate import html_translate
class SaleOrderTemplateLine(models.Model):
_inherit = 'sale.order.template.line'
# FIXME ANVFE why are the sanitize_* attributes different between this field
# and the one on option lines, doesn't make any sense ???
website_description = fields.Html(
string="Website Description",
compute='_compute_website_description',
store=True, readonly=False,
translate=html_translate,
sanitize_form=False)
@api.depends('product_id')
def _compute_website_description(self):
for line in self:
if not line.product_id:
continue
line.website_description = line.product_id.quotation_description
#=== BUSINESS METHODS ===#
def _prepare_order_line_values(self):
res = super()._prepare_order_line_values()
res['website_description'] = self.website_description
return res
@@ -0,0 +1,30 @@
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import api, fields, models
from odoo.tools.translate import html_translate
class SaleOrderTemplateOption(models.Model):
_inherit = 'sale.order.template.option'
website_description = fields.Html(
string="Website Description",
compute='_compute_website_description',
store=True, readonly=False,
translate=html_translate,
sanitize_attributes=False)
@api.depends('product_id')
def _compute_website_description(self):
for option in self:
if not option.product_id:
continue
option.website_description = option.product_id.quotation_description
#=== BUSINESS METHODS ===#
def _prepare_option_line_values(self):
res = super()._prepare_option_line_values()
res['website_description'] = self.website_description
return res