Skip to content
Draft
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
3 changes: 2 additions & 1 deletion sale_cart/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Sale Cart

|badge1| |badge2| |badge3|

This addon add a typology on sale.order to distinguish the sale orders that are
This addon adds a "cart" typology on sale.order to distinguish the sale orders that are
in the process of being written (cart) and those that are quotations
ready to be confirmed.

Expand Down Expand Up @@ -53,6 +53,7 @@ Contributors
~~~~~~~~~~~~

* Laurent Mignon <laurent.mignon@acsone.eu>
* Nicolas DELBOVIER <nicolas.delbovier@acsone.eu>

Maintainers
~~~~~~~~~~~
Expand Down
2 changes: 1 addition & 1 deletion sale_cart/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"license": "AGPL-3",
"author": "ACSONE SA/NV",
"website": "https://github.com/shopinvader/odoo-shopinvader",
"depends": ["sale", "sales_team"],
"depends": ["sale", "sales_team", "sale_typology"],
"data": ["views/sale_order.xml"],
"demo": [],
"external_dependencies": {"python": ["openupgradelib"]},
Expand Down
2 changes: 1 addition & 1 deletion sale_cart/models/sale_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class SaleOrder(models.Model):

_inherit = "sale.order"

typology = fields.Selection([("sale", "Sale"), ("cart", "Cart")], default="sale")
typology = fields.Selection(selection_add=[("cart", "Cart")])

def _confirm_cart(self):
self.ensure_one()
Expand Down
1 change: 1 addition & 0 deletions sale_cart/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
* Laurent Mignon <laurent.mignon@acsone.eu>
* Nicolas DELBOVIER <nicolas.delbovier@acsone.eu>
2 changes: 1 addition & 1 deletion sale_cart/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
This addon add a typology on sale.order to distinguish the sale orders that are
This addon adds a "cart" typology on sale.order to distinguish the sale orders that are
in the process of being written (cart) and those that are quotations
ready to be confirmed.
11 changes: 6 additions & 5 deletions sale_cart/static/description/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand All @@ -9,10 +8,11 @@

