Add stock_vertical_lift_qty_by_packaging

This commit is contained in:
Simone Orsi
2021-05-28 10:35:43 +02:00
committed by nguyen hoang hiep
parent 3c3a67fbf2
commit 153d971262
8 changed files with 73 additions and 0 deletions

View File

@@ -0,0 +1 @@
wait fot the bot ;)

View File

@@ -0,0 +1 @@
from . import models

View File

@@ -0,0 +1,19 @@
# Copyright 2021 Camptocamp SA
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl)
{
"name": "Stock vertical lift qty by packaging",
"summary": """
Glue module for `stock_product_qty_by_packaging` and `stock_vertical_lift`.
""",
"version": "13.0.1.0.0",
"development_status": "Alpha",
"category": "Warehouse Management",
"website": "https://github.com/OCA/stock-logistics-warehouse",
"author": "Camptocamp, Odoo Community Association (OCA)",
"license": "LGPL-3",
"application": False,
"installable": True,
"auto_install": True,
"depends": ["stock_product_qty_by_packaging", "stock_vertical_lift"],
"data": ["views/vertical_lift_operation_base_views.xml"],
}

View File

@@ -0,0 +1 @@
from . import vertical_lift_operation_base

View File

@@ -0,0 +1,22 @@
# Copyright 2020 Camptocamp SA
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from odoo import api, fields, models
class VerticalLiftOperationTransfer(models.AbstractModel):
_inherit = "vertical.lift.operation.transfer"
product_qty_by_packaging_display = fields.Char(
compute="_compute_product_qty_by_packaging_display"
)
@api.depends("current_move_line_id.product_qty")
def _compute_product_qty_by_packaging_display(self):
# Seems the ctx key is not propagated on a related field
# nor from the field definition, nor from the field declaration in the view.
# Hence, we are forced to use a computed field.
for rec in self.with_context(qty_by_pkg_total_units=True):
rec.product_qty_by_packaging_display = (
rec.current_move_line_id.product_qty_by_packaging_display
)

View File

@@ -0,0 +1,2 @@
Simone Orsi <simone.orsi@camptocamp.com>
Sébastien Alix <sebastien.alix@camptocamp.com>

View File

@@ -0,0 +1 @@
Glue module for `stock_product_qty_by_packaging` and `stock_vertical_lift`.

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8" ?>
<odoo>
<record id="vertical_lift_operation_transfer_screen_view" model="ir.ui.view">
<field name="name">vertical.lift.operation.transfer.screen.view</field>
<field name="model">vertical.lift.operation.transfer</field>
<field
name="inherit_id"
ref="stock_vertical_lift.vertical_lift_operation_transfer_screen_view"
/>
<field name="arch" type="xml">
<!-- Display only full qty by packaging and units -->
<xpath expr="//field[@name='product_uom_id']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='product_uom_qty']" position="attributes">
<attribute name="invisible">1</attribute>
</xpath>
<xpath expr="//field[@name='product_uom_id']" position="after">
<field
name="product_qty_by_packaging_display"
class="oe_inline ml8 text-white"
/>
</xpath>
</field>
</record>
</odoo>