Merge lp:~jean-lelievre/purchase-report/product_inventory_warning into lp:~purchase-core-editors/purchase-report/7.0
- product_inventory_warning
- Merge into 7.0
Status: | Work in progress |
---|---|
Proposed branch: | lp:~jean-lelievre/purchase-report/product_inventory_warning |
Merge into: | lp:~purchase-core-editors/purchase-report/7.0 |
Diff against target: |
1477 lines (+1417/-0) 11 files modified
product_inventory_warning/__init__.py (+27/-0) product_inventory_warning/__openerp__.py (+53/-0) product_inventory_warning/i18n/zh_CN.po (+315/-0) product_inventory_warning/product.py (+613/-0) product_inventory_warning/product_view.xml (+137/-0) product_inventory_warning/security/ir.model.access.csv (+3/-0) product_inventory_warning/wizard/__init__.py (+26/-0) product_inventory_warning/wizard/product_qty.py (+69/-0) product_inventory_warning/wizard/product_qty_view.xml (+32/-0) product_inventory_warning/wizard/product_sfc.py (+80/-0) product_inventory_warning/wizard/product_sfc_view.xml (+62/-0) |
To merge this branch: | bzr merge lp:~jean-lelievre/purchase-report/product_inventory_warning |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alexandre Fayolle - camptocamp | Needs Resubmitting | ||
Maxime Chambreuil (http://www.savoirfairelinux.com) | code review | Needs Fixing | |
Review via email: mp+182057@code.launchpad.net |
Commit message
Description of the change
[ADD] Add the module product_
Product Inventory Warning
=======
Add a wizard to calculate the QTY of product.
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote : | # |
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote : | # |
No changes since 2013-11-10 after Need Fixing request -> I set this in WIP
@Jean LELIEVRE
Please do the required changes then set it in Needs Review again
Here you will find the community coding Guide Lines
which applies to new code and code ported from old version.
https:/
Cheers,
Yannick
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote : | # |
Hello,
The management of the project has moved to Github: https:/
Please migrate your merge proposal to Github. You may want to check https:/
Thanks for contributing to the project
Unmerged revisions
- 11. By Jean LELIEVRE ElicoCorp
-
[ADD] Add the module product_
inventory_ warning.
Preview Diff
1 | === added directory 'product_inventory_warning' | |||
2 | === added file 'product_inventory_warning/__init__.py' | |||
3 | --- product_inventory_warning/__init__.py 1970-01-01 00:00:00 +0000 | |||
4 | +++ product_inventory_warning/__init__.py 2013-08-26 08:54:27 +0000 | |||
5 | @@ -0,0 +1,27 @@ | |||
6 | 1 | # -*- coding: utf-8 -*- | ||
7 | 2 | ############################################################################## | ||
8 | 3 | # | ||
9 | 4 | # OpenERP, Open Source Management Solution | ||
10 | 5 | # Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. | ||
11 | 6 | # Author: Andy Lu <andy.lu@elico-corp.com> | ||
12 | 7 | # | ||
13 | 8 | # This program is free software: you can redistribute it and/or modify | ||
14 | 9 | # it under the terms of the GNU Affero General Public License as | ||
15 | 10 | # published by the Free Software Foundation, either version 3 of the | ||
16 | 11 | # License, or (at your option) any later version. | ||
17 | 12 | # | ||
18 | 13 | # This program is distributed in the hope that it will be useful, | ||
19 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | 16 | # GNU Affero General Public License for more details. | ||
22 | 17 | # | ||
23 | 18 | # You should have received a copy of the GNU Affero General Public License | ||
24 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
25 | 20 | # | ||
26 | 21 | ############################################################################## | ||
27 | 22 | |||
28 | 23 | import product | ||
29 | 24 | import wizard | ||
30 | 25 | #import sale_compare | ||
31 | 26 | |||
32 | 27 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
33 | 0 | \ No newline at end of file | 28 | \ No newline at end of file |
34 | 1 | 29 | ||
35 | === added file 'product_inventory_warning/__openerp__.py' | |||
36 | --- product_inventory_warning/__openerp__.py 1970-01-01 00:00:00 +0000 | |||
37 | +++ product_inventory_warning/__openerp__.py 2013-08-26 08:54:27 +0000 | |||
38 | @@ -0,0 +1,53 @@ | |||
39 | 1 | # -*- coding: utf-8 -*- | ||
40 | 2 | ############################################################################## | ||
41 | 3 | # | ||
42 | 4 | # OpenERP, Open Source Management Solution | ||
43 | 5 | # Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. | ||
44 | 6 | # Author: Andy Lu <andy.lu@elico-corp.com> | ||
45 | 7 | # LIN Yu <lin.yu@elico-corp.com> | ||
46 | 8 | # | ||
47 | 9 | # This program is free software: you can redistribute it and/or modify | ||
48 | 10 | # it under the terms of the GNU Affero General Public License as | ||
49 | 11 | # published by the Free Software Foundation, either version 3 of the | ||
50 | 12 | # License, or (at your option) any later version. | ||
51 | 13 | # | ||
52 | 14 | # This program is distributed in the hope that it will be useful, | ||
53 | 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
54 | 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
55 | 17 | # GNU Affero General Public License for more details. | ||
56 | 18 | # | ||
57 | 19 | # You should have received a copy of the GNU Affero General Public License | ||
58 | 20 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
59 | 21 | # | ||
60 | 22 | ############################################################################## | ||
61 | 23 | |||
62 | 24 | { | ||
63 | 25 | 'name': 'Product Inventory Warning', | ||
64 | 26 | 'version': '1', | ||
65 | 27 | 'category': 'Product', | ||
66 | 28 | 'sequence': 1, | ||
67 | 29 | 'summary': 'Product Inventory Warning', | ||
68 | 30 | 'description': """ | ||
69 | 31 | Product Inventory Warning | ||
70 | 32 | ================================================== | ||
71 | 33 | |||
72 | 34 | Add a wizard to calculate the QTY of product. | ||
73 | 35 | """, | ||
74 | 36 | 'author': 'Elico Corp', | ||
75 | 37 | 'website': 'http://www.elico-corp.com', | ||
76 | 38 | 'images' : [], | ||
77 | 39 | 'depends': ['product', 'product_stock_type','product_separate_cost','stock_with_cost'], | ||
78 | 40 | 'data': [ | ||
79 | 41 | 'product_view.xml', | ||
80 | 42 | 'wizard/product_qty_view.xml', | ||
81 | 43 | 'wizard/product_sfc_view.xml', | ||
82 | 44 | 'security/ir.model.access.csv', | ||
83 | 45 | ], | ||
84 | 46 | 'test': [], | ||
85 | 47 | 'demo': [], | ||
86 | 48 | 'installable': True, | ||
87 | 49 | 'auto_install': False, | ||
88 | 50 | 'application': False, | ||
89 | 51 | } | ||
90 | 52 | |||
91 | 53 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
92 | 0 | 54 | ||
93 | === added directory 'product_inventory_warning/i18n' | |||
94 | === added file 'product_inventory_warning/i18n/zh_CN.po' | |||
95 | --- product_inventory_warning/i18n/zh_CN.po 1970-01-01 00:00:00 +0000 | |||
96 | +++ product_inventory_warning/i18n/zh_CN.po 2013-08-26 08:54:27 +0000 | |||
97 | @@ -0,0 +1,315 @@ | |||
98 | 1 | # Translation of OpenERP Server. | ||
99 | 2 | # This file contains the translation of the following modules: | ||
100 | 3 | # * fc_product | ||
101 | 4 | # | ||
102 | 5 | msgid "" | ||
103 | 6 | msgstr "" | ||
104 | 7 | "Project-Id-Version: OpenERP Server 7.0\n" | ||
105 | 8 | "Report-Msgid-Bugs-To: \n" | ||
106 | 9 | "POT-Creation-Date: 2013-05-17 08:19+0000\n" | ||
107 | 10 | "PO-Revision-Date: 2013-05-17 08:19+0000\n" | ||
108 | 11 | "Last-Translator: <>\n" | ||
109 | 12 | "Language-Team: \n" | ||
110 | 13 | "MIME-Version: 1.0\n" | ||
111 | 14 | "Content-Type: text/plain; charset=UTF-8\n" | ||
112 | 15 | "Content-Transfer-Encoding: \n" | ||
113 | 16 | "Plural-Forms: \n" | ||
114 | 17 | |||
115 | 18 | #. module: fc_product | ||
116 | 19 | #: view:product.inventory:0 | ||
117 | 20 | #: field:product.inventory,category_id:0 | ||
118 | 21 | #: view:product.inventory.dates:0 | ||
119 | 22 | #: field:product.inventory.dates,category_id:0 | ||
120 | 23 | msgid "Category" | ||
121 | 24 | msgstr "种类" | ||
122 | 25 | |||
123 | 26 | #. module: fc_product | ||
124 | 27 | #: field:product.inventory,code:0 | ||
125 | 28 | #: field:product.inventory.dates,code:0 | ||
126 | 29 | msgid "SKU" | ||
127 | 30 | msgstr "SKU" | ||
128 | 31 | |||
129 | 32 | #. module: fc_product | ||
130 | 33 | #: field:run.product.inventory.dates,from_date:0 | ||
131 | 34 | msgid "From" | ||
132 | 35 | msgstr "开始" | ||
133 | 36 | |||
134 | 37 | #. module: fc_product | ||
135 | 38 | #: field:product.inventory.dates,produce_qty:0 | ||
136 | 39 | msgid "Production Quantity" | ||
137 | 40 | msgstr "生产数量" | ||
138 | 41 | |||
139 | 42 | #. module: fc_product | ||
140 | 43 | #: model:ir.model,name:fc_product.model_run_product_inventory_dates | ||
141 | 44 | msgid "Compute Product Inventory betweend dates" | ||
142 | 45 | msgstr "根据时间生成产品粗困报表" | ||
143 | 46 | |||
144 | 47 | #. module: fc_product | ||
145 | 48 | #: field:run.product.inventory.dates,to_date:0 | ||
146 | 49 | msgid "To" | ||
147 | 50 | msgstr "到" | ||
148 | 51 | |||
149 | 52 | #. module: fc_product | ||
150 | 53 | #: field:product.inventory.dates,start_value:0 | ||
151 | 54 | msgid "Start Value" | ||
152 | 55 | msgstr "起初金额" | ||
153 | 56 | |||
154 | 57 | #. module: fc_product | ||
155 | 58 | #: field:product.inventory,ondraft_qty:0 | ||
156 | 59 | msgid "Not Confirm Quantity" | ||
157 | 60 | msgstr "未审核采购数" | ||
158 | 61 | |||
159 | 62 | #. module: fc_product | ||
160 | 63 | #: field:product.inventory.dates,end_qty:0 | ||
161 | 64 | msgid "End Quantity" | ||
162 | 65 | msgstr "期末数量" | ||
163 | 66 | |||
164 | 67 | #. module: fc_product | ||
165 | 68 | #: model:ir.model,name:fc_product.model_run_product_inventory | ||
166 | 69 | #: view:run.product.inventory:0 | ||
167 | 70 | msgid "Compute Product Inventory" | ||
168 | 71 | msgstr "计算产品库存" | ||
169 | 72 | |||
170 | 73 | #. module: fc_product | ||
171 | 74 | #: field:product.inventory.dates,consume_qty:0 | ||
172 | 75 | msgid "Consumption Quantity" | ||
173 | 76 | msgstr "消耗数量" | ||
174 | 77 | |||
175 | 78 | #. module: fc_product | ||
176 | 79 | #: code:addons/fc_product/wizard/product_sfc.py:61 | ||
177 | 80 | #: code:addons/fc_product/wizard/sale_compare_wizard.py:61 | ||
178 | 81 | #: model:ir.actions.act_window,name:fc_product.action_product_inventory_dates_tree | ||
179 | 82 | #: model:ir.model,name:fc_product.model_product_inventory_dates | ||
180 | 83 | #: model:ir.ui.menu,name:fc_product.menu_action_product_inventory_dates_tree | ||
181 | 84 | #: view:product.inventory.dates:0 | ||
182 | 85 | #, python-format | ||
183 | 86 | msgid "Product Inventory between dates" | ||
184 | 87 | msgstr "期间产品库存" | ||
185 | 88 | |||
186 | 89 | #. module: fc_product | ||
187 | 90 | #: field:product.inventory,onorder_qty:0 | ||
188 | 91 | msgid "Future Quantity" | ||
189 | 92 | msgstr "预测数量" | ||
190 | 93 | |||
191 | 94 | #. module: fc_product | ||
192 | 95 | #: code:addons/fc_product/product.py:104 | ||
193 | 96 | #: code:addons/fc_product/product.py:106 | ||
194 | 97 | #: field:product.inventory,name_en:0 | ||
195 | 98 | #: field:product.inventory,name_sort_en:0 | ||
196 | 99 | #, python-format | ||
197 | 100 | msgid "Name EN" | ||
198 | 101 | msgstr "英文名" | ||
199 | 102 | |||
200 | 103 | #. module: fc_product | ||
201 | 104 | #: field:product.inventory.dates,start_qty:0 | ||
202 | 105 | msgid "Beginning Quantity" | ||
203 | 106 | msgstr "起初数量" | ||
204 | 107 | |||
205 | 108 | #. module: fc_product | ||
206 | 109 | #: view:product.inventory:0 | ||
207 | 110 | #: field:product.inventory,stock_type_id:0 | ||
208 | 111 | #: view:product.inventory.dates:0 | ||
209 | 112 | #: field:product.inventory.dates,stock_type_id:0 | ||
210 | 113 | msgid "Stock Type" | ||
211 | 114 | msgstr "仓储种类" | ||
212 | 115 | |||
213 | 116 | #. module: fc_product | ||
214 | 117 | #: field:product.inventory,date:0 | ||
215 | 118 | msgid "Creation Date" | ||
216 | 119 | msgstr "创建时间" | ||
217 | 120 | |||
218 | 121 | #. module: fc_product | ||
219 | 122 | #: code:addons/fc_product/wizard/product_qty.py:55 | ||
220 | 123 | #: model:ir.model,name:fc_product.model_product_inventory | ||
221 | 124 | #: view:product.inventory:0 | ||
222 | 125 | #, python-format | ||
223 | 126 | msgid "Product Inventory" | ||
224 | 127 | msgstr "产品库存" | ||
225 | 128 | |||
226 | 129 | #. module: fc_product | ||
227 | 130 | #: field:product.inventory.dates,produce_value:0 | ||
228 | 131 | msgid "Production Value" | ||
229 | 132 | msgstr "生产金额" | ||
230 | 133 | |||
231 | 134 | #. module: fc_product | ||
232 | 135 | #: field:product.inventory,product_safe_qty:0 | ||
233 | 136 | #: field:product.product,product_safe_qty:0 | ||
234 | 137 | msgid "Minimum stock warning Quantity" | ||
235 | 138 | msgstr "最小库存数量" | ||
236 | 139 | |||
237 | 140 | #. module: fc_product | ||
238 | 141 | #: code:addons/fc_product/sale_compare.py:63 | ||
239 | 142 | #, python-format | ||
240 | 143 | msgid "ERP sub total" | ||
241 | 144 | msgstr "ERP sub total" | ||
242 | 145 | |||
243 | 146 | #. module: fc_product | ||
244 | 147 | #: field:product.inventory.dates,consume_value:0 | ||
245 | 148 | msgid "Consumption Value" | ||
246 | 149 | msgstr "消耗金额" | ||
247 | 150 | |||
248 | 151 | #. module: fc_product | ||
249 | 152 | #: code:addons/fc_product/product.py:101 | ||
250 | 153 | #: field:product.inventory,joomla_unit_cn:0 | ||
251 | 154 | #, python-format | ||
252 | 155 | msgid "Website Product Unit in CN" | ||
253 | 156 | msgstr "中文采购单位" | ||
254 | 157 | |||
255 | 158 | #. module: fc_product | ||
256 | 159 | #: field:product.inventory,onhand_qty:0 | ||
257 | 160 | msgid "Onhand Quantity" | ||
258 | 161 | msgstr "在手数量" | ||
259 | 162 | |||
260 | 163 | #. module: fc_product | ||
261 | 164 | #: field:product.inventory,uom_id:0 | ||
262 | 165 | #: field:product.inventory.dates,uom_id:0 | ||
263 | 166 | msgid "UoM" | ||
264 | 167 | msgstr "单位" | ||
265 | 168 | |||
266 | 169 | #. module: fc_product | ||
267 | 170 | #: field:product.inventory.dates,scrap_value:0 | ||
268 | 171 | msgid "Scrap Value" | ||
269 | 172 | msgstr "报废金额" | ||
270 | 173 | |||
271 | 174 | #. module: fc_product | ||
272 | 175 | #: field:product.inventory.dates,to_date:0 | ||
273 | 176 | msgid "End Date" | ||
274 | 177 | msgstr "结束时间" | ||
275 | 178 | |||
276 | 179 | #. module: fc_product | ||
277 | 180 | #: view:run.product.inventory:0 | ||
278 | 181 | #: view:run.product.inventory.dates:0 | ||
279 | 182 | msgid "Compute" | ||
280 | 183 | msgstr "计算" | ||
281 | 184 | |||
282 | 185 | #. module: fc_product | ||
283 | 186 | #: view:run.product.inventory.dates:0 | ||
284 | 187 | msgid "Compute Product Inventory based on current stock moves and dates" | ||
285 | 188 | msgstr "根据当前调拨和日期计算产品库存" | ||
286 | 189 | |||
287 | 190 | #. module: fc_product | ||
288 | 191 | #: view:run.product.inventory:0 | ||
289 | 192 | msgid "Compute Product Inventory based on current stock moves" | ||
290 | 193 | msgstr "根据库存调拨计算产品数量" | ||
291 | 194 | |||
292 | 195 | #. module: fc_product | ||
293 | 196 | #: model:ir.actions.act_window,name:fc_product.action_product_inventory_tree | ||
294 | 197 | #: model:ir.ui.menu,name:fc_product.menu_action_product_inventory_tree | ||
295 | 198 | msgid "Product Inventory Warning" | ||
296 | 199 | msgstr "最小库存报警" | ||
297 | 200 | |||
298 | 201 | #. module: fc_product | ||
299 | 202 | #: model:ir.model,name:fc_product.model_product_product | ||
300 | 203 | #: view:product.inventory:0 | ||
301 | 204 | #: view:product.inventory.dates:0 | ||
302 | 205 | #: field:product.inventory.dates,product_id:0 | ||
303 | 206 | msgid "Product" | ||
304 | 207 | msgstr "产品" | ||
305 | 208 | |||
306 | 209 | #. module: fc_product | ||
307 | 210 | #: model:ir.actions.act_window,name:fc_product.action_run_product_inventory | ||
308 | 211 | #: model:ir.ui.menu,name:fc_product.menu_action_run_product_inventory | ||
309 | 212 | msgid "Compute Product Inventory Warning" | ||
310 | 213 | msgstr "计算最小库存报警" | ||
311 | 214 | |||
312 | 215 | #. module: fc_product | ||
313 | 216 | #: field:product.inventory.dates,end_price:0 | ||
314 | 217 | msgid "End Price" | ||
315 | 218 | msgstr "期末价格" | ||
316 | 219 | |||
317 | 220 | #. module: fc_product | ||
318 | 221 | #: field:product.inventory,product_id:0 | ||
319 | 222 | msgid "Products" | ||
320 | 223 | msgstr "产品" | ||
321 | 224 | |||
322 | 225 | #. module: fc_product | ||
323 | 226 | #: code:addons/fc_product/product.py:100 | ||
324 | 227 | #: field:product.inventory,joomla_unit:0 | ||
325 | 228 | #, python-format | ||
326 | 229 | msgid "Website Product Unit" | ||
327 | 230 | msgstr "产品单位中文" | ||
328 | 231 | |||
329 | 232 | #. module: fc_product | ||
330 | 233 | #: field:product.inventory.dates,sale_value:0 | ||
331 | 234 | msgid "Sale Value" | ||
332 | 235 | msgstr "销售金额" | ||
333 | 236 | |||
334 | 237 | #. module: fc_product | ||
335 | 238 | #: field:product.inventory.dates,sale_qty:0 | ||
336 | 239 | msgid "Sale Quantity" | ||
337 | 240 | msgstr "销售数量" | ||
338 | 241 | |||
339 | 242 | #. module: fc_product | ||
340 | 243 | #: model:ir.actions.act_window,name:fc_product.action_run_product_inventory_dates | ||
341 | 244 | #: model:ir.ui.menu,name:fc_product.menu_action_run_product_inventory_dates | ||
342 | 245 | #: view:run.product.inventory.dates:0 | ||
343 | 246 | msgid "Compute Product Inventory between dates" | ||
344 | 247 | msgstr "根据日期计算产品库存" | ||
345 | 248 | |||
346 | 249 | #. module: fc_product | ||
347 | 250 | #: field:product.inventory.dates,buy_value:0 | ||
348 | 251 | msgid "Purchase Value" | ||
349 | 252 | msgstr "采购金额" | ||
350 | 253 | |||
351 | 254 | #. module: fc_product | ||
352 | 255 | #: view:product.inventory:0 | ||
353 | 256 | msgid "Out of Stock" | ||
354 | 257 | msgstr "缺货产品" | ||
355 | 258 | |||
356 | 259 | #. module: fc_product | ||
357 | 260 | #: model:ir.model,name:fc_product.model_product_template | ||
358 | 261 | #: field:product.inventory.dates,product_tmpl_id:0 | ||
359 | 262 | msgid "Product Template" | ||
360 | 263 | msgstr "产品模板" | ||
361 | 264 | |||
362 | 265 | #. module: fc_product | ||
363 | 266 | #: field:product.inventory.dates,scrap_qty:0 | ||
364 | 267 | msgid "Scrap Quantity" | ||
365 | 268 | msgstr "Scrap Quantity" | ||
366 | 269 | |||
367 | 270 | #. module: fc_product | ||
368 | 271 | #: field:product.inventory,out_stock:0 | ||
369 | 272 | msgid "Out Stock" | ||
370 | 273 | msgstr "Out Stock" | ||
371 | 274 | |||
372 | 275 | #. module: fc_product | ||
373 | 276 | #: view:product.inventory:0 | ||
374 | 277 | #: view:product.inventory.dates:0 | ||
375 | 278 | msgid "Group by..." | ||
376 | 279 | msgstr "分组..." | ||
377 | 280 | |||
378 | 281 | #. module: fc_product | ||
379 | 282 | #: field:product.inventory.dates,end_value:0 | ||
380 | 283 | msgid "End Value" | ||
381 | 284 | msgstr "期末金额" | ||
382 | 285 | |||
383 | 286 | #. module: fc_product | ||
384 | 287 | #: view:run.product.inventory:0 | ||
385 | 288 | #: view:run.product.inventory.dates:0 | ||
386 | 289 | msgid "_Cancel" | ||
387 | 290 | msgstr "_取消" | ||
388 | 291 | |||
389 | 292 | #. module: fc_product | ||
390 | 293 | #: code:addons/fc_product/product.py:105 | ||
391 | 294 | #: code:addons/fc_product/product.py:107 | ||
392 | 295 | #: field:product.inventory,name_cn:0 | ||
393 | 296 | #: field:product.inventory,name_sort_cn:0 | ||
394 | 297 | #, python-format | ||
395 | 298 | msgid "Name CN" | ||
396 | 299 | msgstr "中文名" | ||
397 | 300 | |||
398 | 301 | #. module: fc_product | ||
399 | 302 | #: field:product.inventory.dates,from_date:0 | ||
400 | 303 | msgid "Start Date" | ||
401 | 304 | msgstr "开始时间" | ||
402 | 305 | |||
403 | 306 | #. module: fc_product | ||
404 | 307 | #: field:product.inventory.dates,start_price:0 | ||
405 | 308 | msgid "Start Price" | ||
406 | 309 | msgstr "开始价格" | ||
407 | 310 | |||
408 | 311 | #. module: fc_product | ||
409 | 312 | #: field:product.inventory.dates,buy_qty:0 | ||
410 | 313 | msgid "Purchase Quantity" | ||
411 | 314 | msgstr "采购数量" | ||
412 | 315 | |||
413 | 0 | 316 | ||
414 | === added file 'product_inventory_warning/product.py' | |||
415 | --- product_inventory_warning/product.py 1970-01-01 00:00:00 +0000 | |||
416 | +++ product_inventory_warning/product.py 2013-08-26 08:54:27 +0000 | |||
417 | @@ -0,0 +1,613 @@ | |||
418 | 1 | # -*- coding: utf-8 -*- | ||
419 | 2 | ############################################################################## | ||
420 | 3 | # | ||
421 | 4 | # OpenERP, Open Source Management Solution | ||
422 | 5 | # Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. | ||
423 | 6 | # Author: Yannick Gouin <yannick.gouin@elico-corp.com> | ||
424 | 7 | # | ||
425 | 8 | # This program is free software: you can redistribute it and/or modify | ||
426 | 9 | # it under the terms of the GNU Affero General Public License as | ||
427 | 10 | # published by the Free Software Foundation, either version 3 of the | ||
428 | 11 | # License, or (at your option) any later version. | ||
429 | 12 | # | ||
430 | 13 | # This program is distributed in the hope that it wil l be useful, | ||
431 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
432 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
433 | 16 | # GNU Affero General Public License for more details. | ||
434 | 17 | # | ||
435 | 18 | # You should have received a copy of the GNU Affero General Public License | ||
436 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
437 | 20 | # | ||
438 | 21 | ############################################################################## | ||
439 | 22 | |||
440 | 23 | from osv import osv, fields | ||
441 | 24 | import openerp.addons.decimal_precision as dp | ||
442 | 25 | import time, pytz | ||
443 | 26 | from datetime import datetime | ||
444 | 27 | from tools.translate import _ | ||
445 | 28 | |||
446 | 29 | class product_product(osv.osv): | ||
447 | 30 | _inherit = 'product.product' | ||
448 | 31 | |||
449 | 32 | _columns = { | ||
450 | 33 | 'product_safe_qty': fields.float('Minimum stock warning Quantity', digits_compute=dp.get_precision('Product Unit of Measure')), | ||
451 | 34 | } | ||
452 | 35 | _defaults = { | ||
453 | 36 | 'product_safe_qty': 0.0, | ||
454 | 37 | } | ||
455 | 38 | product_product() | ||
456 | 39 | |||
457 | 40 | |||
458 | 41 | class product_inventory(osv.osv): | ||
459 | 42 | _name = 'product.inventory' | ||
460 | 43 | _description = 'Product Inventory' | ||
461 | 44 | _rec_name = "code" | ||
462 | 45 | _order = 'code' | ||
463 | 46 | |||
464 | 47 | _columns = { | ||
465 | 48 | 'product_id': fields.many2one('product.product', 'Products', required=True), | ||
466 | 49 | 'onhand_qty': fields.float("Onhand Quantity", digits_compute=dp.get_precision('Product Unit of Measure')), | ||
467 | 50 | 'onorder_qty': fields.float("Future Quantity", digits_compute=dp.get_precision('Product Unit of Measure')), | ||
468 | 51 | 'ondraft_qty': fields.float("Not Confirm Quantity", digits_compute=dp.get_precision('Product Unit of Measure')), | ||
469 | 52 | 'date': fields.datetime('Creation Date'), | ||
470 | 53 | 'category_id': fields.many2one('product.category',string='Category'), | ||
471 | 54 | 'stock_type_id': fields.many2one('product.stock_type',string='Stock Type'), | ||
472 | 55 | 'uom_id': fields.many2one('product.uom',string='UoM'), | ||
473 | 56 | 'code': fields.char('SKU', size=128,), | ||
474 | 57 | 'product_safe_qty': fields.float('Minimum stock warning Quantity', digits_compute=dp.get_precision('Product Unit of Measure')), | ||
475 | 58 | 'name': fields.related('product_id', 'name', string=_('Name'), type='char', size=128), | ||
476 | 59 | 'out_stock':fields.boolean("Out Stock"), | ||
477 | 60 | } | ||
478 | 61 | _defaults = { | ||
479 | 62 | 'onhand_qty': 0.0, | ||
480 | 63 | 'onorder_qty': 0.0, | ||
481 | 64 | 'ondraft_qty': 0.0, | ||
482 | 65 | 'product_safe_qty': 0.0, | ||
483 | 66 | 'date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'), | ||
484 | 67 | } | ||
485 | 68 | |||
486 | 69 | |||
487 | 70 | def compute_inventory(self, cr, uid, context=None): | ||
488 | 71 | #prod_obj = self.pool.get('product.product') | ||
489 | 72 | cr.execute("""TRUNCATE TABLE product_inventory""") | ||
490 | 73 | cr.execute("""INSERT INTO product_inventory( product_id, date) SELECT id,current_timestamp at time zone 'UTC' FROM product_product WHERE active AND id IN (SELECT distinct product_id FROM stock_move ) ORDER BY id""") | ||
491 | 74 | cr.execute("""INSERT INTO product_inventory( product_id, date) SELECT product_id,current_timestamp at time zone 'UTC' FROM purchase_order_line WHERE product_id NOT IN (SELECT distinct product_id FROM stock_move ) ORDER BY product_id""") | ||
492 | 75 | cr.execute(""" | ||
493 | 76 | UPDATE product_inventory AS i | ||
494 | 77 | SET code = p.default_code, category_id = t.categ_id, | ||
495 | 78 | stock_type_id = t.stock_type_id, uom_id = t.uom_id, product_safe_qty = p.product_safe_qty | ||
496 | 79 | FROM product_product p, product_template t | ||
497 | 80 | WHERE i.product_id = p.id AND p.product_tmpl_id = t.id""") | ||
498 | 81 | |||
499 | 82 | #onhand_qty | ||
500 | 83 | cr.execute(""" | ||
501 | 84 | UPDATE product_inventory | ||
502 | 85 | SET onhand_qty = sl.product_qty | ||
503 | 86 | FROM | ||
504 | 87 | (SELECT m.product_id, round(coalesce(sum(m.product_qty * pu.factor / u.factor), 0.0),3) AS product_qty | ||
505 | 88 | FROM stock_move m | ||
506 | 89 | LEFT JOIN product_product pp ON (m.product_id=pp.id) | ||
507 | 90 | LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id) | ||
508 | 91 | LEFT JOIN product_uom pu ON (pt.uom_id=pu.id) | ||
509 | 92 | LEFT JOIN product_uom u ON (m.product_uom=u.id) | ||
510 | 93 | WHERE m.state = 'done' | ||
511 | 94 | AND m.location_id NOT IN (SELECT distinct d.id | ||
512 | 95 | FROM stock_warehouse w, stock_location h, stock_location d | ||
513 | 96 | WHERE w.lot_stock_id = h.id | ||
514 | 97 | AND d.parent_left >= h.parent_left | ||
515 | 98 | AND d.parent_right <= h.parent_right) | ||
516 | 99 | AND m.location_dest_id IN (SELECT distinct d.id | ||
517 | 100 | FROM stock_warehouse w, stock_location h, stock_location d | ||
518 | 101 | WHERE w.lot_stock_id = h.id | ||
519 | 102 | AND d.parent_left >= h.parent_left | ||
520 | 103 | AND d.parent_right <= h.parent_right) | ||
521 | 104 | GROUP BY m.product_id ORDER BY m.product_id) sl | ||
522 | 105 | WHERE product_inventory.product_id = sl.product_id """) | ||
523 | 106 | |||
524 | 107 | # Useless, no ? | ||
525 | 108 | #cr.execute("""UPDATE product_inventory SET onhand_qty = 0.0 WHERE coalesce(onhand_qty,0.0) = 0.0""") | ||
526 | 109 | |||
527 | 110 | cr.execute(""" | ||
528 | 111 | UPDATE product_inventory SET onhand_qty = onhand_qty - sl.product_qty | ||
529 | 112 | FROM | ||
530 | 113 | (SELECT m.product_id, round(coalesce(sum(m.product_qty * pu.factor / u.factor), 0.0),3) AS product_qty | ||
531 | 114 | FROM stock_move m | ||
532 | 115 | LEFT JOIN product_product pp ON (m.product_id=pp.id) | ||
533 | 116 | LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id) | ||
534 | 117 | LEFT JOIN product_uom pu ON (pt.uom_id=pu.id) | ||
535 | 118 | LEFT JOIN product_uom u ON (m.product_uom=u.id) | ||
536 | 119 | WHERE m.state = 'done' | ||
537 | 120 | AND m.location_id IN (SELECT distinct d.id | ||
538 | 121 | FROM stock_warehouse w, stock_location h, stock_location d | ||
539 | 122 | WHERE w.lot_stock_id = h.id | ||
540 | 123 | AND d.parent_left >= h.parent_left | ||
541 | 124 | AND d.parent_right <= h.parent_right) | ||
542 | 125 | AND m.location_dest_id NOT IN (SELECT distinct d.id | ||
543 | 126 | FROM stock_warehouse w, stock_location h, stock_location d | ||
544 | 127 | WHERE w.lot_stock_id = h.id | ||
545 | 128 | AND d.parent_left >= h.parent_left | ||
546 | 129 | AND d.parent_right <= h.parent_right) | ||
547 | 130 | GROUP BY m.product_id ORDER BY m.product_id) sl | ||
548 | 131 | WHERE product_inventory.product_id = sl.product_id """) | ||
549 | 132 | |||
550 | 133 | |||
551 | 134 | #onorder_qty | ||
552 | 135 | cr.execute(""" | ||
553 | 136 | UPDATE product_inventory SET onorder_qty = sl.product_qty | ||
554 | 137 | FROM | ||
555 | 138 | (SELECT m.product_id, round(coalesce(sum(m.product_qty * pu.factor / u.factor), 0.0),3) AS product_qty | ||
556 | 139 | FROM stock_move m | ||
557 | 140 | LEFT JOIN product_product pp ON (m.product_id=pp.id) | ||
558 | 141 | LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id) | ||
559 | 142 | LEFT JOIN product_uom pu ON (pt.uom_id=pu.id) | ||
560 | 143 | LEFT JOIN product_uom u ON (m.product_uom=u.id) | ||
561 | 144 | WHERE m.state != 'cancel' AND m.state != 'new' | ||
562 | 145 | AND m.location_id NOT IN (SELECT distinct d.id | ||
563 | 146 | FROM stock_warehouse w, stock_location h, stock_location d | ||
564 | 147 | WHERE w.lot_stock_id = h.id | ||
565 | 148 | AND d.parent_left >= h.parent_left | ||
566 | 149 | AND d.parent_right <= h.parent_right) | ||
567 | 150 | AND m.location_dest_id IN (SELECT distinct d.id | ||
568 | 151 | FROM stock_warehouse w, stock_location h, stock_location d | ||
569 | 152 | WHERE w.lot_stock_id = h.id | ||
570 | 153 | AND d.parent_left >= h.parent_left | ||
571 | 154 | AND d.parent_right <= h.parent_right) | ||
572 | 155 | GROUP BY m.product_id ORDER BY m.product_id) sl | ||
573 | 156 | WHERE product_inventory.product_id = sl.product_id """) | ||
574 | 157 | |||
575 | 158 | # Useless, no ? | ||
576 | 159 | #cr.execute("""UPDATE product_inventory SET onorder_qty = 0.0 WHERE coalesce(onorder_qty,0.0) = 0.0""") | ||
577 | 160 | |||
578 | 161 | cr.execute(""" | ||
579 | 162 | UPDATE product_inventory SET onorder_qty = onorder_qty - sl.product_qty | ||
580 | 163 | FROM | ||
581 | 164 | (SELECT m.product_id, round(coalesce(sum(m.product_qty * pu.factor / u.factor), 0.0),3) AS product_qty | ||
582 | 165 | FROM stock_move m | ||
583 | 166 | LEFT JOIN product_product pp ON (m.product_id=pp.id) | ||
584 | 167 | LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id) | ||
585 | 168 | LEFT JOIN product_uom pu ON (pt.uom_id=pu.id) | ||
586 | 169 | LEFT JOIN product_uom u ON (m.product_uom=u.id) | ||
587 | 170 | WHERE m.state != 'cancel' AND m.state != 'new' | ||
588 | 171 | AND m.location_id IN (SELECT distinct d.id | ||
589 | 172 | FROM stock_warehouse w, stock_location h, stock_location d | ||
590 | 173 | WHERE w.lot_stock_id = h.id | ||
591 | 174 | AND d.parent_left >= h.parent_left | ||
592 | 175 | AND d.parent_right <= h.parent_right) | ||
593 | 176 | AND m.location_dest_id NOT IN (SELECT distinct d.id | ||
594 | 177 | FROM stock_warehouse w, stock_location h, stock_location d | ||
595 | 178 | WHERE w.lot_stock_id = h.id | ||
596 | 179 | AND d.parent_left >= h.parent_left | ||
597 | 180 | AND d.parent_right <= h.parent_right) | ||
598 | 181 | GROUP BY m.product_id ORDER BY m.product_id) sl | ||
599 | 182 | WHERE product_inventory.product_id = sl.product_id """) | ||
600 | 183 | |||
601 | 184 | |||
602 | 185 | #ondraft_qty | ||
603 | 186 | cr.execute(""" | ||
604 | 187 | UPDATE product_inventory SET ondraft_qty = sl.product_qty | ||
605 | 188 | FROM | ||
606 | 189 | (SELECT m.product_id, round(coalesce(sum(m.product_qty * pu.factor / u.factor), 0.0),3) AS product_qty | ||
607 | 190 | FROM purchase_order_line m | ||
608 | 191 | LEFT JOIN product_product pp ON (m.product_id=pp.id) | ||
609 | 192 | LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id) | ||
610 | 193 | LEFT JOIN product_uom pu ON (pt.uom_id=pu.id) | ||
611 | 194 | LEFT JOIN product_uom u ON (m.product_uom=u.id) | ||
612 | 195 | WHERE m.state = 'draft' | ||
613 | 196 | GROUP BY m.product_id ORDER BY m.product_id) sl | ||
614 | 197 | WHERE product_inventory.product_id = sl.product_id """) | ||
615 | 198 | |||
616 | 199 | # Useless, no ? | ||
617 | 200 | #cr.execute("""UPDATE product_inventory SET ondraft_qty = 0.0 WHERE coalesce(ondraft_qty,0.0) = 0.0""") | ||
618 | 201 | |||
619 | 202 | cr.execute("""UPDATE product_inventory SET out_stock = True WHERE onhand_qty < product_safe_qty""") | ||
620 | 203 | return True | ||
621 | 204 | |||
622 | 205 | product_inventory() | ||
623 | 206 | |||
624 | 207 | |||
625 | 208 | class product_inventory_dates(osv.osv): | ||
626 | 209 | _name = 'product.inventory.dates' | ||
627 | 210 | _description = 'Product Inventory between dates' | ||
628 | 211 | _rec_name = "code" | ||
629 | 212 | _order = 'code' | ||
630 | 213 | |||
631 | 214 | _columns = { | ||
632 | 215 | 'product_id': fields.many2one('product.product', 'Product', required=True), | ||
633 | 216 | 'product_tmpl_id': fields.many2one('product.template', 'Product Template', required=True), | ||
634 | 217 | 'start_qty': fields.float("Beginning Quantity", digits_compute=dp.get_precision('Product Unit of Measure')), | ||
635 | 218 | 'buy_qty': fields.float("Purchase Quantity", digits_compute=dp.get_precision('Product Unit of Measure')), | ||
636 | 219 | 'sale_qty': fields.float("Sale Quantity", digits_compute=dp.get_precision('Product Unit of Measure')), | ||
637 | 220 | 'scrap_qty': fields.float("Scrap Quantity", digits_compute=dp.get_precision('Product Unit of Measure')), | ||
638 | 221 | 'consume_qty': fields.float("Consumption Quantity", digits_compute=dp.get_precision('Product Unit of Measure')), | ||
639 | 222 | 'produce_qty': fields.float("Production Quantity", digits_compute=dp.get_precision('Product Unit of Measure')), | ||
640 | 223 | 'end_qty': fields.float("End Quantity", digits_compute=dp.get_precision('Product Unit of Measure')), | ||
641 | 224 | 'start_value': fields.float("Start Value", digits_compute=dp.get_precision('Account')), | ||
642 | 225 | 'start_price': fields.float("Start Price", digits_compute=dp.get_precision('Account')), | ||
643 | 226 | 'buy_value': fields.float("Purchase Value", digits_compute=dp.get_precision('Account')), | ||
644 | 227 | 'sale_value': fields.float("Sale Value", digits_compute=dp.get_precision('Account')), | ||
645 | 228 | 'scrap_value': fields.float("Scrap Value", digits_compute=dp.get_precision('Account')), | ||
646 | 229 | 'consume_value': fields.float("Consumption Value", digits_compute=dp.get_precision('Account')), | ||
647 | 230 | 'produce_value': fields.float("Production Value", digits_compute=dp.get_precision('Account')), | ||
648 | 231 | 'end_value': fields.float("End Value", digits_compute=dp.get_precision('Account')), | ||
649 | 232 | 'end_price': fields.float("End Price", digits_compute=dp.get_precision('Account')), | ||
650 | 233 | 'category_id': fields.many2one('product.category',string='Category'), | ||
651 | 234 | 'stock_type_id': fields.many2one('product.stock_type',string='Stock Type'), | ||
652 | 235 | 'uom_id': fields.many2one('product.uom',string='UoM'), | ||
653 | 236 | 'code': fields.char('SKU', size=128,), | ||
654 | 237 | 'from_date': fields.datetime('Start Date'), | ||
655 | 238 | 'to_date': fields.datetime('End Date'), | ||
656 | 239 | 'prod_active': fields.boolean("Product Active?"), | ||
657 | 240 | } | ||
658 | 241 | _defaults = { | ||
659 | 242 | 'start_qty': 0.00, | ||
660 | 243 | 'end_qty': 0.00, | ||
661 | 244 | 'scrap_qty': 0.00, | ||
662 | 245 | 'consume_qty': 0.00, | ||
663 | 246 | 'produce_qty': 0.00, | ||
664 | 247 | 'buy_qty': 0.00, | ||
665 | 248 | 'sale_qty':0.00, | ||
666 | 249 | } | ||
667 | 250 | |||
668 | 251 | |||
669 | 252 | def _auto_init(self, cr, context=None): | ||
670 | 253 | super(product_inventory_dates, self)._auto_init(cr, context=context) | ||
671 | 254 | ###### Create Stored Function which calculated the Start and End prices ###### | ||
672 | 255 | cr.execute("SELECT proname FROM pg_catalog.pg_proc WHERE proname = 'set_product_inventory_dates_prices'") | ||
673 | 256 | if not cr.fetchone(): | ||
674 | 257 | cr.execute(""" | ||
675 | 258 | CREATE OR REPLACE FUNCTION set_product_inventory_dates_prices() RETURNS integer AS $$ | ||
676 | 259 | DECLARE | ||
677 | 260 | inventory RECORD; | ||
678 | 261 | product_value numeric(5); | ||
679 | 262 | BEGIN | ||
680 | 263 | FOR inventory IN (SELECT product_id, product_tmpl_id, from_date, to_date FROM product_inventory_dates) LOOP | ||
681 | 264 | -- Start Price | ||
682 | 265 | product_value := 0; | ||
683 | 266 | SELECT standard_price INTO product_value | ||
684 | 267 | FROM product_price_history | ||
685 | 268 | WHERE date <= inventory.from_date | ||
686 | 269 | AND template_id = inventory.product_tmpl_id | ||
687 | 270 | ORDER BY date DESC LIMIT 1; | ||
688 | 271 | |||
689 | 272 | IF NOT FOUND THEN | ||
690 | 273 | UPDATE product_inventory_dates SET start_price=0.0 WHERE product_id=inventory.product_id; | ||
691 | 274 | ELSE | ||
692 | 275 | UPDATE product_inventory_dates SET start_price=product_value WHERE product_id=inventory.product_id; | ||
693 | 276 | END IF; | ||
694 | 277 | |||
695 | 278 | -- End Price | ||
696 | 279 | product_value := 0; | ||
697 | 280 | SELECT standard_price INTO product_value | ||
698 | 281 | FROM product_price_history | ||
699 | 282 | WHERE date <= inventory.to_date | ||
700 | 283 | AND template_id = inventory.product_tmpl_id | ||
701 | 284 | ORDER BY date DESC LIMIT 1; | ||
702 | 285 | |||
703 | 286 | IF NOT FOUND THEN | ||
704 | 287 | UPDATE product_inventory_dates SET end_price=0.0 WHERE product_id=inventory.product_id; | ||
705 | 288 | ELSE | ||
706 | 289 | UPDATE product_inventory_dates SET end_price=product_value WHERE product_id=inventory.product_id; | ||
707 | 290 | END IF; | ||
708 | 291 | |||
709 | 292 | END LOOP; | ||
710 | 293 | RETURN 1; | ||
711 | 294 | END; | ||
712 | 295 | $$ LANGUAGE plpgsql;""") | ||
713 | 296 | cr.commit() | ||
714 | 297 | ###### /END: Create Stored Functions ###### | ||
715 | 298 | |||
716 | 299 | |||
717 | 300 | |||
718 | 301 | def compute_inventory(self, cr, uid, context=None): | ||
719 | 302 | from_date = context.get('from_date','2013-04-01') | ||
720 | 303 | to_date = context.get('to_date','2099-12-31') | ||
721 | 304 | |||
722 | 305 | cr.execute("""TRUNCATE TABLE product_inventory_dates""") | ||
723 | 306 | |||
724 | 307 | cr.execute("""INSERT INTO product_inventory_dates(product_id, product_tmpl_id, prod_active, from_date, to_date) | ||
725 | 308 | SELECT id, product_tmpl_id, active, %s, %s FROM product_product | ||
726 | 309 | ORDER BY default_code""", (from_date, to_date)) | ||
727 | 310 | |||
728 | 311 | cr.execute(""" | ||
729 | 312 | UPDATE product_inventory_dates AS i | ||
730 | 313 | SET code = p.default_code, uom_id = t.uom_id, category_id=t.categ_id, stock_type_id = t.stock_type_id, | ||
731 | 314 | scrap_qty=0.000, consume_qty=0.000, produce_qty=0.000, buy_qty=0.000,sale_qty=0.000 | ||
732 | 315 | FROM product_product p, product_template t | ||
733 | 316 | WHERE i.product_id = p.id AND p.product_tmpl_id = t.id""") | ||
734 | 317 | |||
735 | 318 | cr.execute("""SELECT * FROM set_product_inventory_dates_prices()""") | ||
736 | 319 | |||
737 | 320 | #start | ||
738 | 321 | cr.execute(""" | ||
739 | 322 | UPDATE product_inventory_dates | ||
740 | 323 | SET start_qty = sl.product_qty, start_value = round(coalesce((sl.product_qty * product_inventory_dates.start_price), 0.0),3) | ||
741 | 324 | FROM | ||
742 | 325 | (SELECT m.product_id, round(coalesce(sum(m.product_qty * pu.factor / u.factor), 0.0),3) AS product_qty | ||
743 | 326 | FROM stock_move m | ||
744 | 327 | LEFT JOIN product_product pp ON (m.product_id=pp.id) | ||
745 | 328 | LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id) | ||
746 | 329 | LEFT JOIN product_uom pu ON (pt.uom_id=pu.id) | ||
747 | 330 | LEFT JOIN product_uom u ON (m.product_uom=u.id) | ||
748 | 331 | WHERE m.state = 'done' AND m.date <= %s | ||
749 | 332 | AND m.location_id NOT IN (SELECT distinct d.id | ||
750 | 333 | FROM stock_warehouse w, stock_location h, stock_location d | ||
751 | 334 | WHERE w.lot_stock_id = h.id | ||
752 | 335 | AND d.parent_left >= h.parent_left | ||
753 | 336 | AND d.parent_right <= h.parent_right) | ||
754 | 337 | AND m.location_dest_id IN (SELECT distinct d.id | ||
755 | 338 | FROM stock_warehouse w, stock_location h, stock_location d | ||
756 | 339 | WHERE w.lot_stock_id = h.id | ||
757 | 340 | AND d.parent_left >= h.parent_left | ||
758 | 341 | AND d.parent_right <= h.parent_right) | ||
759 | 342 | GROUP BY m.product_id ORDER BY m.product_id) sl | ||
760 | 343 | WHERE product_inventory_dates.product_id = sl.product_id """, (from_date,)) | ||
761 | 344 | |||
762 | 345 | # Useless, no ? | ||
763 | 346 | #cr.execute("""UPDATE product_inventory_dates SET start_qty = 0.0 WHERE coalesce(start_qty,0.0) = 0.0""") | ||
764 | 347 | |||
765 | 348 | cr.execute(""" | ||
766 | 349 | UPDATE product_inventory_dates | ||
767 | 350 | SET start_qty = start_qty - sl.product_qty, start_value = start_value - round(coalesce((sl.product_qty * product_inventory_dates.start_price), 0.0),3) | ||
768 | 351 | FROM | ||
769 | 352 | (SELECT m.product_id, round(coalesce(sum(m.product_qty * pu.factor / u.factor), 0.0),3) AS product_qty | ||
770 | 353 | FROM stock_move m | ||
771 | 354 | LEFT JOIN product_product pp ON (m.product_id=pp.id) | ||
772 | 355 | LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id) | ||
773 | 356 | LEFT JOIN product_uom pu ON (pt.uom_id=pu.id) | ||
774 | 357 | LEFT JOIN product_uom u ON (m.product_uom=u.id) | ||
775 | 358 | WHERE m.state = 'done' AND m.date <= %s | ||
776 | 359 | AND m.location_id IN (SELECT distinct d.id | ||
777 | 360 | FROM stock_warehouse w, stock_location h, stock_location d | ||
778 | 361 | WHERE w.lot_stock_id = h.id | ||
779 | 362 | AND d.parent_left >= h.parent_left | ||
780 | 363 | AND d.parent_right <= h.parent_right) | ||
781 | 364 | AND m.location_dest_id NOT IN (SELECT distinct d.id | ||
782 | 365 | FROM stock_warehouse w, stock_location h, stock_location d | ||
783 | 366 | WHERE w.lot_stock_id = h.id | ||
784 | 367 | AND d.parent_left >= h.parent_left | ||
785 | 368 | AND d.parent_right <= h.parent_right) | ||
786 | 369 | GROUP BY m.product_id ORDER BY m.product_id) sl | ||
787 | 370 | WHERE product_inventory_dates.product_id = sl.product_id """, (from_date,)) | ||
788 | 371 | |||
789 | 372 | |||
790 | 373 | #end | ||
791 | 374 | cr.execute(""" | ||
792 | 375 | UPDATE product_inventory_dates | ||
793 | 376 | SET end_qty = sl.product_qty, end_value = round(coalesce((sl.product_qty * product_inventory_dates.end_price), 0.0),3) | ||
794 | 377 | FROM | ||
795 | 378 | (SELECT m.product_id, round(coalesce(sum(m.product_qty * pu.factor / u.factor), 0.0),3) AS product_qty | ||
796 | 379 | FROM stock_move m | ||
797 | 380 | LEFT JOIN product_product pp ON (m.product_id=pp.id) | ||
798 | 381 | LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id) | ||
799 | 382 | LEFT JOIN product_uom pu ON (pt.uom_id=pu.id) | ||
800 | 383 | LEFT JOIN product_uom u ON (m.product_uom=u.id) | ||
801 | 384 | WHERE m.state = 'done' AND m.date <= %s | ||
802 | 385 | AND m.location_id NOT IN (SELECT distinct d.id | ||
803 | 386 | FROM stock_warehouse w, stock_location h, stock_location d | ||
804 | 387 | WHERE w.lot_stock_id = h.id | ||
805 | 388 | AND d.parent_left >= h.parent_left | ||
806 | 389 | AND d.parent_right <= h.parent_right) | ||
807 | 390 | AND m.location_dest_id IN (SELECT distinct d.id | ||
808 | 391 | FROM stock_warehouse w, stock_location h, stock_location d | ||
809 | 392 | WHERE w.lot_stock_id = h.id | ||
810 | 393 | AND d.parent_left >= h.parent_left | ||
811 | 394 | AND d.parent_right <= h.parent_right) | ||
812 | 395 | GROUP BY m.product_id ORDER BY m.product_id) sl | ||
813 | 396 | WHERE product_inventory_dates.product_id = sl.product_id """, (to_date,)) | ||
814 | 397 | |||
815 | 398 | # Useless, no ? | ||
816 | 399 | #cr.execute("""UPDATE product_inventory_dates SET end_qty = 0.0 WHERE coalesce(end_qty,0.0) = 0.0""") | ||
817 | 400 | |||
818 | 401 | cr.execute(""" | ||
819 | 402 | UPDATE product_inventory_dates | ||
820 | 403 | SET end_qty = end_qty - sl.product_qty, end_value = end_value - round(coalesce((sl.product_qty * product_inventory_dates.end_price), 0.0),3) | ||
821 | 404 | FROM | ||
822 | 405 | (SELECT m.product_id, round(coalesce(sum(m.product_qty * pu.factor / u.factor), 0.0),3) AS product_qty | ||
823 | 406 | FROM stock_move m | ||
824 | 407 | LEFT JOIN product_product pp ON (m.product_id=pp.id) | ||
825 | 408 | LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id) | ||
826 | 409 | LEFT JOIN product_uom pu ON (pt.uom_id=pu.id) | ||
827 | 410 | LEFT JOIN product_uom u ON (m.product_uom=u.id) | ||
828 | 411 | WHERE m.state = 'done' AND m.date <= %s | ||
829 | 412 | AND m.location_id IN (SELECT distinct d.id | ||
830 | 413 | FROM stock_warehouse w, stock_location h, stock_location d | ||
831 | 414 | WHERE w.lot_stock_id = h.id | ||
832 | 415 | AND d.parent_left >= h.parent_left | ||
833 | 416 | AND d.parent_right <= h.parent_right) | ||
834 | 417 | AND m.location_dest_id NOT IN (SELECT distinct d.id | ||
835 | 418 | FROM stock_warehouse w, stock_location h, stock_location d | ||
836 | 419 | WHERE w.lot_stock_id = h.id | ||
837 | 420 | AND d.parent_left >= h.parent_left | ||
838 | 421 | AND d.parent_right <= h.parent_right) | ||
839 | 422 | GROUP BY m.product_id ORDER BY m.product_id) sl | ||
840 | 423 | WHERE product_inventory_dates.product_id = sl.product_id """, (to_date,)) | ||
841 | 424 | |||
842 | 425 | |||
843 | 426 | #buy | ||
844 | 427 | cr.execute(""" | ||
845 | 428 | UPDATE product_inventory_dates | ||
846 | 429 | SET buy_qty = sl.product_qty, buy_value = sl.product_value | ||
847 | 430 | FROM | ||
848 | 431 | (SELECT m.product_id, round(coalesce(sum(m.product_qty * pu.factor / u.factor),0.0),3) AS product_qty, | ||
849 | 432 | round(coalesce(sum(m.amount_total), 0.0),3) AS product_value | ||
850 | 433 | FROM stock_move m | ||
851 | 434 | LEFT JOIN product_product pp ON (m.product_id=pp.id) | ||
852 | 435 | LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id) | ||
853 | 436 | LEFT JOIN product_uom pu ON (pt.uom_id=pu.id) | ||
854 | 437 | LEFT JOIN product_uom u ON (m.product_uom=u.id) | ||
855 | 438 | WHERE m.state = 'done' AND m.date >= %s AND m.date <= %s | ||
856 | 439 | AND m.location_id IN (SELECT id FROM stock_location WHERE usage='supplier') | ||
857 | 440 | AND m.location_dest_id NOT IN (SELECT id FROM stock_location WHERE usage='supplier') | ||
858 | 441 | GROUP BY m.product_id ORDER BY m.product_id) sl | ||
859 | 442 | WHERE product_inventory_dates.product_id = sl.product_id """, (from_date, to_date,)) | ||
860 | 443 | #po_price for return is negative | ||
861 | 444 | cr.execute(""" | ||
862 | 445 | UPDATE product_inventory_dates | ||
863 | 446 | SET buy_qty = buy_qty - sl.product_qty, buy_value = buy_value + sl.product_value | ||
864 | 447 | FROM | ||
865 | 448 | (SELECT m.product_id, round(coalesce(sum(m.product_qty * pu.factor / u.factor),0.0),3) AS product_qty, | ||
866 | 449 | round(coalesce(sum(m.amount_total), 0.0),3) AS product_value | ||
867 | 450 | FROM stock_move m | ||
868 | 451 | LEFT JOIN product_product pp ON (m.product_id=pp.id) | ||
869 | 452 | LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id) | ||
870 | 453 | LEFT JOIN product_uom pu ON (pt.uom_id=pu.id) | ||
871 | 454 | LEFT JOIN product_uom u ON (m.product_uom=u.id) | ||
872 | 455 | WHERE m.state = 'done' AND m.date >= %s AND m.date <= %s | ||
873 | 456 | AND m.location_id NOT IN (SELECT id FROM stock_location WHERE usage='supplier') | ||
874 | 457 | AND m.location_dest_id IN (SELECT id FROM stock_location WHERE usage='supplier') | ||
875 | 458 | GROUP BY m.product_id ORDER BY m.product_id) sl | ||
876 | 459 | WHERE product_inventory_dates.product_id = sl.product_id """, (from_date, to_date,)) | ||
877 | 460 | |||
878 | 461 | |||
879 | 462 | #sale | ||
880 | 463 | cr.execute(""" | ||
881 | 464 | UPDATE product_inventory_dates | ||
882 | 465 | SET sale_qty = sl.product_qty, sale_value = sl.product_value | ||
883 | 466 | FROM | ||
884 | 467 | (SELECT m.product_id, round(coalesce(sum(m.product_qty * pu.factor / u.factor), 0.0),3) AS product_qty, | ||
885 | 468 | round(coalesce(sum(m.product_qty * pu.factor / u.factor * m.price_unit), 0.0),3) AS product_value | ||
886 | 469 | FROM stock_move m | ||
887 | 470 | LEFT JOIN product_product pp ON (m.product_id=pp.id) | ||
888 | 471 | LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id) | ||
889 | 472 | LEFT JOIN product_uom pu ON (pt.uom_id=pu.id) | ||
890 | 473 | LEFT JOIN product_uom u ON (m.product_uom=u.id) | ||
891 | 474 | WHERE m.state = 'done' AND m.date >= %s AND m.date <= %s | ||
892 | 475 | AND m.location_id NOT IN (SELECT id FROM stock_location WHERE usage='customer') | ||
893 | 476 | AND m.location_dest_id IN (SELECT id FROM stock_location WHERE usage='customer') | ||
894 | 477 | GROUP BY m.product_id ORDER BY m.product_id) sl | ||
895 | 478 | WHERE product_inventory_dates.product_id = sl.product_id """, (from_date, to_date,)) | ||
896 | 479 | |||
897 | 480 | cr.execute(""" | ||
898 | 481 | UPDATE product_inventory_dates | ||
899 | 482 | SET sale_qty = sale_qty - sl.product_qty, sale_value = sale_value - sl.product_value | ||
900 | 483 | FROM | ||
901 | 484 | (SELECT m.product_id, round(coalesce(sum(m.product_qty * pu.factor / u.factor), 0.0),3) AS product_qty, | ||
902 | 485 | round(coalesce(sum(m.product_qty * pu.factor / u.factor * m.price_unit), 0.0),3) AS product_value | ||
903 | 486 | FROM stock_move m | ||
904 | 487 | LEFT JOIN product_product pp ON (m.product_id=pp.id) | ||
905 | 488 | LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id) | ||
906 | 489 | LEFT JOIN product_uom pu ON (pt.uom_id=pu.id) | ||
907 | 490 | LEFT JOIN product_uom u ON (m.product_uom=u.id) | ||
908 | 491 | WHERE m.state = 'done' AND m.date >= %s AND m.date <= %s | ||
909 | 492 | AND m.location_id IN (SELECT id FROM stock_location WHERE usage='customer') | ||
910 | 493 | AND m.location_dest_id NOT IN (SELECT id FROM stock_location WHERE usage='customer') | ||
911 | 494 | GROUP BY m.product_id ORDER BY m.product_id) sl | ||
912 | 495 | WHERE product_inventory_dates.product_id = sl.product_id """, (from_date, to_date,)) | ||
913 | 496 | |||
914 | 497 | |||
915 | 498 | #scrap | ||
916 | 499 | cr.execute(""" | ||
917 | 500 | UPDATE product_inventory_dates | ||
918 | 501 | SET scrap_qty = sl.product_qty, scrap_value = sl.product_value | ||
919 | 502 | FROM | ||
920 | 503 | (SELECT m.product_id, round(coalesce(sum(m.product_qty * pu.factor / u.factor), 0.0),3) AS product_qty, | ||
921 | 504 | round(coalesce(sum(m.product_qty * pu.factor / u.factor * m.price_unit), 0.0),3) AS product_value | ||
922 | 505 | FROM stock_move m | ||
923 | 506 | LEFT JOIN product_product pp ON (m.product_id=pp.id) | ||
924 | 507 | LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id) | ||
925 | 508 | LEFT JOIN product_uom pu ON (pt.uom_id=pu.id) | ||
926 | 509 | LEFT JOIN product_uom u ON (m.product_uom=u.id) | ||
927 | 510 | WHERE m.state = 'done' AND m.date >= %s AND m.date <= %s | ||
928 | 511 | AND m.location_id IN (SELECT id FROM stock_location WHERE usage='inventory') | ||
929 | 512 | AND m.location_dest_id NOT IN (SELECT id FROM stock_location WHERE usage='inventory') | ||
930 | 513 | GROUP BY m.product_id ORDER BY m.product_id) sl | ||
931 | 514 | WHERE product_inventory_dates.product_id = sl.product_id """, (from_date, to_date,)) | ||
932 | 515 | |||
933 | 516 | cr.execute(""" | ||
934 | 517 | UPDATE product_inventory_dates | ||
935 | 518 | SET scrap_qty = scrap_qty - sl.product_qty, scrap_value = scrap_value - sl.product_value | ||
936 | 519 | FROM | ||
937 | 520 | (SELECT m.product_id, round(coalesce(sum(m.product_qty * pu.factor / u.factor), 0.0),3) AS product_qty, | ||
938 | 521 | round(coalesce(sum(m.product_qty * pu.factor / u.factor * m.price_unit), 0.0),3) AS product_value | ||
939 | 522 | FROM stock_move m | ||
940 | 523 | LEFT JOIN product_product pp ON (m.product_id=pp.id) | ||
941 | 524 | LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id) | ||
942 | 525 | LEFT JOIN product_uom pu ON (pt.uom_id=pu.id) | ||
943 | 526 | LEFT JOIN product_uom u ON (m.product_uom=u.id) | ||
944 | 527 | WHERE m.state = 'done' AND m.date >= %s AND m.date <= %s | ||
945 | 528 | AND m.location_id NOT IN (SELECT id FROM stock_location WHERE usage='inventory') | ||
946 | 529 | AND m.location_dest_id IN (SELECT id FROM stock_location WHERE usage='inventory') | ||
947 | 530 | GROUP BY m.product_id ORDER BY m.product_id) sl | ||
948 | 531 | WHERE product_inventory_dates.product_id = sl.product_id """, (from_date, to_date,)) | ||
949 | 532 | |||
950 | 533 | |||
951 | 534 | #consume | ||
952 | 535 | cr.execute(""" | ||
953 | 536 | UPDATE product_inventory_dates | ||
954 | 537 | SET consume_qty = sl.product_qty, consume_value = sl.product_value | ||
955 | 538 | FROM | ||
956 | 539 | (SELECT m.product_id, round(coalesce(sum(m.product_qty * pu.factor / u.factor), 0.0),3) AS product_qty, | ||
957 | 540 | round(coalesce(sum(m.product_qty * pu.factor / u.factor * m.price_unit), 0.0),3) AS product_value | ||
958 | 541 | FROM stock_move m | ||
959 | 542 | --INNER JOIN mrp_production_move_ids mp on m.id = mp.move_id | ||
960 | 543 | LEFT JOIN product_product pp ON (m.product_id=pp.id) | ||
961 | 544 | LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id) | ||
962 | 545 | LEFT JOIN product_uom pu ON (pt.uom_id=pu.id) | ||
963 | 546 | LEFT JOIN product_uom u ON (m.product_uom=u.id) | ||
964 | 547 | WHERE m.state = 'done' AND m.date >= %s AND m.date <= %s | ||
965 | 548 | AND m.location_id NOT IN (SELECT id FROM stock_location WHERE usage='production') | ||
966 | 549 | AND m.location_dest_id IN (SELECT id FROM stock_location WHERE usage='production') | ||
967 | 550 | GROUP BY m.product_id ORDER BY m.product_id) sl | ||
968 | 551 | WHERE product_inventory_dates.product_id = sl.product_id """, (from_date, to_date,)) | ||
969 | 552 | |||
970 | 553 | cr.execute(""" | ||
971 | 554 | UPDATE product_inventory_dates | ||
972 | 555 | SET consume_qty = consume_qty - sl.product_qty, consume_value = consume_value - sl.product_value | ||
973 | 556 | FROM | ||
974 | 557 | (SELECT m.product_id, round(coalesce(sum(m.product_qty * pu.factor / u.factor), 0.0),3) AS product_qty, | ||
975 | 558 | round(coalesce(sum(m.product_qty * pu.factor / u.factor * m.price_unit), 0.0),3) AS product_value | ||
976 | 559 | FROM stock_move m | ||
977 | 560 | --INNER JOIN mrp_production_move_ids mp on m.id = mp.move_id | ||
978 | 561 | LEFT JOIN product_product pp ON (m.product_id=pp.id) | ||
979 | 562 | LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id) | ||
980 | 563 | LEFT JOIN product_uom pu ON (pt.uom_id=pu.id) | ||
981 | 564 | LEFT JOIN product_uom u ON (m.product_uom=u.id) | ||
982 | 565 | WHERE m.state = 'done' AND m.date >= %s AND m.date <= %s | ||
983 | 566 | AND m.location_id IN (SELECT id FROM stock_location WHERE usage='production') | ||
984 | 567 | AND m.location_dest_id NOT IN (SELECT id FROM stock_location WHERE usage='production') | ||
985 | 568 | GROUP BY m.product_id ORDER BY m.product_id) sl | ||
986 | 569 | WHERE product_inventory_dates.product_id = sl.product_id """, (from_date, to_date,)) | ||
987 | 570 | |||
988 | 571 | |||
989 | 572 | #produce | ||
990 | 573 | cr.execute(""" | ||
991 | 574 | UPDATE product_inventory_dates | ||
992 | 575 | SET produce_qty = sl.product_qty, produce_value = sl.product_value | ||
993 | 576 | FROM | ||
994 | 577 | (SELECT m.product_id, round(coalesce(sum(m.product_qty * pu.factor / u.factor), 0.0),3) AS product_qty, | ||
995 | 578 | round(coalesce(sum(m.product_qty * pu.factor / u.factor * m.price_unit), 0.0),3) AS product_value | ||
996 | 579 | FROM stock_move m | ||
997 | 580 | LEFT JOIN product_product pp ON (m.product_id=pp.id) | ||
998 | 581 | LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id) | ||
999 | 582 | LEFT JOIN product_uom pu ON (pt.uom_id=pu.id) | ||
1000 | 583 | LEFT JOIN product_uom u ON (m.product_uom=u.id) | ||
1001 | 584 | WHERE m.state = 'done' AND m.date >= %s AND m.date <= %s | ||
1002 | 585 | AND m.production_id IS NOT NULL | ||
1003 | 586 | AND m.location_id IN (SELECT id FROM stock_location WHERE usage='production') | ||
1004 | 587 | AND m.location_dest_id NOT IN (SELECT id FROM stock_location WHERE usage='production') | ||
1005 | 588 | GROUP BY m.product_id ORDER BY m.product_id) sl | ||
1006 | 589 | WHERE product_inventory_dates.product_id = sl.product_id """, (from_date, to_date,)) | ||
1007 | 590 | |||
1008 | 591 | cr.execute(""" | ||
1009 | 592 | UPDATE product_inventory_dates | ||
1010 | 593 | SET produce_qty = produce_qty - sl.product_qty, produce_value = produce_value - sl.product_value | ||
1011 | 594 | FROM | ||
1012 | 595 | (SELECT m.product_id, round(coalesce(sum(m.product_qty * pu.factor / u.factor), 0.0),3) AS product_qty, | ||
1013 | 596 | round(coalesce(sum(m.product_qty * pu.factor / u.factor * m.price_unit), 0.0),3) AS product_value | ||
1014 | 597 | FROM stock_move m | ||
1015 | 598 | LEFT JOIN product_product pp ON (m.product_id=pp.id) | ||
1016 | 599 | LEFT JOIN product_template pt ON (pp.product_tmpl_id=pt.id) | ||
1017 | 600 | LEFT JOIN product_uom pu ON (pt.uom_id=pu.id) | ||
1018 | 601 | LEFT JOIN product_uom u ON (m.product_uom=u.id) | ||
1019 | 602 | WHERE m.state = 'done' AND m.date >= %s AND m.date <= %s | ||
1020 | 603 | AND m.production_id IS NOT NULL | ||
1021 | 604 | AND m.location_id NOT IN (SELECT id FROM stock_location WHERE usage='production') | ||
1022 | 605 | AND m.location_dest_id IN (SELECT id FROM stock_location WHERE usage='production') | ||
1023 | 606 | GROUP BY m.product_id ORDER BY m.product_id) sl | ||
1024 | 607 | WHERE product_inventory_dates.product_id = sl.product_id """, (from_date, to_date,)) | ||
1025 | 608 | |||
1026 | 609 | return True | ||
1027 | 610 | |||
1028 | 611 | product_inventory_dates() | ||
1029 | 612 | |||
1030 | 613 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
1031 | 0 | 614 | ||
1032 | === added file 'product_inventory_warning/product_view.xml' | |||
1033 | --- product_inventory_warning/product_view.xml 1970-01-01 00:00:00 +0000 | |||
1034 | +++ product_inventory_warning/product_view.xml 2013-08-26 08:54:27 +0000 | |||
1035 | @@ -0,0 +1,137 @@ | |||
1036 | 1 | <?xml version="1.0" encoding="UTF-8"?> | ||
1037 | 2 | <openerp> | ||
1038 | 3 | <data> | ||
1039 | 4 | <record id="product_normal_form_view_safeqty" model="ir.ui.view"> | ||
1040 | 5 | <field name="name">product.normal.form.safeqty</field> | ||
1041 | 6 | <field name="model">product.product</field> | ||
1042 | 7 | <field name="type">form</field> | ||
1043 | 8 | <field name="inherit_id" ref="stock.view_normal_procurement_locations_form"/> | ||
1044 | 9 | <field name="arch" type="xml"> | ||
1045 | 10 | <xpath expr="//field[@name='incoming_qty']" position="before"> | ||
1046 | 11 | <field name="product_safe_qty"/> | ||
1047 | 12 | </xpath> | ||
1048 | 13 | </field> | ||
1049 | 14 | </record> | ||
1050 | 15 | |||
1051 | 16 | <record id="view_product_inventory_tree" model="ir.ui.view"> | ||
1052 | 17 | <field name="name">product.inventory.tree</field> | ||
1053 | 18 | <field name="model">product.inventory</field> | ||
1054 | 19 | <field name="type">tree</field> | ||
1055 | 20 | <field name="arch" type="xml"> | ||
1056 | 21 | <tree string="Product Inventory" colors="red:onhand_qty < product_safe_qty" > | ||
1057 | 22 | <field name="stock_type_id"/> | ||
1058 | 23 | <field name="category_id"/> | ||
1059 | 24 | <field name="product_id"/> | ||
1060 | 25 | <field name="name"/> | ||
1061 | 26 | <field name="onhand_qty"/> | ||
1062 | 27 | <field name="onorder_qty"/> | ||
1063 | 28 | <field name="uom_id"/> | ||
1064 | 29 | <field name="ondraft_qty"/> | ||
1065 | 30 | <field name="product_safe_qty"/> | ||
1066 | 31 | <field name="code" invisible="1"/> | ||
1067 | 32 | <field name="date"/> | ||
1068 | 33 | </tree> | ||
1069 | 34 | </field> | ||
1070 | 35 | </record> | ||
1071 | 36 | |||
1072 | 37 | <record id="view_product_inventory_search" model="ir.ui.view"> | ||
1073 | 38 | <field name="name">product.inventory.search</field> | ||
1074 | 39 | <field name="model">product.inventory</field> | ||
1075 | 40 | <field name="type">search</field> | ||
1076 | 41 | <field name="arch" type="xml"> | ||
1077 | 42 | <search string="Product Inventory"> | ||
1078 | 43 | <field name="product_id"/> | ||
1079 | 44 | <field name="stock_type_id"/> | ||
1080 | 45 | <field name="category_id"/> | ||
1081 | 46 | <field name="onhand_qty"/> | ||
1082 | 47 | <filter string='Out of Stock' icon="terp-mrp" domain="[('out_stock','=',True)]"/> | ||
1083 | 48 | <group expand='0' string='Group by...'> | ||
1084 | 49 | <filter string='Category' icon="terp-stock_symbol-selection" domain="[]" context="{'group_by' : 'category_id'}"/> | ||
1085 | 50 | <filter string='Stock Type' icon="terp-mrp" domain="[]" context="{'group_by' : 'stock_type_id'}"/> | ||
1086 | 51 | <filter string='Product' icon="terp-go-home" domain="[]" context="{'group_by' : 'product_id'}"/> | ||
1087 | 52 | </group> | ||
1088 | 53 | </search> | ||
1089 | 54 | </field> | ||
1090 | 55 | </record> | ||
1091 | 56 | |||
1092 | 57 | <record id="action_product_inventory_tree" model="ir.actions.act_window"> | ||
1093 | 58 | <field name="name">Product Inventory Warning</field> | ||
1094 | 59 | <field name="res_model">product.inventory</field> | ||
1095 | 60 | <field name="view_type">form</field> | ||
1096 | 61 | <field name="view_mode">tree</field> | ||
1097 | 62 | <field name="search_view_id" ref="view_product_inventory_search"/> | ||
1098 | 63 | <field name="limit">60</field> | ||
1099 | 64 | </record> | ||
1100 | 65 | |||
1101 | 66 | <menuitem | ||
1102 | 67 | id="menu_action_product_inventory_tree" | ||
1103 | 68 | parent="purchase.menu_procurement_management_product" | ||
1104 | 69 | action="action_product_inventory_tree" | ||
1105 | 70 | sequence = "95"/> | ||
1106 | 71 | |||
1107 | 72 | |||
1108 | 73 | <record id="view_product_inventory_dates_tree" model="ir.ui.view"> | ||
1109 | 74 | <field name="name">product.inventory.dates.tree</field> | ||
1110 | 75 | <field name="model">product.inventory.dates</field> | ||
1111 | 76 | <field name="type">tree</field> | ||
1112 | 77 | <field name="arch" type="xml"> | ||
1113 | 78 | <tree string="Product Inventory between dates"> | ||
1114 | 79 | <field name="stock_type_id"/> | ||
1115 | 80 | <field name="category_id"/> | ||
1116 | 81 | <field name="product_id"/> | ||
1117 | 82 | <field name="start_qty" sum="Start Qty"/> | ||
1118 | 83 | <field name="start_value" sum="Start Value"/> | ||
1119 | 84 | <field name="buy_qty" sum="Buy Qty"/> | ||
1120 | 85 | <field name="buy_value" sum="Buy Value"/> | ||
1121 | 86 | <field name="sale_qty" sum="Sale Qty"/> | ||
1122 | 87 | <field name="sale_value" sum="Sale Value"/> | ||
1123 | 88 | <field name="scrap_qty" sum="Scrap Qty"/> | ||
1124 | 89 | <field name="scrap_value" sum="Scrap Value"/> | ||
1125 | 90 | <field name="consume_qty" sum="Consume Qty"/> | ||
1126 | 91 | <field name="consume_value" sum="Consume Value"/> | ||
1127 | 92 | <field name="produce_qty" sum="Produce Qty"/> | ||
1128 | 93 | <field name="produce_value" sum="Produce Value"/> | ||
1129 | 94 | <field name="end_qty" sum="End Qty"/> | ||
1130 | 95 | <field name="end_value" sum="End Value"/> | ||
1131 | 96 | <field name="code" invisible="1"/> | ||
1132 | 97 | <field name="uom_id"/> | ||
1133 | 98 | <field name="from_date"/> | ||
1134 | 99 | <field name="to_date"/> | ||
1135 | 100 | </tree> | ||
1136 | 101 | </field> | ||
1137 | 102 | </record> | ||
1138 | 103 | |||
1139 | 104 | <record id="view_product_inventory_dates_search" model="ir.ui.view"> | ||
1140 | 105 | <field name="name">product.inventory.dates.search</field> | ||
1141 | 106 | <field name="model">product.inventory.dates</field> | ||
1142 | 107 | <field name="type">search</field> | ||
1143 | 108 | <field name="arch" type="xml"> | ||
1144 | 109 | <search string="Product Inventory between dates"> | ||
1145 | 110 | <field name="product_id"/> | ||
1146 | 111 | <field name="stock_type_id"/> | ||
1147 | 112 | <field name="category_id"/> | ||
1148 | 113 | <group expand='0' string='Group by...'> | ||
1149 | 114 | <filter string='Category' icon="terp-stock_symbol-selection" domain="[]" context="{'group_by' : 'category_id'}"/> | ||
1150 | 115 | <filter string='Stock Type' icon="terp-mrp" domain="[]" context="{'group_by' : 'stock_type_id'}"/> | ||
1151 | 116 | <filter string='To Date' icon="terp-go-home" domain="[]" context="{'group_by' : 'to_date'}"/> | ||
1152 | 117 | </group> | ||
1153 | 118 | </search> | ||
1154 | 119 | </field> | ||
1155 | 120 | </record> | ||
1156 | 121 | |||
1157 | 122 | <record id="action_product_inventory_dates_tree" model="ir.actions.act_window"> | ||
1158 | 123 | <field name="name">Product Inventory between dates</field> | ||
1159 | 124 | <field name="res_model">product.inventory.dates</field> | ||
1160 | 125 | <field name="view_type">form</field> | ||
1161 | 126 | <field name="view_mode">tree</field> | ||
1162 | 127 | <field name="search_view_id" ref="view_product_inventory_dates_search"/> | ||
1163 | 128 | <field name="limit">60</field> | ||
1164 | 129 | </record> | ||
1165 | 130 | |||
1166 | 131 | <menuitem | ||
1167 | 132 | id="menu_action_product_inventory_dates_tree" | ||
1168 | 133 | parent="purchase.menu_procurement_management_product" | ||
1169 | 134 | action="action_product_inventory_dates_tree" | ||
1170 | 135 | sequence = "97"/> | ||
1171 | 136 | </data> | ||
1172 | 137 | </openerp> | ||
1173 | 0 | 138 | ||
1174 | === added directory 'product_inventory_warning/security' | |||
1175 | === added file 'product_inventory_warning/security/ir.model.access.csv' | |||
1176 | --- product_inventory_warning/security/ir.model.access.csv 1970-01-01 00:00:00 +0000 | |||
1177 | +++ product_inventory_warning/security/ir.model.access.csv 2013-08-26 08:54:27 +0000 | |||
1178 | @@ -0,0 +1,3 @@ | |||
1179 | 1 | id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
1180 | 2 | access_product_inventory_wro,product_inventory wro,product_inventory_warning.model_product_inventory,stock.group_stock_user,1,0,0,0 | ||
1181 | 3 | access_product_inventorydates_wro,product_inventory_dates wro,product_inventory_warning.model_product_inventory_dates,stock.group_stock_user,1,0,0,0 | ||
1182 | 0 | \ No newline at end of file | 4 | \ No newline at end of file |
1183 | 1 | 5 | ||
1184 | === added directory 'product_inventory_warning/wizard' | |||
1185 | === added file 'product_inventory_warning/wizard/__init__.py' | |||
1186 | --- product_inventory_warning/wizard/__init__.py 1970-01-01 00:00:00 +0000 | |||
1187 | +++ product_inventory_warning/wizard/__init__.py 2013-08-26 08:54:27 +0000 | |||
1188 | @@ -0,0 +1,26 @@ | |||
1189 | 1 | # -*- coding: utf-8 -*- | ||
1190 | 2 | ############################################################################## | ||
1191 | 3 | # | ||
1192 | 4 | # OpenERP, Open Source Management Solution | ||
1193 | 5 | # Copyright (c) 2010-2013 Elico Corp. All Rights Reserved. | ||
1194 | 6 | # Author: Andy Lu <andy.lu@elico-corp.com> | ||
1195 | 7 | # | ||
1196 | 8 | # This program is free software: you can redistribute it and/or modify | ||
1197 | 9 | # it under the terms of the GNU Affero General Public License as | ||
1198 | 10 | # published by the Free Software Foundation, either version 3 of the | ||
1199 | 11 | # License, or (at your option) any later version. | ||
1200 | 12 | # | ||
1201 | 13 | # This program is distributed in the hope that it will be useful, | ||
1202 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1203 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1204 | 16 | # GNU Affero General Public License for more details. | ||
1205 | 17 | # | ||
1206 | 18 | # You should have received a copy of the GNU Affero General Public License | ||
1207 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1208 | 20 | # | ||
1209 | 21 | ############################################################################## | ||
1210 | 22 | |||
1211 | 23 | import product_qty | ||
1212 | 24 | import product_sfc | ||
1213 | 25 | |||
1214 | 26 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
1215 | 0 | 27 | ||
1216 | === added file 'product_inventory_warning/wizard/product_qty.py' | |||
1217 | --- product_inventory_warning/wizard/product_qty.py 1970-01-01 00:00:00 +0000 | |||
1218 | +++ product_inventory_warning/wizard/product_qty.py 2013-08-26 08:54:27 +0000 | |||
1219 | @@ -0,0 +1,69 @@ | |||
1220 | 1 | # -*- coding: utf-8 -*- | ||
1221 | 2 | ############################################################################## | ||
1222 | 3 | # | ||
1223 | 4 | # OpenERP, Open Source Management Solution | ||
1224 | 5 | # Copyright (c) 2010-Today Elico Corp. All Rights Reserved. | ||
1225 | 6 | # Author: Andy Lu <andy.lu@elico-corp.com> | ||
1226 | 7 | # | ||
1227 | 8 | # This program is free software: you can redistribute it and/or modify | ||
1228 | 9 | # it under the terms of the GNU Affero General Public License as | ||
1229 | 10 | # published by the Free Software Foundation, either version 3 of the | ||
1230 | 11 | # License, or (at your option) any later version. | ||
1231 | 12 | # | ||
1232 | 13 | # This program is distributed in the hope that it will be useful, | ||
1233 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1234 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1235 | 16 | # GNU Affero General Public License for more details. | ||
1236 | 17 | # | ||
1237 | 18 | # You should have received a copy of the GNU Affero General Public License | ||
1238 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1239 | 20 | # | ||
1240 | 21 | ############################################################################## | ||
1241 | 22 | |||
1242 | 23 | |||
1243 | 24 | from osv import fields, osv | ||
1244 | 25 | from tools.translate import _ | ||
1245 | 26 | |||
1246 | 27 | class product_qty(osv.osv_memory): | ||
1247 | 28 | _name = "run.product.inventory" | ||
1248 | 29 | _description = "Compute Product Inventory" | ||
1249 | 30 | _columns = { | ||
1250 | 31 | |||
1251 | 32 | } | ||
1252 | 33 | |||
1253 | 34 | def compute_inventory(self, cr, uid, ids, context=None): | ||
1254 | 35 | """ To compute inventory. | ||
1255 | 36 | @param self: The object pointer. | ||
1256 | 37 | @param cr: A database cursor | ||
1257 | 38 | @param uid: ID of the user currently logged in | ||
1258 | 39 | @param ids: the ID or list of IDs if we want more than one | ||
1259 | 40 | @param context: A standard dictionary | ||
1260 | 41 | @return: | ||
1261 | 42 | """ | ||
1262 | 43 | if context is None: | ||
1263 | 44 | context = {} | ||
1264 | 45 | |||
1265 | 46 | pi_obj = self.pool.get('product.inventory') | ||
1266 | 47 | pi_obj.compute_inventory(cr, uid) | ||
1267 | 48 | |||
1268 | 49 | mod_obj = self.pool.get('ir.model.data') | ||
1269 | 50 | |||
1270 | 51 | res = mod_obj.get_object_reference(cr, uid, 'product_inventory_warning', 'view_product_inventory_tree') | ||
1271 | 52 | res_id = res and res[1] or False, | ||
1272 | 53 | |||
1273 | 54 | return { | ||
1274 | 55 | 'name': _('Product Inventory'), | ||
1275 | 56 | 'view_type': 'form', | ||
1276 | 57 | 'view_mode': 'tree', | ||
1277 | 58 | 'view_id': res_id, | ||
1278 | 59 | 'res_model': 'product.inventory', | ||
1279 | 60 | 'context': "{}", | ||
1280 | 61 | 'type': 'ir.actions.act_window', | ||
1281 | 62 | 'target': 'current', | ||
1282 | 63 | 'res_id': False, | ||
1283 | 64 | } | ||
1284 | 65 | #return {'type': 'ir.actions.act_window_close'} | ||
1285 | 66 | |||
1286 | 67 | product_qty() | ||
1287 | 68 | |||
1288 | 69 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
1289 | 0 | 70 | ||
1290 | === added file 'product_inventory_warning/wizard/product_qty_view.xml' | |||
1291 | --- product_inventory_warning/wizard/product_qty_view.xml 1970-01-01 00:00:00 +0000 | |||
1292 | +++ product_inventory_warning/wizard/product_qty_view.xml 2013-08-26 08:54:27 +0000 | |||
1293 | @@ -0,0 +1,32 @@ | |||
1294 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
1295 | 2 | <openerp> | ||
1296 | 3 | <data> | ||
1297 | 4 | |||
1298 | 5 | <record id="view_run_product_inventory" model="ir.ui.view"> | ||
1299 | 6 | <field name="name">Compute Product Inventory</field> | ||
1300 | 7 | <field name="model">run.product.inventory</field> | ||
1301 | 8 | <field name="type">form</field> | ||
1302 | 9 | <field name="arch" type="xml"> | ||
1303 | 10 | <form string="Compute Product Inventory"> | ||
1304 | 11 | <separator string="Compute Product Inventory based on current stock moves" colspan="4" /> | ||
1305 | 12 | <separator string="" colspan="4" /> | ||
1306 | 13 | <button special="cancel" string="_Cancel" icon='gtk-cancel'/> | ||
1307 | 14 | <button name="compute_inventory" string="Compute" type="object" icon="gtk-ok"/> | ||
1308 | 15 | </form> | ||
1309 | 16 | </field> | ||
1310 | 17 | </record> | ||
1311 | 18 | |||
1312 | 19 | <act_window name="Compute Product Inventory Warning" | ||
1313 | 20 | res_model="run.product.inventory" | ||
1314 | 21 | view_mode="form" | ||
1315 | 22 | target="new" | ||
1316 | 23 | context="{}" | ||
1317 | 24 | id="action_run_product_inventory"/> | ||
1318 | 25 | |||
1319 | 26 | <menuitem | ||
1320 | 27 | id="menu_action_run_product_inventory" | ||
1321 | 28 | parent="purchase.menu_procurement_management_product" | ||
1322 | 29 | action="action_run_product_inventory" | ||
1323 | 30 | sequence = "90"/> | ||
1324 | 31 | </data> | ||
1325 | 32 | </openerp> | ||
1326 | 0 | 33 | ||
1327 | === added file 'product_inventory_warning/wizard/product_sfc.py' | |||
1328 | --- product_inventory_warning/wizard/product_sfc.py 1970-01-01 00:00:00 +0000 | |||
1329 | +++ product_inventory_warning/wizard/product_sfc.py 2013-08-26 08:54:27 +0000 | |||
1330 | @@ -0,0 +1,80 @@ | |||
1331 | 1 | # -*- coding: utf-8 -*- | ||
1332 | 2 | ############################################################################## | ||
1333 | 3 | # | ||
1334 | 4 | # OpenERP, Open Source Management Solution | ||
1335 | 5 | # Copyright (c) 2010-Today Elico Corp. All Rights Reserved. | ||
1336 | 6 | # Author: Andy Lu <andy.lu@elico-corp.com> | ||
1337 | 7 | # | ||
1338 | 8 | # This program is free software: you can redistribute it and/or modify | ||
1339 | 9 | # it under the terms of the GNU Affero General Public License as | ||
1340 | 10 | # published by the Free Software Foundation, either version 3 of the | ||
1341 | 11 | # License, or (at your option) any later version. | ||
1342 | 12 | # | ||
1343 | 13 | # This program is distributed in the hope that it will be useful, | ||
1344 | 14 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
1345 | 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
1346 | 16 | # GNU Affero General Public License for more details. | ||
1347 | 17 | # | ||
1348 | 18 | # You should have received a copy of the GNU Affero General Public License | ||
1349 | 19 | # along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
1350 | 20 | # | ||
1351 | 21 | ############################################################################## | ||
1352 | 22 | |||
1353 | 23 | |||
1354 | 24 | from osv import fields, osv | ||
1355 | 25 | from tools.translate import _ | ||
1356 | 26 | import time | ||
1357 | 27 | |||
1358 | 28 | class product_sfc(osv.osv_memory): | ||
1359 | 29 | _name = "run.product.inventory.dates" | ||
1360 | 30 | _description = "Compute Product Inventory betweend dates" | ||
1361 | 31 | _columns = { | ||
1362 | 32 | |||
1363 | 33 | 'from_date': fields.datetime('From', required=True), | ||
1364 | 34 | 'to_date': fields.datetime('To', required=True), | ||
1365 | 35 | |||
1366 | 36 | } | ||
1367 | 37 | _defaults = { | ||
1368 | 38 | 'from_date': lambda *a: time.strftime('%Y-%m-%d 16:00:00'), | ||
1369 | 39 | 'to_date': lambda *a: time.strftime('%Y-%m-%d 15:59:59'), | ||
1370 | 40 | } | ||
1371 | 41 | |||
1372 | 42 | def compute_inventory(self, cr, uid, ids, context=None): | ||
1373 | 43 | """ To compute inventory. | ||
1374 | 44 | @param self: The object pointer. | ||
1375 | 45 | @param cr: A database cursor | ||
1376 | 46 | @param uid: ID of the user currently logged in | ||
1377 | 47 | @param ids: the ID or list of IDs if we want more than one | ||
1378 | 48 | @param context: A standard dictionary | ||
1379 | 49 | @return: | ||
1380 | 50 | """ | ||
1381 | 51 | if context is None: | ||
1382 | 52 | context = {} | ||
1383 | 53 | data = self.browse(cr, uid, ids, context=context)[0] | ||
1384 | 54 | context['from_date'] = data.from_date | ||
1385 | 55 | context['to_date'] = data.to_date | ||
1386 | 56 | |||
1387 | 57 | pi_obj = self.pool.get('product.inventory.dates') | ||
1388 | 58 | pi_obj.compute_inventory(cr, uid, context) | ||
1389 | 59 | |||
1390 | 60 | mod_obj = self.pool.get('ir.model.data') | ||
1391 | 61 | |||
1392 | 62 | res = mod_obj.get_object_reference(cr, uid, 'product_inventory_warning', 'view_product_inventory_dates_tree') | ||
1393 | 63 | res_id = res and res[1] or False, | ||
1394 | 64 | |||
1395 | 65 | return { | ||
1396 | 66 | 'name': _('Product Inventory between dates'), | ||
1397 | 67 | 'view_type': 'form', | ||
1398 | 68 | 'view_mode': 'tree', | ||
1399 | 69 | 'view_id': res_id, | ||
1400 | 70 | 'res_model': 'product.inventory.dates', | ||
1401 | 71 | 'context': "{}", | ||
1402 | 72 | 'type': 'ir.actions.act_window', | ||
1403 | 73 | 'target': 'current', | ||
1404 | 74 | 'res_id': False, | ||
1405 | 75 | } | ||
1406 | 76 | #return {'type': 'ir.actions.act_window_close'} | ||
1407 | 77 | |||
1408 | 78 | product_sfc() | ||
1409 | 79 | |||
1410 | 80 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: | ||
1411 | 0 | 81 | ||
1412 | === added file 'product_inventory_warning/wizard/product_sfc_view.xml' | |||
1413 | --- product_inventory_warning/wizard/product_sfc_view.xml 1970-01-01 00:00:00 +0000 | |||
1414 | +++ product_inventory_warning/wizard/product_sfc_view.xml 2013-08-26 08:54:27 +0000 | |||
1415 | @@ -0,0 +1,62 @@ | |||
1416 | 1 | <?xml version="1.0" encoding="utf-8"?> | ||
1417 | 2 | <openerp> | ||
1418 | 3 | <data> | ||
1419 | 4 | |||
1420 | 5 | <record id="view_run_product_inventory" model="ir.ui.view"> | ||
1421 | 6 | <field name="name">Compute Product Inventory</field> | ||
1422 | 7 | <field name="model">run.product.inventory</field> | ||
1423 | 8 | <field name="type">form</field> | ||
1424 | 9 | <field name="arch" type="xml"> | ||
1425 | 10 | <form string="Compute Product Inventory"> | ||
1426 | 11 | <separator string="Compute Product Inventory based on current stock moves" colspan="4" /> | ||
1427 | 12 | <separator string="" colspan="4" /> | ||
1428 | 13 | <button special="cancel" string="_Cancel" icon='gtk-cancel'/> | ||
1429 | 14 | <button name="compute_inventory" string="Compute" type="object" icon="gtk-ok"/> | ||
1430 | 15 | </form> | ||
1431 | 16 | </field> | ||
1432 | 17 | </record> | ||
1433 | 18 | |||
1434 | 19 | <act_window name="Compute Product Inventory Warning" | ||
1435 | 20 | res_model="run.product.inventory" | ||
1436 | 21 | view_mode="form" | ||
1437 | 22 | target="new" | ||
1438 | 23 | context="{}" | ||
1439 | 24 | id="action_run_product_inventory"/> | ||
1440 | 25 | |||
1441 | 26 | <menuitem | ||
1442 | 27 | id="menu_action_run_product_inventory" | ||
1443 | 28 | parent="purchase.menu_procurement_management_product" | ||
1444 | 29 | action="action_run_product_inventory" | ||
1445 | 30 | sequence = "90"/> | ||
1446 | 31 | |||
1447 | 32 | |||
1448 | 33 | <record id="view_run_product_inventory_dates" model="ir.ui.view"> | ||
1449 | 34 | <field name="name">Compute Product Inventory between dates</field> | ||
1450 | 35 | <field name="model">run.product.inventory.dates</field> | ||
1451 | 36 | <field name="type">form</field> | ||
1452 | 37 | <field name="arch" type="xml"> | ||
1453 | 38 | <form string="Compute Product Inventory between dates"> | ||
1454 | 39 | <separator string="Compute Product Inventory based on current stock moves and dates" colspan="4" /> | ||
1455 | 40 | <field name="from_date"/> | ||
1456 | 41 | <field name="to_date"/> | ||
1457 | 42 | <separator string="" colspan="4" /> | ||
1458 | 43 | <button special="cancel" string="_Cancel" icon='gtk-cancel'/> | ||
1459 | 44 | <button name="compute_inventory" string="Compute" type="object" icon="gtk-ok"/> | ||
1460 | 45 | </form> | ||
1461 | 46 | </field> | ||
1462 | 47 | </record> | ||
1463 | 48 | |||
1464 | 49 | <act_window name="Compute Product Inventory between dates" | ||
1465 | 50 | res_model="run.product.inventory.dates" | ||
1466 | 51 | view_mode="form" | ||
1467 | 52 | target="new" | ||
1468 | 53 | context="{}" | ||
1469 | 54 | id="action_run_product_inventory_dates"/> | ||
1470 | 55 | |||
1471 | 56 | <menuitem | ||
1472 | 57 | id="menu_action_run_product_inventory_dates" | ||
1473 | 58 | parent="purchase.menu_procurement_management_product" | ||
1474 | 59 | action="action_run_product_inventory_dates" | ||
1475 | 60 | sequence = "96"/> | ||
1476 | 61 | </data> | ||
1477 | 62 | </openerp> |
Hello Jean,
Based on the description of the MP and the module, I would say that the feature is already in OpenERP (OpenERP already provides the qty of product). I think you should add some documentation to explain what OpenERP doesn't do, what your module brings and how to use it.
Please fix PEP8 issues and add the pot file.
I have never seen a module with so much SQL queries. I would be interested to know how it scales.
Otherwise LGTM.
Thanks for your work!