Merge lp:~acsone-openerp/stock-logistic-warehouse/7.0-inventory-hierarchical-lga into lp:~numerigraphe-team/stock-logistic-warehouse/7.0-inventory-hierarchical-ls

Proposed by Laetitia Gangloff (Acsone)
Status: Merged
Merge reported by: Lionel Sausin - Initiatives/Numérigraphe
Merged at revision: not available
Proposed branch: lp:~acsone-openerp/stock-logistic-warehouse/7.0-inventory-hierarchical-lga
Merge into: lp:~numerigraphe-team/stock-logistic-warehouse/7.0-inventory-hierarchical-ls
Diff against target: 74 lines (+18/-13)
3 files modified
stock_inventory_hierarchical/hierarchical_inventory_view.xml (+7/-2)
stock_inventory_location/ (+9/-11)
stock_inventory_location/stock_inventory_location_view.xml (+2/-0)
To merge this branch: bzr merge lp:~acsone-openerp/stock-logistic-warehouse/7.0-inventory-hierarchical-lga
Reviewer Review Type Date Requested Status
Lionel Sausin - Initiatives/Numérigraphe Approve
Review via email:

Description of the change


I propose some little change following my first test of your module.

In stock_inventory_hierarchical :
I redefine tree view for sub-inventories, because the context seems not transferred to name_get. I get problem in the following case :
create inventory - create sub-inventory - create sub-inventory on the sub-inventory
I also set default value for parent_id and exhaustive when create sub-inventory.

In stock_inventory_location :
I replace the onchange_location on inventory line by a domain, I found it is easier to have only available location than display a warning message. (Maybe add an help to explain why there is not all location ?)
I update default_location method for exhaustive inventory, to take the stock location define of the first warehouse of the user company. In a multi-company context this stock location should be always correct.

To post a comment you must log in.
Revision history for this message
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) wrote :

I see 2 problems with replacing onchange_location with a domain:
- if the inventory is not exhaustive, the content of location_id is unspecified (probably the default, but we can't be sure)
- if users insist on entering a wrong location, openerp will propose to create it which is going to be confusing

review: Needs Fixing
65. By Laetitia Gangloff (Acsone)

stock_inventory_location : add use of a domain in inventory_line keep onchange_location

Revision history for this message
Laetitia Gangloff (Acsone) (laetitia-gangloff) wrote :

I reset the onchange_location and keep the domain.

For the first problem, in which case, it is not the default ?! It is not modifiable, and the stock value is set, maybe if there is many warehouse, and we want the second warehouse ?

For the second problem, the onchange do not resolve it, the creation is possible with or without the onchange.

Revision history for this message
Lionel Sausin - Initiatives/Numérigraphe (ls-initiatives) wrote :

It may not be the default for example if you create an inventory as exhaustive, change the location, then change your mind and make it non-exhaustive.
The onchange does not prevent the location's quick-create but at least you can't add the new/wrong location to the inventory.

I'll merge the other changes but I need to spread them correctly among the branches and modules to keep them modular and easy the main reviews.

review: Approve
Revision history for this message
Laetitia Gangloff (Acsone) (laetitia-gangloff) wrote :

No problem, I just try to get the easiest way to propose my change.

Thank you for your review !

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'stock_inventory_hierarchical/hierarchical_inventory_view.xml'
--- stock_inventory_hierarchical/hierarchical_inventory_view.xml 2014-04-02 14:24:38 +0000
+++ stock_inventory_hierarchical/hierarchical_inventory_view.xml 2014-06-11 13:56:48 +0000
@@ -52,8 +52,13 @@
52 expr="//page[@string='General Information']"52 expr="//page[@string='General Information']"
53 position="after">53 position="after">
54 <page string="Sub-inventories">54 <page string="Sub-inventories">
55 <field name="inventory_ids" nolabel="1"55 <field name="inventory_ids" nolabel="1" context="{'default_parent_id': active_id, 'default_exhaustive': exhaustive}">
56 context="{'inventory_display': 'short'}" />56 <tree>
57 <field name="name" />
58 <field name="state" />
59 <field name="progress_rate" widget="progressbar" />
60 </tree>
61 </field>
57 </page>62 </page>
58 </xpath>63 </xpath>
59 </field>64 </field>
=== modified file 'stock_inventory_location/'
--- stock_inventory_location/ 2014-06-10 14:10:31 +0000
+++ stock_inventory_location/ 2014-06-11 13:56:48 +0000
@@ -29,7 +29,6 @@
31from .exceptions import ExhaustiveInventoryException31from .exceptions import ExhaustiveInventoryException
32from import mute_logger
35class StockInventory(orm.Model):34class StockInventory(orm.Model):
@@ -113,16 +112,15 @@
114 # TODO: remove this in v8113 # TODO: remove this in v8
115 def _default_location(self, cr, uid, ids, context=None):114 def _default_location(self, cr, uid, ids, context=None):
116 """Default stock location"""115 """Default stock location
117 try:116 get the stock location define on the first warehouse of the default company
118 location = self.pool[''].get_object(117 """
119 cr, uid, 'stock', 'stock_location_stock')118 location_id = False
120 with mute_logger('openerp.osv.orm'):119 company_id = self.pool['']._company_default_get(cr, uid, 'stock.warehouse', context=context)
121 location.check_access_rule('read', context=context)120 warehouse_id = self.pool['stock.warehouse'].search(cr, uid, [('company_id', '=', company_id)], limit=1)
122 location_id = location.id121 if warehouse_id:
123 except ValueError, orm.except_orm:122 location_id = self.pool['stock.warehouse'].read(cr, uid, warehouse_id[0], ['lot_stock_id'])['lot_stock_id'][0]
124 return False123 return location_id
125 return location_id or False
127 _defaults = {125 _defaults = {
128 'state': 'draft',126 'state': 'draft',
=== modified file 'stock_inventory_location/stock_inventory_location_view.xml'
--- stock_inventory_location/stock_inventory_location_view.xml 2014-06-10 14:00:45 +0000
+++ stock_inventory_location/stock_inventory_location_view.xml 2014-06-11 13:56:48 +0000
@@ -36,10 +36,12 @@
36 <xpath expr="/form//field[@name='inventory_line_id']/tree//field[@name='location_id']"36 <xpath expr="/form//field[@name='inventory_line_id']/tree//field[@name='location_id']"
37 position="attributes">37 position="attributes">
38 <attribute name="on_change">onchange_location_id(parent.location_id, parent.exhaustive, location_id)</attribute>38 <attribute name="on_change">onchange_location_id(parent.location_id, parent.exhaustive, location_id)</attribute>
39 <attribute name="domain">[('usage', '=', 'internal'), ('id', 'child_of', parent.location_id)]</attribute>
39 </xpath>40 </xpath>
40 <xpath expr="/form//field[@name='inventory_line_id']/form//field[@name='location_id']"41 <xpath expr="/form//field[@name='inventory_line_id']/form//field[@name='location_id']"
41 position="attributes">42 position="attributes">
42 <attribute name="on_change">onchange_location_id(parent.location_id, parent.exhaustive, location_id)</attribute>43 <attribute name="on_change">onchange_location_id(parent.location_id, parent.exhaustive, location_id)</attribute>
44 <attribute name="domain">[('usage', '=', 'internal'), ('id', 'child_of', parent.location_id)]</attribute>
43 </xpath>45 </xpath>
45 <!-- Add button to open an inventory. Call wizard on confirm inventory -->47 <!-- Add button to open an inventory. Call wizard on confirm inventory -->


People subscribed via source and target branches