Merge lp:~numerigraphe-team/ocb-addons/7.0-inventory-readonly-lines into lp:ocb-addons

Proposed by Lionel Sausin - Initiatives/Numérigraphe
Status: Rejected
Rejected by: Holger Brunn (Therp)
Proposed branch: lp:~numerigraphe-team/ocb-addons/7.0-inventory-readonly-lines
Merge into: lp:ocb-addons
Diff against target: 96 lines (+28/-12)
1 file modified
stock/stock_view.xml (+28/-12)
To merge this branch: bzr merge lp:~numerigraphe-team/ocb-addons/7.0-inventory-readonly-lines
Reviewer Review Type Date Requested Status
Holger Brunn (Therp) Disapprove
Review via email:

This proposal supersedes a proposal from 2014-03-10.

Description of the change

As usability improvement in inventories, we propose to make the fields "product", "location" and "serial nb" read-only as soon as an inventory line is recorded.
This keeps users from mistakenly keeping wrong products in stock.

Consider you filled the inventory with the wizard :
Product A: 15
Product B : 20
And physically you really have :
Product A: 15
Product C: 20
It's tempting to change just the product on the 2nd line but it's wrong: that would not remove product B from the stock.
You actually have to set the 2nd line to 0 and add a 3rd line to record the right data.

There is a proposal to merge this into the trunk too, but it's in standby until the new WMS code gets merged.

To post a comment you must log in.
Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote : Posted in a previous version of this proposal

Yes, please link a bug report.

For readability, you might want to consider using '!=' instead of '<>'

review: Needs Fixing (code review)
8592. By Numérigraphe

[REF] use != instead of XML entities to make the code readble

Revision history for this message
Holger Brunn (Therp) (hbrunn) :
review: Approve (code review)
8593. By Numérigraphe

[REF] use != instead of XML entities to make the code readble (continued)

Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

Development for 7.0 has moved to github on - please move your merge proposal there if it is still valid.

(I close and reject this in order to have a cleaner overview for 6.1 MPs which indeed have to be done on launchpad)

review: Disapprove

Unmerged revisions

8593. By Numérigraphe

[REF] use != instead of XML entities to make the code readble (continued)

8592. By Numérigraphe

[REF] use != instead of XML entities to make the code readble

8591. By Loïc Bellier - Numérigraphe

