Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

17.0 mig deltatech packaging #1538

Merged
Merged
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
65 changes: 65 additions & 0 deletions deltatech_packaging/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
=========
packaging
=========

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

.. |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-LGPL--3-blue.png
:target: http://www.gnu.org/licenses/lgpl-3.0-standalone.html
:alt: License: LGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-dhongu%2Fdeltatech-lightgray.png?logo=github
:target: https://github.com/dhongu/deltatech/tree/17.0/deltatech_packaging
:alt: dhongu/deltatech

|badge1| |badge2| |badge3|

Features:

- al adaugarea de produse intr-un pachet se tine cont de cantitatea
maxima declarata pe tipul de amabalare specific produsului

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `Terrabit Issues <https://www.terrabit.ro/helpdesk>`_.
In case of trouble, please check there if your issue has already been reported.

Do not contact contributors directly about support or help with technical issues.

Credits
=======

Authors
-------

* Terrabit
* Dorin Hongu

Maintainers
-----------

.. |maintainer-dhongu| image:: https://github.com/dhongu.png?size=40px
:target: https://github.com/dhongu
:alt: dhongu

Current maintainer:

|maintainer-dhongu|

This module is part of the `dhongu/deltatech <https://github.com/dhongu/deltatech/tree/17.0/deltatech_packaging>`_ project on GitHub.

You are welcome to contribute.
4 changes: 4 additions & 0 deletions deltatech_packaging/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# © 2024 Deltatech
# See README.rst file on addons root folder for license details

from . import models
17 changes: 17 additions & 0 deletions deltatech_packaging/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# © 2024 Deltatech
# See README.rst file on addons root folder for license details


{
"name": "packaging",
"summary": "packaging",
"version": "17.0.1.0.1",
"author": "Terrabit, Dorin Hongu",
"website": "https://www.terrabit.ro",
"category": "Tools",
"depends": ["stock"],
"license": "LGPL-3",
"images": ["static/description/main_screenshot.png"],
"development_status": "Beta",
"maintainers": ["dhongu"],
}
4 changes: 4 additions & 0 deletions deltatech_packaging/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# © 2024 Deltatech
# See README.rst file on addons root folder for license details

from . import stock_picking
60 changes: 60 additions & 0 deletions deltatech_packaging/models/stock_picking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# © 2024 Deltatech
# See README.rst file on addons root folder for license details


from odoo import models
from odoo.tools.float_utils import float_round


class StockPicking(models.Model):
_inherit = "stock.picking"

def _pre_put_in_pack_hook(self, move_line_ids):
res = super()._pre_put_in_pack_hook(move_line_ids)

Check warning on line 13 in deltatech_packaging/models/stock_picking.py

View check run for this annotation

Codecov / codecov/patch

deltatech_packaging/models/stock_picking.py#L13

Added line #L13 was not covered by tests
for ml in move_line_ids:
if not ml.move_id.product_packaging_id:
continue
product_packaging = ml.move_id.product_packaging_id

Check warning on line 17 in deltatech_packaging/models/stock_picking.py

View check run for this annotation

Codecov / codecov/patch

deltatech_packaging/models/stock_picking.py#L16-L17

Added lines #L16 - L17 were not covered by tests

packaging_uom = product_packaging.product_uom_id

Check warning on line 19 in deltatech_packaging/models/stock_picking.py

View check run for this annotation

Codecov / codecov/patch

deltatech_packaging/models/stock_picking.py#L19

Added line #L19 was not covered by tests

packaging_qty = float_round(ml.quantity / product_packaging.qty, precision_rounding=packaging_uom.rounding)
qty_done = ml.quantity

Check warning on line 22 in deltatech_packaging/models/stock_picking.py

View check run for this annotation

Codecov / codecov/patch

deltatech_packaging/models/stock_picking.py#L21-L22

Added lines #L21 - L22 were not covered by tests
if packaging_qty > 1:
package = self.env["stock.quant.package"].create(

Check warning on line 24 in deltatech_packaging/models/stock_picking.py

View check run for this annotation

Codecov / codecov/patch

deltatech_packaging/models/stock_picking.py#L24

Added line #L24 was not covered by tests
{
"package_type_id": product_packaging.package_type_id.id,
}
)
ml.write(

Check warning on line 29 in deltatech_packaging/models/stock_picking.py

View check run for this annotation

Codecov / codecov/patch

deltatech_packaging/models/stock_picking.py#L29

Added line #L29 was not covered by tests
{
"quantity": product_packaging.qty,
"product_packaging_qty": product_packaging.qty,
"result_package_id": package.id,
}
)
new_move_line = self.env["stock.move.line"]

Check warning on line 36 in deltatech_packaging/models/stock_picking.py

View check run for this annotation

Codecov / codecov/patch

deltatech_packaging/models/stock_picking.py#L36

Added line #L36 was not covered by tests
for _i in range(int(packaging_qty) - 1):
package = self.env["stock.quant.package"].create(

Check warning on line 38 in deltatech_packaging/models/stock_picking.py

View check run for this annotation

Codecov / codecov/patch

deltatech_packaging/models/stock_picking.py#L38

Added line #L38 was not covered by tests
{
"package_type_id": product_packaging.package_type_id.id,
}
)
new_move_line = ml.copy(default={"product_packaging_qty": 0, "quantity": 0.0})
new_move_line.write(

Check warning on line 44 in deltatech_packaging/models/stock_picking.py

View check run for this annotation

Codecov / codecov/patch

deltatech_packaging/models/stock_picking.py#L43-L44

Added lines #L43 - L44 were not covered by tests
{
"quantity": product_packaging.qty,
"product_packaging_qty": product_packaging.qty,
"result_package_id": package.id,
}
)
diff = qty_done - (packaging_qty * product_packaging.qty)

Check warning on line 51 in deltatech_packaging/models/stock_picking.py

View check run for this annotation

Codecov / codecov/patch

deltatech_packaging/models/stock_picking.py#L51

Added line #L51 was not covered by tests
if new_move_line and diff:
new_move_line.write(

Check warning on line 53 in deltatech_packaging/models/stock_picking.py

View check run for this annotation

Codecov / codecov/patch

deltatech_packaging/models/stock_picking.py#L53

Added line #L53 was not covered by tests
{
"quantity": diff,
"product_packaging_qty": diff,
}
)

return res

Check warning on line 60 in deltatech_packaging/models/stock_picking.py

View check run for this annotation

Codecov / codecov/patch

deltatech_packaging/models/stock_picking.py#L60

Added line #L60 was not covered by tests
3 changes: 3 additions & 0 deletions deltatech_packaging/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["whool"]
build-backend = "whool.buildapi"
4 changes: 4 additions & 0 deletions deltatech_packaging/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Features:

- al adaugarea de produse intr-un pachet se tine cont de cantitatea maxima declarata pe tipul de amabalare specific
produsului
Binary file added deltatech_packaging/static/description/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading