mirror of
https://github.com/OCA/stock-logistics-warehouse.git
synced 2025-01-21 14:27:28 +02:00
[FIX] stock_move_packaging_qty: add packaging qty reserved
- Add packaging qty reserved in stock move line with compute to know packaging reserved when reserved. MT-5861 @moduon Co-authored-by: Emilio Pascual <53056345+EmilioPascual@users.noreply.github.com>
This commit is contained in:
committed by
Eduardo De Miguel
parent
f7a013993f
commit
fe6326a210
@@ -7,7 +7,7 @@ Stock Packaging Qty
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:0647041df888b4720a5e1b3f04ebab2f3f73052200569f6ba7d963104c308e1f
|
||||
!! source digest: sha256:cdc1ef5bdc2e95d07b6b1cdd1df18cb6a7957b142cdf59a226f1305e7cabc5c8
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
|
||||
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
|
||||
@@ -38,8 +38,6 @@ Add packaging fields in the stock moves, their lines and their reports.
|
||||
Known issues / Roadmap
|
||||
======================
|
||||
|
||||
* Maybe we should track also reserved packaging quantities?
|
||||
|
||||
* Since we store done product packaging quantities in the stock move lines, we
|
||||
should be able to use this information in quants to provide real
|
||||
packaging-based stock data.
|
||||
@@ -68,6 +66,8 @@ Contributors
|
||||
* Mateu Griful <mateu.griful@forgeflow.com>
|
||||
* Lois Rilo <lois.rilo@forgeflow.com>
|
||||
* Jairo Llopis (`Moduon <https://www.moduon.team/>`__)
|
||||
* Emilio Pascual (`Moduon <https://www.moduon.team/>`__)
|
||||
* Eduardo de Miguel (`Moduon <https://www.moduon.team/>`__)
|
||||
|
||||
Maintainers
|
||||
~~~~~~~~~~~
|
||||
|
||||
@@ -4,8 +4,10 @@
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
"Project-Id-Version: Odoo Server 16.0\n"
|
||||
"Project-Id-Version: Odoo Server 16.0+e\n"
|
||||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2024-04-25 09:26+0000\n"
|
||||
"PO-Revision-Date: 2024-04-25 09:26+0000\n"
|
||||
"Last-Translator: \n"
|
||||
"Language-Team: \n"
|
||||
"MIME-Version: 1.0\n"
|
||||
@@ -68,6 +70,16 @@ msgstr ""
|
||||
msgid "Product packaging quantity done."
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_move_packaging_qty
|
||||
#: model:ir.model.fields,help:stock_move_packaging_qty.field_stock_move_line__product_packaging_qty_reserved
|
||||
msgid "Product packaging quantity reserved."
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_move_packaging_qty
|
||||
#: model:ir.model.fields,field_description:stock_move_packaging_qty.field_stock_move_line__product_packaging_qty_reserved
|
||||
msgid "Reserved Pkg. Qty."
|
||||
msgstr ""
|
||||
|
||||
#. module: stock_move_packaging_qty
|
||||
#: model:ir.model,name:stock_move_packaging_qty.model_stock_move
|
||||
msgid "Stock Move"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# Copyright 2024 Moduon Team S.L.
|
||||
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl-3.0)
|
||||
from odoo import fields, models
|
||||
from odoo import api, fields, models
|
||||
from odoo.tools import float_round
|
||||
|
||||
|
||||
class StockMoveLine(models.Model):
|
||||
@@ -9,11 +10,29 @@ class StockMoveLine(models.Model):
|
||||
product_packaging_id = fields.Many2one(
|
||||
related="move_id.product_packaging_id", readonly=True
|
||||
)
|
||||
product_packaging_qty_reserved = fields.Float(
|
||||
string="Reserved Pkg. Qty.",
|
||||
help="Product packaging quantity reserved.",
|
||||
compute="_compute_product_packaging_qty_reserved",
|
||||
store=True,
|
||||
)
|
||||
product_packaging_qty_done = fields.Float(
|
||||
string="Done Pkg. Qty.",
|
||||
help="Product packaging quantity done.",
|
||||
)
|
||||
|
||||
@api.depends("product_packaging_id", "reserved_qty")
|
||||
def _compute_product_packaging_qty_reserved(self):
|
||||
"""Get the quantity done in product packaging."""
|
||||
self.product_packaging_qty_reserved = False
|
||||
for line in self:
|
||||
if not line.product_packaging_id.qty:
|
||||
continue
|
||||
line.product_packaging_qty_reserved = float_round(
|
||||
line.reserved_qty / line.product_packaging_id.qty,
|
||||
precision_rounding=line.product_packaging_id.product_uom_id.rounding,
|
||||
)
|
||||
|
||||
def _get_aggregated_properties(self, move_line=False, move=False):
|
||||
"""Aggregate by product packaging too."""
|
||||
result = super()._get_aggregated_properties(move_line, move)
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
* Mateu Griful <mateu.griful@forgeflow.com>
|
||||
* Lois Rilo <lois.rilo@forgeflow.com>
|
||||
* Jairo Llopis (`Moduon <https://www.moduon.team/>`__)
|
||||
* Emilio Pascual (`Moduon <https://www.moduon.team/>`__)
|
||||
* Eduardo de Miguel (`Moduon <https://www.moduon.team/>`__)
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
* Maybe we should track also reserved packaging quantities?
|
||||
|
||||
* Since we store done product packaging quantities in the stock move lines, we
|
||||
should be able to use this information in quants to provide real
|
||||
packaging-based stock data.
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
||||
<head>
|
||||
@@ -8,10 +9,11 @@
|
||||
|
||||
/*
|
||||
:Author: David Goodger (goodger@python.org)
|
||||
:Id: $Id: html4css1.css 8954 2022-01-20 10:10:25Z milde $
|
||||
:Id: $Id: html4css1.css 9511 2024-01-13 09:50:07Z milde $
|
||||
:Copyright: This stylesheet has been placed in the public domain.
|
||||
|
||||
Default cascading style sheet for the HTML output of Docutils.
|
||||
Despite the name, some widely supported CSS2 features are used.
|
||||
|
||||
See https://docutils.sourceforge.io/docs/howto/html-stylesheets.html for how to
|
||||
customize this style sheet.
|
||||
@@ -274,7 +276,7 @@ pre.literal-block, pre.doctest-block, pre.math, pre.code {
|
||||
margin-left: 2em ;
|
||||
margin-right: 2em }
|
||||
|
||||
pre.code .ln { color: grey; } /* line numbers */
|
||||
pre.code .ln { color: gray; } /* line numbers */
|
||||
pre.code, code { background-color: #eeeeee }
|
||||
pre.code .comment, code .comment { color: #5C6576 }
|
||||
pre.code .keyword, code .keyword { color: #3B0D06; font-weight: bold }
|
||||
@@ -300,7 +302,7 @@ span.option {
|
||||
span.pre {
|
||||
white-space: pre }
|
||||
|
||||
span.problematic {
|
||||
span.problematic, pre.problematic {
|
||||
color: red }
|
||||
|
||||
span.section-subtitle {
|
||||
@@ -366,7 +368,7 @@ ul.auto-toc {
|
||||
!! This file is generated by oca-gen-addon-readme !!
|
||||
!! changes will be overwritten. !!
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
!! source digest: sha256:0647041df888b4720a5e1b3f04ebab2f3f73052200569f6ba7d963104c308e1f
|
||||
!! source digest: sha256:cdc1ef5bdc2e95d07b6b1cdd1df18cb6a7957b142cdf59a226f1305e7cabc5c8
|
||||
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
||||
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/lgpl-3.0-standalone.html"><img alt="License: LGPL-3" src="https://img.shields.io/badge/licence-LGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/stock-logistics-warehouse/tree/16.0/stock_move_packaging_qty"><img alt="OCA/stock-logistics-warehouse" src="https://img.shields.io/badge/github-OCA%2Fstock--logistics--warehouse-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/stock-logistics-warehouse-16-0/stock-logistics-warehouse-16-0-stock_move_packaging_qty"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/stock-logistics-warehouse&target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
||||
<p>Add packaging fields in the stock moves, their lines and their reports.</p>
|
||||
@@ -386,7 +388,6 @@ ul.auto-toc {
|
||||
<div class="section" id="known-issues-roadmap">
|
||||
<h1><a class="toc-backref" href="#toc-entry-1">Known issues / Roadmap</a></h1>
|
||||
<ul class="simple">
|
||||
<li>Maybe we should track also reserved packaging quantities?</li>
|
||||
<li>Since we store done product packaging quantities in the stock move lines, we
|
||||
should be able to use this information in quants to provide real
|
||||
packaging-based stock data.</li>
|
||||
@@ -414,12 +415,16 @@ If you spotted it first, help us to smash it by providing a detailed and welcome
|
||||
<li>Mateu Griful <<a class="reference external" href="mailto:mateu.griful@forgeflow.com">mateu.griful@forgeflow.com</a>></li>
|
||||
<li>Lois Rilo <<a class="reference external" href="mailto:lois.rilo@forgeflow.com">lois.rilo@forgeflow.com</a>></li>
|
||||
<li>Jairo Llopis (<a class="reference external" href="https://www.moduon.team/">Moduon</a>)</li>
|
||||
<li>Emilio Pascual (<a class="reference external" href="https://www.moduon.team/">Moduon</a>)</li>
|
||||
<li>Eduardo de Miguel (<a class="reference external" href="https://www.moduon.team/">Moduon</a>)</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="section" id="maintainers">
|
||||
<h2><a class="toc-backref" href="#toc-entry-6">Maintainers</a></h2>
|
||||
<p>This module is maintained by the OCA.</p>
|
||||
<a class="reference external image-reference" href="https://odoo-community.org"><img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" /></a>
|
||||
<a class="reference external image-reference" href="https://odoo-community.org">
|
||||
<img alt="Odoo Community Association" src="https://odoo-community.org/logo.png" />
|
||||
</a>
|
||||
<p>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.</p>
|
||||
|
||||
@@ -23,6 +23,24 @@
|
||||
<field name="model">stock.move.line</field>
|
||||
<field name="inherit_id" ref="stock.view_move_line_mobile_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//label[@for='reserved_uom_qty']" position="before">
|
||||
<label
|
||||
for="product_packaging_qty_reserved"
|
||||
attrs="{'invisible': [('state', '=', 'done')]}"
|
||||
groups="product.group_stock_packaging"
|
||||
/>
|
||||
<div
|
||||
class="o_row"
|
||||
attrs="{'invisible': [('state', '=', 'done')]}"
|
||||
groups="product.group_stock_packaging"
|
||||
>
|
||||
<field
|
||||
name="product_packaging_qty_reserved"
|
||||
attrs="{'invisible': [('product_packaging_id', '=', False)]}"
|
||||
/>
|
||||
<field name="product_packaging_id" />
|
||||
</div>
|
||||
</xpath>
|
||||
<xpath expr="//label[@for='qty_done']" position="before">
|
||||
<label for="product_packaging_qty_done" />
|
||||
<div class="o_row">
|
||||
@@ -48,6 +66,14 @@
|
||||
ref="stock.view_stock_move_line_detailed_operation_tree"
|
||||
/>
|
||||
<field name="arch" type="xml">
|
||||
<field name="reserved_uom_qty" position="before">
|
||||
<field
|
||||
name="product_packaging_qty_reserved"
|
||||
optional="show"
|
||||
attrs="{'column_invisible': ['|',('parent.immediate_transfer', '=', True),('parent.picking_type_code','=','incoming')], 'invisible': [('product_packaging_id', '=', False)]}"
|
||||
groups="product.group_stock_packaging"
|
||||
/>
|
||||
</field>
|
||||
<field name="qty_done" position="before">
|
||||
<field
|
||||
name="product_packaging_qty_done"
|
||||
|
||||
Reference in New Issue
Block a user