/*
:Author: David Goodger (goodger@python.org)
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
:Copyright: This stylesheet has been placed in the public domain.

Default cascading style sheet for the HTML output of Docutils.
Despite the name, some widely supported CSS2 features are used.

See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
customize this style sheet.
Expand Down Expand Up @@ -275,7 +275,7 @@
margin-left: 2em ;
margin-right: 2em }

pre.code .ln { color: grey; } /* line numbers */
pre.code .ln { color: gray; } /* line numbers */
pre.code, code { background-color: #eeeeee }
pre.code .comment, code .comment { color: #5C6576 }
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
Expand All @@ -301,7 +301,7 @@
span.pre {
white-space: pre }

span.problematic {
span.problematic, pre.problematic {
color: red }

span.section-subtitle {
Expand Down Expand Up @@ -370,7 +370,7 @@ <h1 class="title">Sale Cart</h1>
!! source digest: sha256:669b6f8b598ec1aa67334391cf3183bed210a1af06ea0bce3d1f34fbc6c3ebf8
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/shopinvader/odoo-shopinvader/tree/16.0/sale_cart"><img alt="shopinvader/odoo-shopinvader" src="https://img.shields.io/badge/github-shopinvader%2Fodoo--shopinvader-lightgray.png?logo=github" /></a></p>
<p>This addon add a typology on sale.order to distinguish the sale orders that are
<p>This addon adds a “cart” typology on sale.order to distinguish the sale orders that are
in the process of being written (cart) and those that are quotations
ready to be confirmed.</p>
<p><strong>Table of contents</strong></p>
Expand Down Expand Up @@ -405,6 +405,7 @@ <h2><a class="toc-backref" href="#toc-entry-3">Authors</a></h2>
<h2><a class="toc-backref" href="#toc-entry-4">Contributors</a></h2>
<ul class="simple">
<li>Laurent Mignon &lt;<a class="reference external" href="mailto:laurent.mignon&#64;acsone.eu">laurent.mignon&#64;acsone.eu</a>&gt;</li>
<li>Nicolas DELBOVIER &lt;<a class="reference external" href="mailto:nicolas.delbovier&#64;acsone.eu">nicolas.delbovier&#64;acsone.eu</a>&gt;</li>
</ul>
</div>
<div class="section" id="maintainers">
Expand Down
60 changes: 60 additions & 0 deletions sale_cart_quotation/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
===================
Sale Cart Quotation
===================

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

.. |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/licence-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-shopinvader%2Fodoo--shopinvader-lightgray.png?logo=github
:target: https://github.com/shopinvader/odoo-shopinvader/tree/16.0/sale_cart_quotation
:alt: shopinvader/odoo-shopinvader

|badge1| |badge2| |badge3|

Glue module between sale_quotation and sale_cart

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/shopinvader/odoo-shopinvader/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/shopinvader/odoo-shopinvader/issues/new?body=module:%20sale_cart_quotation%0Aversion:%2016.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
~~~~~~~

* ACSONE SA/NV

Contributors
~~~~~~~~~~~~

* Nicolas DELBOVIER <nicolas.delbovier@acsone.eu>

Maintainers
~~~~~~~~~~~

This module is part of the `shopinvader/odoo-shopinvader <https://github.com/shopinvader/odoo-shopinvader/tree/16.0/sale_cart_quotation>`_ project on GitHub.

You are welcome to contribute.
1 change: 1 addition & 0 deletions sale_cart_quotation/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
14 changes: 14 additions & 0 deletions sale_cart_quotation/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright 2025 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

{
"name": "Sale Cart Quotation",
"summary": """Glue module between sale_quotation and sale_cart""",
"version": "16.0.1.0.0",
"license": "AGPL-3",
"author": "ACSONE SA/NV",
"website": "https://github.com/shopinvader/odoo-shopinvader",
"depends": ["sale_quotation", "sale_cart"],
"data": ["views/sale_order.xml", "data/mail_templates.xml"],
"demo": [],
}
31 changes: 31 additions & 0 deletions sale_cart_quotation/data/mail_templates.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<odoo>
<record id="mail_template_request_quotation" model="mail.template">
<field name="name">Quotation Request</field>
<field name="model_id" ref="sale.model_sale_order" />
<field
name="subject"
>{{ object.user_id.company_id.name }} Quotation Request (Ref {{ object.name }})</field>
<field name="email_from">{{ object.user_id.company_id.email_formatted }}</field>
<field
name="description"
>Used to notify the sales team when a client requests a quotation.</field>
<field name="body_html" type="html">
<div>
<p>Dear Sales Team,</p>
<p>
A new quotation (<strong><t
t-out="object.name"
/></strong>) has been requested by
the client <strong><t t-out="object.partner_id.name" /></strong>.
</p>
--
<p>
<t t-out="object.user_id.company_id.name" />
</p>
</div>
</field>
<field name="auto_delete" eval="True" />
<field name="lang">{{ object.partner_id.lang }}</field>
<field name="partner_to" eval="False" />
</record>
</odoo>
1 change: 1 addition & 0 deletions sale_cart_quotation/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import sale_order
52 changes: 52 additions & 0 deletions sale_cart_quotation/models/sale_order.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Copyright 2025 ACSONE SA/NV
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).

from odoo import _, models
from odoo.exceptions import UserError, ValidationError


class SaleOrder(models.Model):
_inherit = "sale.order"

def action_request_quotation(self):
if any(rec.state != "draft" or rec.typology != "cart" for rec in self):
raise UserError(
_(
"Only orders of cart typology in draft state "
"can be converted to quotation"
)
)
self.write({"quotation_state": "customer_request", "typology": "sale"})
self._send_request_notification()
return True

def _send_request_notification(self):
template = self.env.ref("sale_cart_quotation.mail_template_request_quotation")
for record in self:
recipients = self.env["res.partner"]
if record.user_id and record.user_id.partner_id:
recipients |= record.user_id.partner_id

if record.team_id:
for member in record.team_id.member_ids:
recipients |= member.partner_id

if not recipients:
raise ValidationError(
_(
"Unable to send quotation request email because no "
"valid recipients (salesperson or sales team members) "
"were found for quotation %s." % record.name
)
)

# use the "mt_note" subtype to make sure only odoo users are notified
# (not the client)
record.with_context(
mail_notify_author=True, # author (ie user_id) is not notified by default
).message_post_with_template(
template.id,
email_layout_xmlid="mail.mail_notification_layout",
subtype_id=self.env.ref("mail.mt_note").id,
partner_ids=recipients.ids,
)
1 change: 1 addition & 0 deletions sale_cart_quotation/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* Nicolas DELBOVIER <nicolas.delbovier@acsone.eu>
1 change: 1 addition & 0 deletions sale_cart_quotation/readme/DESCRIPTION.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Glue module between sale_quotation and sale_cart
Loading