-
-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by bguillot
- Loading branch information
Showing
35 changed files
with
1,074 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
setup/stock_packaging_usability/odoo/addons/stock_packaging_usability
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../stock_packaging_usability |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) |
1 change: 1 addition & 0 deletions
1
setup/stock_packaging_usability_pp/odoo/addons/stock_packaging_usability_pp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../stock_packaging_usability_pp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
.. image:: https://img.shields.io/badge/licence-AGPL--3-blue.svg | ||
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html | ||
:alt: License: AGPL-3 | ||
|
||
========================= | ||
Stock Packaging Usability | ||
========================= | ||
|
||
Configuration | ||
============= | ||
|
||
Go to the Settings page of the Inventory menu and enable the option | ||
*Record packages used on packing: pallets, boxes, ...*: it will add all | ||
users to the group *Manage Packages*. | ||
|
||
Usage | ||
===== | ||
|
||
This module adds 2 buttons in the *Operations* lines of a picking: | ||
|
||
* *Put in current pack* | ||
|
||
* *Put in new pack* | ||
|
||
It is a complement of the button *Put in Pack* which is available on the picking. With these 2 new buttons, you are not obliged to set the *Done quantity* package by package. | ||
|
||
.. image:: https://odoo-community.org/website/image/ir.attachment/5784_f2813bd/datas | ||
:alt: Try me on Runbot | ||
:target: https://runbot.odoo-community.org/runbot/152/10.0 | ||
|
||
Bug Tracker | ||
=========== | ||
|
||
Bugs are tracked on `GitHub Issues | ||
<https://github.com/OCA/stock-logistics-tracking/issues>`_. In case of trouble, please | ||
check there if your issue has already been reported. If you spotted it first, | ||
help us smashing it by providing a detailed and welcomed feedback. | ||
|
||
Credits | ||
======= | ||
|
||
Contributors | ||
------------ | ||
|
||
* Alexis de Lattre <[email protected]> | ||
|
||
Maintainer | ||
---------- | ||
|
||
.. image:: https://odoo-community.org/logo.png | ||
:alt: Odoo Community Association | ||
:target: https://odoo-community.org | ||
|
||
This module is maintained by the OCA. | ||
|
||
OCA, or the Odoo Community Association, is a nonprofit organization whose | ||
mission is to support the collaborative development of Odoo features and | ||
promote its widespread use. | ||
|
||
To contribute to this module, please visit https://odoo-community.org. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import models |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright 2014-2021 Akretion France (http://www.akretion.com). | ||
# @author Alexis de Lattre <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
|
||
{ | ||
"name": "Stock Packaging Usability", | ||
"version": "14.0.1.0.0", | ||
"category": "Inventory/Inventory", | ||
"license": "AGPL-3", | ||
"summary": "Faster packaging process in Odoo", | ||
"author": "Akretion,Odoo Community Association (OCA)", | ||
"maintainers": ["alexis-via"], | ||
"website": "https://github.com/OCA/stock-logistics-tracking", | ||
"depends": ["stock"], | ||
"data": [ | ||
"views/stock_move_line.xml", | ||
], | ||
"installable": True, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
# Translation of Odoo Server. | ||
# This file contains the translation of the following modules: | ||
# * stock_packaging_usability | ||
# | ||
msgid "" | ||
msgstr "" | ||
"Project-Id-Version: Odoo Server 14.0\n" | ||
"Report-Msgid-Bugs-To: \n" | ||
"POT-Creation-Date: 2021-12-23 16:50+0000\n" | ||
"PO-Revision-Date: 2021-12-23 16:50+0000\n" | ||
"Last-Translator: \n" | ||
"Language-Team: \n" | ||
"MIME-Version: 1.0\n" | ||
"Content-Type: text/plain; charset=UTF-8\n" | ||
"Content-Transfer-Encoding: \n" | ||
"Plural-Forms: \n" | ||
|
||
#. module: stock_packaging_usability | ||
#: code:addons/stock_packaging_usability/models/stock_move_line.py:0 | ||
#, python-format | ||
msgid "Could not find any package level linked to package '%s'." | ||
msgstr "" | ||
|
||
#. module: stock_packaging_usability | ||
#: model:ir.model.fields,field_description:stock_packaging_usability.field_stock_move_line__display_name | ||
msgid "Display Name" | ||
msgstr "Nom affiché" | ||
|
||
#. module: stock_packaging_usability | ||
#: model:ir.model.fields,field_description:stock_packaging_usability.field_stock_move_line__id | ||
msgid "ID" | ||
msgstr "" | ||
|
||
#. module: stock_packaging_usability | ||
#: model:ir.model.fields,field_description:stock_packaging_usability.field_stock_move_line____last_update | ||
msgid "Last Modified on" | ||
msgstr "Dernière modification le" | ||
|
||
#. module: stock_packaging_usability | ||
#: model:ir.model,name:stock_packaging_usability.model_stock_move_line | ||
msgid "Product Moves (Stock Move Line)" | ||
msgstr "Mouvements d'article (Ligne de mouvement de stock)" | ||
|
||
#. module: stock_packaging_usability | ||
#: model_terms:ir.ui.view,arch_db:stock_packaging_usability.view_stock_move_line_detailed_operation_tree | ||
#: model_terms:ir.ui.view,arch_db:stock_packaging_usability.view_stock_move_line_operation_tree | ||
msgid "Put in Current Pack" | ||
msgstr "" | ||
|
||
#. module: stock_packaging_usability | ||
#: model_terms:ir.ui.view,arch_db:stock_packaging_usability.view_stock_move_line_detailed_operation_tree | ||
#: model_terms:ir.ui.view,arch_db:stock_packaging_usability.view_stock_move_line_operation_tree | ||
msgid "Put in New Pack" | ||
msgstr "" | ||
|
||
#. module: stock_packaging_usability | ||
#: code:addons/stock_packaging_usability/models/stock_move_line.py:0 | ||
#, python-format | ||
msgid "Qty done is 0" | ||
msgstr "" | ||
|
||
#. module: stock_packaging_usability | ||
#: code:addons/stock_packaging_usability/models/stock_move_line.py:0 | ||
#, python-format | ||
msgid "There are several package levels linked to package '%s'." | ||
msgstr "" | ||
|
||
#. module: stock_packaging_usability | ||
#: code:addons/stock_packaging_usability/models/stock_move_line.py:0 | ||
#, python-format | ||
msgid "There is no current package." | ||
msgstr "" | ||
|
||
#. module: stock_packaging_usability | ||
#: code:addons/stock_packaging_usability/models/stock_move_line.py:0 | ||
#, python-format | ||
msgid "This operation is already packaged." | ||
msgstr "" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from . import stock_move_line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
# Copyright 2014-2021 Akretion France (http://www.akretion.com) | ||
# @author Alexis de Lattre <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
|
||
from odoo import _, models | ||
from odoo.exceptions import UserError | ||
from odoo.tools import float_compare, float_is_zero, float_round | ||
|
||
|
||
class StockMoveLine(models.Model): | ||
_inherit = "stock.move.line" | ||
|
||
def put_in_new_pack(self): | ||
self.ensure_one() | ||
pack = self.env["stock.quant.package"].create({}) | ||
picking = self.picking_id | ||
pack_level = self.env["stock.package_level"].create( | ||
{ | ||
"package_id": pack.id, | ||
"picking_id": picking.id, | ||
"location_id": False, | ||
"location_dest_id": self.location_dest_id.id, | ||
"move_line_ids": [(6, 0, [self.id])], | ||
"company_id": picking.company_id.id, | ||
} | ||
) | ||
self._put_in_target_pack(pack, pack_level) | ||
|
||
def put_in_last_pack(self): | ||
all_cur_packs_ids = [ | ||
moveline2.result_package_id.id | ||
for moveline2 in self.picking_id.move_line_ids | ||
if moveline2.result_package_id | ||
] | ||
if not all_cur_packs_ids: | ||
raise UserError(_("There is no current package.")) | ||
pack_id = max(all_cur_packs_ids) | ||
pack = self.env["stock.quant.package"].browse(pack_id) | ||
pack_levels = self.env["stock.package_level"].search( | ||
[("package_id", "=", pack_id)] | ||
) | ||
if not pack_levels: | ||
raise UserError( | ||
_("Could not find any package level linked to package '%s'.") | ||
% pack.display_name | ||
) | ||
if len(pack_levels) > 1: | ||
raise UserError( | ||
_("There are several package levels linked to package '%s'.") | ||
% pack.display_name | ||
) | ||
self._put_in_target_pack(pack, pack_levels) | ||
|
||
def _put_in_target_pack(self, pack, pack_level): | ||
self.ensure_one() | ||
assert pack, "pack is a required argument" | ||
prec = self.env["decimal.precision"].precision_get("Product Unit of Measure") | ||
if float_is_zero(self.qty_done, precision_digits=prec): | ||
raise UserError(_("Qty done is 0")) | ||
if self.result_package_id: | ||
raise UserError(_("This operation is already packaged.")) | ||
moveline_to_pack = self | ||
if ( | ||
float_compare(self.qty_done, self.product_uom_qty, precision_digits=prec) | ||
< 0 | ||
): | ||
quantity_left_todo = float_round( | ||
self.product_uom_qty - self.qty_done, | ||
precision_rounding=self.product_uom_id.rounding, | ||
) | ||
done_to_keep = self.qty_done | ||
# IMPORTANT: we first create the new move line with product_uom_qty=0 | ||
# and THEN we write product_uom_qty = qty_done on it. | ||
# We MUSTN'T create the new move line directly with | ||
# product_uom_qty=self.qty_done because it doesn't update | ||
# the reserved_qty on the quant, because on stock.move.line | ||
# the inherit of write() calls | ||
# self.env['stock.quant']._update_reserved_quantity() | ||
# but the inherit of create() doesn't ! | ||
new_moveline = self.copy({"product_uom_qty": 0, "qty_done": done_to_keep}) | ||
self.write( | ||
{ | ||
"product_uom_qty": quantity_left_todo, | ||
"qty_done": 0, | ||
} | ||
) | ||
new_moveline.write({"product_uom_qty": done_to_keep}) | ||
moveline_to_pack = new_moveline | ||
pack_level.write({"move_line_ids": [(4, moveline_to_pack.id)]}) | ||
moveline_to_pack.write({"result_package_id": pack.id}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Go to the Configuration page of the Inventory menu and enable the option | ||
*Delivery Packages* (Put your products in packs and track them): it will add all | ||
users to the group *Manage Packages*. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Alexis de Lattre <[email protected]> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
This module makes it faster to define which product goes in which pack on an outgoing picking. It adds 2 buttons in the *Operations* lines of a picking: | ||
|
||
* **Put in current pack** | ||
|
||
* **Put in new pack** | ||
|
||
It is a complement of the button **Put in Pack** which is available on the picking. With these 2 new buttons, you are not obliged to set the *Done quantity* package by package. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<!-- | ||
Copyright 2014-2021 Akretion France (http://www.akretion.com/) | ||
@author Alexis de Lattre <[email protected]> | ||
License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
--> | ||
<odoo> | ||
|
||
|
||
<record id="view_stock_move_line_operation_tree" model="ir.ui.view"> | ||
<field name="name">stock_packaging_usability.stock.move.line.form</field> | ||
<field name="model">stock.move.line</field> | ||
<field name="inherit_id" ref="stock.view_stock_move_line_operation_tree" /> | ||
<field name="arch" type="xml"> | ||
<field name="result_package_id" position="after"> | ||
<button | ||
name="put_in_last_pack" | ||
type="object" | ||
string="Current Pack" | ||
icon="fa-stack-overflow" | ||
groups="stock.group_tracking_lot" | ||
attrs="{'invisible': ['|', ('result_package_id', '!=', False), ('qty_done', '=', 0)]}" | ||
/> | ||
<button | ||
name="put_in_new_pack" | ||
type="object" | ||
string="New Pack" | ||
icon="fa-dropbox" | ||
groups="stock.group_tracking_lot" | ||
attrs="{'invisible': ['|', ('result_package_id', '!=', False), ('qty_done', '=', 0)]}" | ||
/> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
|
||
<record id="view_stock_move_line_detailed_operation_tree" model="ir.ui.view"> | ||
<field name="model">stock.move.line</field> | ||
<field name="inherit_id" ref="stock.view_stock_move_line_detailed_operation_tree" /> | ||
<field name="arch" type="xml"> | ||
<field name="result_package_id" position="after"> | ||
<button | ||
name="put_in_last_pack" | ||
type="object" | ||
string="Current Pack" | ||
icon="fa-stack-overflow" | ||
groups="stock.group_tracking_lot" | ||
attrs="{'invisible': ['|', ('result_package_id', '!=', False), ('qty_done', '=', 0)]}" | ||
/> | ||
<button | ||
name="put_in_new_pack" | ||
type="object" | ||
string="New Pack" | ||
icon="fa-dropbox" | ||
groups="stock.group_tracking_lot" | ||
attrs="{'invisible': ['|', ('result_package_id', '!=', False), ('qty_done', '=', 0)]}" | ||
/> | ||
</field> | ||
</field> | ||
</record> | ||
|
||
|
||
</odoo> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Will be re-generated from readme subdir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from . import models | ||
from . import wizard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Copyright 2014-2021 Akretion France (http://www.akretion.com). | ||
# @author Alexis de Lattre <[email protected]> | ||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl). | ||
|
||
{ | ||
"name": "Stock Packaging Usability (Product Packaging)", | ||
"version": "14.0.1.0.0", | ||
"category": "Inventory/Inventory", | ||
"license": "AGPL-3", | ||
"summary": "Faster packaging process with product packaging", | ||
"author": "Akretion,Odoo Community Association (OCA)", | ||
"maintainers": ["alexis-via"], | ||
"website": "https://github.com/OCA/stock-logistics-tracking", | ||
"depends": [ | ||
"stock_packaging_usability", | ||
"delivery", | ||
], | ||
"data": [ | ||
"wizard/stock_select_product_packaging_view.xml", | ||
"views/stock_picking.xml", | ||
"views/stock_move_line.xml", | ||
"views/stock_quant_package.xml", | ||
"views/product_packaging.xml", | ||
"security/ir.model.access.csv", | ||
], | ||
"installable": True, | ||
} |
Oops, something went wrong.