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

Proposed by Numérigraphe
Status: Work in progress
Proposed branch: lp:~numerigraphe-team/ocb-addons/7.0-inventory-readonly-lines
Merge into: lp:openobject-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
Numérigraphe (community) Needs Resubmitting
Stock and Logistic Core Editors Pending
OpenERP Core Team Pending
Review via email: mp+170616@code.launchpad.net

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 post a comment you must log in.
Revision history for this message
Numérigraphe (numerigraphe) wrote :

I'm putting to standby until the new WMS code is merged into v8, and I'll resubmit then.
In the meanwhile I'll propose this for OCB-addons/7.0 .

Revision history for this message
Numérigraphe (numerigraphe) :
review: Needs Resubmitting
8592. By Numérigraphe

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

8593. By Numérigraphe

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

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-13 17:09:40 +0000
3+++ stock/stock_view.xml 2014-04-18 12:37:11 +0000
4@@ -47,14 +47,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@@ -64,15 +65,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':parent.date}" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom,parent.date)" domain="[('type','&lt;&gt;','service')]"/>
28+ <field context="{'location':location_id, 'uom':product_uom, 'to_date':parent.date}"
29+ name="product_id"
30+ on_change="on_change_product_id(location_id,product_id,product_uom,parent.date)"
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@@ -135,21 +141,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':parent.date}" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom,parent.date)" 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':parent.date}"
55+ name="product_id"
56+ on_change="on_change_product_id(location_id,product_id,product_uom,parent.date)"
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':parent.date}" name="product_id" on_change="on_change_product_id(location_id,product_id,product_uom,parent.date)" 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':parent.date}"
76+ name="product_id"
77+ on_change="on_change_product_id(location_id,product_id,product_uom,parent.date)"
78+ domain="[('type','!=','service')]"
79+ attrs="{'readonly': [('id','!=',False)]}"/>
80 </group>
81 <group>
82 <label for="product_qty"/>
83@@ -157,11 +172,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>

Subscribers

People subscribed via source and target branches

to all changes: