Merge lp:~hirt/ocb-addons/6.1_stock_use_date_always into lp:ocb-addons/6.1

Proposed by Etienne Hirt
Status: Work in progress
Proposed branch: lp:~hirt/ocb-addons/6.1_stock_use_date_always
Merge into: lp:ocb-addons/6.1
Diff against target: 179 lines (+16/-14)
2 files modified
stock/stock.py (+3/-1)
stock/stock_view.xml (+13/-13)
To merge this branch: bzr merge lp:~hirt/ocb-addons/6.1_stock_use_date_always
Reviewer Review Type Date Requested Status
Stefan Rijnhart (Opener) Needs Information
Ronald Portier (Therp) Needs Fixing
Holger Brunn (Therp) Needs Fixing
Review via email: mp+194646@code.launchpad.net

Description of the change

[6.1] Improve Sorting for pickings (always make date valid use date for sorting)

To post a comment you must log in.
6814. By Etienne Hirt

Minor additional fix:
remove restriction to company addresses in incoming deliveries

Revision history for this message
Holger Brunn (Therp) (hbrunn) wrote :

Could you explain #93?

And date and date_expected are different things in my opinion. So we lose data the way you propose.

Actually, I don't even exactly understand the problem you want to fix here. Please file a bug report and elaborate there.

review: Needs Fixing
Revision history for this message
Etienne Hirt (hirt) wrote :

Dear Holger,

Thanks for your analysis and your patience.