[IMP] make fields readonly on recorded inventory lines, so users are not tempted to change location/product/lot instead of creating new lines

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'stock/stock_view.xml'
2--- stock/stock_view.xml 2014-03-24 09:12:54 +0000
3+++ stock/stock_view.xml 2014-04-18 12:37:01 +0000
4@@ -41,14 +41,15 @@
5 <field name="model">stock.inventory.line</field>
6 <field name="arch" type="xml">
7 <tree string="Stock Inventory Lines">
8- <field name="product_id"/>
9+ <field name="product_id" attrs="{'readonly': [('id','!=',False)]}"/>
10 <field name="product_qty"/>
11 <field name="product_uom" groups="product.group_uom"/>
12- <field name="prod_lot_id" groups="stock.group_production_lot"/>
13+ <field name="prod_lot_id" groups="stock.group_production_lot" attrs="{'readonly': [('id','!=',False)]}"/>
14 <button name="%(stock.action_view_stock_inventory_line_split)d"
15 string="Split inventory lines" groups="stock.group_inventory_valuation"
16 type="action" icon="gtk-justify-fill"/>
17- <field name="location_id" groups="stock.group_locations"/>
18+ <field name="location_id" groups="stock.group_locations" attrs="{'readonly': [('id','!=',False)]}"/>
19+ <field name = "id" invisible="1"/>
20 </tree>
21 </field>
22 </record>
23@@ -58,15 +59,20 @@
24 <field name="arch" type="xml">
25 <form string="Stock Inventory Lines" version="7.0">
26 <group col="4">
27- <field context="{'location':location_id, 'uom':product_uom, 'to_date'}" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom," domain="[('type','&lt;&gt;','service')]"/>
28+ <field context="{'location':location_id, 'uom':product_uom, 'to_date'}"
29+ name="product_id"
30+ on_change="on_change_product_id(location_id,product_id,product_uom,"
31+ domain="[('type','!=','service')]"
32+ attrs="{'readonly': [('id','!=',False)]}" />
33 <field name="product_qty"/>
34 <field name="product_uom" groups="product.group_uom"/>
35- <field name="prod_lot_id" groups="stock.group_production_lot"/>
36- <field domain="[('usage','=','internal')]" name="location_id"/>
37+ <field name="prod_lot_id" groups="stock.group_production_lot" attrs="{'readonly': [('id','!=',False)]}"/>
38+ <field domain="[('usage','=','internal')]" name="location_id" attrs="{'readonly': [('id','!=',False)]}"/>
39 <button name="%(stock.action_view_stock_inventory_line_split)d"
40 string="Split Inventory Line" groups="stock.group_inventory_valuation"
41 type="action" icon="gtk-justify-fill"/>
42 </group>
43+ <field name = "id" invisible="1"/>
44 </form>
45 </field>
46 </record>
47@@ -129,21 +135,30 @@
48 <page string="General Information">
49 <field name="inventory_line_id">
50 <tree string="Products" editable="bottom">
51- <field domain="[('usage','=','internal')]" name="location_id" groups="stock.group_locations"/>
52- <field context="{'location':location_id, 'uom':product_uom, 'to_date'}" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom," domain="[('type','&lt;&gt;','service')]"/>
53+ <field domain="[('usage','=','internal')]" name="location_id" groups="stock.group_locations" attrs="{'readonly': [('id','!=',False)]}"/>
54+ <field context="{'location':location_id, 'uom':product_uom, 'to_date'}"
55+ name="product_id"
56+ on_change="on_change_product_id(location_id,product_id,product_uom,"
57+ domain="[('type','!=','service')]"
58+ attrs="{'readonly': [('id','!=',False)]}"/>
59 <field name="product_qty"/>
60 <field name="product_uom" groups="product.group_uom"/>
61- <field name="prod_lot_id" groups="stock.group_production_lot"/>
62+ <field name="prod_lot_id" groups="stock.group_production_lot" attrs="{'readonly': [('id','!=',False)]}"/>
63 <button name="%(stock.action_view_stock_inventory_line_split)d"
64 string="Split inventory lines" groups="stock.group_inventory_valuation"
65 type="action" icon="gtk-justify-fill" states="draft,confirm"/>
66 <field name="state" invisible="True"/>
67+ <field name = "id" invisible="1"/>
68 </tree>
69 <form string="Products" version="7.0">
70 <group>
71 <group>
72- <field domain="[('usage','=','internal')]" name="location_id"/>
73- <field context="{'location':location_id, 'uom':product_uom, 'to_date'}" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom," domain="[('type','&lt;&gt;','service')]"/>
74+ <field domain="[('usage','=','internal')]" name="location_id" attrs="{'readonly': [('id','!=',False)]}"/>
75+ <field context="{'location':location_id, 'uom':product_uom, 'to_date'}"
76+ name="product_id"
77+ on_change="on_change_product_id(location_id,product_id,product_uom,"
78+ domain="[('type','!=','service')]"
79+ attrs="{'readonly': [('id','!=',False)]}"/>
80 </group>
81 <group>
82 <label for="product_qty"/>
83@@ -151,11 +166,12 @@
84 <field name="product_qty" class="oe_inline"/>
85 <field name="product_uom" class="oe_inline" groups="product.group_uom"/>
86 </div>
87- <field name="prod_lot_id" groups="stock.group_production_lot"/>
88+ <field name="prod_lot_id" groups="stock.group_production_lot" attrs="{'readonly': [('id','!=',False)]}"/>
89 <button name="%(stock.action_view_stock_inventory_line_split)d"
90 string="Split inventory lines" groups="stock.group_inventory_valuation"
91 type="action" icon="gtk-justify-fill"/>
92 </group>
93+ <field name = "id" invisible="1"/>
94 </group>
95 </form>
96 </field>