summaryrefslogtreecommitdiff
path: root/addons/sale_quotation_builder/models
diff options
context:
space:
mode:
authorSébastien Theys <seb@odoo.com>2018-09-12 15:12:45 +0200
committerRomain Derie <rde@odoo.com>2018-09-19 12:00:37 +0200
commit78e51c429d6336b74adb6761c1edc08bec371c06 (patch)
treea36ae28276cd06cd5ddfe40a3a743fe41f614624 /addons/sale_quotation_builder/models
parent83f9ef9059b72b8e59011d6ddc573d3537ede4a7 (diff)
[IMP] sale: improve demo, default data, and manifests
*** Activate pay and sign, as well as quotation template, by default when using demo data. Previously, the features would show by default on runbot because they activated on installing modules. Now that they are settings of sale_management, we need to specifically activate them for demoing. However we don't want them for on-boarding. *** Remove the default template from sale_management, move it into sale_quotation_builder The default template was useless in sale_management because it was empty: it was previously a required field, which is not the case anymore. It was only filled and used in sale_quotation_builder to display an example quotation, which is why it is now moved there. *** Update manifests Fix category of sale_quotation_builder and slightly improve its text. PR: #26801 task-1876864
Diffstat (limited to 'addons/sale_quotation_builder/models')
-rw-r--r--addons/sale_quotation_builder/models/__init__.py1
-rw-r--r--addons/sale_quotation_builder/models/res_config_settings.py16
2 files changed, 17 insertions, 0 deletions
diff --git a/addons/sale_quotation_builder/models/__init__.py b/addons/sale_quotation_builder/models/__init__.py
index 84a0f45f0b4..f6215511df1 100644
--- a/addons/sale_quotation_builder/models/__init__.py
+++ b/addons/sale_quotation_builder/models/__init__.py
@@ -2,5 +2,6 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from . import product_template
+from . import res_config_settings
from . import sale_order
from . import sale_order_template
diff --git a/addons/sale_quotation_builder/models/res_config_settings.py b/addons/sale_quotation_builder/models/res_config_settings.py
new file mode 100644
index 00000000000..9e42e987a85
--- /dev/null
+++ b/addons/sale_quotation_builder/models/res_config_settings.py
@@ -0,0 +1,16 @@
+# -*- coding: utf-8 -*-
+# Part of Odoo. See LICENSE file for full copyright and licensing details.
+
+from odoo import models, api
+
+
+class ResConfigSettings(models.TransientModel):
+ _inherit = 'res.config.settings'
+
+ @api.model
+ def _set_default_sale_order_template_id_if_empty(self):
+ IrDefault = self.env['ir.default']
+ if not IrDefault.get('sale.order', 'sale_order_template_id'):
+ template = self.env.ref('sale_quotation_builder.sale_order_template_default', raise_if_not_found=False)
+ if template and template.active:
+ IrDefault.set('sale.order', 'sale_order_template_id', template.id)