summaryrefslogtreecommitdiff
path: root/addons
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
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')
-rw-r--r--addons/sale/data/sale_demo.xml6
-rw-r--r--addons/sale_management/__manifest__.py3
-rw-r--r--addons/sale_management/data/sale_order_template_data.xml11
-rw-r--r--addons/sale_management/data/sale_order_template_demo.xml5
-rw-r--r--addons/sale_management/models/res_config_settings.py1
-rw-r--r--addons/sale_management/models/sale_order.py27
-rw-r--r--addons/sale_quotation_builder/__manifest__.py6
-rw-r--r--addons/sale_quotation_builder/data/sale_order_template_data.xml111
-rw-r--r--addons/sale_quotation_builder/models/__init__.py1
-rw-r--r--addons/sale_quotation_builder/models/res_config_settings.py16
10 files changed, 93 insertions, 94 deletions
diff --git a/addons/sale/data/sale_demo.xml b/addons/sale/data/sale_demo.xml
index bd5ccbe1744..7f8f5a1693b 100644
--- a/addons/sale/data/sale_demo.xml
+++ b/addons/sale/data/sale_demo.xml
@@ -2,6 +2,12 @@
<odoo>
<data noupdate="1">
+ <!-- We want to activate pay and sign by default for easier demoing. -->
+ <record id="base.main_company" model="res.company">
+ <field name="portal_confirmation_sign" eval="True"/>
+ <field name="portal_confirmation_pay" eval="True"/>
+ </record>
+
<record id="base.user_demo" model="res.users">
<field eval="[(4, ref('sales_team.group_sale_salesman'))]" name="groups_id"/>
</record>
diff --git a/addons/sale_management/__manifest__.py b/addons/sale_management/__manifest__.py
index 9f23c1084db..98f77d20956 100644
--- a/addons/sale_management/__manifest__.py
+++ b/addons/sale_management/__manifest__.py
@@ -6,7 +6,7 @@
'version': '1.0',
'category': 'Sales',
'sequence': 17,
- 'summary': 'From quotes to invoices',
+ 'summary': 'From quotations to invoices',
'description': """
Manage sales quotations and orders
==================================
@@ -39,7 +39,6 @@ The Dashboard for the Sales Manager will include
'depends': ['sale', 'digest'],
'data': [
'security/sale_management_security.xml',
- 'data/sale_order_template_data.xml',
'views/sale_portal_templates.xml',
'views/sale_order_template_views.xml',
'security/ir.model.access.csv',
diff --git a/addons/sale_management/data/sale_order_template_data.xml b/addons/sale_management/data/sale_order_template_data.xml
deleted file mode 100644
index ba5b0af6d65..00000000000
--- a/addons/sale_management/data/sale_order_template_data.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<odoo>
- <!-- Mails & quote templates is done in a NOUPDATE block
- so users can freely customize/delete them -->
- <data noupdate="1">
- <record id="sale_order_template_default" model="sale.order.template">
- <field name="name">Default Template</field>
- <field name="number_of_days">30</field>
- </record>
- </data>
-</odoo>
diff --git a/addons/sale_management/data/sale_order_template_demo.xml b/addons/sale_management/data/sale_order_template_demo.xml
index 4e156a51220..37b02e50f2d 100644
--- a/addons/sale_management/data/sale_order_template_demo.xml
+++ b/addons/sale_management/data/sale_order_template_demo.xml
@@ -1,5 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
+ <!-- We want to activate SO template by default for easier demoing. -->
+ <record id="base.group_user" model="res.groups">
+ <field name="implied_ids" eval="[(4, ref('sale_management.group_sale_order_template'))]"/>
+ </record>
+
<record id="sale_order_template_1" model="sale.order.template">
<field name="name">4 Person Desk</field>
<field name="number_of_days">45</field>
diff --git a/addons/sale_management/models/res_config_settings.py b/addons/sale_management/models/res_config_settings.py
index ed3fc5caac5..2abc29f1d05 100644
--- a/addons/sale_management/models/res_config_settings.py
+++ b/addons/sale_management/models/res_config_settings.py
@@ -15,3 +15,4 @@ class ResConfigSettings(models.TransientModel):
def _onchange_group_sale_order_template(self):
if not self.group_sale_order_template:
self.module_sale_quotation_builder = False
+ self.default_sale_order_template_id = False
diff --git a/addons/sale_management/models/sale_order.py b/addons/sale_management/models/sale_order.py
index c9f5ba048fe..86fcdeb939b 100644
--- a/addons/sale_management/models/sale_order.py
+++ b/addons/sale_management/models/sale_order.py
@@ -13,39 +13,18 @@ from werkzeug.urls import url_encode
class SaleOrder(models.Model):
_inherit = 'sale.order'
- def _get_default_sale_order_template(self):
- if not self.env.user.has_group('sale_management.group_sale_order_template'):
- return False
- template = self.env.ref('sale_management.sale_order_template_default', raise_if_not_found=False)
- return template if template and template.active else False
-
- def _get_default_require_signature(self):
- default_template = self._get_default_sale_order_template()
- if default_template:
- return default_template.require_signature
- else:
- return False
-
- def _get_default_require_payment(self):
- default_template = self._get_default_sale_order_template()
- if default_template:
- return default_template.require_payment
- else:
- return False
-
sale_order_template_id = fields.Many2one(
'sale.order.template', 'Quotation Template',
readonly=True,
- states={'draft': [('readonly', False)], 'sent': [('readonly', False)]},
- default=_get_default_sale_order_template)
+ states={'draft': [('readonly', False)], 'sent': [('readonly', False)]})
sale_order_option_ids = fields.One2many(
'sale.order.option', 'order_id', 'Optional Products Lines',
copy=True, readonly=True,
states={'draft': [('readonly', False)], 'sent': [('readonly', False)]})
- require_signature = fields.Boolean('Online Signature', default=_get_default_require_signature,
+ require_signature = fields.Boolean('Online Signature',
states={'sale': [('readonly', True)], 'done': [('readonly', True)]},
help='Request a online signature to the customer in order to confirm orders automatically.')
- require_payment = fields.Boolean('Electronic Payment', default=_get_default_require_payment,
+ require_payment = fields.Boolean('Electronic Payment',
states={'sale': [('readonly', True)], 'done': [('readonly', True)]},
help='Request an electronic payment to the customer in order to confirm orders automatically.')
diff --git a/addons/sale_quotation_builder/__manifest__.py b/addons/sale_quotation_builder/__manifest__.py
index 7f4b1cd45b1..ab2a9883bad 100644
--- a/addons/sale_quotation_builder/__manifest__.py
+++ b/addons/sale_quotation_builder/__manifest__.py
@@ -3,11 +3,11 @@
{
'name': 'Quotation Builder',
- 'category': 'Website',
- 'summary': 'Sales',
+ 'category': 'Sales',
+ 'summary': 'Build great quotation templates',
'website': 'https://www.odoo.com/page/quote-builder',
'version': '1.0',
- 'description': "",
+ 'description': "Design great quotation templates with building blocks to significantly boost your success rate.",
'depends': ['website', 'sale_management', 'website_mail'],
'data': [
'data/sale_order_template_data.xml',
diff --git a/addons/sale_quotation_builder/data/sale_order_template_data.xml b/addons/sale_quotation_builder/data/sale_order_template_data.xml
index 4a03ccbaac7..8d22743e318 100644
--- a/addons/sale_quotation_builder/data/sale_order_template_data.xml
+++ b/addons/sale_quotation_builder/data/sale_order_template_data.xml
@@ -1,53 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
- <record id="sale_management.sale_order_template_default" model="sale.order.template">
- <field name="website_description" type="xml">
- <section data-snippet-id="title">
- <h1 class="o_page_header">About us</h1>
- </section>
- <section data-snippet-id="text-block">
- <div class="row">
- <div class="col-lg-12">
- <p>
- This is a <strong>sample quotation template</strong>. You should
- customize it to fit your own needs from the <i>Sale</i>
- application, using the menu: Configuration /
- Quotation Templates.
- </p><p>
- Great quotation templates will significantly
- <strong>boost your success rate</strong>. The
- first section is usually about your company,
- your references, your methodology or
- guarantees, your team, SLA, terms and conditions, etc.
- </p>
+ <!-- no update so users can freely customize/delete the template -->
+ <data noupdate="1">
+ <record id="sale_order_template_default" model="sale.order.template">
+ <field name="name">Default Template</field>
+ <field name="number_of_days">30</field>
+
+ <field name="website_description" type="xml">
+ <section data-snippet-id="title" class="mt32">
+ <h2 class="o_page_header">About us</h2>
+ </section>
+ <section data-snippet-id="text-block">
+ <div class="row">
+ <div class="col-lg-12">
+ <p>
+ This is a <strong>sample quotation template</strong>. You should
+ customize it to fit your own needs from the <i>Sales</i>
+ application, using the menu: Configuration /
+ Quotation Templates.
+ </p><p>
+ Great quotation templates will significantly
+ <strong>boost your success rate</strong>. The
+ first section is usually about your company,
+ your references, your methodology or
+ guarantees, your team, SLA, terms and conditions, etc.
+ </p>
+ </div>
</div>
- </div>
- </section>
- <section data-snippet-id="quality">
- <div class="row mt32">
- <div class="col-lg-4">
- <div class="card bg-info text-white">
- <h3 class="card-header text-center">Our Quality</h3>
+ </section>
+ <section data-snippet-id="quality">
+ <div class="card-deck">
+ <div class="card">
+ <div class="card-header">Our Quality</div>
<div class="card-body">
Product quality is the foundation we
stand on; we build it with a relentless
focus on fabric, performance and craftsmanship.
</div>
</div>
- </div>
- <div class="col-lg-4">
- <div class="card bg-info text-white">
- <h3 class="card-header text-center">Our Service</h3>
+ <div class="card">
+ <div class="card-header">Our Service</div>
<div class="card-body">
As a leading professional services firm,
we know that success is all about the
commitment we put on strong services.
</div>
</div>
- </div>
- <div class="col-lg-4">
- <div class="card bg-info text-white">
- <h3 class="card-header text-center">Price</h3>
+ <div class="card">
+ <div class="card-header">Price</div>
<div class="card-body">
We always ensure that our products are
set at a fair price so that you will be
@@ -55,24 +55,27 @@
</div>
</div>
</div>
- </div>
- </section>
- <section data-snippet-id="text-block">
- <h1 class="o_page_header">Our Offer</h1>
- <p>
- You can <strong>set a description per product</strong>. Odoo will
- automatically create a quotation using the descriptions
- of all products in the proposal. The table of content
- on the left is generated automatically using the styles you
- used in your description (heading 1, heading 2, ...)
- </p><p>
- If edit a quotation from the 'Preview' of a quotation, you will
- update the quotation for this customer only. If you edit the quotation
- template (from the Configuration menu), all future quotations will
- use this modified template.
- </p>
- </section>
- </field>
- </record>
+ </section>
+ <section data-snippet-id="title" class="mt32">
+ <h2 class="o_page_header">Our Offer</h2>
+ </section>
+ <section data-snippet-id="text-block">
+ <p>
+ You can <strong>set a description per product</strong>. Odoo will
+ automatically create a quotation using the descriptions
+ of all products in the proposal. The table of content
+ on the left is generated automatically using the styles you
+ used in your description (heading 1, heading 2, ...)
+ </p><p>
+ If you edit a quotation from the 'Preview' of a quotation, you will
+ update that quotation only. If you edit the quotation
+ template (from the Configuration menu), all future quotations will
+ use this modified template.
+ </p>
+ </section>
+ </field>
+ </record>
+ <function model="res.config.settings" name="_set_default_sale_order_template_id_if_empty"/>
+ </data>
</odoo>
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)