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

[15.0][ADD] stock_picking_batch_weighing: New module #4

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
6 changes: 6 additions & 0 deletions setup/stock_picking_batch_weighing/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,
)
80 changes: 80 additions & 0 deletions stock_picking_batch_weighing/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
====================================
Weighing assistant in batch pickings
====================================

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

.. |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-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-OCA%2Fstock--weighing-lightgray.png?logo=github
:target: https://github.com/OCA/stock-weighing/tree/15.0/stock_picking_batch_weighing
:alt: OCA/stock-weighing
.. |badge4| image:: https://img.shields.io/badge/weblate-Translate%20me-F47D42.png
:target: https://translation.odoo-community.org/projects/stock-weighing-15-0/stock-weighing-15-0-stock_picking_batch_weighing
:alt: Translate me on Weblate
.. |badge5| image:: https://img.shields.io/badge/runboat-Try%20me-875A7B.png
:target: https://runboat.odoo-community.org/builds?repo=OCA/stock-weighing&target_branch=15.0
:alt: Try me on Runboat

|badge1| |badge2| |badge3| |badge4| |badge5|

We can go to the weighing operations from an action button in the batch
picking form.

**Table of contents**

.. contents::
:local:

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

Bugs are tracked on `GitHub Issues <https://github.com/OCA/stock-weighing/issues>`_.
In case of trouble, please check there if your issue has already been reported.
If you spotted it first, help us to smash it by providing a detailed and welcomed
`feedback <https://github.com/OCA/stock-weighing/issues/new?body=module:%20stock_picking_batch_weighing%0Aversion:%2015.0%0A%0A**Steps%20to%20reproduce**%0A-%20...%0A%0A**Current%20behavior**%0A%0A**Expected%20behavior**>`_.

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

Credits
=======

Authors
-------

* Tecnativa

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

- `Tecnativa <https://www.tecnativa.com>`__

- David Vidal
- Sergio Teruel

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

This module is maintained by the OCA.

.. image:: https://odoo-community.org/logo.png
:alt: Odoo Community Association
:target: https://odoo-community.org

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.

This module is part of the `OCA/stock-weighing <https://github.com/OCA/stock-weighing/tree/15.0/stock_picking_batch_weighing>`_ project on GitHub.

You are welcome to contribute. To learn how please visit https://odoo-community.org/page/Contribute.
2 changes: 2 additions & 0 deletions stock_picking_batch_weighing/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import models
from . import wizards
16 changes: 16 additions & 0 deletions stock_picking_batch_weighing/__manifest__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
{
"name": "Weighing assistant in batch pickings",
"summary": "Launch the weighing assistant from batch pickings",
"version": "15.0.1.0.0",
"author": "Tecnativa, Odoo Community Association (OCA)",
"website": "https://github.com/OCA/stock-weighing",
"license": "AGPL-3",
"category": "Inventory",
"depends": [
"stock_weighing",
"stock_picking_batch",
],
"data": ["views/stock_picking_batch_views.xml"],
}
76 changes: 76 additions & 0 deletions stock_picking_batch_weighing/i18n/es.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_picking_batch_weighing
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-17 09:43+0000\n"
"PO-Revision-Date: 2024-07-17 11:45+0200\n"
"Last-Translator: \n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 3.4.4\n"

#. module: stock_picking_batch_weighing
#: code:addons/stock_picking_batch_weighing/wizards/weigh_operation_selection.py:0
#, python-format
msgid "Batch Pickings"
msgstr "Agrupación de albaranes"

#. module: stock_picking_batch_weighing
#: model:ir.model,name:stock_picking_batch_weighing.model_stock_picking_batch
msgid "Batch Transfer"
msgstr "Agrupación de albaranes"

#. module: stock_picking_batch_weighing
#: model:ir.model.fields,field_description:stock_picking_batch_weighing.field_stock_picking_batch__has_weighing_operations
msgid "Has Weighing Operations"
msgstr "Tiene operaciones de pesaje"

#. module: stock_picking_batch_weighing
#: model:ir.model,name:stock_picking_batch_weighing.model_stock_move
msgid "Stock Move"
msgstr "Movimiento de stock"

#. module: stock_picking_batch_weighing
#: model_terms:ir.ui.view,arch_db:stock_picking_batch_weighing.stock_picking_batch_form
msgid "Weigh"
msgstr "Pesar"

#. module: stock_picking_batch_weighing
#: model:ir.model.fields,help:stock_picking_batch_weighing.field_stock_picking_batch__weighing_operations
msgid "Weighed products are done from weighing operations"
msgstr "Los productos pesado están realizados desde operaciones de pesaje"

#. module: stock_picking_batch_weighing
#: model:ir.model.fields,field_description:stock_picking_batch_weighing.field_stock_picking_batch__weighing_operations
msgid "Weighing Operations"
msgstr "Operaciones de pesaje"

#. module: stock_picking_batch_weighing
#: code:addons/stock_picking_batch_weighing/wizards/weigh_operation_selection.py:0
#, python-format
msgid "Weighing batch pickings"
msgstr "Pesaje de agrupación de albaranes"

#. module: stock_picking_batch_weighing
#: code:addons/stock_picking_batch_weighing/models/stock_picking_batch.py:0
#, python-format
msgid "Weighing operations for %(name)s"
msgstr "Operaciones de pesaje para %(name)s"

#. module: stock_picking_batch_weighing
#: model_terms:ir.ui.view,arch_db:stock_picking_batch_weighing.stock_picking_batch_kanban
msgid "Weighings"
msgstr "Pesajes"

