Skip to content

Commit b2ded86

Browse files
committed
[16.0][ADD] stock_picking_backorder_reason
1 parent 8349f0d commit b2ded86

32 files changed

+1604
-0
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../../stock_picking_backorder_reason
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import setuptools
2+
3+
setuptools.setup(
4+
setup_requires=['setuptools-odoo'],
5+
odoo_addon=True,
6+
)
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
==============================
2+
Stock Picking Backorder Reason
3+
==============================
4+
5+
.. !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
6+
!! This file is generated by oca-gen-addon-readme !!
7+
!! changes will be overwritten. !!
8+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
9+
10+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
11+
:target: https://odoo-community.org/page/development-status
12+
:alt: Beta
13+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
14+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
15+
:alt: License: AGPL-3
16+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--logistics--workflow-lightgray.png?logo=github
17+
:target: https://github.com/OCA/stock-logistics-workflow/tree/16.0/stock_picking_backorder_reason
18+
:alt: OCA/stock-logistics-workflow
19+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
20+
:target: https://translation.odoo-community.org/projects/stock-logistics-workflow-16-0/stock-logistics-workflow-16-0-stock_picking_backorder_reason
21+
:alt: Translate me on Weblate
22+
.. |badge5| image:: https://img.shields.io/badge/runbot-Try%20me-875A7B.png
23+
:target: https://runbot.odoo-community.org/runbot/154/16.0
24+
:alt: Try me on Runbot
25+
26+
|badge1| |badge2| |badge3| |badge4| |badge5|
27+
28+
This module allows to help user defining a backorder reason when it is
29+
launched on picking validation. This reason will be written on picking chatter level.
30+
31+
A reason can have several backorder strategy to apply:
32+
33+
* Create: Create the backorder
34+
* Cancel: Cancel the backorder
35+
* Use Partner Configuration: On partner level, you can define which strategy to
36+
apply and for which flow (Sale: Create/Cancel, Purchase: Create/Cancel)
37+
38+
This behaviour can be activated on picking type level.
39+
40+
Moreover, on company level, you can set default reason strategy for new partners.
41+
42+
**Table of contents**
43+
44+
.. contents::
45+
:local:
46+
47+
Configuration
48+
=============
49+
50+
#. Go to Inventory > Configuration > Operation Types
51+
#. Select the one you want to activate the feature and check the
52+
'Backorder Reason' checkbox.
53+
#. Then, select either the 'Backorder Reason' Sale or Purchase depending the flow the operation type
54+
is concerned by.
55+
#. Now, you can define some backorder reasons that will be selected by the warehouse user:
56+
* Go to Inventory > Configuration > Warehouse Management > Backorder Reasons
57+
* Fill in the name and choose an action to do (Create/Cancel/Use Partner option)
58+
59+
#. Go to Inventory > Configuration > Settings > Operations
60+
* You can change the default reason backorder strategy for new partners (for both sale/purchase flows)
61+
* By default, it's set on 'Create'
62+
63+
Known issues / Roadmap
64+
======================
65+
66+
* For the time being, options are set on wizard level. One may want to have
67+
the granularity on line one.
68+
69+
Bug Tracker
70+
===========
71+
72+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-logistics-workflow/issues>`_.
73+
In case of trouble, please check there if your issue has already been reported.
74+
If you spotted it first, help us smashing it by providing a detailed and welcomed
75+
`feedback <https://github.com/OCA/stock-logistics-workflow/issues/new?body=module:%20stock_picking_backorder_reason%0Aversion:%2016.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
76+
77+
Do not contact contributors directly about support or help with technical issues.
78+
79+
Credits
80+
=======
81+
82+
Authors
83+
~~~~~~~
84+
85+
* ACSONE SA/NV
86+
87+
Contributors
88+
~~~~~~~~~~~~
89+
90+
* Jacques-Etienne Baudoux <je@bcim.be>
91+
* Laurent Mignon <laurent.mignon@acsone.eu>
92+
* Denis Roussel <denis.roussel@acsone.eu>
93+
94+
Maintainers
95+
~~~~~~~~~~~
96+
97+
This module is maintained by the OCA.
98+
99+
.. image:: https://odoo-community.org/logo.png
100+
:alt: Odoo Community Association
101+
:target: https://odoo-community.org
102+
103+
OCA, or the Odoo Community Association, is a nonprofit organization whose
104+
mission is to support the collaborative development of Odoo features and
105+
promote its widespread use.
106+
107+
This module is part of the `OCA/stock-logistics-workflow <https://github.com/OCA/stock-logistics-workflow/tree/16.0/stock_picking_backorder_reason>`_ project on GitHub.
108+
109+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models, wizards
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2023 ACSONE SA/NV
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
{
5+
"name": "Stock Picking Backorder Reason",
6+
"summary": """
7+
Allows to add a layer on top of backorder confirmation in order to choose
8+
a reason. That reason will contain the strategy to apply.""",
9+
"version": "16.0.1.0.0",
10+
"license": "AGPL-3",
11+
"author": "ACSONE SA/NV,Odoo Community Association (OCA)",
12+
"website": "https://github.com/OCA/stock-logistics-workflow",
13+
"depends": [
14+
"stock",
15+
],
16+
"data": [
17+
"views/res_config_settings.xml",
18+
"views/stock_picking_type.xml",
19+
"security/stock_backorder_reason.xml",
20+
"views/stock_backorder_reason.xml",
21+
"wizards/stock_backorder_choice.xml",
22+
],
23+
"demo": [
24+
"demo/stock_backorder_reason.xml",
25+
],
26+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<!-- Copyright 2023 ACSONE SA/NV
3+
License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl). -->
4+
<odoo noupdate="1">
5+
6+
<!-- TODO
7+
<record model="stock.backorder.reason" id="stock_backorder_reason_demo_1">
8+
<field name="name">...</field>
9+
</record>
10+
-->
11+
12+
</odoo>
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
from . import (
2+
res_company,
3+
res_config_settings,
4+
res_partner,
5+
stock_backorder_reason,
6+
stock_picking,
7+
stock_picking_type,
8+
)
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Copyright 2023 ACSONE SA/NV
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class ResCompany(models.Model):
8+
_inherit = "res.company"
9+
10+
partner_sale_backorder_default_strategy = fields.Selection(
11+
selection=[("create", "Create"), ("cancel", "Cancel")],
12+
default="create",
13+
required=True,
14+
help="Choose the default strategy to set on partners for backorders "
15+
"on sale flows (for customers).",
16+
)
17+
partner_purchase_backorder_default_strategy = fields.Selection(
18+
selection=[("create", "Create"), ("cancel", "Cancel")],
19+
default="create",
20+
required=True,
21+
help="Choose the default strategy to set on partners for backorders "
22+
"on purchase flows (for suppliers).",
23+
)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2023 ACSONE SA/NV
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import fields, models
5+
6+
7+
class ResConfigSettings(models.TransientModel):
8+
9+
_inherit = "res.config.settings"
10+
11+
partner_sale_backorder_default_strategy = fields.Selection(
12+
related="company_id.partner_sale_backorder_default_strategy",
13+
readonly=False,
14+
)
15+
partner_purchase_backorder_default_strategy = fields.Selection(
16+
related="company_id.partner_purchase_backorder_default_strategy", readonly=False
17+
)
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Copyright 2017 Camptocamp SA
2+
# Copyright 2018 Jacques-Etienne Baudoux (BCIM sprl) <je@bcim.be>
3+
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl)
4+
5+
from odoo import api, fields, models
6+
7+
8+
class ResPartner(models.Model):
9+
_inherit = "res.partner"
10+
11+
sale_reason_backorder_strategy = fields.Selection(
12+
selection=[("create", "Create"), ("cancel", "Cancel")],
13+
default=lambda self: self._get_default_sale_reason_backorder_strategy(),
14+
required=True,
15+
tracking=True,
16+
help="Choose the strategy that will be applied on pickings that have "
17+
"backorder choice enabled and depending on partner sale strategy.",
18+
)
19+
purchase_reason_backorder_strategy = fields.Selection(
20+
selection=[("create", "Create"), ("cancel", "Cancel")],
21+
default=lambda self: self._get_default_purchase_reason_backorder_strategy(),
22+
required=True,
23+
tracking=True,
24+
help="Choose the strategy that will be applied on pickings that have "
25+
"backorder choice enabled and depending on partner purchase strategy.",
26+
)
27+
28+
@api.model
29+
def _get_default_sale_reason_backorder_strategy(self):
30+
return self.env.company.partner_sale_backorder_default_strategy
31+
32+
@api.model
33+
def _get_default_purchase_reason_backorder_strategy(self):
34+
return self.env.company.partner_purchase_backorder_default_strategy

0 commit comments

Comments
 (0)