Skip to content

Commit

Permalink
Merge commit 'refs/pull/2860/head' of https://github.com/oca/sale-wor…
Browse files Browse the repository at this point in the history
…kflow into 17.0-4879
  • Loading branch information
docker-odoo committed Dec 27, 2023
2 parents a82faee + 6a2b4bb commit aac1304
Show file tree
Hide file tree
Showing 97 changed files with 19,236 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .pre-commit-config.yaml
Expand Up @@ -41,7 +41,7 @@ repos:
hooks:
- id: whool-init
- repo: https://github.com/oca/maintainer-tools
rev: f71041f22b8cd68cf7c77b73a14ca8d8cd190a60
rev: 9a170331575a265c092ee6b24b845ec508e8ef75
hooks:
# update the NOT INSTALLABLE ADDONS section above
- id: oca-update-pre-commit-excluded-addons
Expand All @@ -58,12 +58,12 @@ repos:
- --convert-fragments-to-markdown
- id: oca-gen-external-dependencies
- repo: https://github.com/OCA/odoo-pre-commit-hooks
rev: v0.0.25
rev: v0.0.29
hooks:
- id: oca-checks-odoo-module
- id: oca-checks-po
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
rev: v4.0.0-alpha.5
hooks:
- id: prettier
name: prettier (with plugin-xml)
Expand All @@ -74,15 +74,15 @@ repos:
- --plugin=@prettier/plugin-xml
files: \.(css|htm|html|js|json|jsx|less|md|scss|toml|ts|xml|yaml|yml)$
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.24.0
rev: v8.55.0
hooks:
- id: eslint
verbose: true
args:
- --color
- --fix
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
# exclude autogenerated files
Expand All @@ -104,13 +104,13 @@ repos:
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.3
rev: v0.1.8
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
- repo: https://github.com/OCA/pylint-odoo
rev: v8.0.19
rev: v9.0.4
hooks:
- id: pylint_odoo
name: pylint with optional checks
Expand Down
132 changes: 132 additions & 0 deletions sale_exception/README.rst
@@ -0,0 +1,132 @@
==============
Sale Exception
==============

..
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This file is generated by oca-gen-addon-readme !!
!! changes will be overwritten. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! source digest: sha256:4afad3f062ea26e238dc3fbc683974249b44c26b5d6b09870caaa8d91eb1dcaa
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
.. |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-OCA%2Fsale--workflow-lightgray.png?logo=github
:target: https://github.com/OCA/sale-workflow/tree/17.0/sale_exception
:alt: OCA/sale-workflow
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/sale-workflow-17-0/sale-workflow-17-0-sale_exception
: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-workflow&target_branch=17.0
:alt: Try me on Runboat

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

This module allows you attach several customizable exceptions to your
sale order in a way that you can filter orders by exceptions type and
fix them.

This is especially useful in an scenario for mass sales order import
because it's likely some orders have errors when you import them (like
product not found in Odoo, wrong line format etc.)

**Table of contents**

.. contents::
:local:

Configuration
=============

If you are going to use Customer sale warning and Product warning, for
setting corresponding information, you need to:

1. Go to *Settings > User & Companies > Users*.
2. Edit your user.
3. Check "A warning can be set on a product or a customer (Sale)" group.
4. Install sale_management addon.

Usage
=====

Not Enough Virtual Stock: #. Go to *Sales > Products > Products*. #.
Create new storable product without stock available. #. Go to *Sales >
Orders > Quotations* #. Create new quotation. #. Add product without
stock available. #. An exception will be displayed.

No ZIP code on destination: #. Go to *Contacts*. #. Edit or create new
contact. #. Set empty zip code. #. Go to *Sales > Orders > Quotations*
#. Create new quotation. #. Set delivery address with no zip code. #. An
exception will be displayed.

Product warning: #. Go to *Sales > Products > Products*. #. Edit or
create new product. #. Go to *Sales* tab. #. Set your desired warning
option under the *Warning when Selling this Product* group. #. Set some
warning message. #. Go to *Sales > Orders > Quotations* #. Create new
quotation. #. Add product with warning message. #. An exception will be
displayed.

Partner warning: #. Go to *Contacts*. #. Edit or create new contact. #.
Go to *Internal notes* tab. #. Set warning option according to *Warning
on the Sales Order* group. #. Set some warning message. #. Go to *Sales
> Orders > Quotations* #. Create new quotation. #. Set partner with
warning message. #. An exception will be displayed.

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/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-workflow/issues/new?body=module:%20sale_exception%0Aversion:%2017.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
-------

* Akretion
* Sodexis
* Camptocamp

Contributors
------------

