Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
119 changes: 119 additions & 0 deletions sale_quotation_builder/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
.. image:: https://odoo-community.org/readme-banner-image
:target: https://odoo-community.org/get-involved?utm_source=readme
:alt: Odoo Community Association

=================
Quotation Builder
=================

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:1225dc217a04f41e8b05d761e3467119be1228a171637fcf65a859972852fa0d
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
.. |badge2| image:: https://img.shields.io/badge/license-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--reporting-lightgray.png?logo=github
:target: https://github.com/OCA/sale-reporting/tree/19.0/sale_quotation_builder
:alt: OCA/sale-reporting
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-reporting-19-0/sale-reporting-19-0-sale_quotation_builder
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-reporting&target_branch=19.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

Design great quotation templates with building blocks to significantly
boost your success rate

Disclaimer
~~~~~~~~~~

This module is a forwardport from Odoo SA and as such, it is not
included in the OCA CLA. That means we do not have a copy of the
copyright on it like all other OCA modules.

**Table of contents**

.. contents::
:local:

Use Cases / Context
===================

After this PR (https://github.com/odoo/odoo/pull/133773), Odoo removed
the ``sale_quotation_builder`` module and added a new one called
``sale_pdf_quote_builder``.

Both features work fine, but there is no direct equivalence between
them. For new customers, it's okay to use the new module to upload PDF
documents. However, customers upgrading from older versions may want to
keep the old behavior.

This module restores those features.

Usage
=====

To generate a template
----------------------

1. Go to ``Sales`` > ``Configuration`` > ``Sales Orders`` >
``Quotation Templates``.
2. Create or edit a record.
3. In the form-view header, click the ``Design Template`` button to open
the website editor.
4. Build your layout by dragging and dropping block snippets, then save.

To generate a new quotation
---------------------------

1. Go to ``Sales`` > ``Orders`` > ``Quotations``.
2. Create or edit a quotation.
3. Select the template created in the previous step.
4. Click the ``Preview`` button. You will be redirected to the portal,
where you can see the layout.

Bug Tracker
===========

Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-reporting/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/sale-reporting/issues/new?body=module:%20sale_quotation_builder%0Aversion:%2019.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Odoo SA

Maintainers
-----------

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

OCA, or the Odoo Community Association, is a nonprofit organization whose
mission is to support the collaborative development of Odoo features and
promote its widespread use.

This module is part of the `OCA/sale-reporting <https://github.com/OCA/sale-reporting/tree/19.0/sale_quotation_builder>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
5 changes: 5 additions & 0 deletions sale_quotation_builder/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from . import controllers
from . import models
from .hooks import pre_init_hook
19 changes: 19 additions & 0 deletions sale_quotation_builder/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.

{
"name": "Quotation Builder",
"category": "Sales/Sales",
"summary": "Build great quotation templates",
"website": "https://github.com/OCA/sale-reporting",
"author": "Odoo Community Association (OCA), Odoo SA",
"version": "19.0.1.0.0",
"depends": ["website", "sale_management", "website_mail"],
"data": [
"data/sale_order_template_data.xml",
"views/sale_portal_templates.xml",
"views/sale_order_template_views.xml",
],
"installable": True,
"license": "LGPL-3",
"pre_init_hook": "pre_init_hook",
}
3 changes: 3 additions & 0 deletions sale_quotation_builder/controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from . import main
24 changes: 24 additions & 0 deletions sale_quotation_builder/controllers/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Part of Odoo. See LICENSE file for full copyright and licensing details.

from odoo.http import Controller, request, route


class QuotationBuilderController(Controller):
@route(
["/sale_quotation_builder/template/<string:template_id>"],
type="http",
auth="user",
website=True,
)
def sale_quotation_builder_template_view(self, template_id, **post):
template_id = request.env["ir.http"]._unslug(template_id)[-1]
template = (
request.env["sale.order.template"]
.browse(template_id)
.with_context(
allowed_company_ids=request.env.user.company_ids.ids,
)
)
return request.render(
"sale_quotation_builder.so_template", {"template": template}
)
83 changes: 83 additions & 0 deletions sale_quotation_builder/data/sale_order_template_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo noupdate="1">
<!-- no update so users can freely customize/delete the template -->
<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="company_id" eval="False" />
<field name="website_description" type="html">
<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>
</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 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 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
happy to buy them.
</div>
</div>
</div>
</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.company" name="_set_default_sale_order_template_id_if_empty" />
</odoo>
28 changes: 28 additions & 0 deletions sale_quotation_builder/hooks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
def pre_init_hook(env):
"""Allow installing sale_quotation_builder in databases
with large sale.order / sale.order.line tables.

Since website_description fields computation is based
on new fields added by the module, they will be empty anyway.

By avoiding the computation of those fields,
we reduce the installation time noticeably
"""
env.cr.execute(
"""
ALTER TABLE "sale_order"
ADD COLUMN "website_description" text
"""
)
env.cr.execute(
"""
ALTER TABLE "sale_order_line"
ADD COLUMN "website_description" text
"""
)
env.cr.execute(
"""
ALTER TABLE "sale_order_template_line"
ADD COLUMN "website_description" text
"""
)
Loading
Loading