changeset 90f0e03023ba in modules/account_stock_landed_cost:default
details: 
https://hg.tryton.org/modules/account_stock_landed_cost?cmd=changeset&node=90f0e03023ba
description:
        Add more information on stock move form

        issue11768
        review439591003
diffstat:

 stock.py                 |   8 ++++++--
 stock.xml                |  12 ++++++++++++
 tryton.cfg               |   1 +
 view/stock_move_form.xml |   9 +++++++++
 4 files changed, 28 insertions(+), 2 deletions(-)

diffs (60 lines):

diff -r c84c16a0fcd6 -r 90f0e03023ba stock.py
--- a/stock.py  Thu Sep 29 09:08:06 2022 +0200
+++ b/stock.py  Sun Oct 09 19:07:16 2022 +0200
@@ -3,12 +3,16 @@
 from trytond.model import fields
 from trytond.modules.product import price_digits
 from trytond.pool import PoolMeta
+from trytond.pyson import Eval
 
 
 class Move(metaclass=PoolMeta):
     __name__ = 'stock.move'
-    unit_landed_cost = fields.Numeric('Unit Landed Cost',
-        digits=price_digits, readonly=True)
+    unit_landed_cost = fields.Numeric(
+        "Unit Landed Cost", digits=price_digits, readonly=True,
+        states={
+            'invisible': ~Eval('unit_landed_cost'),
+            })
 
     def _compute_unit_price(self, unit_price):
         if self.unit_landed_cost:
diff -r c84c16a0fcd6 -r 90f0e03023ba stock.xml
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/stock.xml Sun Oct 09 19:07:16 2022 +0200
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
+this repository contains the full copyright notices and license terms. -->
+<tryton>
+    <data>
+        <record model="ir.ui.view" id="stock_move_view_form">
+            <field name="model">stock.move</field>
+            <field name="inherit" ref="stock.move_view_form"/>
+            <field name="name">stock_move_form</field>
+        </record>
+    </data>
+</tryton>
diff -r c84c16a0fcd6 -r 90f0e03023ba tryton.cfg
--- a/tryton.cfg        Thu Sep 29 09:08:06 2022 +0200
+++ b/tryton.cfg        Sun Oct 09 19:07:16 2022 +0200
@@ -13,4 +13,5 @@
 xml:
     account.xml
     product.xml
+    stock.xml
     message.xml
diff -r c84c16a0fcd6 -r 90f0e03023ba view/stock_move_form.xml
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/view/stock_move_form.xml  Sun Oct 09 19:07:16 2022 +0200
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<!-- This file is part of Tryton.  The COPYRIGHT file at the top level of
+this repository contains the full copyright notices and license terms. -->
+<data>
+    <xpath expr="//field[@name='cost_price']" position="after">
+        <label name="unit_landed_cost"/>
+        <field name="unit_landed_cost"/>
+    </xpath>
+</data>

Reply via email to