- Raphaël Valyi <raphael.valyi@akretion.com>
- Renato Lima <renato.lima@akretion.com>
- Sébastien BEAU <sebastien.beau@akretion.com>
- Guewen Baconnier <guewen.baconnier@camptocamp.com>
- Yannick Vaucher <yannick.vaucher@camptocamp.com>
- Simone Orsi <simahawk@gmail.com>
- SodexisTeam <dev@sodexis.com>
- Mourad EL HADJ MIMOUNE <mourad.elhadj.mimoune@akretion.com>
- Raphaël Reverdy <raphael.reverdy@akretion.com>
- Florian da Costa <florian.dacosta@akretion.com>
- Iván Todorovich <ivan.todorovich@druidoo.io>
- Nguyen Minh Chien <chien@trobz.com>

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-workflow <https://github.com/OCA/sale-workflow/tree/17.0/sale_exception>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
3 changes: 3 additions & 0 deletions sale_exception/__init__.py
@@ -0,0 +1,3 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)
from . import models
from . import wizard
24 changes: 24 additions & 0 deletions sale_exception/__manifest__.py
@@ -0,0 +1,24 @@
# Copyright 2011 Akretion, Sodexis
# Copyright 2018 Akretion
# Copyright 2019 Camptocamp SA
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
{
"name": "Sale Exception",
"summary": "Custom exceptions on sale order",
"version": "17.0.1.0.0",
"category": "Generic Modules/Sale",
"author": "Akretion, "
"Sodexis, "
"Camptocamp, "
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/sale-workflow",
"depends": ["sale", "base_exception"],
"license": "AGPL-3",
"data": [
"security/ir.model.access.csv",
"data/sale_exception_data.xml",
"wizard/sale_exception_confirm_view.xml",
"views/sale_view.xml",
],
"demo": ["demo/sale_exception_demo.xml"],
}
50 changes: 50 additions & 0 deletions sale_exception/data/sale_exception_data.xml
@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8" ?>
<!-- License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). -->
<odoo noupdate="1">
<record forcecreate="True" id="ir_cron_test_orders" model="ir.cron">
<field name="name">Test Draft Orders</field>
<field name="active" eval="False" />
<field name="user_id" ref="base.user_root" />
<field name="interval_number">20</field>
<field name="interval_type">minutes</field>
<field name="numbercall">-1</field>
<field eval="False" name="doall" />
<field name="model_id" ref="sale.model_sale_order" />
<field name="state">code</field>
<field name="code">model.test_all_draft_orders()</field>
</record>
<record id="excep_no_zip" model="exception.rule">
<field name="name">No ZIP code on destination</field>
<field name="description">No ZIP code on destination</field>
<field name="sequence">50</field>
<field name="model">sale.order</field>
<field name="code">failed=not self.partner_shipping_id.zip</field>
<field name="active" eval="False" />
</record>
<record id="excep_no_stock" model="exception.rule">
<field name="name">Not Enough Virtual Stock</field>
<field name="description">Not Enough Virtual Stock</field>
<field name="sequence">50</field>
<field name="model">sale.order.line</field>
<field
name="code"
>failed=self.product_id and self.product_id.type == 'product' and self.virtual_available_at_date &lt; self.product_uom_qty</field>
<field name="active" eval="False" />
</record>
<record id="exception_partner_sale_warning" model="exception.rule">
<field name="name">Customer sale warning</field>
<field name="description">The customer has a sale warning in his form</field>
<field name="sequence">40</field>
<field name="model">sale.order</field>
<field name="code">failed=self.partner_id.sale_warn == "warning"</field>
<field name="active" eval="False" />
</record>
<record id="exception_product_sale_warning" model="exception.rule">
<field name="name">Product warning</field>
<field name="description">The product has a warning in his form</field>
<field name="sequence">40</field>
<field name="model">sale.order.line</field>
<field name="code">failed=self.product_id.sale_line_warn == "warning"</field>
<field name="active" eval="False" />
</record>
</odoo>
33 changes: 33 additions & 0 deletions sale_exception/demo/sale_exception_demo.xml
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="excep_no_sol" model="exception.rule">
<field name="name">No order lines</field>
<field
name="description"
>At least one order line should be present in the sale</field>
<field name="sequence">50</field>
<field name="model">sale.order</field>
<field name="exception_type">by_domain</field>
<field name="domain">[('order_line', '=', False)]</field>
<field name="active" eval="False" />
</record>
<record id="excep_no_free" model="exception.rule">
<field name="name">No free order</field>
<field name="description">The total can't be 0</field>
<field name="sequence">50</field>
<field name="model">sale.order</field>
<field name="exception_type">by_domain</field>
<field name="domain">[('amount_total', '=', 0)]</field>
<field name="active" eval="False" />
</record>
<record id="excep_no_dumping" model="exception.rule">
<field name="name">No dumping</field>
<field name="description">A product is sold cheaper than his cost.</field>
<field name="sequence">50</field>
<field name="model">sale.order.line</field>
<field
name="code"
>failed = obj.product_id.standard_price != 0 and obj.product_id.standard_price &gt; obj.price_unit</field>
<field name="active" eval="False" />
</record>
</odoo>

0 comments on commit aac1304

Please sign in to comment.