summaryrefslogtreecommitdiff
path: root/addons/sale_quotation_builder/models/product_template.py
diff options
context:
space:
mode:
authorstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
committerstephanchrst <stephanchrst@gmail.com>2022-05-10 21:51:50 +0700
commit3751379f1e9a4c215fb6eb898b4ccc67659b9ace (patch)
treea44932296ef4a9b71d5f010906253d8c53727726 /addons/sale_quotation_builder/models/product_template.py
parent0a15094050bfde69a06d6eff798e9a8ddf2b8c21 (diff)
initial commit 2
Diffstat (limited to 'addons/sale_quotation_builder/models/product_template.py')
-rw-r--r--addons/sale_quotation_builder/models/product_template.py24
1 files changed, 24 insertions, 0 deletions
diff --git a/addons/sale_quotation_builder/models/product_template.py b/addons/sale_quotation_builder/models/product_template.py
new file mode 100644
index 00000000..91a10749
--- /dev/null
+++ b/addons/sale_quotation_builder/models/product_template.py
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import fields, models, api
+from odoo.tools.translate import html_translate
+
+
+class ProductTemplate(models.Model):
+ _inherit = "product.template"
+
+ quotation_only_description = fields.Html('Quotation Only Description', sanitize_attributes=False,
+ translate=html_translate, help="The quotation description (not used on eCommerce)")
+
+ quotation_description = fields.Html('Quotation Description', compute='_compute_quotation_description',
+ help="This field uses the Quotation Only Description if it is defined, otherwise it will try to read the eCommerce Description.")
+
+ def _compute_quotation_description(self):
+ for record in self:
+ if record.quotation_only_description:
+ record.quotation_description = record.quotation_only_description
+ elif hasattr(record, 'website_description') and record.website_description:
+ record.quotation_description = record.website_description
+ else:
+ record.quotation_description = ''