Cédric Krier pushed to branch branch/default at Tryton / Tryton


Commits:
6a1be3be by Maxime Richez at 2023-01-27T14:38:36+01:00
Display stock moves and invoice lines in sale and purchase lines form

Closes #12003
- - - - -


6 changed files:

- modules/purchase/CHANGELOG
- modules/purchase/purchase.py
- modules/purchase/view/purchase_line_form.xml
- modules/sale/CHANGELOG
- modules/sale/sale.py
- modules/sale/view/sale_line_form.xml


Changes:

=====================================
modules/purchase/CHANGELOG
=====================================
@@ -1,3 +1,4 @@
+* Add related stock moves and invoice lines on purchase line
 * Add relate to purchase lines from party and product
 * Simplify relate to purchases
 * Prevent creation of lines for non draft purchases


=====================================
modules/purchase/purchase.py
=====================================
@@ -1165,9 +1165,16 @@
             'invisible': Eval('type') != 'line',
             'readonly': Eval('purchase_state') != 'draft',
             })
-    invoice_lines = fields.One2Many('account.invoice.line', 'origin',
-        'Invoice Lines', readonly=True)
-    moves = fields.One2Many('stock.move', 'origin', 'Moves', readonly=True)
+    invoice_lines = fields.One2Many(
+        'account.invoice.line', 'origin', "Invoice Lines", readonly=True,
+        states={
+            'invisible': ~Eval('invoice_lines'),
+            })
+    moves = fields.One2Many(
+        'stock.move', 'origin', "Moves", readonly=True,
+        states={
+            'invisible': ~Eval('moves'),
+            })
     moves_ignored = fields.Many2Many('purchase.line-ignored-stock.move',
             'purchase_line', 'move', 'Ignored Moves', readonly=True)
     moves_recreated = fields.Many2Many('purchase.line-recreated-stock.move',


=====================================
modules/purchase/view/purchase_line_form.xml
=====================================
@@ -34,6 +34,12 @@
         <page string="Taxes" id="taxes">
             <field name="taxes" colspan="4"/>
         </page>
+        <page name="moves" col="1">
+            <field name="moves"/>
+        </page>
+        <page name="invoice_lines" col="1">
+            <field name="invoice_lines"/>
+        </page>
         <page string="Notes" id="notes">
             <separator name="note" colspan="4"/>
             <field name="note" colspan="4"/>


=====================================
modules/sale/CHANGELOG
=====================================
@@ -1,3 +1,4 @@
+* Add related stock moves and invoice lines on sale line
 * Add relate to sale lines from party and product
 * Simplify relate to sales
 * Prevent creation of lines for non draft sales


=====================================
modules/sale/sale.py
=====================================
@@ -1232,9 +1232,16 @@
             'readonly': Eval('sale_state') != 'draft',
             },
         depends={'sale'})
-    invoice_lines = fields.One2Many('account.invoice.line', 'origin',
-        'Invoice Lines', readonly=True)
-    moves = fields.One2Many('stock.move', 'origin', 'Moves', readonly=True)
+    invoice_lines = fields.One2Many(
+        'account.invoice.line', 'origin', "Invoice Lines", readonly=True,
+        states={
+            'invisible': ~Eval('invoice_lines'),
+            })
+    moves = fields.One2Many(
+        'stock.move', 'origin', "Moves", readonly=True,
+        states={
+            'invisible': ~Eval('moves'),
+            })
     moves_ignored = fields.Many2Many('sale.line-ignored-stock.move',
             'sale_line', 'move', 'Ignored Moves', readonly=True)
     moves_recreated = fields.Many2Many('sale.line-recreated-stock.move',


=====================================
modules/sale/view/sale_line_form.xml
=====================================
@@ -30,6 +30,12 @@
         <page string="Taxes" id="taxes">
             <field name="taxes" colspan="4"/>
         </page>
+        <page name="moves" col="1">
+            <field name="moves"/>
+        </page>
+        <page name="invoice_lines" col="1">
+            <field name="invoice_lines"/>
+        </page>
         <page string="Notes" id="notes">
             <separator name="note" colspan="4"/>
             <field name="note" colspan="4"/>



View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/6a1be3be33ca944c12823e0a83b403811902bfd1

-- 
View it on Heptapod: 
https://foss.heptapod.net/tryton/tryton/-/commit/6a1be3be33ca944c12823e0a83b403811902bfd1
You're receiving this email because of your account on foss.heptapod.net.


Reply via email to