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

Subscribers

People subscribed via source and target branches

to all changes: