Skip to content

Commit

Permalink
[ADD] stock_picking_package_number_glue
Browse files Browse the repository at this point in the history
  • Loading branch information
unaiberis committed Jan 21, 2025
1 parent fea1f23 commit e8c6fc4
Show file tree
Hide file tree
Showing 7 changed files with 107 additions and 0 deletions.
6 changes: 6 additions & 0 deletions setup/stock_picking_package_number_glue/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import setuptools

setuptools.setup(
setup_requires=['setuptools-odoo'],
odoo_addon=True,
)
76 changes: 76 additions & 0 deletions stock_picking_package_number_glue/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
.. image:: https://img.shields.io/badge/license-LGPL--3-blue.svg
:target: https://opensource.org/licenses/LGPL-3.0
:alt: License: LGPL-3

=================================
Stock Picking Package Number Glue
=================================

Overview
========

The **Stock Picking Package Number Glue** module extends the **Stock Picking** functionality by automatically synchronizing the `number_of_packages` field with the `packages_qty` field. This ensures that the number of packages is correctly updated whenever the quantity of packages is modified.

Features
========

- **Automatic Synchronization**:

- Automatically updates the `number_of_packages` field based on the value of the `packages_qty` field in stock pickings.

- **Onchange Trigger**:

- Uses the `@api.onchange` decorator to track changes in the `packages_qty` field and update the `number_of_packages` field accordingly.

Usage
=====

1. **Install the Module**:

- Install the **Stock Picking Package Number Glue** module from the Apps menu.

2. **Modify Package Quantity**:

- When editing a stock picking, update the `packages_qty` field.

3. **Automatic Update**:

- The `number_of_packages` field will be automatically updated to match the value of `packages_qty`.

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

No additional configuration is required for this module. It works automatically once installed.

Testing
=======

Perform the following tests to ensure the module is working correctly:

- Create or edit a stock picking.

- Change the value of the `packages_qty` field.

- Verify that the `number_of_packages` field is automatically updated with the same value as `packages_qty`.

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

If you encounter any issues, please report them on the GitHub repository at `GitHub Issues <https://github.com/avanzosc/odoo-addons/issues>`_.

Credits
=======

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

* Ana Juaristi <[email protected]>

* Unai Beristain <[email protected]>

For specific questions or support, please contact the contributors.

License
=======

This project is licensed under the LGPL-3 License. For more details, refer to the LICENSE file or visit <https://opensource.org/licenses/LGPL-3.0>.
1 change: 1 addition & 0 deletions stock_picking_package_number_glue/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import models
12 changes: 12 additions & 0 deletions stock_picking_package_number_glue/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"name": "Stock Picking Package Number Glue",
"version": "16.0.1.0.0",
"category": "Stock",
"author": "Avanzosc",
"license": "LGPL-3",
"depends": ["stock", "delivery_carrier_number", "stock_picking_package_usability"],
"data": [],
"installable": True,
"application": False,
"website": "https://github.com/avanzosc/odoo-addons",
}
1 change: 1 addition & 0 deletions stock_picking_package_number_glue/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
from . import stock_picking
10 changes: 10 additions & 0 deletions stock_picking_package_number_glue/models/stock_picking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from odoo import api, models


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

@api.onchange("packages_qty")
def _onchange_packages_qty(self):
for picking in self:
picking.number_of_packages = picking.packages_qty

0 comments on commit e8c6fc4

Please sign in to comment.