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: mp+210207@code.launchpad.net

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 https://github.com/OCA/ocb - 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
=== modified file 'stock/stock_view.xml'
--- stock/stock_view.xml 2014-03-24 09:12:54 +0000
+++ stock/stock_view.xml 2014-04-18 12:37:01 +0000
@@ -41,14 +41,15 @@
41 <field name="model">stock.inventory.line</field>41 <field name="model">stock.inventory.line</field>
42 <field name="arch" type="xml">42 <field name="arch" type="xml">
43 <tree string="Stock Inventory Lines">43 <tree string="Stock Inventory Lines">
44 <field name="product_id"/>44 <field name="product_id" attrs="{'readonly': [('id','!=',False)]}"/>
45 <field name="product_qty"/>45 <field name="product_qty"/>
46 <field name="product_uom" groups="product.group_uom"/>46 <field name="product_uom" groups="product.group_uom"/>
47 <field name="prod_lot_id" groups="stock.group_production_lot"/>47 <field name="prod_lot_id" groups="stock.group_production_lot" attrs="{'readonly': [('id','!=',False)]}"/>
48 <button name="%(stock.action_view_stock_inventory_line_split)d"48 <button name="%(stock.action_view_stock_inventory_line_split)d"
49 string="Split inventory lines" groups="stock.group_inventory_valuation"49 string="Split inventory lines" groups="stock.group_inventory_valuation"
50 type="action" icon="gtk-justify-fill"/>50 type="action" icon="gtk-justify-fill"/>
51 <field name="location_id" groups="stock.group_locations"/>51 <field name="location_id" groups="stock.group_locations" attrs="{'readonly': [('id','!=',False)]}"/>
52 <field name = "id" invisible="1"/>
52 </tree>53 </tree>
53 </field>54 </field>
54 </record>55 </record>
@@ -58,15 +59,20 @@
58 <field name="arch" type="xml">59 <field name="arch" type="xml">
59 <form string="Stock Inventory Lines" version="7.0">60 <form string="Stock Inventory Lines" version="7.0">
60 <group col="4">61 <group col="4">
61 <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')]"/>62 <field context="{'location':location_id, 'uom':product_uom, 'to_date':parent.date}"
63 name="product_id"
64 on_change="on_change_product_id(location_id,product_id,product_uom,parent.date)"
65 domain="[('type','!=','service')]"
66 attrs="{'readonly': [('id','!=',False)]}" />
62 <field name="product_qty"/>67 <field name="product_qty"/>
63 <field name="product_uom" groups="product.group_uom"/>68 <field name="product_uom" groups="product.group_uom"/>
64 <field name="prod_lot_id" groups="stock.group_production_lot"/>69 <field name="prod_lot_id" groups="stock.group_production_lot" attrs="{'readonly': [('id','!=',False)]}"/>
65 <field domain="[('usage','=','internal')]" name="location_id"/>70 <field domain="[('usage','=','internal')]" name="location_id" attrs="{'readonly': [('id','!=',False)]}"/>
66 <button name="%(stock.action_view_stock_inventory_line_split)d"71 <button name="%(stock.action_view_stock_inventory_line_split)d"
67 string="Split Inventory Line" groups="stock.group_inventory_valuation"72 string="Split Inventory Line" groups="stock.group_inventory_valuation"
68 type="action" icon="gtk-justify-fill"/>73 type="action" icon="gtk-justify-fill"/>
69 </group>74 </group>
75 <field name = "id" invisible="1"/>
70 </form>76 </form>
71 </field>77 </field>
72 </record>78 </record>
@@ -129,21 +135,30 @@
129 <page string="General Information">135 <page string="General Information">
130 <field name="inventory_line_id">136 <field name="inventory_line_id">
131 <tree string="Products" editable="bottom">137 <tree string="Products" editable="bottom">
132 <field domain="[('usage','=','internal')]" name="location_id" groups="stock.group_locations"/>138 <field domain="[('usage','=','internal')]" name="location_id" groups="stock.group_locations" attrs="{'readonly': [('id','!=',False)]}"/>
133 <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')]"/>139 <field context="{'location':location_id, 'uom':product_uom, 'to_date':parent.date}"
140 name="product_id"
141 on_change="on_change_product_id(location_id,product_id,product_uom,parent.date)"
142 domain="[('type','!=','service')]"
143 attrs="{'readonly': [('id','!=',False)]}"/>
134 <field name="product_qty"/>144 <field name="product_qty"/>
135 <field name="product_uom" groups="product.group_uom"/>145 <field name="product_uom" groups="product.group_uom"/>
136 <field name="prod_lot_id" groups="stock.group_production_lot"/>146 <field name="prod_lot_id" groups="stock.group_production_lot" attrs="{'readonly': [('id','!=',False)]}"/>
137 <button name="%(stock.action_view_stock_inventory_line_split)d"147 <button name="%(stock.action_view_stock_inventory_line_split)d"
138 string="Split inventory lines" groups="stock.group_inventory_valuation"148 string="Split inventory lines" groups="stock.group_inventory_valuation"
139 type="action" icon="gtk-justify-fill" states="draft,confirm"/>149 type="action" icon="gtk-justify-fill" states="draft,confirm"/>
140 <field name="state" invisible="True"/>150 <field name="state" invisible="True"/>
151 <field name = "id" invisible="1"/>
141 </tree>152 </tree>
142 <form string="Products" version="7.0">153 <form string="Products" version="7.0">
143 <group>154 <group>
144 <group>155 <group>
145 <field domain="[('usage','=','internal')]" name="location_id"/>156 <field domain="[('usage','=','internal')]" name="location_id" attrs="{'readonly': [('id','!=',False)]}"/>
146 <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')]"/>157 <field context="{'location':location_id, 'uom':product_uom, 'to_date':parent.date}"
158 name="product_id"
159 on_change="on_change_product_id(location_id,product_id,product_uom,parent.date)"
160 domain="[('type','!=','service')]"
161 attrs="{'readonly': [('id','!=',False)]}"/>
147 </group>162 </group>
148 <group>163 <group>
149 <label for="product_qty"/>164 <label for="product_qty"/>
@@ -151,11 +166,12 @@
151 <field name="product_qty" class="oe_inline"/>166 <field name="product_qty" class="oe_inline"/>
152 <field name="product_uom" class="oe_inline" groups="product.group_uom"/>167 <field name="product_uom" class="oe_inline" groups="product.group_uom"/>
153 </div>168 </div>
154 <field name="prod_lot_id" groups="stock.group_production_lot"/>169 <field name="prod_lot_id" groups="stock.group_production_lot" attrs="{'readonly': [('id','!=',False)]}"/>
155 <button name="%(stock.action_view_stock_inventory_line_split)d"170 <button name="%(stock.action_view_stock_inventory_line_split)d"
156 string="Split inventory lines" groups="stock.group_inventory_valuation"171 string="Split inventory lines" groups="stock.group_inventory_valuation"
157 type="action" icon="gtk-justify-fill"/>172 type="action" icon="gtk-justify-fill"/>
158 </group>173 </group>
174 <field name = "id" invisible="1"/>
159 </group>175 </group>
160 </form>176 </form>
161 </field>177 </field>