#. module: stock_picking_batch_weighing
#: model:ir.model,name:stock_picking_batch_weighing.model_weigh_operation_selection
msgid "weigh operation selection screen"
msgstr "pantalla de selección de operación de pesaje"
74 changes: 74 additions & 0 deletions stock_picking_batch_weighing/i18n/stock_picking_batch_weighing.pot
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * stock_picking_batch_weighing
#
msgid ""
msgstr ""
"Project-Id-Version: Odoo Server 15.0\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-07-17 09:43+0000\n"
"PO-Revision-Date: 2024-07-17 09:43+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_picking_batch_weighing
#: code:addons/stock_picking_batch_weighing/wizards/weigh_operation_selection.py:0
#, python-format
msgid "Batch Pickings"
msgstr ""

#. module: stock_picking_batch_weighing
#: model:ir.model,name:stock_picking_batch_weighing.model_stock_picking_batch
msgid "Batch Transfer"
msgstr ""

#. module: stock_picking_batch_weighing
#: model:ir.model.fields,field_description:stock_picking_batch_weighing.field_stock_picking_batch__has_weighing_operations
msgid "Has Weighing Operations"
msgstr ""

#. module: stock_picking_batch_weighing
#: model:ir.model,name:stock_picking_batch_weighing.model_stock_move
msgid "Stock Move"
msgstr ""

#. module: stock_picking_batch_weighing
#: model_terms:ir.ui.view,arch_db:stock_picking_batch_weighing.stock_picking_batch_form
msgid "Weigh"
msgstr ""

#. module: stock_picking_batch_weighing
#: model:ir.model.fields,help:stock_picking_batch_weighing.field_stock_picking_batch__weighing_operations
msgid "Weighed products are done from weighing operations"
msgstr ""

#. module: stock_picking_batch_weighing
#: model:ir.model.fields,field_description:stock_picking_batch_weighing.field_stock_picking_batch__weighing_operations
msgid "Weighing Operations"
msgstr ""

#. module: stock_picking_batch_weighing
#: code:addons/stock_picking_batch_weighing/wizards/weigh_operation_selection.py:0
#, python-format
msgid "Weighing batch pickings"
msgstr ""

#. module: stock_picking_batch_weighing
#: code:addons/stock_picking_batch_weighing/models/stock_picking_batch.py:0
#, python-format
msgid "Weighing operations for %(name)s"
msgstr ""

#. module: stock_picking_batch_weighing
#: model_terms:ir.ui.view,arch_db:stock_picking_batch_weighing.stock_picking_batch_kanban
msgid "Weighings"
msgstr ""

#. module: stock_picking_batch_weighing
#: model:ir.model,name:stock_picking_batch_weighing.model_weigh_operation_selection
msgid "weigh operation selection screen"
msgstr ""
2 changes: 2 additions & 0 deletions stock_picking_batch_weighing/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from . import stock_picking_batch
from . import stock_move
16 changes: 16 additions & 0 deletions stock_picking_batch_weighing/models/stock_move.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright 2024 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, models


class StockMove(models.Model):
_inherit = "stock.move"

@api.model
def action_stock_batch_picking_weighing(self):
"""Used in the start screen"""
action = self.env["ir.actions.act_window"]._for_xml_id(

Check warning on line 12 in stock_picking_batch_weighing/models/stock_move.py

View check run for this annotation

Codecov / codecov/patch

stock_picking_batch_weighing/models/stock_move.py#L12

Added line #L12 was not covered by tests
"stock_picking_batch.stock_picking_batch_action"
)
action["views"] = [[False, "kanban"], [False, "list"]]
return action
34 changes: 34 additions & 0 deletions stock_picking_batch_weighing/models/stock_picking_batch.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copyright 2024 Tecnativa - David Vidal
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
import ast

from odoo import _, api, fields, models


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

weighing_operations = fields.Boolean(related="picking_type_id.weighing_operations")
has_weighing_operations = fields.Boolean(compute="_compute_has_weighing_operations")

@api.depends("picking_ids")
def _compute_has_weighing_operations(self):
for batch in self:
batch.has_weighing_operations = batch.picking_ids.filtered(
"has_weighing_operations"
)

def action_weighing_operations(self):
"""Weight operations for this picking"""
action = self.env["ir.actions.actions"]._for_xml_id(

Check warning on line 23 in stock_picking_batch_weighing/models/stock_picking_batch.py

View check run for this annotation

Codecov / codecov/patch

stock_picking_batch_weighing/models/stock_picking_batch.py#L23

Added line #L23 was not covered by tests
"stock_weighing.weighing_operation_action"
)
weighings = self.move_ids.filtered("has_weight")
action["name"] = _("Weighing operations for %(name)s", name=self.name)
action["domain"] = [("id", "in", weighings.ids)]
action["context"] = dict(

Check warning on line 29 in stock_picking_batch_weighing/models/stock_picking_batch.py

View check run for this annotation

Codecov / codecov/patch

stock_picking_batch_weighing/models/stock_picking_batch.py#L26-L29

Added lines #L26 - L29 were not covered by tests
self.env.context,
**ast.literal_eval(action["context"]),
group_by=["picking_id"]
)
return action

Check warning on line 34 in stock_picking_batch_weighing/models/stock_picking_batch.py

View check run for this annotation

Codecov / codecov/patch

stock_picking_batch_weighing/models/stock_picking_batch.py#L34

Added line #L34 was not covered by tests
3 changes: 3 additions & 0 deletions stock_picking_batch_weighing/readme/CONTRIBUTORS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
- [Tecnativa](https://www.tecnativa.com)
- David Vidal
- Sergio Teruel
1 change: 1 addition & 0 deletions stock_picking_batch_weighing/readme/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
We can go to the weighing operations from an action button in the batch picking form.
Loading
Loading