Skip to content

Commit 9337979

Browse files
committed
Merge PR #170 into 17.0
Signed-off-by rvalyi
2 parents 8d73597 + 1bf1628 commit 9337979

14 files changed

+656
-0
lines changed

Diff for: sale_stock_product_pack/README.rst

+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
=======================
2+
Sale Stock Product Pack
3+
=======================
4+
5+
..
6+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
7+
!! This file is generated by oca-gen-addon-readme !!
8+
!! changes will be overwritten. !!
9+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
10+
!! source digest: sha256:c81e7b28f443c2245ae020a601f05690394a2d93dbdcd6da083db3bc63784d4e
11+
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
12+
13+
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
14+
:target: https://odoo-community.org/page/development-status
15+
:alt: Beta
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%2Fproduct--pack-lightgray.png?logo=github
20+
:target: https://github.com/OCA/product-pack/tree/17.0/sale_stock_product_pack
21+
:alt: OCA/product-pack
22+
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
23+
:target: https://translation.odoo-community.org/projects/product-pack-17-0/product-pack-17-0-sale_stock_product_pack
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/product-pack&target_branch=17.0
27+
:alt: Try me on Runboat
28+
29+
|badge1| |badge2| |badge3| |badge4| |badge5|
30+
31+
This modules adds compatibility of product packs with sales and stock
32+
altogether:
33+
34+
- Correctly compute delivered quantities for the different types of
35+
packs so they can be properly invoiced when the pack is storable.
36+
37+
**Table of contents**
38+
39+
.. contents::
40+
:local:
41+
42+
Known issues / Roadmap
43+
======================
44+
45+
- Non detailed packs aren't yet supported by stock_product_pack, so no
46+
support for them either in this module.
47+
48+
Bug Tracker
49+
===========
50+
51+
Bugs are tracked on `GitHub Issues <https://github.com/OCA/product-pack/issues>`_.
52+
In case of trouble, please check there if your issue has already been reported.
53+
If you spotted it first, help us to smash it by providing a detailed and welcomed
54+
`feedback <https://github.com/OCA/product-pack/issues/new?body=module:%20sale_stock_product_pack%0Aversion:%2017.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.
55+
56+
Do not contact contributors directly about support or help with technical issues.
57+
58+
Credits
59+
=======
60+
61+
Authors
62+
-------
63+
64+
* Tecnativa
65+
66+
Contributors
67+
------------
68+
69+
- `Tecnativa <https://www.tecnativa.com>`__:
70+
71+
- Ernesto Tejeda
72+
- Pedro M. Baeza
73+
74+
Maintainers
75+
-----------
76+
77+
This module is maintained by the OCA.
78+
79+
.. image:: https://odoo-community.org/logo.png
80+
:alt: Odoo Community Association
81+
:target: https://odoo-community.org
82+
83+
OCA, or the Odoo Community Association, is a nonprofit organization whose
84+
mission is to support the collaborative development of Odoo features and
85+
promote its widespread use.
86+
87+
.. |maintainer-chienandalu| image:: https://github.com/chienandalu.png?size=40px
88+
:target: https://github.com/chienandalu
89+
:alt: chienandalu
90+
91+
Current `maintainer <https://odoo-community.org/page/maintainer-role>`__:
92+
93+
|maintainer-chienandalu|
94+
95+
This module is part of the `OCA/product-pack <https://github.com/OCA/product-pack/tree/17.0/sale_stock_product_pack>`_ project on GitHub.
96+
97+
You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.

Diff for: sale_stock_product_pack/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import models

Diff for: sale_stock_product_pack/__manifest__.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2021 Tecnativa - David Vidal
2+
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl).
3+
{
4+
"name": "Sale Stock Product Pack",
5+
"summary": "Compatibility module for packs that are storable products",
6+
"version": "17.0.1.0.0",
7+
"development_status": "Beta",
8+
"category": "Sale",
9+
"website": "https://github.com/OCA/product-pack",
10+
"author": "Tecnativa, Odoo Community Association (OCA)",
11+
"maintainers": ["chienandalu"],
12+
"license": "AGPL-3",
13+
"depends": ["sale_product_pack", "stock_product_pack"],
14+
"data": [],
15+
}
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Translation of Odoo Server.
2+
# This file contains the translation of the following modules:
3+
# * sale_stock_product_pack
4+
#
5+
msgid ""
6+
msgstr ""
7+
"Project-Id-Version: Odoo Server 13.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_stock_product_pack
17+
#: model:ir.model,name:sale_stock_product_pack.model_sale_order_line
18+
msgid "Sales Order Line"
19+
msgstr ""

Diff for: sale_stock_product_pack/models/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from . import sale_order

Diff for: sale_stock_product_pack/models/sale_order.py

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Copyright 2021 Tecnativa - David Vidal
2+
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
3+
# pylint: disable=W8110
4+
from odoo import models
5+
6+
7+
class SaleOrderLine(models.Model):
8+
_inherit = "sale.order.line"
9+
10+
def _compute_qty_delivered(self):
11+
"""Compute pack delivered pack quantites according to its components
12+
deliveries"""
13+
super()._compute_qty_delivered()
14+
main_pack_lines = self.filtered("pack_parent_line_id").mapped(
15+
"pack_parent_line_id"
16+
)
17+
for line in main_pack_lines.filtered(
18+
lambda x: x.qty_delivered_method == "stock_move"
19+
and x.pack_child_line_ids
20+
and x.product_uom_qty
21+
):
22+
delivered_packs = []
23+
# We filter non qty lines of editable packs
24+
for pack_line in line.pack_child_line_ids.filtered("product_uom_qty"):
25+
# If a component isn't delivered, the pack isn't as well
26+
if not pack_line.qty_delivered:
27+
delivered_packs.append(0)
28+
break
29+
qty_per_pack = pack_line.product_uom_qty / line.product_uom_qty
30+
delivered_packs.append(pack_line.qty_delivered / qty_per_pack)
31+
line.qty_delivered = delivered_packs and min(delivered_packs) or 0.0

Diff for: sale_stock_product_pack/pyproject.toml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["whool"]
3+
build-backend = "whool.buildapi"

Diff for: sale_stock_product_pack/readme/CONTRIBUTORS.md

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
- [Tecnativa](https://www.tecnativa.com):
2+
- Ernesto Tejeda
3+
- Pedro M. Baeza

Diff for: sale_stock_product_pack/readme/DESCRIPTION.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
This modules adds compatibility of product packs with sales and stock
2+
altogether:
3+
4+
- Correctly compute delivered quantities for the different types of
5+
packs so they can be properly invoiced when the pack is storable.

Diff for: sale_stock_product_pack/readme/ROADMAP.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
- Non detailed packs aren't yet supported by stock_product_pack, so no
2+
support for them either in this module.

Diff for: sale_stock_product_pack/static/description/icon.png

9.23 KB
Loading

0 commit comments

Comments
 (0)