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
1=== modified file 'stock_inventory_hierarchical/hierarchical_inventory_view.xml'
2--- stock_inventory_hierarchical/hierarchical_inventory_view.xml 2014-04-02 14:24:38 +0000
3+++ stock_inventory_hierarchical/hierarchical_inventory_view.xml 2014-06-11 13:56:48 +0000
4@@ -52,8 +52,13 @@
5 expr="//page[@string='General Information']"
6 position="after">
7 <page string="Sub-inventories">
8- <field name="inventory_ids" nolabel="1"
9- context="{'inventory_display': 'short'}" />
10+ <field name="inventory_ids" nolabel="1" context="{'default_parent_id': active_id, 'default_exhaustive': exhaustive}">
11+ <tree>
12+ <field name="name" />
13+ <field name="state" />
14+ <field name="progress_rate" widget="progressbar" />
15+ </tree>
16+ </field>
17 </page>
18 </xpath>
19 </field>
21=== modified file 'stock_inventory_location/'
22--- stock_inventory_location/ 2014-06-10 14:10:31 +0000
23+++ stock_inventory_location/ 2014-06-11 13:56:48 +0000
24@@ -29,7 +29,6 @@
27 from .exceptions import ExhaustiveInventoryException
28-from import mute_logger
31 class StockInventory(orm.Model):
32@@ -113,16 +112,15 @@
34 # TODO: remove this in v8
35 def _default_location(self, cr, uid, ids, context=None):
36- """Default stock location"""
37- try:
38- location = self.pool[''].get_object(
39- cr, uid, 'stock', 'stock_location_stock')
40- with mute_logger('openerp.osv.orm'):
41- location.check_access_rule('read', context=context)
42- location_id =
43- except ValueError, orm.except_orm:
44- return False
45- return location_id or False
46+ """Default stock location
47+ get the stock location define on the first warehouse of the default company
48+ """
49+ location_id = False
50+ company_id = self.pool['']._company_default_get(cr, uid, 'stock.warehouse', context=context)
51+ warehouse_id = self.pool['stock.warehouse'].search(cr, uid, [('company_id', '=', company_id)], limit=1)
52+ if warehouse_id:
53+ location_id = self.pool['stock.warehouse'].read(cr, uid, warehouse_id[0], ['lot_stock_id'])['lot_stock_id'][0]
54+ return location_id
56 _defaults = {
57 'state': 'draft',
59=== modified file 'stock_inventory_location/stock_inventory_location_view.xml'
60--- stock_inventory_location/stock_inventory_location_view.xml 2014-06-10 14:00:45 +0000
61+++ stock_inventory_location/stock_inventory_location_view.xml 2014-06-11 13:56:48 +0000
62@@ -36,10 +36,12 @@
63 <xpath expr="/form//field[@name='inventory_line_id']/tree//field[@name='location_id']"
64 position="attributes">
65 <attribute name="on_change">onchange_location_id(parent.location_id, parent.exhaustive, location_id)</attribute>
66+ <attribute name="domain">[('usage', '=', 'internal'), ('id', 'child_of', parent.location_id)]</attribute>
67 </xpath>
68 <xpath expr="/form//field[@name='inventory_line_id']/form//field[@name='location_id']"
69 position="attributes">
70 <attribute name="on_change">onchange_location_id(parent.location_id, parent.exhaustive, location_id)</attribute>
71+ <attribute name="domain">[('usage', '=', 'internal'), ('id', 'child_of', parent.location_id)]</attribute>
72 </xpath>
74 <!-- Add button to open an inventory. Call wizard on confirm inventory -->


People subscribed via source and target branches