Skip to content

Commit 7df4b18

Browse files
committed
Merge PR OCA#3576 into 18.0
Signed-off-by pedrobaeza
2 parents 930f55a + 733954d commit 7df4b18

File tree

19 files changed

+858
-0
lines changed

19 files changed

+858
-0
lines changed
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
======================================
2+
Sale Order Product Availability Inline
3+
======================================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:688f99946dbceb8ec2c60c5531dc75a77c3160f942ffedce72756f72ef59a651
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Mature-brightgreen.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Mature
16+
.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
17+
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
18+
:alt: License: AGPL-3
19+
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fsale--workflow-lightgray.png?logo=github
20+
:target: https://github.com/OCA/sale-workflow/tree/18.0/sale_order_product_availability_inline
21+
:alt: OCA/sale-workflow
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/sale-workflow-18-0/sale-workflow-18-0-sale_order_product_availability_inline
24+
:alt: Translate me on Weblate
25+
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
26+
:target: https://runboat.odoo-community.org/builds?repo=OCA/sale-workflow&target_branch=18.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This module extends the functionality of 'Sales and Warehouse
32+
Management' to show you the stock availability (Free To Use Quantity) of
33+
each product as part of its name in the product drop-down widget on
34+
sales order lines.
35+
36+
**Table of contents**
37+
38+
.. contents::
39+
:local:
40+
41+
Usage
42+
=====
43+
44+
To use this module, you need to:
45+
46+
1. Go to *Sales > Orders > Orders* and choose an existing sales order or
47+
create a new one.
48+
2. Click on 'Add a product' under 'Order Lines' tab, then click on
49+
'Product' field to deploy products list.
50+
3. You will see stock availability (Free To Use Quantity) of each
51+
product as part of their name.
52+
53+
Bug Tracker
54+
===========
55+
56+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/sale-workflow/issues>`_.
57+
In case of trouble, please check there if your issue has already been reported.
58+
If you spotted it first, help us to smash it by providing a detailed and welcomed
59+
`feedback <https://github.com/OCA/sale-workflow/issues/new?body=module:%20sale_order_product_availability_inline%0Aversion:%2018.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
60+
61+
Do not contact contributors directly about support or help with technical issues.
62+
63+
Credits
64+
=======
65+
66+
Authors
67+
-------
68+
69+
* Tecnativa
70+
71+
Contributors
72+
------------
73+
74+
- `Tecnativa <https://www.tecnativa.com>`__:
75+
76+
- Ernesto Tejeda
77+
- Pedro M. Baeza
78+
- César A. Sánchez
79+
- Luis D. Lafaurie
80+
- Carlos Lopez
81+
82+
- `Pesol <https://www.pesol.es>`__:
83+
84+
- Jonathan Oscategui Taza <info@pesol.es>
85+
86+
- `Sodexis <https://www.sodexis.com>`__:
87+
88+
- SodexisTeam <dev@sodexis.com>
89+
90+
Maintainers
91+
-----------
92+
93+
This module is maintained by the OCA.
94+
95+
.. image:: https://odoo-community.org/logo.png
96+
:alt: Odoo Community Association
97+
:target: https://odoo-community.org
98+
99+
OCA, or the Odoo Community Association, is a nonprofit organization whose
100+
mission is to support the collaborative development of Odoo features and
101+
promote its widespread use.
102+
103+
.. |maintainer-ernestotejeda| image:: https://github.com/ernestotejeda.png?size=40px
104+
:target: https://github.com/ernestotejeda
105+
:alt: ernestotejeda
106+
107+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
108+
109+
|maintainer-ernestotejeda|
110+
111+
This module is part of the `OCA/sale-workflow <https://github.com/OCA/sale-workflow/tree/18.0/sale_order_product_availability_inline>`_ project on GitHub.
112+
113+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
2+
from . import models
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2020 Tecnativa - Ernesto Tejeda
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
{
4+
"name": "Sale Order Product Availability Inline",
5+
"summary": "Show product availability in sales order line product " "drop-down.",
6+
"version": "18.0.1.0.0",
7+
"development_status": "Mature",
8+
"category": "Sales Management",
9+
"website": "https://github.com/OCA/sale-workflow",
10+
"author": "Tecnativa, Odoo Community Association (OCA)",
11+
"maintainers": ["ernestotejeda"],
12+
"license": "AGPL-3",
13+
"depends": ["sale_stock", "base_view_inheritance_extension"],
14+
"data": ["views/sale_views.xml"],
15+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * sale_order_product_availability_inline
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 15.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2022-06-28 23:08+0000\n"
10+
"PO-Revision-Date: 2022-06-28 23:08+0000\n"
11+
"Last-Translator: \n"
12+
"Language-Team: \n"
13+
"Language: \n"
14+
"MIME-Version: 1.0\n"
15+
"Content-Type: text/plain; charset=UTF-8\n"
16+
"Content-Transfer-Encoding: \n"
17+
"Plural-Forms: \n"
18+
19+
#. module: sale_order_product_availability_inline
20+
#: model:ir.model,name:sale_order_product_availability_inline.model_product_product
21+
msgid "Product Variant"
22+
msgstr ""
23+
24+
#. module: sale_order_product_availability_inline
25+
#: model:ir.model,name:sale_order_product_availability_inline.model_sale_order_line
26+
msgid "Sales Order Line"
27+
msgstr "Línia de comandes de vendes"
28+
29+
#~ msgid "Product"
30+
#~ msgstr "Producte"
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * sale_order_product_availability_inline
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 15.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"POT-Creation-Date: 2022-06-28 23:08+0000\n"
10+
"PO-Revision-Date: 2023-07-25 12:10+0000\n"
11+
"Last-Translator: Ivorra78 <informatica@totmaterial.es>\n"
12+
"Language-Team: \n"
13+
"Language: es\n"
14+
"MIME-Version: 1.0\n"
15+
"Content-Type: text/plain; charset=UTF-8\n"
16+
"Content-Transfer-Encoding: \n"
17+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
18+
"X-Generator: Weblate 4.17\n"
19+
20+
#. module: sale_order_product_availability_inline
21+
#: model:ir.model,name:sale_order_product_availability_inline.model_product_product
22+
msgid "Product Variant"
23+
msgstr "Variante de Producto"
24+
25+
#. module: sale_order_product_availability_inline
26+
#: model:ir.model,name:sale_order_product_availability_inline.model_sale_order_line
27+
msgid "Sales Order Line"
28+
msgstr "Línea Pedido de Venta"
29+
30+
#~ msgid "Product"
31+
#~ msgstr "Producto"
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * sale_order_product_availability_inline
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 16.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"PO-Revision-Date: 2023-12-07 18:33+0000\n"
10+
"Last-Translator: mymage <stefano.consolaro@mymage.it>\n"
11+
"Language-Team: none\n"
12+
"Language: it\n"
13+
"MIME-Version: 1.0\n"
14+
"Content-Type: text/plain; charset=UTF-8\n"
15+
"Content-Transfer-Encoding: \n"
16+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
17+
"X-Generator: Weblate 4.17\n"
18+
19+
#. module: sale_order_product_availability_inline
20+
#: model:ir.model,name:sale_order_product_availability_inline.model_product_product
21+
msgid "Product Variant"
22+
msgstr "Variante prodotto"
23+
24+
#. module: sale_order_product_availability_inline
25+
#: model:ir.model,name:sale_order_product_availability_inline.model_sale_order_line
26+
msgid "Sales Order Line"
27+
msgstr "Riga ordine di vendita"
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * sale_order_product_availability_inline
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 17.0\n"
8+
"Report-Msgid-Bugs-To: \n"
9+
"Last-Translator: \n"
10+
"Language-Team: \n"
11+
"MIME-Version: 1.0\n"
12+
"Content-Type: text/plain; charset=UTF-8\n"
13+
"Content-Transfer-Encoding: \n"
14+
"Plural-Forms: \n"
15+
16+
#. module: sale_order_product_availability_inline
17+
#: model:ir.model,name:sale_order_product_availability_inline.model_product_product
18+
msgid "Product Variant"
19+
msgstr ""
20+
21+
#. module: sale_order_product_availability_inline
22+
#: model:ir.model,name:sale_order_product_availability_inline.model_sale_order_line
23+
msgid "Sales Order Line"
24+
msgstr ""
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
2+
from . import product_product
3+
from . import sale
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Copyright 2020 Tecnativa - Ernesto Tejeda
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import models
5+
6+
7+
class ProductProduct(models.Model):
8+
_inherit = "product.product"
9+
10+
def _compute_display_name(self):
11+
res = super()._compute_display_name()
12+
if self.env.context.get("so_product_stock_inline"):
13+
self = self.with_context(warehouse=self.env.context.get("warehouse"))
14+
availability = {r.id: [r.free_qty, r.uom_id.display_name] for r in self}
15+
precision = self.env["decimal.precision"].precision_get(
16+
"Product Unit of Measure"
17+
)
18+
for record in self:
19+
name = "{} ({:.{}f} {})".format(
20+
record.display_name,
21+
availability[record.id][0],
22+
precision,
23+
availability[record.id][1],
24+
)
25+
record.display_name = name
26+
return res
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Copyright 2020 Tecnativa - Ernesto Tejeda
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
4+
from odoo import api, models
5+
6+
7+
class SaleOrderLine(models.Model):
8+
_inherit = "sale.order.line"
9+
10+
@api.depends("product_id")
11+
def _compute_name(self):
12+
if self.env.context.get("so_product_stock_inline"):
13+
self = self.with_context(so_product_stock_inline=False)
14+
return super()._compute_name()

0 commit comments

Comments
 (0)