I finally added a bug report (Bug #1265608) for explaining the sorting problem with the date_expected vs. date.

Please have a look at the Bug #1265640 for explanation of #93

Revision history for this message
Ronald Portier (Therp) (rportier1962) wrote :

Dear Etienne,

I do not think it is a good idea to have one merge proposal for two changes that are nearly totally unrelated. Except for the fact that they modify the same file. Please put the change of the address selection in a separate proposal.

As for the ordering problem, I think your proposal is quite risky. If you really want to be sure that date is always filled with a valid value - based on date_expected until a move is done -, I feel it would be more appropiate to override create/write methods. Otherwise you might still end up sorting on an date withouth value.

review: Needs Fixing
6815. By Etienne Hirt

remove address restriction change as done in a separate branch

Revision history for this message
Stefan Rijnhart (Opener) (stefan-opener) wrote :

I can see that the 'date' usage is a bit of a mess: a halfhearted way of keeping it synchronized with date_expected is implemented using an on_change method, but there a places where a stock move is created without a value for 'date'. Note that your fix does not solve this either, because you only override the write() method. Biggest problem with this is that it messes up the sorting for existing moves if they don't have a 'date' set (I think that is what Ronald hints at above). In that case it seems better to me to be able to sort by expected date, even for delivered moves. Note that in 7.0, the 'date' field is hidden in the stock move tree views (group_no_one), so that a forward port of this fix would lead to seemingly slightly random orders in the views.

Maybe it is better to identify the places where 'date_expected' is written and 'date' is not kept synchronous. Fix this code. You can then as a user in 6.1 at least click on the 'date' column to see the moves ordered by this field (show the field in a custom module in 7.0), and maybe change the default order in a custom module (in 6.1 and 7.0).

You could also propose the changed order to trunk, see what they say. The gaps in the data could be filled in by a small query in the migration procedure.

What do you think?

review: Needs Information
6816. By Etienne Hirt

commit removed executable flags

6817. By Etienne Hirt

fix indent in stock_move write

Unmerged revisions

6817. By Etienne Hirt

fix indent in stock_move write

6816. By Etienne Hirt

commit removed executable flags

6815. By Etienne Hirt

remove address restriction change as done in a separate branch

6814. By Etienne Hirt

Minor additional fix:
remove restriction to company addresses in incoming deliveries

6813. By Etienne Hirt

make date field readonly in view and set it from expected as long as not in done state
now sort according to date always such that the sorting is always correct independent of state

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_asset/i18n/ca.po' (properties changed: +x to -x)
2=== modified file 'account_asset/i18n/de.po' (properties changed: +x to -x)
3=== modified file 'account_asset/i18n/es.po' (properties changed: +x to -x)
4=== modified file 'account_asset/i18n/es_CR.po' (properties changed: +x to -x)
5=== modified file 'account_asset/i18n/fr.po' (properties changed: +x to -x)
6=== modified file 'account_asset/i18n/fr_BE.po' (properties changed: +x to -x)
7=== modified file 'account_asset/i18n/pl.po' (properties changed: +x to -x)
8=== modified file 'account_asset/i18n/pt.po' (properties changed: +x to -x)
9=== modified file 'account_asset/i18n/sv.po' (properties changed: +x to -x)
10=== modified file 'account_asset/security/ir.model.access.csv' (properties changed: +x to -x)
11=== modified file 'account_asset/wizard/__init__.py' (properties changed: +x to -x)
12=== modified file 'account_asset/wizard/account_asset_change_duration.py' (properties changed: +x to -x)
13=== modified file 'account_asset/wizard/wizard_asset_compute.py' (properties changed: +x to -x)
14=== modified file 'base_report_designer/plugin/openerp_report_designer/bin/OOo_run.sh' (properties changed: +x to -x)
15=== modified file 'document/odt2txt.py' (properties changed: +x to -x)
16=== modified file 'document/test_cindex.py' (properties changed: +x to -x)
17=== modified file 'document_ftp/ftpserver/ftpserver.py' (properties changed: +x to -x)
18=== modified file 'document_webdav/test_davclient.py' (properties changed: +x to -x)
19=== modified file 'email_template/html2text.py' (properties changed: +x to -x)
20=== modified file 'l10n_ch/report/ocrbb.ttf' (properties changed: +x to -x)
21=== modified file 'l10n_ch/test/test.v11' (properties changed: +x to -x)
22=== modified file 'l10n_ch/test/test_part_1.v11' (properties changed: +x to -x)
23=== modified file 'l10n_ch/test/test_part_2.v11' (properties changed: +x to -x)
24=== modified file 'mail/static/scripts/openerp_mailgate.py' (properties changed: +x to -x)
25=== modified file 'plugin_thunderbird/static/thunderbird_plugin/install.sh' (properties changed: +x to -x)
26=== modified file 'purchase/purchase.py' (properties changed: +x to -x)
27=== modified file 'purchase/wizard/purchase_line_invoice.py' (properties changed: +x to -x)
28=== modified file 'purchase_double_validation/test/purchase_double_validation_test.yml' (properties changed: +x to -x)
29=== modified file 'purchase_requisition/test/purchase_requisition_demo.yml' (properties changed: +x to -x)
30=== modified file 'stock/stock.py'
31--- stock/stock.py 2014-04-03 08:49:26 +0000
32+++ stock/stock.py 2014-07-19 23:06:08 +0000
33@@ -1513,7 +1513,7 @@
34 return (res and res[0]) or False
35 _name = "stock.move"
36 _description = "Stock Move"
37- _order = 'date_expected desc, id'
38+ _order = 'date desc, id'
39 _log_create = False
40
41 def action_partial_move(self, cr, uid, ids, context=None):
42@@ -1721,6 +1721,8 @@
43 if frozen_fields.intersection(vals):
44 raise osv.except_osv(_('Operation forbidden'),
45 _('Quantities, UoMs, Products and Locations cannot be modified on stock moves that have already been processed (except by the Administrator)'))
46+ if move.state != 'done' and vals.get('date_expected'):
47+ vals['date'] = vals.get('date_expected')
48 return super(stock_move, self).write(cr, uid, ids, vals, context=context)
49
50 def copy(self, cr, uid, id, default=None, context=None):
51
52=== modified file 'stock/stock_view.xml'
53--- stock/stock_view.xml 2013-09-10 15:12:35 +0000
54+++ stock/stock_view.xml 2014-07-19 23:06:08 +0000
55@@ -161,7 +161,7 @@
56 states="draft,done,cancel"/>
57 <field name="location_id"/>
58 <field name="location_dest_id"/>
59- <field name="date" string="Date"/>
60+ <field name="date" string="Date" readonly="1"/>
61 <field name="state" invisible="True"/>
62 </tree>
63 </field>
64@@ -348,7 +348,7 @@
65 <field name="product_qty" on_change="onchange_quantity(product_id, product_qty, product_uom, product_uos)"/>
66 <field name="product_uom" string="UoM"/>
67 <field name="tracking_id"/>
68- <field name="date"/>
69+ <field name="date" readonly="1"/>
70 <field name="prodlot_id" groups="base.group_extended"/>
71 <field name="location_id"/>
72 <field name="location_dest_id"/>
73@@ -433,7 +433,7 @@
74 <field name="location_id" />
75 <field name="location_dest_id" />
76 <field name="create_date"/>
77- <field name="date" string="Date"/>
78+ <field name="date" string="Date" readonly="1"/>
79 <field name="date_expected" string="Date Expected"/>
80 <field name="state"/>
81 </tree>
82@@ -457,7 +457,7 @@
83 <field name="location_id" />
84 <field name="location_dest_id" />
85 <field name="create_date" />
86- <field name="date" string="Date"/>
87+ <field name="date" string="Date" readonly="1"/>
88 <field name="date_expected" string="Date Expected"/>
89 <field name="state"/>
90 </tree>
91@@ -766,7 +766,7 @@
92 <group colspan="2" col="2">
93 <separator string="Dates" colspan="2" />
94 <field name="create_date" invisible="1"/>
95- <field name="date"/>
96+ <field name="date" readonly="1"/>
97 <field name="date_expected" on_change="onchange_date(date,date_expected)"/>
98 </group>
99
100@@ -928,7 +928,7 @@
101 groups="base.group_extended"
102 states="draft,assigned,confirmed"/>
103 <field name="location_id"/>
104- <field name="date"/>
105+ <field name="date" readonly="1"/>
106 <field name="state"/>
107 <button name="%(action_partial_move_server)d" string="Process" type="action" states="confirmed,assigned" icon="gtk-go-forward"/>
108 </tree>
109@@ -957,7 +957,7 @@
110 <group colspan="2" col="2">
111 <separator string="Dates" colspan="2" />
112 <field name="create_date" invisible="1"/>
113- <field name="date"/>
114+ <field name="date" readonly="1"/>
115 <field name="date_expected" on_change="onchange_date(date,date_expected)"/>
116 </group>
117
118@@ -1177,7 +1177,7 @@
119 <group colspan="2" col="2">
120 <separator string="Dates" colspan="2" />
121 <field name="create_date" invisible="1"/>
122- <field name="date"/>
123+ <field name="date" readonly="1"/>
124 <field name="date_expected" on_change="onchange_date(date,date_expected)"/>
125 </group>
126
127@@ -1393,7 +1393,7 @@
128 states="draft,assigned,confirmed,done"/>
129 <field name="location_id"/>
130 <field name="location_dest_id"/>
131- <field name="date"/>
132+ <field name="date" readonly="1"/>
133 <field name="date_expected"/>
134 <field name="state"/>
135 <button name="action_done" states="confirmed,assigned" string="Process" type="object" icon="gtk-go-forward"/>
136@@ -1440,7 +1440,7 @@
137 <group colspan="2" col="2">
138 <separator string="Dates" colspan="2" />
139 <field name="create_date" groups="base.group_extended"/>
140- <field name="date" groups="base.group_extended"/>
141+ <field name="date" groups="base.group_extended" readonly="1"/>
142 <field name="date_expected" on_change="onchange_date(date,date_expected)"/>
143 </group>
144
145@@ -1564,7 +1564,7 @@
146 groups="base.group_extended"
147 icon="terp-stock_effects-object-colorize"
148 states="draft,assigned,confirmed,done"/>
149- <field name="date"/>
150+ <field name="date" readonly="1"/>
151 <field name="state"/>
152 <button name="action_assign" states="confirmed" string="Set Available" type="object" icon="gtk-yes"/>
153 <button name="action_done" string="Process" type="object" states="confirmed,assigned" icon="gtk-go-forward"/>
154@@ -1584,7 +1584,7 @@
155 <field name="product_id"/>
156 <field name="product_qty" />
157 <field name="product_uom" string="UoM"/>
158- <field name="date"/>
159+ <field name="date" readonly="1"/>
160 <field name="state"/>
161 <button name="action_done" states="confirmed,assigned" string="Process" type="object" icon="gtk-go-forward"/>
162 </tree>
163@@ -1629,7 +1629,7 @@
164 <group colspan="2" col="2">
165 <separator string="Dates" colspan="2" />
166 <field name="create_date" groups="base.group_extended"/>
167- <field name="date" groups="base.group_extended"/>
168+ <field name="date" groups="base.group_extended" readonly="1"/>
169 <field name="date_expected" on_change="onchange_date(date,date_expected)"/>
170 </group>
171
172
173=== modified file 'wiki/static/src/lib/wiky/Readme.md' (properties changed: +x to -x)
174=== modified file 'wiki/static/src/lib/wiky/autogit.sh' (properties changed: +x to -x)
175=== modified file 'wiki/static/src/lib/wiky/index.html' (properties changed: +x to -x)
176=== modified file 'wiki/static/src/lib/wiky/input_complete' (properties changed: +x to -x)
177=== modified file 'wiki/static/src/lib/wiky/jquery-1.4.2.min.js' (properties changed: +x to -x)
178=== modified file 'wiki/static/src/lib/wiky/wiky.css' (properties changed: +x to -x)
179=== modified file 'wiki/static/src/lib/wiky/wiky.js' (properties changed: +x to -x)

Subscribers

People subscribed via source and target branches