Merge lp:~mathieu-julius/stock-logistic-tracking/stock-logistic-tracking70 into lp:stock-logistic-tracking
- stock-logistic-tracking70
- Merge into 7.0
Status: | Merged |
---|---|
Merged at revision: | 16 |
Proposed branch: | lp:~mathieu-julius/stock-logistic-tracking/stock-logistic-tracking70 |
Merge into: | lp:stock-logistic-tracking |
Diff against target: |
6170 lines (+4162/-1034) 84 files modified
Readme (+104/-0) stock_barcode_reader/__openerp__.py (+5/-4) stock_barcode_reader/package_acquisition.py (+8/-17) stock_barcode_reader/stock.py (+3/-5) stock_barcode_reader/wizard/reference.py (+4/-6) stock_inventory_sequence/__init__.py (+24/-0) stock_inventory_sequence/__openerp__.py (+47/-0) stock_inventory_sequence/inventory.py (+31/-0) stock_inventory_sequence/inventory_sequence.xml (+19/-0) stock_move_packaging/__openerp__.py (+12/-10) stock_move_packaging/stock.py (+5/-7) stock_move_packaging/stock_view.xml (+1/-2) stock_move_packaging/wizard/move_pack.py (+19/-12) stock_move_packaging/wizard/move_pack_view.xml (+0/-2) stock_move_split_default/__init__.py (+24/-0) stock_move_split_default/__openerp__.py (+45/-0) stock_move_split_default/stock_tracking.py (+38/-0) stock_product_category_tracked/__init__.py (+24/-0) stock_product_category_tracked/__openerp__.py (+47/-0) stock_product_category_tracked/product_category.py (+51/-0) stock_product_category_tracked/product_category_view.xml (+31/-0) stock_tracking_add_move/__openerp__.py (+6/-5) stock_tracking_add_move/stock.py (+6/-12) stock_tracking_add_move/stock_view.xml (+53/-56) stock_tracking_add_move/wizard/add_move.py (+3/-5) stock_tracking_add_move/wizard/add_move_view.xml (+61/-64) stock_tracking_add_remove/__init__.py (+25/-0) stock_tracking_add_remove/__openerp__.py (+53/-0) stock_tracking_add_remove/data/type.xml (+16/-0) stock_tracking_add_remove/security/ir.model.access.csv (+2/-0) stock_tracking_add_remove/stock_tracking.py (+278/-0) stock_tracking_add_remove/stock_view.xml (+48/-0) stock_tracking_add_remove/wizard/__init__.py (+25/-0) stock_tracking_add_remove/wizard/add_object.py (+132/-0) stock_tracking_add_remove/wizard/add_object_view.xml (+69/-0) stock_tracking_add_remove/wizard/remove_object.py (+227/-0) stock_tracking_add_remove/wizard/remove_object_view.xml (+55/-0) stock_tracking_add_remove_pack/__init__.py (+25/-0) stock_tracking_add_remove_pack/__openerp__.py (+53/-0) stock_tracking_add_remove_pack/data/type.xml (+11/-0) stock_tracking_add_remove_pack/stock_tracking.py (+79/-0) stock_tracking_add_remove_pack/stock_view.xml (+29/-0) stock_tracking_add_remove_pack/wizard/__init__.py (+25/-0) stock_tracking_add_remove_pack/wizard/add_pack.py (+62/-0) stock_tracking_add_remove_pack/wizard/add_pack_view.xml (+21/-0) stock_tracking_add_remove_pack/wizard/remove_pack.py (+46/-0) stock_tracking_add_remove_pack/wizard/remove_pack_view.xml (+19/-0) stock_tracking_child/__init__.py (+24/-0) stock_tracking_child/__openerp__.py (+48/-0) stock_tracking_child/i18n/fr.po (+72/-0) stock_tracking_child/stock_tracking.py (+151/-0) stock_tracking_child/stock_tracking_view.xml (+82/-0) stock_tracking_extended/__openerp__.py (+9/-9) stock_tracking_extended/i18n/fr.po (+62/-215) stock_tracking_extended/inventory_sequence.xml (+0/-19) stock_tracking_extended/stock_tracking.py (+98/-227) stock_tracking_extended/stock_tracking_view.xml (+100/-274) stock_tracking_prodlot/__init__.py (+24/-0) stock_tracking_prodlot/__openerp__.py (+45/-0) stock_tracking_prodlot/stock_tracking.py (+42/-0) stock_tracking_reopen/__openerp__.py (+7/-7) stock_tracking_reopen/stock.py (+58/-53) stock_tracking_reopen/stock_view.xml (+21/-23) stock_tracking_state/__init__.py (+24/-0) stock_tracking_state/__openerp__.py (+48/-0) stock_tracking_state/i18n/fr.po (+76/-0) stock_tracking_state/stock_tracking.py (+83/-0) stock_tracking_state/stock_tracking_view.xml (+46/-0) stock_tracking_swap/__init__.py (+25/-0) stock_tracking_swap/__openerp__.py (+50/-0) stock_tracking_swap/i18n/fr.po (+161/-0) stock_tracking_swap/stock.py (+46/-0) stock_tracking_swap/stock_view.xml (+34/-0) stock_tracking_swap/wizard/__init__.py (+24/-0) stock_tracking_swap/wizard/swap.py (+194/-0) stock_tracking_swap/wizard/swap_view.xml (+74/-0) stock_tracking_swap_pack/__init__.py (+25/-0) stock_tracking_swap_pack/__openerp__.py (+52/-0) stock_tracking_swap_pack/i18n/fr.po (+110/-0) stock_tracking_swap_pack/stock.py (+44/-0) stock_tracking_swap_pack/stock_view.xml (+29/-0) stock_tracking_swap_pack/wizard/__init__.py (+24/-0) stock_tracking_swap_pack/wizard/swap.py (+140/-0) stock_tracking_swap_pack/wizard/swap_view.xml (+39/-0) |
To merge this branch: | bzr merge lp:~mathieu-julius/stock-logistic-tracking/stock-logistic-tracking70 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Guewen Baconnier @ Camptocamp | Approve | ||
Review via email: mp+150276@code.launchpad.net |
Commit message
Description of the change
Lot of modifications.
Improvements to split modules. There is now a state module (to open close packs), a child module to put packs inside a pack...
We've added some new features to be able to add product / prodlot or packs inside a pack, to swap objects inside of it too.
The stock_barcode_
There are still some improvement to do on the stock_tracking_
Maybe we can remove some modules of this branch (stock_
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote : | # |
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote : | # |
Previous comment:
Can you split your reviews into smaller chunks please? => the next times
s/real plain/real pain/
Mathieu Vatel - Julius Network Solutions (mathieu-julius) wrote : | # |
> Previous comment:
> Can you split your reviews into smaller chunks please? => the next times
> s/real plain/real pain/
=> For sure sorry for this.
We've made a lot split inside modules to made them installable and functional... but for the next times we will split the reviews !!
Mathieu Vatel - Julius Network Solutions (mathieu-julius) wrote : | # |
> l.223-254 Why do you add 30 lines of commented code?
=> This has been removed
> l.753 remove the lambda,
> 'use_exist': True,
=> done
> Please try to wrap the long lines to 80 chars (l.876, 877 for instance
> and in _columns in general).
> You can use the " continuation for that:
>
> 'track_incoming': fields.boolean(
> 'Track Incoming Lots',
> help="Forces to specify a Serial Number for all moves containing "
> "this product and coming from a Supplier Location"),
=> Try to wrap most of them, (there's maybe still some of them)
> l.910-927: indentation is broken (mix tabs and spaces) (in a general
> manner, check the xml files, a lot of them seems to contain tabs).
=> I've replace all tabs inside installable modules by spaces
> l.1170, can you remove the commented dependency if it not required anymore?
=> Done
> l.1254,1271,etc. use 'if context is None' instead of 'if context == None'
=> Done for all the installable modules
> By the way, you don't need to initialize context to {} if you do not use it
> in the body of the method
=> Of course you're right.
> l.1269,etc. the docstring of a methods gos below the declaration, not above
=> This should has been done
> l.1309,1311,etc. prefer the ternary ... if ... else form:
> move_data.name if move_data else prodlot_data.name
=> Done for the one I've found
> l.1356-
=> Done
> l.1383 use inline comment with #
=> Done
> l.1419,1481 why do you not set `pack_history_id` in the `default` argument of
> `copy` the line above?
=> No, the pack_history_id is written in the move which have been copied not in the copy.
> l.1661-
> value of {}.get
> type = context.
=> Done
> l.1677,1877 context.
=> Done
> l.1967,1968 the inline comments here are really misleading
=> I've deleted them
> l.2414-2418, very redundant when you can simply do active_id =
> context.
=> Done
> l.2780,2801,etc.: for product in product_list: (or .iterkeys())
=> Done rev 46
> l.2801: replace by
> product_
=> Done rev 46
> Do not forget to put 'installable' to True on the migrated addons.
=> It's done, all the module with installable False do not work fine on the 7.0
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote : | # |
Thanks for your changes!
Preview Diff
1 | === added file 'Readme' |
2 | --- Readme 1970-01-01 00:00:00 +0000 |
3 | +++ Readme 2013-03-06 10:58:19 +0000 |
4 | @@ -0,0 +1,104 @@ |
5 | +########################################## Stock-Logistic-Tracking ###################################################### |
6 | + |
7 | +-=- stock_tracking_extended -=- |
8 | + |
9 | +Depends : stock |
10 | +Presentation : |
11 | +This module add some info into packs to get a better tracking of products and serial lots inside of these packs |
12 | + |
13 | +-=- stock_inventory_sequence -=- |
14 | + |
15 | +Depends : stock |
16 | +Presentation : |
17 | +This module adds a sequence for generating automatically inventories name |
18 | + |
19 | +<!> <!> <!> -=- stock_move_split_default -=- <!> <!> <!> |
20 | + |
21 | +Depends : stock |
22 | +Presentation : |
23 | +This module allows to define and identify package in parent or child |
24 | + |
25 | +-=- stock_product_category_tracked -=- |
26 | + |
27 | +Depends : stock |
28 | +Presentation : |
29 | +This module adds a field into the product category to define if this should be tracked or not |
30 | + |
31 | +<!> <!> <!> -=- stock_tracking_prodlot -=- <!> <!> <!> |
32 | + |
33 | +Depends : stock |
34 | +Presentation : |
35 | +This module allows to define and identify package in parent or child |
36 | + |
37 | +-=- stock_tracking_add_remove -=- |
38 | + |
39 | +Depends : stock, stock_tracking_extended |
40 | +Presentation : |
41 | +This module add a wizard to fill in packaging |
42 | +This wizard is used to add or remove a product object from a package |
43 | +Adding to the historical movements and parents objects |
44 | + |
45 | +-=- stock_tracking_child -=- |
46 | + |
47 | +Depends : stock, stock_tracking_extended |
48 | +Presentation : |
49 | +This module allows to define and identify package in parent or child |
50 | + |
51 | +-=- stock_move_packaging -=- |
52 | + |
53 | +Depends : stock, stock_tracking_extended |
54 | +Presentation : |
55 | +This module allows to move packing with a wizard and adds fields for source location and destination location in history |
56 | + |
57 | +-=- stock_tracking_state -=- |
58 | + |
59 | +Depends : stock, stock_tracking_extended |
60 | +Presentation : |
61 | +This module will ad the state field to make changes of closed packed |
62 | + |
63 | +-=- stock_tracking_swap -=- |
64 | + |
65 | +Depends : stock, stock_tracking_extended |
66 | +Presentation : |
67 | +This module add a wizard to swap products or prodlots in packaging |
68 | +This wizard is used to replace an object from a package |
69 | +Adding to the historical movements and parent objects |
70 | + |
71 | +-=- stock_tracking_add_move -=- |
72 | + |
73 | +Depends : stock, stock_tracking_extended, tr_barcode |
74 | +Presentation : |
75 | +This module add a wizard to fill in packaging |
76 | +This wizard is used to add or remove an object from a package |
77 | +Adding to the historical movements and parents objects |
78 | + |
79 | +-=- stock_tracking_add_remove_pack -=- |
80 | + |
81 | +Depends : stock_tracking_extended, stock_tracking_child, stock_tracking_add_product |
82 | +Presentation : |
83 | +This module add a wizard to fill in packaging |
84 | +This wizard is used to add or remove a pack object from a package |
85 | +Adding to the historical movements and parents objects |
86 | + |
87 | +-=- stock_barcode_reader -=- |
88 | + |
89 | +Depends : stock, stock_tracking_extended, stock_tracking_add_move |
90 | +Presentation : |
91 | +This module is an ergonomic wizard to fill in package |
92 | +Add menu for acquisition of package |
93 | +Add button in Stock picking for start acquisition |
94 | + |
95 | +-=- stock_tracking_reopen -=- |
96 | + |
97 | +Depends : stock, stock_tracking_extended, stock_tracking_state |
98 | +Presentation : |
99 | +This module change reference of the packaging if it's re-open |
100 | + |
101 | +-=- stock_tracking_swap_pack -=- |
102 | + |
103 | +Depends : stock, stock_tracking_extended, stock_tracking_child |
104 | +Presentation : |
105 | +This module add a wizard to swap packs in packaging |
106 | +This wizard is used to replace an object from a package |
107 | +Adding to the historical movements and parent objects |
108 | + |
109 | |
110 | === modified file 'stock_barcode_reader/__openerp__.py' |
111 | --- stock_barcode_reader/__openerp__.py 2013-02-13 08:35:37 +0000 |
112 | +++ stock_barcode_reader/__openerp__.py 2013-03-06 10:58:19 +0000 |
113 | @@ -45,11 +45,10 @@ |
114 | "stock_tracking_extended", |
115 | "stock_tracking_add_move", |
116 | ], |
117 | - "category" : "Customs/Stock", |
118 | - "init_xml" : [], |
119 | - "demo_xml" : [], |
120 | + "category" : "Warehouse Management", |
121 | "images" : ['images/Acquisition.png'], |
122 | - "update_xml" : [ |
123 | + "demo" : [], |
124 | + "data" : [ |
125 | 'wizard/reference_view.xml', |
126 | 'acquisition_view.xml', |
127 | 'stock_view.xml', |
128 | @@ -60,3 +59,5 @@ |
129 | 'installable': False, |
130 | 'active': False, |
131 | } |
132 | + |
133 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
134 | |
135 | === modified file 'stock_barcode_reader/package_acquisition.py' |
136 | --- stock_barcode_reader/package_acquisition.py 2012-11-07 17:52:33 +0000 |
137 | +++ stock_barcode_reader/package_acquisition.py 2013-03-06 10:58:19 +0000 |
138 | @@ -19,14 +19,14 @@ |
139 | # |
140 | ################################################################################# |
141 | |
142 | -from osv import osv,fields |
143 | -from tools.translate import _ |
144 | -from report import report_sxw |
145 | -from report_aeroo import report_aeroo |
146 | +from openerp.osv import fields, osv, orm |
147 | +from openerp.tools.translate import _ |
148 | +from openerp.report import report_sxw |
149 | +from openerp.addons.report_aeroo import report_aeroo |
150 | import datetime |
151 | from tools import misc |
152 | |
153 | -class stock_fill_inventory(osv.osv_memory): |
154 | +class stock_fill_inventory(orm.TransientModel): |
155 | _inherit = "stock.fill.inventory" |
156 | def fill_inventory(self, cr, uid, ids, context=None): |
157 | res = super(stock_fill_inventory, self).fill_inventory(cr, uid, ids, context=context) |
158 | @@ -35,9 +35,8 @@ |
159 | if stock_inventory_obj.browse(cr, uid, context.get('active_id', False), context).location_id: |
160 | stock_inventory_obj.write(cr, uid, context.get('active_id', False), {'location_id': fill_inventory.location_id.id}) |
161 | return res |
162 | -stock_fill_inventory() |
163 | |
164 | -class acquisition_acquisition(osv.osv): |
165 | +class acquisition_acquisition(orm.Model): |
166 | |
167 | _name = "acquisition.acquisition" |
168 | _order = 'id desc' |
169 | @@ -627,9 +626,7 @@ |
170 | |
171 | return res |
172 | |
173 | -acquisition_acquisition() |
174 | - |
175 | -class acquisition_list(osv.osv): |
176 | +class acquisition_list(orm.Model): |
177 | |
178 | _name = "acquisition.list" |
179 | _columns = { |
180 | @@ -671,9 +668,7 @@ |
181 | ['name']), |
182 | ] |
183 | |
184 | -acquisition_list() |
185 | - |
186 | -class acquisition_setting(osv.osv): |
187 | +class acquisition_setting(orm.Model): |
188 | |
189 | _name = "acquisition.setting" |
190 | _columns = { |
191 | @@ -798,8 +793,4 @@ |
192 | # 'product_qty': 1} |
193 | # inventory_line_obj.create(cr, uid, vals) |
194 | |
195 | - |
196 | - |
197 | -acquisition_setting() |
198 | - |
199 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
200 | |
201 | === modified file 'stock_barcode_reader/stock.py' |
202 | --- stock_barcode_reader/stock.py 2012-11-02 10:27:43 +0000 |
203 | +++ stock_barcode_reader/stock.py 2013-03-06 10:58:19 +0000 |
204 | @@ -19,10 +19,10 @@ |
205 | # |
206 | ################################################################################# |
207 | |
208 | -from osv import osv,fields |
209 | -from tools.translate import _ |
210 | +from openerp.osv import osv, fields, orm |
211 | +from openerp.tools.translate import _ |
212 | |
213 | -class stock_picking(osv.osv): |
214 | +class stock_picking(orm.Model): |
215 | _inherit = "stock.picking" |
216 | |
217 | def start_acquisition(self, cr, uid, ids, context=None): |
218 | @@ -51,6 +51,4 @@ |
219 | } |
220 | return action |
221 | |
222 | -stock_picking() |
223 | - |
224 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
225 | |
226 | === modified file 'stock_barcode_reader/wizard/reference.py' |
227 | --- stock_barcode_reader/wizard/reference.py 2012-11-02 10:27:43 +0000 |
228 | +++ stock_barcode_reader/wizard/reference.py 2013-03-06 10:58:19 +0000 |
229 | @@ -19,10 +19,10 @@ |
230 | # |
231 | ################################################################################# |
232 | |
233 | -from osv import osv,fields |
234 | -from tools.translate import _ |
235 | +from openerp.osv import fields, osv, orm |
236 | +from openerp.tools.translate import _ |
237 | |
238 | -class stock_reference(osv.osv_memory): |
239 | +class stock_reference(orm.TransientModel): |
240 | |
241 | _name = "stock.reference" |
242 | _description = 'Products Acquisition' |
243 | @@ -30,7 +30,7 @@ |
244 | # _rec_name = 'reference' |
245 | |
246 | def _get_track_id(self, cr, uid, context=None): |
247 | - if context == None: |
248 | + if context is None: |
249 | context = {} |
250 | return context.get('active_id',False) |
251 | |
252 | @@ -95,6 +95,4 @@ |
253 | |
254 | return {'value': {'reference' : False, 'text' : text}} |
255 | |
256 | -stock_reference() |
257 | - |
258 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
259 | |
260 | === added directory 'stock_inventory_sequence' |
261 | === added file 'stock_inventory_sequence/__init__.py' |
262 | --- stock_inventory_sequence/__init__.py 1970-01-01 00:00:00 +0000 |
263 | +++ stock_inventory_sequence/__init__.py 2013-03-06 10:58:19 +0000 |
264 | @@ -0,0 +1,24 @@ |
265 | +# -*- coding: utf-8 -*- |
266 | +################################################################################# |
267 | +# |
268 | +# OpenERP, Open Source Management Solution |
269 | +# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr> |
270 | +# |
271 | +# This program is free software: you can redistribute it and/or modify |
272 | +# it under the terms of the GNU General Public License as published by |
273 | +# the Free Software Foundation, either version 3 of the License, or |
274 | +# (at your option) any later version. |
275 | +# |
276 | +# This program is distributed in the hope that it will be useful, |
277 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
278 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
279 | +# GNU General Public License for more details. |
280 | +# |
281 | +# You should have received a copy of the GNU General Public License |
282 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
283 | +# |
284 | +################################################################################# |
285 | + |
286 | +import inventory |
287 | + |
288 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
289 | \ No newline at end of file |
290 | |
291 | === added file 'stock_inventory_sequence/__openerp__.py' |
292 | --- stock_inventory_sequence/__openerp__.py 1970-01-01 00:00:00 +0000 |
293 | +++ stock_inventory_sequence/__openerp__.py 2013-03-06 10:58:19 +0000 |
294 | @@ -0,0 +1,47 @@ |
295 | +# -*- coding: utf-8 -*- |
296 | +################################################################################# |
297 | +# |
298 | +# OpenERP, Open Source Management Solution |
299 | +# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr> |
300 | +# |
301 | +# This program is free software: you can redistribute it and/or modify |
302 | +# it under the terms of the GNU General Public License as published by |
303 | +# the Free Software Foundation, either version 3 of the License, or |
304 | +# (at your option) any later version. |
305 | +# |
306 | +# This program is distributed in the hope that it will be useful, |
307 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
308 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
309 | +# GNU General Public License for more details. |
310 | +# |
311 | +# You should have received a copy of the GNU General Public License |
312 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
313 | +# |
314 | +################################################################################# |
315 | + |
316 | +{ |
317 | + "name" : "Stock Inventory Sequence", |
318 | + "version" : "1.0", |
319 | + "author" : "Julius Network Solutions", |
320 | + "description" : """ |
321 | + |
322 | +Presentation: |
323 | + |
324 | +This module adds a sequence for generating automatically inventories name |
325 | + |
326 | +""", |
327 | + "website" : "http://www.julius.fr", |
328 | + "depends" : [ |
329 | + "stock", |
330 | + ], |
331 | + "category" : "Warehouse Management", |
332 | + "demo" : [], |
333 | + "data" : [ |
334 | + 'inventory_sequence.xml', |
335 | + ], |
336 | + 'test': [], |
337 | + 'installable': True, |
338 | + 'active': False, |
339 | +} |
340 | + |
341 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
342 | |
343 | === added file 'stock_inventory_sequence/inventory.py' |
344 | --- stock_inventory_sequence/inventory.py 1970-01-01 00:00:00 +0000 |
345 | +++ stock_inventory_sequence/inventory.py 2013-03-06 10:58:19 +0000 |
346 | @@ -0,0 +1,31 @@ |
347 | + # -*- coding: utf-8 -*- |
348 | +################################################################################# |
349 | +# |
350 | +# OpenERP, Open Source Management Solution |
351 | +# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr> |
352 | +# |
353 | +# This program is free software: you can redistribute it and/or modify |
354 | +# it under the terms of the GNU General Public License as published by |
355 | +# the Free Software Foundation, either version 3 of the License, or |
356 | +# (at your option) any later version. |
357 | +# |
358 | +# This program is distributed in the hope that it will be useful, |
359 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
360 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
361 | +# GNU General Public License for more details. |
362 | +# |
363 | +# You should have received a copy of the GNU General Public License |
364 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
365 | +# |
366 | +################################################################################# |
367 | + |
368 | +from openerp.osv import fields, osv, orm |
369 | +from openerp.tools.translate import _ |
370 | + |
371 | +class stock_inventory(orm.Model): |
372 | + _inherit = 'stock.inventory' |
373 | + _defaults = { |
374 | + 'name': lambda x, y, z, c: x.pool.get('ir.sequence').next_by_code(y, z, 'stock.inventory') or '/' |
375 | + } |
376 | + |
377 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
378 | |
379 | === added file 'stock_inventory_sequence/inventory_sequence.xml' |
380 | --- stock_inventory_sequence/inventory_sequence.xml 1970-01-01 00:00:00 +0000 |
381 | +++ stock_inventory_sequence/inventory_sequence.xml 2013-03-06 10:58:19 +0000 |
382 | @@ -0,0 +1,19 @@ |
383 | +<?xml version="1.0" encoding="utf-8"?> |
384 | +<openerp> |
385 | + <data noupdate="1"> |
386 | + |
387 | + <!-- Sequences for stock.inventory --> |
388 | + <record id="seq_type_inventory_order" model="ir.sequence.type"> |
389 | + <field name="name">Inventory Order</field> |
390 | + <field name="code">stock.inventory</field> |
391 | + </record> |
392 | + |
393 | + <record id="seq_sale_order" model="ir.sequence"> |
394 | + <field name="name">Inventory Order</field> |
395 | + <field name="code">stock.inventory</field> |
396 | + <field name="prefix">INV</field> |
397 | + <field name="padding">3</field> |
398 | + </record> |
399 | + |
400 | + </data> |
401 | +</openerp> |
402 | |
403 | === modified file 'stock_move_packaging/__openerp__.py' |
404 | --- stock_move_packaging/__openerp__.py 2013-02-13 08:35:37 +0000 |
405 | +++ stock_move_packaging/__openerp__.py 2013-03-06 10:58:19 +0000 |
406 | @@ -33,18 +33,20 @@ |
407 | """, |
408 | "website" : "http://www.julius.fr", |
409 | "depends" : [ |
410 | - "stock", |
411 | - "stock_tracking_extended", |
412 | - ], |
413 | - "category" : "Customs/Stock", |
414 | - "init_xml" : [], |
415 | - "demo_xml" : [], |
416 | - "images" : ['images/Move packaging.png'], |
417 | - "update_xml" : [ |
418 | - 'stock_view.xml', |
419 | - 'wizard/move_pack_view.xml', |
420 | + "stock", |
421 | + "stock_tracking_extended", |
422 | + ], |
423 | + "category" : "Warehouse Management", |
424 | +# "images" : ['images/Move packaging.png'], |
425 | + "demo" : [], |
426 | + "data" : [ |
427 | + 'stock_view.xml', |
428 | + 'wizard/move_pack_view.xml', |
429 | ], |
430 | 'test': [], |
431 | 'installable': False, |
432 | 'active': False, |
433 | } |
434 | + |
435 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
436 | + |
437 | |
438 | === modified file 'stock_move_packaging/stock.py' |
439 | --- stock_move_packaging/stock.py 2012-03-07 12:56:37 +0000 |
440 | +++ stock_move_packaging/stock.py 2013-03-06 10:58:19 +0000 |
441 | @@ -19,10 +19,10 @@ |
442 | # |
443 | ################################################################################# |
444 | |
445 | -from osv import fields, osv |
446 | -from tools.translate import _ |
447 | +from openerp.osv import fields, osv, orm |
448 | +from openerp.tools.translate import _ |
449 | |
450 | -class stock_tracking_history(osv.osv): |
451 | +class stock_tracking_history(orm.Model): |
452 | |
453 | _inherit = "stock.tracking.history" |
454 | |
455 | @@ -30,7 +30,7 @@ |
456 | res = super(stock_tracking_history, self)._get_types(cr, uid, context) |
457 | if not res: |
458 | res = [] |
459 | - res = res + [('move','Move')] |
460 | + res = res + [('move',_('Move'))] |
461 | return res |
462 | |
463 | _columns = { |
464 | @@ -39,7 +39,5 @@ |
465 | 'location_dest_id': fields.many2one('stock.location', 'Destination Location'), |
466 | # 'move_ids': fields.one2many('stock.move', 'pack_history_id', 'Associated moves'), |
467 | } |
468 | - |
469 | -stock_tracking_history() |
470 | |
471 | -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
472 | \ No newline at end of file |
473 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
474 | |
475 | === modified file 'stock_move_packaging/stock_view.xml' |
476 | --- stock_move_packaging/stock_view.xml 2012-03-07 12:56:37 +0000 |
477 | +++ stock_move_packaging/stock_view.xml 2013-03-06 10:58:19 +0000 |
478 | @@ -5,7 +5,6 @@ |
479 | <record id="view_tracking_history_tree" model="ir.ui.view"> |
480 | <field name="name">stock.tracking.history.tree</field> |
481 | <field name="model">stock.tracking.history</field> |
482 | - <field name="type">tree</field> |
483 | <field name="inherit_id" ref="stock_tracking_extended.view_tracking_history_tree"/> |
484 | <field name="arch" type="xml"> |
485 | <field name="type" position="after"> |
486 | @@ -18,7 +17,6 @@ |
487 | <record id="view_tracking_history_form" model="ir.ui.view"> |
488 | <field name="name">stock.tracking.history.form</field> |
489 | <field name="model">stock.tracking.history</field> |
490 | - <field name="type">form</field> |
491 | <field name="inherit_id" ref="stock_tracking_extended.view_tracking_history_form"/> |
492 | <field name="arch" type="xml"> |
493 | <field name="type" position="after"> |
494 | @@ -27,5 +25,6 @@ |
495 | </field> |
496 | </field> |
497 | </record> |
498 | + |
499 | </data> |
500 | </openerp> |
501 | |
502 | === modified file 'stock_move_packaging/wizard/move_pack.py' |
503 | --- stock_move_packaging/wizard/move_pack.py 2012-03-20 18:24:57 +0000 |
504 | +++ stock_move_packaging/wizard/move_pack.py 2013-03-06 10:58:19 +0000 |
505 | @@ -19,11 +19,12 @@ |
506 | # |
507 | ################################################################################# |
508 | |
509 | -from osv import fields, osv |
510 | -from tools.translate import _ |
511 | +from openerp.osv import fields, osv, orm |
512 | +from openerp.tools.translate import _ |
513 | +from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT |
514 | import time |
515 | |
516 | -class stock_move_packaging(osv.osv_memory): |
517 | +class stock_move_packaging(orm.TransientModel): |
518 | |
519 | _name = "stock.move.packaging" |
520 | |
521 | @@ -33,7 +34,7 @@ |
522 | } |
523 | |
524 | _defaults = { |
525 | - 'pack_id': lambda s,cr,uid,c: c.get('active_id',False), |
526 | + 'pack_id': lambda s,cr,uid,c: c.get('active_id') or False, |
527 | } |
528 | |
529 | def move_pack(self, cr, uid, ids, context=None): |
530 | @@ -47,13 +48,21 @@ |
531 | context = {} |
532 | |
533 | context.update({'from_pack':True}) |
534 | - for obj in self.browse(cr, uid, ids): |
535 | + for obj in self.browse(cr, uid, ids, context=context): |
536 | pack = obj.pack_id |
537 | if not pack or not obj.location_dest_id: |
538 | continue |
539 | + """ |
540 | + This is related to the module stock_tracking_child |
541 | + TODO: remove this from this method to be able to install it without stock_tracking_child |
542 | + """ |
543 | if pack.parent_id: |
544 | raise osv.except_osv(_('Warning!'),_('You cannot move this pack because it\'s inside of an other pack: %s.') % (pack.parent_id.name)) |
545 | for child in pack.child_ids: |
546 | + """ |
547 | + This is related to the module stock_tracking_state |
548 | + TODO: remove this from this method to be able to install it without stock_tracking_state |
549 | + """ |
550 | if child.state != 'close': |
551 | raise osv.except_osv(_('Warning!'),_('You cannot move this pack because there is a none closed pack inside of it: %s.') % (child.name)) |
552 | current_type = pack.location_id.usage |
553 | @@ -66,7 +75,7 @@ |
554 | pick_type = 'in' |
555 | elif type == 'customer': |
556 | pick_type = 'out' |
557 | - date = time.strftime('%Y-%m-%d %H:%M:%S'), |
558 | + date = time.strftime(DEFAULT_SERVER_DATETIME_FORMAT), |
559 | pick_id = picking_obj.create(cr, uid, { |
560 | 'type': pick_type, |
561 | 'auto_picking': 'draft', |
562 | @@ -75,7 +84,7 @@ |
563 | 'invoice_state': 'none', |
564 | 'date': date, |
565 | 'state': 'done', |
566 | - }) |
567 | + }, context=context) |
568 | |
569 | child_packs = tracking_obj.hierarchy_ids(pack) |
570 | for child_pack in child_packs: |
571 | @@ -84,7 +93,7 @@ |
572 | 'type': 'move', |
573 | 'location_id': child_pack.location_id.id, |
574 | 'location_dest_id': obj.location_dest_id.id, |
575 | - }) |
576 | + }, context=context) |
577 | |
578 | for move in child_pack.current_move_ids: |
579 | defaults = { |
580 | @@ -96,10 +105,8 @@ |
581 | 'date_expected': date, |
582 | } |
583 | new_id = move_obj.copy(cr, uid, move.id, default=defaults, context=context) |
584 | - move_obj.write(cr, uid, [move.id], {'pack_history_id': hist_id, 'move_dest_id': new_id}) |
585 | - tracking_obj.write(cr, uid, [child_pack.id], {'location_id': obj.location_dest_id.id}) |
586 | + move_obj.write(cr, uid, [move.id], {'pack_history_id': hist_id, 'move_dest_id': new_id}, context=context) |
587 | + tracking_obj.write(cr, uid, [child_pack.id], {'location_id': obj.location_dest_id.id}, context=context) |
588 | return {'type': 'ir.actions.act_window_close'} |
589 | - |
590 | -stock_move_packaging() |
591 | |
592 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
593 | \ No newline at end of file |
594 | |
595 | === modified file 'stock_move_packaging/wizard/move_pack_view.xml' |
596 | --- stock_move_packaging/wizard/move_pack_view.xml 2012-03-07 12:56:37 +0000 |
597 | +++ stock_move_packaging/wizard/move_pack_view.xml 2013-03-06 10:58:19 +0000 |
598 | @@ -5,7 +5,6 @@ |
599 | <record id="view_move_pack" model="ir.ui.view"> |
600 | <field name="name">Move Pack</field> |
601 | <field name="model">stock.move.packaging</field> |
602 | - <field name="type">form</field> |
603 | <field name="arch" type="xml"> |
604 | <form string="Move Pack"> |
605 | <group width="660" height="275"> |
606 | @@ -34,7 +33,6 @@ |
607 | <record id="view_tracking_form_move_inherit" model="ir.ui.view"> |
608 | <field name="name">stock.tracking.form.inherit</field> |
609 | <field name="model">stock.tracking</field> |
610 | - <field name="type">form</field> |
611 | <field name="inherit_id" ref="stock_tracking_extended.view_tracking_form_inherit"/> |
612 | <field name="arch" type="xml"> |
613 | <button name="set_close" position="after"> |
614 | |
615 | === added directory 'stock_move_split_default' |
616 | === added file 'stock_move_split_default/__init__.py' |
617 | --- stock_move_split_default/__init__.py 1970-01-01 00:00:00 +0000 |
618 | +++ stock_move_split_default/__init__.py 2013-03-06 10:58:19 +0000 |
619 | @@ -0,0 +1,24 @@ |
620 | +# -*- coding: utf-8 -*- |
621 | +################################################################################# |
622 | +# |
623 | +# OpenERP, Open Source Management Solution |
624 | +# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr> |
625 | +# |
626 | +# This program is free software: you can redistribute it and/or modify |
627 | +# it under the terms of the GNU General Public License as published by |
628 | +# the Free Software Foundation, either version 3 of the License, or |
629 | +# (at your option) any later version. |
630 | +# |
631 | +# This program is distributed in the hope that it will be useful, |
632 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
633 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
634 | +# GNU General Public License for more details. |
635 | +# |
636 | +# You should have received a copy of the GNU General Public License |
637 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
638 | +# |
639 | +################################################################################# |
640 | + |
641 | +import stock_tracking |
642 | + |
643 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
644 | \ No newline at end of file |
645 | |
646 | === added file 'stock_move_split_default/__openerp__.py' |
647 | --- stock_move_split_default/__openerp__.py 1970-01-01 00:00:00 +0000 |
648 | +++ stock_move_split_default/__openerp__.py 2013-03-06 10:58:19 +0000 |
649 | @@ -0,0 +1,45 @@ |
650 | +# -*- coding: utf-8 -*- |
651 | +################################################################################# |
652 | +# |
653 | +# OpenERP, Open Source Management Solution |
654 | +# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr> |
655 | +# |
656 | +# This program is free software: you can redistribute it and/or modify |
657 | +# it under the terms of the GNU General Public License as published by |
658 | +# the Free Software Foundation, either version 3 of the License, or |
659 | +# (at your option) any later version. |
660 | +# |
661 | +# This program is distributed in the hope that it will be useful, |
662 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
663 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
664 | +# GNU General Public License for more details. |
665 | +# |
666 | +# You should have received a copy of the GNU General Public License |
667 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
668 | +# |
669 | +################################################################################# |
670 | + |
671 | +{ |
672 | + "name" : "Stock Tracking Split", |
673 | + "version" : "1.0", |
674 | + "author" : "Julius Network Solutions", |
675 | + "description" : """ |
676 | + |
677 | +Presentation: |
678 | + |
679 | +This module allows to define and identify package in parent or child |
680 | + |
681 | +""", |
682 | + "website" : "http://www.julius.fr", |
683 | + "depends" : [ |
684 | + "stock", |
685 | + ], |
686 | + "category" : "Warehouse Management", |
687 | + "demo" : [], |
688 | + "data" : [], |
689 | + 'test': [], |
690 | + 'installable': True, |
691 | + 'active': False, |
692 | +} |
693 | + |
694 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
695 | |
696 | === added file 'stock_move_split_default/stock_tracking.py' |
697 | --- stock_move_split_default/stock_tracking.py 1970-01-01 00:00:00 +0000 |
698 | +++ stock_move_split_default/stock_tracking.py 2013-03-06 10:58:19 +0000 |
699 | @@ -0,0 +1,38 @@ |
700 | +# -*- coding: utf-8 -*- |
701 | +################################################################################# |
702 | +# |
703 | +# OpenERP, Open Source Management Solution |
704 | +# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr> |
705 | +# |
706 | +# This program is free software: you can redistribute it and/or modify |
707 | +# it under the terms of the GNU General Public License as published by |
708 | +# the Free Software Foundation, either version 3 of the License, or |
709 | +# (at your option) any later version. |
710 | +# |
711 | +# This program is distributed in the hope that it will be useful, |
712 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
713 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
714 | +# GNU General Public License for more details. |
715 | +# |
716 | +# You should have received a copy of the GNU General Public License |
717 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
718 | +# |
719 | +################################################################################# |
720 | + |
721 | +from openerp.osv import fields, osv, orm |
722 | +from openerp.tools.translate import _ |
723 | + |
724 | +class split_in_production_lot(orm.TransientModel): |
725 | + _inherit = "stock.move.split" |
726 | + _columns = { |
727 | + 'use_exist' : fields.boolean('Existing Lots', invisible=True), |
728 | + } |
729 | + _defaults = { |
730 | + 'use_exist': True, |
731 | + } |
732 | + def default_get(self, cr, uid, fields, context=None): |
733 | + res = super(split_in_production_lot, self).default_get(cr, uid, fields, context=context) |
734 | + res.update({'use_exist': True}) |
735 | + return res |
736 | + |
737 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
738 | |
739 | === added directory 'stock_product_category_tracked' |
740 | === added file 'stock_product_category_tracked/__init__.py' |
741 | --- stock_product_category_tracked/__init__.py 1970-01-01 00:00:00 +0000 |
742 | +++ stock_product_category_tracked/__init__.py 2013-03-06 10:58:19 +0000 |
743 | @@ -0,0 +1,24 @@ |
744 | +# -*- coding: utf-8 -*- |
745 | +################################################################################# |
746 | +# |
747 | +# OpenERP, Open Source Management Solution |
748 | +# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr> |
749 | +# |
750 | +# This program is free software: you can redistribute it and/or modify |
751 | +# it under the terms of the GNU General Public License as published by |
752 | +# the Free Software Foundation, either version 3 of the License, or |
753 | +# (at your option) any later version. |
754 | +# |
755 | +# This program is distributed in the hope that it will be useful, |
756 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
757 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
758 | +# GNU General Public License for more details. |
759 | +# |
760 | +# You should have received a copy of the GNU General Public License |
761 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
762 | +# |
763 | +################################################################################# |
764 | + |
765 | +import product_category |
766 | + |
767 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
768 | \ No newline at end of file |
769 | |
770 | === added file 'stock_product_category_tracked/__openerp__.py' |
771 | --- stock_product_category_tracked/__openerp__.py 1970-01-01 00:00:00 +0000 |
772 | +++ stock_product_category_tracked/__openerp__.py 2013-03-06 10:58:19 +0000 |
773 | @@ -0,0 +1,47 @@ |
774 | +# -*- coding: utf-8 -*- |
775 | +################################################################################# |
776 | +# |
777 | +# OpenERP, Open Source Management Solution |
778 | +# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr> |
779 | +# |
780 | +# This program is free software: you can redistribute it and/or modify |
781 | +# it under the terms of the GNU General Public License as published by |
782 | +# the Free Software Foundation, either version 3 of the License, or |
783 | +# (at your option) any later version. |
784 | +# |
785 | +# This program is distributed in the hope that it will be useful, |
786 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
787 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
788 | +# GNU General Public License for more details. |
789 | +# |
790 | +# You should have received a copy of the GNU General Public License |
791 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
792 | +# |
793 | +################################################################################# |
794 | + |
795 | +{ |
796 | + "name" : "Stock Product Category Tracked", |
797 | + "version" : "1.0", |
798 | + "author" : "Julius Network Solutions", |
799 | + "description" : """ |
800 | + |
801 | +Presentation: |
802 | + |
803 | +This module adds a field into the product category to define if this should be tracked or not. |
804 | + |
805 | +""", |
806 | + "website" : "http://www.julius.fr", |
807 | + "depends" : [ |
808 | + "stock", |
809 | + ], |
810 | + "category" : "Warehouse Management", |
811 | + "demo" : [], |
812 | + "data" : [ |
813 | + 'product_category_view.xml', |
814 | + ], |
815 | + 'test': [], |
816 | + 'installable': True, |
817 | + 'active': False, |
818 | +} |
819 | + |
820 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
821 | |
822 | === added file 'stock_product_category_tracked/product_category.py' |
823 | --- stock_product_category_tracked/product_category.py 1970-01-01 00:00:00 +0000 |
824 | +++ stock_product_category_tracked/product_category.py 2013-03-06 10:58:19 +0000 |
825 | @@ -0,0 +1,51 @@ |
826 | + # -*- coding: utf-8 -*- |
827 | +################################################################################# |
828 | +# |
829 | +# OpenERP, Open Source Management Solution |
830 | +# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr> |
831 | +# |
832 | +# This program is free software: you can redistribute it and/or modify |
833 | +# it under the terms of the GNU General Public License as published by |
834 | +# the Free Software Foundation, either version 3 of the License, or |
835 | +# (at your option) any later version. |
836 | +# |
837 | +# This program is distributed in the hope that it will be useful, |
838 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
839 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
840 | +# GNU General Public License for more details. |
841 | +# |
842 | +# You should have received a copy of the GNU General Public License |
843 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
844 | +# |
845 | +################################################################################# |
846 | + |
847 | +from openerp.osv import fields, osv, orm |
848 | +from openerp.tools.translate import _ |
849 | + |
850 | +class product_category(orm.Model): |
851 | + _inherit = 'product.category' |
852 | + _columns = { |
853 | + 'track_incoming': fields.boolean('Track Incoming Lots', |
854 | + help="Forces to specify a Serial Number for all moves " |
855 | + "containing this product and coming from a Supplier Location"), |
856 | + 'track_outgoing': fields.boolean('Track Outgoing Lots', |
857 | + help="Forces to specify a Serial Number for all moves containing " |
858 | + "this product and going to a Customer Location"), |
859 | + } |
860 | + |
861 | +class product_category(orm.Model): |
862 | + |
863 | + _inherit = 'product.product' |
864 | + |
865 | + def onchange_category(self, cr, uid, ids, category_id, context=None): |
866 | + if category_id: |
867 | + categ = self.pool.get('product.category').browse(cr, uid, category_id, context=context) |
868 | + return {'value': { |
869 | + 'track_incoming': categ and categ.track_incoming or False, |
870 | + 'track_outgoing': categ and categ.track_outgoing or False, |
871 | + } |
872 | + } |
873 | + return {} |
874 | + |
875 | + |
876 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
877 | |
878 | === added file 'stock_product_category_tracked/product_category_view.xml' |
879 | --- stock_product_category_tracked/product_category_view.xml 1970-01-01 00:00:00 +0000 |
880 | +++ stock_product_category_tracked/product_category_view.xml 2013-03-06 10:58:19 +0000 |
881 | @@ -0,0 +1,31 @@ |
882 | +<?xml version="1.0" encoding="utf-8"?> |
883 | +<openerp> |
884 | + <data> |
885 | + |
886 | + <record id="product_category_tracked_form" model="ir.ui.view"> |
887 | + <field name="name">product.category.property.form.inherit</field> |
888 | + <field name="model">product.category</field> |
889 | + <field name="type">form</field> |
890 | + <field name="inherit_id" ref="product.product_category_form_view"/> |
891 | + <field name="arch" type="xml"> |
892 | + <field name="type" position="after"> |
893 | + <field name="track_incoming"/> |
894 | + <field name="track_outgoing"/> |
895 | + <newline/> |
896 | + </field> |
897 | + </field> |
898 | + </record> |
899 | + |
900 | + <record id="product_normal_onchange_category_form_view" model="ir.ui.view"> |
901 | + <field name="name">product.normal.on_change.category.form</field> |
902 | + <field name="model">product.product</field> |
903 | + <field name="inherit_id" ref="product.product_normal_form_view"/> |
904 | + <field name="arch" type="xml"> |
905 | + <field name="categ_id" position="attributes"> |
906 | + <attribute name="on_change">onchange_category(categ_id,context)</attribute> |
907 | + </field> |
908 | + </field> |
909 | + </record> |
910 | + |
911 | + </data> |
912 | +</openerp> |
913 | |
914 | === modified file 'stock_tracking_add_move/__openerp__.py' |
915 | --- stock_tracking_add_move/__openerp__.py 2013-02-13 08:35:37 +0000 |
916 | +++ stock_tracking_add_move/__openerp__.py 2013-03-06 10:58:19 +0000 |
917 | @@ -38,11 +38,10 @@ |
918 | "stock_tracking_extended", |
919 | "tr_barcode", |
920 | ], |
921 | - "category" : "Customs/Stock", |
922 | - "init_xml" : [], |
923 | - "demo_xml" : [], |
924 | - "images" : ['images/Add move.png'], |
925 | - "update_xml" : [ |
926 | + "category" : "Warehouse Management", |
927 | +# "images" : ['images/Add move.png'], |
928 | + "demo" : [], |
929 | + "data" : [ |
930 | 'wizard/add_move_view.xml', |
931 | 'stock_view.xml', |
932 | "security/ir.model.access.csv", |
933 | @@ -51,3 +50,5 @@ |
934 | 'installable': False, |
935 | 'active': False, |
936 | } |
937 | + |
938 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
939 | |
940 | === modified file 'stock_tracking_add_move/stock.py' |
941 | --- stock_tracking_add_move/stock.py 2012-11-02 10:27:23 +0000 |
942 | +++ stock_tracking_add_move/stock.py 2013-03-06 10:58:19 +0000 |
943 | @@ -19,10 +19,10 @@ |
944 | # |
945 | ################################################################################# |
946 | |
947 | -from osv import fields, osv |
948 | -from tools.translate import _ |
949 | +from openerp.osv import fields, osv, orm |
950 | +from openerp.tools.translate import _ |
951 | |
952 | -class stock_tracking(osv.osv): |
953 | +class stock_tracking(orm.Model): |
954 | |
955 | _inherit = 'stock.tracking' |
956 | |
957 | @@ -165,9 +165,7 @@ |
958 | raise osv.except_osv(_('Warning!'),_('Barcode Not found!')) |
959 | return {} |
960 | |
961 | -stock_tracking() |
962 | - |
963 | -class stock_scan_to_validate(osv.osv): |
964 | +class stock_scan_to_validate(orm.Model): |
965 | |
966 | _name = 'stock.scan.to.validate' |
967 | _columns = { |
968 | @@ -180,9 +178,7 @@ |
969 | ('tracking_barcode_unique', 'unique (tracking_id,barcode_id)', 'This barcode is already in the list to add or to remove !') |
970 | ] |
971 | |
972 | -stock_scan_to_validate() |
973 | - |
974 | -class stock_tracking_history(osv.osv): |
975 | +class stock_tracking_history(orm.Model): |
976 | |
977 | _inherit = "stock.tracking.history" |
978 | |
979 | @@ -190,7 +186,7 @@ |
980 | res = super(stock_tracking_history, self)._get_types(cr, uid, context) |
981 | if not res: |
982 | res = [] |
983 | - res = res + [('pack_in','Add parent'),('pack_out','Unlink parent')] |
984 | + res = res + [('pack_in',_('Add parent')),('pack_out',_('Unlink parent'))] |
985 | return res |
986 | |
987 | _columns = { |
988 | @@ -198,6 +194,4 @@ |
989 | 'parent_id': fields.many2one('stock.tracking', 'Parent pack'), |
990 | } |
991 | |
992 | -stock_tracking_history() |
993 | - |
994 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
995 | |
996 | === modified file 'stock_tracking_add_move/stock_view.xml' |
997 | --- stock_tracking_add_move/stock_view.xml 2012-03-07 12:56:37 +0000 |
998 | +++ stock_tracking_add_move/stock_view.xml 2013-03-06 10:58:19 +0000 |
999 | @@ -2,62 +2,59 @@ |
1000 | <openerp> |
1001 | <data> |
1002 | |
1003 | - <record id="view_scan_to_validate_tree" model="ir.ui.view"> |
1004 | - <field name="name">stock.scan.to.validate.tree</field> |
1005 | - <field name="model">stock.scan.to.validate</field> |
1006 | - <field name="type">tree</field> |
1007 | - <field name="arch" type="xml"> |
1008 | - <tree string="To validate"> |
1009 | - <!--<field name="type"/>--> |
1010 | - <field name="barcode_id"/> |
1011 | - </tree> |
1012 | - </field> |
1013 | - </record> |
1014 | - |
1015 | - <!--<record id="view_tracking_form_add_remove" model="ir.ui.view"> |
1016 | - <field name="name">stock.tracking.form.add.remove</field> |
1017 | - <field name="model">stock.tracking</field> |
1018 | - <field name="type">form</field> |
1019 | - <field name="inherit_id" ref="stock.view_tracking_form"/> |
1020 | - <field name="arch" type="xml"> |
1021 | - <page string="Stock Moves" position="after"> |
1022 | - <page string="To add" attrs="{'invisible':[('state', '=', 'close')]}"> |
1023 | - <separator string="Objects to add into this pack" colspan="4"/> |
1024 | - <field name="to_add" nolabel="1" colspan="4"/> |
1025 | - <button name="add_validation" states="open" string="Confirm ADD" colspan="2" type="object" icon="gtk-ok"/> |
1026 | - </page> |
1027 | - <page string="To remove" attrs="{'invisible':[('state', '=', 'close')]}"> |
1028 | - <separator string="Objects to remove from this pack" colspan="4"/> |
1029 | - <field name="to_remove" nolabel="1" colspan="4"/> |
1030 | - <button name="remove_validation" states="open" string="Confirm REMOVE" colspan="2" type="object" icon="gtk-ok"/> |
1031 | - </page> |
1032 | - </page> |
1033 | - </field> |
1034 | - </record>--> |
1035 | - |
1036 | - <record id="view_tracking_history_tree" model="ir.ui.view"> |
1037 | - <field name="name">stock.tracking.history.tree</field> |
1038 | - <field name="model">stock.tracking.history</field> |
1039 | - <field name="type">tree</field> |
1040 | - <field name="inherit_id" ref="stock_tracking_extended.view_tracking_history_tree"/> |
1041 | - <field name="arch" type="xml"> |
1042 | - <field name="type" position="after"> |
1043 | - <field name="parent_id"/> |
1044 | - </field> |
1045 | - </field> |
1046 | - </record> |
1047 | - |
1048 | - <record id="view_tracking_history_form" model="ir.ui.view"> |
1049 | - <field name="name">stock.tracking.history.form</field> |
1050 | - <field name="model">stock.tracking.history</field> |
1051 | - <field name="type">form</field> |
1052 | - <field name="inherit_id" ref="stock_tracking_extended.view_tracking_history_form"/> |
1053 | - <field name="arch" type="xml"> |
1054 | - <field name="type" position="after"> |
1055 | - <field name="parent_id"/> |
1056 | - </field> |
1057 | - </field> |
1058 | - </record> |
1059 | + <record id="view_scan_to_validate_tree" model="ir.ui.view"> |
1060 | + <field name="name">stock.scan.to.validate.tree</field> |
1061 | + <field name="model">stock.scan.to.validate</field> |
1062 | + <field name="arch" type="xml"> |
1063 | + <tree string="To validate"> |
1064 | + <!--<field name="type"/>--> |
1065 | + <field name="barcode_id"/> |
1066 | + </tree> |
1067 | + </field> |
1068 | + </record> |
1069 | + |
1070 | + <!--<record id="view_tracking_form_add_remove" model="ir.ui.view"> |
1071 | + <field name="name">stock.tracking.form.add.remove</field> |
1072 | + <field name="model">stock.tracking</field> |
1073 | + <field name="type">form</field> |
1074 | + <field name="inherit_id" ref="stock.view_tracking_form"/> |
1075 | + <field name="arch" type="xml"> |
1076 | + <page string="Stock Moves" position="after"> |
1077 | + <page string="To add" attrs="{'invisible':[('state', '=', 'close')]}"> |
1078 | + <separator string="Objects to add into this pack" colspan="4"/> |
1079 | + <field name="to_add" nolabel="1" colspan="4"/> |
1080 | + <button name="add_validation" states="open" string="Confirm ADD" colspan="2" type="object" icon="gtk-ok"/> |
1081 | + </page> |
1082 | + <page string="To remove" attrs="{'invisible':[('state', '=', 'close')]}"> |
1083 | + <separator string="Objects to remove from this pack" colspan="4"/> |
1084 | + <field name="to_remove" nolabel="1" colspan="4"/> |
1085 | + <button name="remove_validation" states="open" string="Confirm REMOVE" colspan="2" type="object" icon="gtk-ok"/> |
1086 | + </page> |
1087 | + </page> |
1088 | + </field> |
1089 | + </record>--> |
1090 | + |
1091 | + <record id="view_tracking_history_tree" model="ir.ui.view"> |
1092 | + <field name="name">stock.tracking.history.tree</field> |
1093 | + <field name="model">stock.tracking.history</field> |
1094 | + <field name="inherit_id" ref="stock_tracking_extended.view_tracking_history_tree"/> |
1095 | + <field name="arch" type="xml"> |
1096 | + <field name="type" position="after"> |
1097 | + <field name="parent_id"/> |
1098 | + </field> |
1099 | + </field> |
1100 | + </record> |
1101 | + |
1102 | + <record id="view_tracking_history_form" model="ir.ui.view"> |
1103 | + <field name="name">stock.tracking.history.form</field> |
1104 | + <field name="model">stock.tracking.history</field> |
1105 | + <field name="inherit_id" ref="stock_tracking_extended.view_tracking_history_form"/> |
1106 | + <field name="arch" type="xml"> |
1107 | + <field name="type" position="after"> |
1108 | + <field name="parent_id"/> |
1109 | + </field> |
1110 | + </field> |
1111 | + </record> |
1112 | |
1113 | </data> |
1114 | </openerp> |
1115 | |
1116 | === modified file 'stock_tracking_add_move/wizard/add_move.py' |
1117 | --- stock_tracking_add_move/wizard/add_move.py 2012-07-03 07:39:19 +0000 |
1118 | +++ stock_tracking_add_move/wizard/add_move.py 2013-03-06 10:58:19 +0000 |
1119 | @@ -19,10 +19,10 @@ |
1120 | # |
1121 | ################################################################################# |
1122 | |
1123 | -from osv import fields, osv |
1124 | -from tools.translate import _ |
1125 | +from openerp.osv import fields, osv, orm |
1126 | +from openerp.tools.translate import _ |
1127 | |
1128 | -class stock_packaging_move(osv.osv_memory): |
1129 | +class stock_packaging_move(orm.TransientModel): |
1130 | |
1131 | _name = "stock.packaging.move" |
1132 | |
1133 | @@ -73,7 +73,5 @@ |
1134 | ''' Call for the removal function ''' |
1135 | tracking_obj.remove_validation(cr, uid, [parent_id], barcode_ids, context=None) |
1136 | return {'type': 'ir.actions.act_window_close'} |
1137 | - |
1138 | -stock_packaging_move() |
1139 | |
1140 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1141 | \ No newline at end of file |
1142 | |
1143 | === modified file 'stock_tracking_add_move/wizard/add_move_view.xml' |
1144 | --- stock_tracking_add_move/wizard/add_move_view.xml 2012-03-07 12:56:37 +0000 |
1145 | +++ stock_tracking_add_move/wizard/add_move_view.xml 2013-03-06 10:58:19 +0000 |
1146 | @@ -1,30 +1,29 @@ |
1147 | <?xml version="1.0" encoding="utf-8"?> |
1148 | <openerp> |
1149 | - <data> |
1150 | - |
1151 | - <record id="view_pack_add_move" model="ir.ui.view"> |
1152 | - <field name="name">Add object</field> |
1153 | - <field name="model">stock.packaging.move</field> |
1154 | - <field name="type">form</field> |
1155 | - <field name="arch" type="xml"> |
1156 | - <form string="Add Move"> |
1157 | - <group width="400" height="100"> |
1158 | - <group colspan="4"> |
1159 | - <field name="reference" colspan="2"/> |
1160 | - <field name="pack_id" colspan="2" invisible="1"/> |
1161 | - <newline/> |
1162 | - <separator string="Add Move" colspan="4"/> |
1163 | - <button icon='gtk-cancel' special="cancel" |
1164 | - string="Cancel" /> |
1165 | - <button name="add_move" string="Add Move" |
1166 | - type="object" icon="gtk-ok"/> |
1167 | - </group> |
1168 | - </group> |
1169 | - </form> |
1170 | - </field> |
1171 | - </record> |
1172 | - |
1173 | - <record id="pack_add_move" model="ir.actions.act_window"> |
1174 | + <data> |
1175 | + |
1176 | + <record id="view_pack_add_move" model="ir.ui.view"> |
1177 | + <field name="name">Add object</field> |
1178 | + <field name="model">stock.packaging.move</field> |
1179 | + <field name="arch" type="xml"> |
1180 | + <form string="Add Move"> |
1181 | + <group width="400" height="100"> |
1182 | + <group colspan="4"> |
1183 | + <field name="reference" colspan="2"/> |
1184 | + <field name="pack_id" colspan="2" invisible="1"/> |
1185 | + <newline/> |
1186 | + <separator string="Add Move" colspan="4"/> |
1187 | + <button icon='gtk-cancel' special="cancel" |
1188 | + string="Cancel" /> |
1189 | + <button name="add_move" string="Add Move" |
1190 | + type="object" icon="gtk-ok"/> |
1191 | + </group> |
1192 | + </group> |
1193 | + </form> |
1194 | + </field> |
1195 | + </record> |
1196 | + |
1197 | + <record id="pack_add_move" model="ir.actions.act_window"> |
1198 | <field name="name">Add object</field> |
1199 | <field name="type">ir.actions.act_window</field> |
1200 | <field name="res_model">stock.packaging.move</field> |
1201 | @@ -32,30 +31,29 @@ |
1202 | <field name="view_mode">form</field> |
1203 | <field name="view_id" ref="view_pack_add_move"/> |
1204 | <field name="target">new</field> |
1205 | - </record> |
1206 | - |
1207 | - <record id="view_pack_remove_move" model="ir.ui.view"> |
1208 | - <field name="name">Remove object</field> |
1209 | - <field name="model">stock.packaging.move</field> |
1210 | - <field name="type">form</field> |
1211 | - <field name="arch" type="xml"> |
1212 | - <form string="Remove Move"> |
1213 | - <group width="400" height="100"> |
1214 | - <group colspan="4"> |
1215 | - <field name="reference" colspan="2"/> |
1216 | - <newline/> |
1217 | - <separator string="Remove Move" colspan="4"/> |
1218 | - <button icon='gtk-cancel' special="cancel" |
1219 | - string="Cancel" /> |
1220 | - <button name="remove_move" string="Remove Move" |
1221 | - type="object" icon="gtk-ok"/> |
1222 | - </group> |
1223 | - </group> |
1224 | - </form> |
1225 | - </field> |
1226 | - </record> |
1227 | - |
1228 | - <record id="pack_remove_move" model="ir.actions.act_window"> |
1229 | + </record> |
1230 | + |
1231 | + <record id="view_pack_remove_move" model="ir.ui.view"> |
1232 | + <field name="name">Remove object</field> |
1233 | + <field name="model">stock.packaging.move</field> |
1234 | + <field name="arch" type="xml"> |
1235 | + <form string="Remove Move"> |
1236 | + <group width="400" height="100"> |
1237 | + <group colspan="4"> |
1238 | + <field name="reference" colspan="2"/> |
1239 | + <newline/> |
1240 | + <separator string="Remove Move" colspan="4"/> |
1241 | + <button icon='gtk-cancel' special="cancel" |
1242 | + string="Cancel" /> |
1243 | + <button name="remove_move" string="Remove Move" |
1244 | + type="object" icon="gtk-ok"/> |
1245 | + </group> |
1246 | + </group> |
1247 | + </form> |
1248 | + </field> |
1249 | + </record> |
1250 | + |
1251 | + <record id="pack_remove_move" model="ir.actions.act_window"> |
1252 | <field name="name">Remove object</field> |
1253 | <field name="type">ir.actions.act_window</field> |
1254 | <field name="res_model">stock.packaging.move</field> |
1255 | @@ -63,20 +61,19 @@ |
1256 | <field name="view_mode">form</field> |
1257 | <field name="view_id" ref="view_pack_remove_move"/> |
1258 | <field name="target">new</field> |
1259 | - </record> |
1260 | - |
1261 | - <record id="view_tracking_form_inherit" model="ir.ui.view"> |
1262 | - <field name="name">stock.tracking.form.inherit</field> |
1263 | - <field name="model">stock.tracking</field> |
1264 | - <field name="type">form</field> |
1265 | - <field name="inherit_id" ref="stock_tracking_extended.view_tracking_form_inherit"/> |
1266 | - <field name="arch" type="xml"> |
1267 | - <button name="reset_open" position="after"> |
1268 | - <button name="%(pack_add_move)d" states="open" string="Add object" colspan="2" type="action" icon="gtk-ok"/> |
1269 | - <button name="%(pack_remove_move)d" states="open" string="Remove object" colspan="2" type="action" icon="gtk-ok"/> |
1270 | - </button> |
1271 | - </field> |
1272 | - </record> |
1273 | - |
1274 | + </record> |
1275 | + |
1276 | + <record id="view_tracking_form_inherit" model="ir.ui.view"> |
1277 | + <field name="name">stock.tracking.form.inherit</field> |
1278 | + <field name="model">stock.tracking</field> |
1279 | + <field name="inherit_id" ref="stock_tracking_extended.view_tracking_form_inherit"/> |
1280 | + <field name="arch" type="xml"> |
1281 | + <button name="reset_open" position="after"> |
1282 | + <button name="%(pack_add_move)d" states="open" string="Add object" colspan="2" type="action" icon="gtk-ok"/> |
1283 | + <button name="%(pack_remove_move)d" states="open" string="Remove object" colspan="2" type="action" icon="gtk-ok"/> |
1284 | + </button> |
1285 | + </field> |
1286 | + </record> |
1287 | + |
1288 | </data> |
1289 | </openerp> |
1290 | |
1291 | === added directory 'stock_tracking_add_remove' |
1292 | === added file 'stock_tracking_add_remove/__init__.py' |
1293 | --- stock_tracking_add_remove/__init__.py 1970-01-01 00:00:00 +0000 |
1294 | +++ stock_tracking_add_remove/__init__.py 2013-03-06 10:58:19 +0000 |
1295 | @@ -0,0 +1,25 @@ |
1296 | +# -*- coding: utf-8 -*- |
1297 | +################################################################################# |
1298 | +# |
1299 | +# OpenERP, Open Source Management Solution |
1300 | +# Copyright (C) 2012 Julius Network Solutions SARL <contact@julius.fr> |
1301 | +# |
1302 | +# This program is free software: you can redistribute it and/or modify |
1303 | +# it under the terms of the GNU General Public License as published by |
1304 | +# the Free Software Foundation, either version 3 of the License, or |
1305 | +# (at your option) any later version. |
1306 | +# |
1307 | +# This program is distributed in the hope that it will be useful, |
1308 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1309 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1310 | +# GNU General Public License for more details. |
1311 | +# |
1312 | +# You should have received a copy of the GNU General Public License |
1313 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1314 | +# |
1315 | +################################################################################# |
1316 | + |
1317 | +import wizard |
1318 | +import stock_tracking |
1319 | + |
1320 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1321 | \ No newline at end of file |
1322 | |
1323 | === added file 'stock_tracking_add_remove/__openerp__.py' |
1324 | --- stock_tracking_add_remove/__openerp__.py 1970-01-01 00:00:00 +0000 |
1325 | +++ stock_tracking_add_remove/__openerp__.py 2013-03-06 10:58:19 +0000 |
1326 | @@ -0,0 +1,53 @@ |
1327 | +# -*- coding: utf-8 -*- |
1328 | +################################################################################# |
1329 | +# |
1330 | +# OpenERP, Open Source Management Solution |
1331 | +# Copyright (C) 2012 Julius Network Solutions SARL <contact@julius.fr> |
1332 | +# |
1333 | +# This program is free software: you can redistribute it and/or modify |
1334 | +# it under the terms of the GNU General Public License as published by |
1335 | +# the Free Software Foundation, either version 3 of the License, or |
1336 | +# (at your option) any later version. |
1337 | +# |
1338 | +# This program is distributed in the hope that it will be useful, |
1339 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1340 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1341 | +# GNU General Public License for more details. |
1342 | +# |
1343 | +# You should have received a copy of the GNU General Public License |
1344 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1345 | +# |
1346 | +################################################################################# |
1347 | + |
1348 | +{ |
1349 | + "name" : "Stock tracking add or remove object", |
1350 | + "version" : "1.0", |
1351 | + "author" : "Julius Network Solutions", |
1352 | + "description" : """Presentation: |
1353 | + |
1354 | +This module add a wizard to fill in packaging. It will also add a wizard to remove pieces from a pack |
1355 | +This wizard is used to add or remove an object from a package. |
1356 | +Adding to the historical movements and parent objects |
1357 | + |
1358 | +""", |
1359 | + "website" : "http://www.julius.fr", |
1360 | + "depends" : [ |
1361 | + "stock", |
1362 | + "stock_tracking_extended", |
1363 | + ], |
1364 | + "category" : "Warehouse Management", |
1365 | + "images" : [], |
1366 | + "demo" : [], |
1367 | + "data" : [ |
1368 | + "security/ir.model.access.csv", |
1369 | + "wizard/add_object_view.xml", |
1370 | + "wizard/remove_object_view.xml", |
1371 | + "data/type.xml", |
1372 | + 'stock_view.xml', |
1373 | + ], |
1374 | + 'test': [], |
1375 | + 'installable': True, |
1376 | + 'active': False, |
1377 | +} |
1378 | + |
1379 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1380 | \ No newline at end of file |
1381 | |
1382 | === added directory 'stock_tracking_add_remove/data' |
1383 | === added file 'stock_tracking_add_remove/data/type.xml' |
1384 | --- stock_tracking_add_remove/data/type.xml 1970-01-01 00:00:00 +0000 |
1385 | +++ stock_tracking_add_remove/data/type.xml 2013-03-06 10:58:19 +0000 |
1386 | @@ -0,0 +1,16 @@ |
1387 | +<?xml version="1.0" encoding="utf-8"?> |
1388 | +<openerp> |
1389 | + <data> |
1390 | + |
1391 | + <record id="add_type_product" model="stock.packaging.add.type"> |
1392 | + <field name="code">product</field> |
1393 | + <field name="name">Product not tracked</field> |
1394 | + </record> |
1395 | + |
1396 | + <record id="add_type_prodlots" model="stock.packaging.add.type"> |
1397 | + <field name="code">prodlot</field> |
1398 | + <field name="name">Production lots</field> |
1399 | + </record> |
1400 | + |
1401 | + </data> |
1402 | +</openerp> |
1403 | |
1404 | === added directory 'stock_tracking_add_remove/security' |
1405 | === added file 'stock_tracking_add_remove/security/ir.model.access.csv' |
1406 | --- stock_tracking_add_remove/security/ir.model.access.csv 1970-01-01 00:00:00 +0000 |
1407 | +++ stock_tracking_add_remove/security/ir.model.access.csv 2013-03-06 10:58:19 +0000 |
1408 | @@ -0,0 +1,2 @@ |
1409 | +id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink |
1410 | +access_stock_packaging_add_type_all,stock.packaging.add.type all,model_stock_packaging_add_type,,1,1,1,0 |
1411 | |
1412 | === added file 'stock_tracking_add_remove/stock_tracking.py' |
1413 | --- stock_tracking_add_remove/stock_tracking.py 1970-01-01 00:00:00 +0000 |
1414 | +++ stock_tracking_add_remove/stock_tracking.py 2013-03-06 10:58:19 +0000 |
1415 | @@ -0,0 +1,278 @@ |
1416 | +# -*- coding: utf-8 -*- |
1417 | +################################################################################# |
1418 | +# |
1419 | +# OpenERP, Open Source Management Solution |
1420 | +# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr> |
1421 | +# |
1422 | +# This program is free software: you can redistribute it and/or modify |
1423 | +# it under the terms of the GNU General Public License as published by |
1424 | +# the Free Software Foundation, either version 3 of the License, or |
1425 | +# (at your option) any later version. |
1426 | +# |
1427 | +# This program is distributed in the hope that it will be useful, |
1428 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1429 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1430 | +# GNU General Public License for more details. |
1431 | +# |
1432 | +# You should have received a copy of the GNU General Public License |
1433 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1434 | +# |
1435 | +################################################################################# |
1436 | + |
1437 | +from openerp.osv import fields, osv, orm |
1438 | +from openerp.tools.translate import _ |
1439 | +from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT |
1440 | +import time |
1441 | + |
1442 | +class stock_tracking(orm.Model): |
1443 | + _inherit = 'stock.tracking' |
1444 | + |
1445 | + def _get_move_product_vals(self, cr, uid, pack_id, product, qty=False, move_data=False, context=None): |
1446 | + if context is None: |
1447 | + context = {} |
1448 | + pack = self.browse(cr, uid, pack_id, context=context) |
1449 | + vals = { |
1450 | + 'name': product.name, |
1451 | + 'product_id': product.id, |
1452 | + 'product_uom': product.uom_id.id, |
1453 | + 'product_qty': qty, |
1454 | + 'location_id': pack.location_id.id, |
1455 | + 'location_dest_id': pack.location_id.id, |
1456 | + 'tracking_id': pack.id, |
1457 | + 'state': 'done', |
1458 | + } |
1459 | + return vals |
1460 | + |
1461 | + def _add_products(self, cr, uid, pack_id, product_ids, quantities=False, context=None): |
1462 | + """ Method to add products into a pack """ |
1463 | + if context is None: |
1464 | + context = {} |
1465 | + move_obj = self.pool.get('stock.move') |
1466 | + prod_obj = self.pool.get('product.product') |
1467 | + pack_obj = self.pool.get('stock.tracking') |
1468 | + history_obj = self.pool.get('stock.tracking.history') |
1469 | + pack = pack_obj.browse(cr, uid, pack_id, context=context) |
1470 | + date = time.strftime(DEFAULT_SERVER_DATETIME_FORMAT) |
1471 | + # Process # |
1472 | + for product in prod_obj.browse(cr, uid, product_ids, context=context): |
1473 | + # If quantity is not define , 1 by default # |
1474 | + qty = 1.0 |
1475 | + if quantities and quantities[product.id]: |
1476 | + qty = quantities[product.id] |
1477 | + vals = {} |
1478 | + vals = self._get_move_product_vals(cr, uid, pack_id, product, qty, move_data=False, context=context) |
1479 | + if vals: |
1480 | + new_move_id = move_obj.create(cr, uid, vals, context=context) |
1481 | + hist_id = history_obj.create(cr, uid, { |
1482 | + 'tracking_id': pack.id, |
1483 | + 'type': 'add_product', |
1484 | + 'location_id': pack.location_id.id, |
1485 | + 'location_dest_id': pack.location_id.id, |
1486 | + 'product_id': product.id, |
1487 | + 'qty': qty, |
1488 | + 'date' : date, |
1489 | + }, context=context) |
1490 | + self.get_products(cr, uid, [pack.id], context=context) |
1491 | + return True |
1492 | + |
1493 | + def _get_move_prodlot_vals(self, cr, uid, pack_id, prodlot_data, qty=False, move_data=False, context=None): |
1494 | + if context is None: |
1495 | + context = {} |
1496 | + pack = self.browse(cr, uid, pack_id, context=context) |
1497 | + vals = { |
1498 | + 'name': move_data.name if move_data else prodlot_data.name, |
1499 | + 'state': 'done', |
1500 | + 'product_id': move_data and move_data.prodlot_id.product_id.id or prodlot_data.product_id.id, |
1501 | + 'product_uom': move_data and move_data.product_uom.id or prodlot_data.product_id.uom_id.id, |
1502 | + 'prodlot_id': move_data and move_data.prodlot_id.id or prodlot_data.id, |
1503 | + 'location_id': move_data and move_data.location_dest_id.id or pack.location_id.id, |
1504 | + 'location_dest_id': pack.location_id.id, |
1505 | + 'tracking_id': pack.id, |
1506 | + 'product_qty': qty, |
1507 | + } |
1508 | + return vals |
1509 | + |
1510 | + def _add_prodlots(self, cr, uid, pack_id, prodlot_ids, quantities=False, context=None): |
1511 | + """ Method to add prodlots into a pack """ |
1512 | + if context is None: |
1513 | + context = {} |
1514 | + move_obj = self.pool.get('stock.move') |
1515 | + prodlot_obj = self.pool.get('stock.production.lot') |
1516 | + pack_obj = self.pool.get('stock.tracking') |
1517 | + history_obj = self.pool.get('stock.tracking.history') |
1518 | + pack = pack_obj.browse(cr, uid, pack_id, context=context) |
1519 | + date = time.strftime(DEFAULT_SERVER_DATETIME_FORMAT) |
1520 | + modified = False |
1521 | + for prodlot_data in prodlot_obj.browse(cr, uid, prodlot_ids, context=context): |
1522 | + if quantities and quantities[prodlot_data.id]: |
1523 | + qty = quantities[prodlot_data.id] |
1524 | + move_ids = move_obj.search(cr, uid, [ |
1525 | + ('state', '=', 'done'), |
1526 | + ('prodlot_id', '=', prodlot_data.id), |
1527 | + ], order='date desc', limit=1, context=context) |
1528 | + vals = {} |
1529 | + if move_ids: |
1530 | + move_data = move_obj.browse(cr, uid, move_ids[0], context=context) |
1531 | + vals = self._get_move_prodlot_vals(cr, uid, pack_id, |
1532 | + prodlot_data, qty, move_data=move_data, context=context) |
1533 | + else: |
1534 | + vals = self._get_move_prodlot_vals(cr, uid, pack_id, |
1535 | + prodlot_data, qty, move_data=False, context=context) |
1536 | + if vals: |
1537 | + new_move_id = move_obj.create(cr, uid, vals, context=context) |
1538 | + hist_id = history_obj.create(cr, uid, { |
1539 | + 'tracking_id': pack.id, |
1540 | + 'type': 'add_prodlot', |
1541 | + 'location_id': pack.location_id.id, |
1542 | + 'location_dest_id': pack.location_id.id, |
1543 | + 'prodlot_id': prodlot_data.id, |
1544 | + 'qty': qty, |
1545 | + 'date' : date, |
1546 | + }, context=context) |
1547 | + self.get_products(cr, uid, [pack_id], context=context) |
1548 | + self.get_serials(cr, uid, [pack_id], context=context) |
1549 | + return True |
1550 | + |
1551 | + |
1552 | + def _remove_products(self, cr, uid, pack_id, products, context=None): |
1553 | + """ Method to remove products from a pack """ |
1554 | + # Initialization # |
1555 | + move_obj = self.pool.get('stock.move') |
1556 | + history_obj = self.pool.get('stock.tracking.history') |
1557 | + prod_obj = self.pool.get('product.product') |
1558 | + date = time.strftime(DEFAULT_SERVER_DATETIME_FORMAT) |
1559 | + if context is None: |
1560 | + context = {} |
1561 | + |
1562 | + pack = self.browse(cr, uid, pack_id, context=context) |
1563 | + for product in products: |
1564 | + if not product.move_id: |
1565 | + continue |
1566 | + move_data = product.move_id |
1567 | + move_qty = move_data.product_qty |
1568 | + remove_qty = product.quantity |
1569 | + if not remove_qty: |
1570 | + continue |
1571 | + |
1572 | + #if the quantity to remove is bigger than the move quantity we only remove the move value |
1573 | + if move_qty < remove_qty: |
1574 | + remove_qty = move_qty |
1575 | + |
1576 | + # Process # |
1577 | + hist_id = history_obj.create(cr, uid, { |
1578 | + 'tracking_id': pack.id, |
1579 | + 'type': 'remove_product', |
1580 | + 'location_id': pack.location_id.id, |
1581 | + 'location_dest_id': pack.location_id.id, |
1582 | + 'product_id': product.product_id.id, |
1583 | + 'qty': remove_qty, |
1584 | + 'date' : date, |
1585 | + }, context=context) |
1586 | + if remove_qty != move_qty: |
1587 | + defaults = { |
1588 | + 'location_id': pack.location_id.id, |
1589 | + 'location_dest_id': pack.location_id.id, |
1590 | + 'date': date, |
1591 | + 'date_expected': date, |
1592 | + 'tracking_id': pack.id, |
1593 | + 'product_id': product.product_id.id, |
1594 | + 'product_qty': move_qty - remove_qty, |
1595 | + 'state': 'done', |
1596 | + } |
1597 | + new_id = move_obj.copy(cr, uid, move_data.id, default=defaults, context=context) |
1598 | + defaults = { |
1599 | + 'location_id': pack.location_id.id, |
1600 | + 'location_dest_id': pack.location_id.id, |
1601 | + 'date': date, |
1602 | + 'date_expected': date, |
1603 | + 'tracking_id': False, |
1604 | + 'product_qty': remove_qty, |
1605 | + 'state': 'done', |
1606 | + } |
1607 | + move_obj.copy(cr, uid, move_data.id, default=defaults, context=context) |
1608 | + move_obj.write(cr, uid, [move_data.id], {'pack_history_id': hist_id}, context=context) |
1609 | + self.get_products(cr, uid, [pack.id], context=context) |
1610 | + return True |
1611 | + |
1612 | + def _remove_prodlot(self, cr, uid, pack_id, prodlots, context=None): |
1613 | + """ Method to remove prodlots from a pack """ |
1614 | + # Initialization # |
1615 | + move_obj = self.pool.get('stock.move') |
1616 | + history_obj = self.pool.get('stock.tracking.history') |
1617 | + prodlot_obj = self.pool.get('stock.production.lot') |
1618 | + product_obj = self.pool.get('product.product') |
1619 | + date = time.strftime(DEFAULT_SERVER_DATETIME_FORMAT) |
1620 | + if context is None: |
1621 | + context = {} |
1622 | + |
1623 | + pack = self.browse(cr, uid, pack_id, context=context) |
1624 | + for prodlot in prodlots: |
1625 | + if not prodlot.move_id: |
1626 | + continue |
1627 | + move_data = prodlot.move_id |
1628 | + move_qty = move_data.product_qty |
1629 | + remove_qty = prodlot.quantity |
1630 | + if not remove_qty: |
1631 | + continue |
1632 | + |
1633 | + #if the quantity to remove is bigger than the move quantity we only remove the move value |
1634 | + if move_qty < remove_qty: |
1635 | + remove_qty = move_qty |
1636 | + |
1637 | + # Process # |
1638 | + hist_id = history_obj.create(cr, uid, { |
1639 | + 'tracking_id': pack.id, |
1640 | + 'type': 'remove_prodlot', |
1641 | + 'location_id': pack.location_id.id, |
1642 | + 'location_dest_id': pack.location_id.id, |
1643 | + 'prodlot_id': prodlot.prodlot_id.id, |
1644 | + 'qty': remove_qty, |
1645 | + 'date' : date, |
1646 | + }, context=context) |
1647 | + if remove_qty != move_qty: |
1648 | + defaults = { |
1649 | + 'location_id': pack.location_id.id, |
1650 | + 'location_dest_id': pack.location_id.id, |
1651 | + 'date': date, |
1652 | + 'date_expected': date, |
1653 | + 'tracking_id': pack.id, |
1654 | + 'product_id': prodlot.prodlot_id.product_id.id, |
1655 | + 'product_qty': move_qty - remove_qty, |
1656 | + 'state': 'done', |
1657 | + } |
1658 | + new_id = move_obj.copy(cr, uid, move_data.id, default=defaults, context=context) |
1659 | + defaults = { |
1660 | + 'location_id': pack.location_id.id, |
1661 | + 'location_dest_id': pack.location_id.id, |
1662 | + 'date': date, |
1663 | + 'date_expected': date, |
1664 | + 'tracking_id': False, |
1665 | + 'product_qty': remove_qty, |
1666 | + 'state': 'done', |
1667 | + } |
1668 | + move_obj.copy(cr, uid, move_data.id, default=defaults, context=context) |
1669 | + move_obj.write(cr, uid, [move_data.id], {'pack_history_id': hist_id}, context=context) |
1670 | + self.get_serials(cr, uid, [pack.id], context=context) |
1671 | + self.get_products(cr, uid, [pack.id], context=context) |
1672 | + return True |
1673 | + |
1674 | +class stock_tracking_history(osv.osv): |
1675 | + |
1676 | + _inherit = "stock.tracking.history" |
1677 | + |
1678 | + def _get_types(self, cr, uid, context={}): |
1679 | + res = super(stock_tracking_history, self)._get_types(cr, uid, context) |
1680 | + if not res: |
1681 | + res = [] |
1682 | + res = res + [('add_product',_('Add product')),('remove_product',_('Remove product')), |
1683 | + ('add_prodlot',_('Add prodlot')),('remove_prodlot',_('Remove prodlot'))] |
1684 | + return res |
1685 | + |
1686 | + _columns = { |
1687 | + 'type': fields.selection(_get_types, 'Type'), |
1688 | + 'product_id': fields.many2one('product.product', 'Product'), |
1689 | + 'prodlot_id': fields.many2one('stock.production.lot', 'Production lot'), |
1690 | + 'qty': fields.float('Quantity'), |
1691 | + } |
1692 | + |
1693 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1694 | |
1695 | === added file 'stock_tracking_add_remove/stock_view.xml' |
1696 | --- stock_tracking_add_remove/stock_view.xml 1970-01-01 00:00:00 +0000 |
1697 | +++ stock_tracking_add_remove/stock_view.xml 2013-03-06 10:58:19 +0000 |
1698 | @@ -0,0 +1,48 @@ |
1699 | +<?xml version="1.0" encoding="utf-8"?> |
1700 | +<openerp> |
1701 | + <data> |
1702 | + |
1703 | + <record id="view_tracking_form_add_product" model="ir.ui.view"> |
1704 | + <field name="name">stock.tracking.form.inherit</field> |
1705 | + <field name="model">stock.tracking</field> |
1706 | + <field name="inherit_id" ref="stock_tracking_extended.view_tracking_extended_form"/> |
1707 | + <field name="arch" type="xml"> |
1708 | + <div name="product_buttons" position="inside"> |
1709 | + <button name="%(stock_tracking_add_remove.action_stock_packaging_add)d" string="Add products" colspan="2" type="action" context="{'type_selection':'product'}"/> |
1710 | + <button name="%(stock_tracking_add_remove.action_stock_packaging_remove)d" colspan="1" string="Remove product" type="action" context="{'type_selection':'product'}"/> |
1711 | + </div> |
1712 | + <div name="prodlot_buttons" position="inside"> |
1713 | + <button name="%(stock_tracking_add_remove.action_stock_packaging_add)d" string="Add production lot" colspan="2" type="action" context="{'type_selection':'prodlot'}"/> |
1714 | + <button name="%(stock_tracking_add_remove.action_stock_packaging_remove)d" colspan="1" string="Remove production lot" type="action" context="{'type_selection':'prodlot'}"/> |
1715 | + </div> |
1716 | + </field> |
1717 | + </record> |
1718 | + |
1719 | + |
1720 | + <record id="view_tracking_history_tree_inherit" model="ir.ui.view"> |
1721 | + <field name="name">stock.tracking.history.tree</field> |
1722 | + <field name="model">stock.tracking.history</field> |
1723 | + <field name="inherit_id" ref="stock_tracking_extended.view_tracking_history_tree"/> |
1724 | + <field name="arch" type="xml"> |
1725 | + <tree string="History"> |
1726 | + <field name="qty"/> |
1727 | + </tree> |
1728 | + </field> |
1729 | + </record> |
1730 | + |
1731 | + |
1732 | + <record id="view_tracking_history_form_inherit" model="ir.ui.view"> |
1733 | + <field name="name">stock.tracking.history.form</field> |
1734 | + <field name="model">stock.tracking.history</field> |
1735 | + <field name="inherit_id" ref="stock_tracking_extended.view_tracking_history_form"/> |
1736 | + <field name="arch" type="xml"> |
1737 | + <form string="History"> |
1738 | + <field name="product_id" attrs="{'invisible': [('type','!=','add_product'),('type','!=','remove_product')]}"/> |
1739 | + <field name="prodlot_id" attrs="{'invisible': [('type','!=','add_prodlot'),('type','!=','remove_prodlot')]}"/> |
1740 | + <field name="qty"/> |
1741 | + </form> |
1742 | + </field> |
1743 | + </record> |
1744 | + |
1745 | + </data> |
1746 | +</openerp> |
1747 | |
1748 | === added directory 'stock_tracking_add_remove/wizard' |
1749 | === added file 'stock_tracking_add_remove/wizard/__init__.py' |
1750 | --- stock_tracking_add_remove/wizard/__init__.py 1970-01-01 00:00:00 +0000 |
1751 | +++ stock_tracking_add_remove/wizard/__init__.py 2013-03-06 10:58:19 +0000 |
1752 | @@ -0,0 +1,25 @@ |
1753 | +# -*- coding: utf-8 -*- |
1754 | +################################################################################# |
1755 | +# |
1756 | +# OpenERP, Open Source Management Solution |
1757 | +# Copyright (C) 2012 Julius Network Solutions SARL <contact@julius.fr> |
1758 | +# |
1759 | +# This program is free software: you can redistribute it and/or modify |
1760 | +# it under the terms of the GNU General Public License as published by |
1761 | +# the Free Software Foundation, either version 3 of the License, or |
1762 | +# (at your option) any later version. |
1763 | +# |
1764 | +# This program is distributed in the hope that it will be useful, |
1765 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1766 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1767 | +# GNU General Public License for more details. |
1768 | +# |
1769 | +# You should have received a copy of the GNU General Public License |
1770 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1771 | +# |
1772 | +################################################################################# |
1773 | + |
1774 | +import add_object |
1775 | +import remove_object |
1776 | + |
1777 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1778 | \ No newline at end of file |
1779 | |
1780 | === added file 'stock_tracking_add_remove/wizard/add_object.py' |
1781 | --- stock_tracking_add_remove/wizard/add_object.py 1970-01-01 00:00:00 +0000 |
1782 | +++ stock_tracking_add_remove/wizard/add_object.py 2013-03-06 10:58:19 +0000 |
1783 | @@ -0,0 +1,132 @@ |
1784 | +# -*- coding: utf-8 -*- |
1785 | +################################################################################# |
1786 | +# |
1787 | +# OpenERP, Open Source Management Solution |
1788 | +# Copyright (C) 2012 Julius Network Solutions SARL <contact@julius.fr> |
1789 | +# |
1790 | +# This program is free software: you can redistribute it and/or modify |
1791 | +# it under the terms of the GNU General Public License as published by |
1792 | +# the Free Software Foundation, either version 3 of the License, or |
1793 | +# (at your option) any later version. |
1794 | +# |
1795 | +# This program is distributed in the hope that it will be useful, |
1796 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
1797 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1798 | +# GNU General Public License for more details. |
1799 | +# |
1800 | +# You should have received a copy of the GNU General Public License |
1801 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
1802 | +# |
1803 | +################################################################################# |
1804 | + |
1805 | +from openerp.osv import fields, osv, orm |
1806 | +from openerp.tools.translate import _ |
1807 | + |
1808 | +class stock_packaging_add_type(orm.Model): |
1809 | + _name = 'stock.packaging.add.type' |
1810 | + |
1811 | + _columns = { |
1812 | + 'code': fields.char('Code', size=64), |
1813 | + 'name': fields.char('Name', size=64), |
1814 | + } |
1815 | + |
1816 | +class stock_packaging_add(orm.TransientModel): |
1817 | + |
1818 | + _name = "stock.packaging.add" |
1819 | + _description = "Add objects to a pack" |
1820 | + |
1821 | + _columns = { |
1822 | + 'type_id': fields.many2one('stock.packaging.add.type', 'Type', required=True), |
1823 | + 'type': fields.char('Type', size=64), |
1824 | + 'pack_id': fields.many2one('stock.tracking', 'Pack', required=True), |
1825 | + 'product_ids': fields.one2many('stock.packaging.add.line', 'parent_id', 'Lines'), |
1826 | + 'prodlot_ids': fields.one2many('stock.packaging.add.line', 'parent_id', 'Lines'), |
1827 | + } |
1828 | + |
1829 | + def _get_type_id(self, cr, uid, context): |
1830 | + if context==None: |
1831 | + context={} |
1832 | + type = context.get('type_selection', 'product') |
1833 | + type_obj = self.pool.get('stock.packaging.add.type') |
1834 | + default_type = type_obj.search(cr, uid, [('code', '=', type)], limit=1, context=context) |
1835 | + if not default_type: |
1836 | + default_type = type_obj.search(cr, uid, [], limit=1, context=context) |
1837 | + return default_type and default_type[0] or False |
1838 | + |
1839 | + def _get_type(self, cr, uid, context): |
1840 | + if context==None: |
1841 | + context={} |
1842 | + type = context.get('type_selection', 'product') |
1843 | + res_type = '' |
1844 | + type_obj = self.pool.get('stock.packaging.add.type') |
1845 | + default_type = type_obj.search(cr, uid, [('code', '=', type)], limit=1, context=context) |
1846 | + if not default_type: |
1847 | + default_type = type_obj.search(cr, uid, [], limit=1, context=context) |
1848 | + if default_type and default_type[0]: |
1849 | + read_type = type_obj.read(cr, uid, default_type[0], ['code'], context=context) |
1850 | + if read_type['code']: |
1851 | + res_type = read_type['code'] |
1852 | + return res_type or '' |
1853 | + |
1854 | + _defaults = { |
1855 | + 'pack_id': lambda self, cr, uid, context: context.get('active_id', False), |
1856 | + 'type_id': lambda self, cr, uid, context: self._get_type_id(cr, uid, context), |
1857 | + 'type': lambda self, cr, uid, context: self._get_type(cr, uid, context), |
1858 | + } |
1859 | + |
1860 | + def onchange_type_id(self, cr, uid, ids, type_id): |
1861 | + res = {'value': {'type': ''}} |
1862 | + if type_id: |
1863 | + type_obj = self.pool.get('stock.packaging.add.type') |
1864 | + type = type_obj.read(cr, uid, type_id, ['code']) |
1865 | + if type['code']: |
1866 | + res = {'value': {'type': type['code']}} |
1867 | + return res |
1868 | + |
1869 | + def add_object(self, cr, uid, ids, context=None): |
1870 | + # Initialization # |
1871 | + if context is None: |
1872 | + context = {} |
1873 | + tracking_obj = self.pool.get('stock.tracking') |
1874 | + # Process # |
1875 | + for current in self.browse(cr, uid, ids, context=context): |
1876 | + pack_id = current.pack_id.id |
1877 | + code_type = current.type_id.code |
1878 | + # Creation of an empty list for the product, and empty dictionary for the quantity" |
1879 | + quantities = {} |
1880 | + if code_type == 'product': |
1881 | + product_ids = [] |
1882 | + for line_data in current.product_ids: |
1883 | + # For each product added, we appends at the product_ids list the quantity added # |
1884 | + product_ids.append(line_data.product_id.id) |
1885 | + quantities[line_data.product_id.id]=line_data.quantity |
1886 | + # call functions add product with argument pack_id , products_ids and quantities # |
1887 | + tracking_obj._add_products(cr, uid, pack_id, product_ids, quantities, context=context) |
1888 | + elif code_type == 'prodlot': |
1889 | + prodlot_ids = [] |
1890 | + for line_data in current.prodlot_ids: |
1891 | + # For each product added, we appends at the prodlot_ids list the quantity added # |
1892 | + prodlot_ids.append(line_data.prodlot_id.id) |
1893 | + quantities[line_data.prodlot_id.id] = line_data.quantity |
1894 | + tracking_obj._add_prodlots(cr, uid, pack_id, prodlot_ids, quantities, context=context) |
1895 | + return {'type': 'ir.actions.act_window_close'} |
1896 | + |
1897 | +class stock_packaging_add_line(orm.TransientModel): |
1898 | + |
1899 | + _name = "stock.packaging.add.line" |
1900 | + _description = "Add object to a pack" |
1901 | + |
1902 | + _columns = { |
1903 | + 'product_id': fields.many2one('product.product', 'Product', domain="[('type', '!=', 'service'),('track_outgoing', '=', False)]"), |
1904 | + 'parent_id': fields.many2one('stock.packaging.add', 'Parent'), |
1905 | + 'location_id': fields.many2one('stock.location', 'Location'), |
1906 | + 'quantity': fields.float('Quantity', required=True), |
1907 | +# 'prodlot_id': fields.many2one('stock.production.lot', 'Production lot', domain="[('tracking_id','=',False)]"), |
1908 | + 'prodlot_id': fields.many2one('stock.production.lot', 'Production lot'), |
1909 | + } |
1910 | + |
1911 | + _defaults = { |
1912 | + 'quantity': 1.0, |
1913 | + } |
1914 | + |
1915 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1916 | \ No newline at end of file |
1917 | |
1918 | === added file 'stock_tracking_add_remove/wizard/add_object_view.xml' |
1919 | --- stock_tracking_add_remove/wizard/add_object_view.xml 1970-01-01 00:00:00 +0000 |
1920 | +++ stock_tracking_add_remove/wizard/add_object_view.xml 2013-03-06 10:58:19 +0000 |
1921 | @@ -0,0 +1,69 @@ |
1922 | +<?xml version="1.0" encoding="utf-8"?> |
1923 | +<openerp> |
1924 | + <data> |
1925 | + <!-- Add Product --> |
1926 | + |
1927 | + <record id="view_stock_packaging_add_wizard" model="ir.ui.view"> |
1928 | + <field name="name">Stock packaging add</field> |
1929 | + <field name="model">stock.packaging.add</field> |
1930 | + <field name="arch" type="xml"> |
1931 | + <form string="Add object" version="7.0"> |
1932 | + <group colspan="4" col="4"> |
1933 | + <field name="pack_id" invisible="True"/> |
1934 | + <field name="type_id" colspan="4" on_change="onchange_type_id(type_id)" widget="selection" invisible="True"/> |
1935 | + <field name="type" invisible="True"/> |
1936 | + <newline/> |
1937 | + <group name="products" colspan="4" col="4" attrs="{'invisible':[('type','!=','product')]}"> |
1938 | + <separator string="Products" colspan="4"/> |
1939 | + <field name="product_ids" colspan="4" nolabel="1"> |
1940 | + <tree string="Add products" editable="top"> |
1941 | + <field name="product_id" required="True"/> |
1942 | + <field name="location_id"/> |
1943 | + <field name="quantity" required="True"/> |
1944 | + </tree> |
1945 | + </field> |
1946 | + </group> |
1947 | + <group name="prodlots" colspan="4" col="4" attrs="{'invisible':[('type','!=','prodlot')]}"> |
1948 | + <separator string="Production lots" colspan="4"/> |
1949 | + <field name="prodlot_ids" colspan="4" nolabel="1"> |
1950 | + <tree string="Add production lots" editable="top"> |
1951 | + <field name="prodlot_id" required="True"/> |
1952 | + <field name="quantity" required="True"/> |
1953 | + </tree> |
1954 | + </field> |
1955 | + </group> |
1956 | + </group> |
1957 | + <footer> |
1958 | + <button name="add_object" string="Add to the pack" type="object" class="oe_highlight"/> |
1959 | + or |
1960 | + <button string="Cancel" special="cancel" class="oe_link"/> |
1961 | + </footer> |
1962 | + </form> |
1963 | + </field> |
1964 | + </record> |
1965 | + |
1966 | + <record id="action_stock_packaging_add" model="ir.actions.act_window"> |
1967 | + <field name="name">Stock packaging add</field> |
1968 | + <field name="type">ir.actions.act_window</field> |
1969 | + <field name="res_model">stock.packaging.add</field> |
1970 | + <field name="view_type">form</field> |
1971 | + <field name="view_mode">form</field> |
1972 | + <field name="target">new</field> |
1973 | + </record> |
1974 | + |
1975 | + <record id="view_stock_packaging_add_line_wizard" model="ir.ui.view"> |
1976 | + <field name="name">Stock packaging add line</field> |
1977 | + <field name="model">stock.packaging.add.line</field> |
1978 | + <field name="arch" type="xml"> |
1979 | + <form string="Add line"> |
1980 | + <field name="parent_id" invisible="True"/> |
1981 | + <field name="product_id"/> |
1982 | + <field name="prodlot_id"/> |
1983 | + <field name="location_id"/> |
1984 | + <field name="quantity" required="True"/> |
1985 | + </form> |
1986 | + </field> |
1987 | + </record> |
1988 | + |
1989 | + </data> |
1990 | +</openerp> |
1991 | |
1992 | === added file 'stock_tracking_add_remove/wizard/remove_object.py' |
1993 | --- stock_tracking_add_remove/wizard/remove_object.py 1970-01-01 00:00:00 +0000 |
1994 | +++ stock_tracking_add_remove/wizard/remove_object.py 2013-03-06 10:58:19 +0000 |
1995 | @@ -0,0 +1,227 @@ |
1996 | +# -*- coding: utf-8 -*- |
1997 | +################################################################################# |
1998 | +# |
1999 | +# OpenERP, Open Source Management Solution |
2000 | +# Copyright (C) 2012 Julius Network Solutions SARL <contact@julius.fr> |
2001 | +# |
2002 | +# This program is free software: you can redistribute it and/or modify |
2003 | +# it under the terms of the GNU General Public License as published by |
2004 | +# the Free Software Foundation, either version 3 of the License, or |
2005 | +# (at your option) any later version. |
2006 | +# |
2007 | +# This program is distributed in the hope that it will be useful, |
2008 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2009 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2010 | +# GNU General Public License for more details. |
2011 | +# |
2012 | +# You should have received a copy of the GNU General Public License |
2013 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2014 | +# |
2015 | +################################################################################# |
2016 | + |
2017 | +from openerp.osv import fields, osv, orm |
2018 | +from openerp.tools.translate import _ |
2019 | +import time |
2020 | +from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT |
2021 | + |
2022 | +class stock_packaging_remove(orm.TransientModel): |
2023 | + _name = "stock.packaging.remove" |
2024 | + |
2025 | + _columns = { |
2026 | + 'type_id': fields.many2one('stock.packaging.add.type', 'Type', required=True), |
2027 | + 'type': fields.char('Type', size=64), |
2028 | + 'pack_id': fields.many2one('stock.tracking', 'Pack'), |
2029 | + 'product_ids': fields.one2many('stock.packaging.remove.line', 'parent_id', 'Lines', domain=[('product_id', '!=', False)]), |
2030 | + 'prodlot_ids': fields.one2many('stock.packaging.remove.line', 'parent_id', 'Lines', domain=[('prodlot_id', '!=', False)]), |
2031 | + } |
2032 | + |
2033 | + def _get_type_id(self, cr, uid, context): |
2034 | + if context is None: |
2035 | + context = {} |
2036 | + type = context.get('type_selection', 'product') |
2037 | + type_obj = self.pool.get('stock.packaging.add.type') |
2038 | + default_type = type_obj.search(cr, uid, [('code', '=', type)], limit=1, context=context) |
2039 | + if not default_type: |
2040 | + default_type = type_obj.search(cr, uid, [], limit=1, context=context) |
2041 | + return default_type and default_type[0] or False |
2042 | + |
2043 | + def _get_type(self, cr, uid, context=None): |
2044 | + if context is None: |
2045 | + context = {} |
2046 | + type = context.get('type_selection', 'product') |
2047 | + res_type = '' |
2048 | + type_obj = self.pool.get('stock.packaging.add.type') |
2049 | + default_type = type_obj.search(cr, uid, [('code', '=', type)], limit=1, context=context) |
2050 | + if not default_type: |
2051 | + default_type = type_obj.search(cr, uid, [], limit=1, context=context) |
2052 | + if default_type and default_type[0]: |
2053 | + read_type = type_obj.read(cr, uid, default_type[0], ['code'], context=context) |
2054 | + if read_type['code']: |
2055 | + res_type = read_type['code'] |
2056 | + return res_type or '' |
2057 | + |
2058 | + _defaults = { |
2059 | + 'pack_id': lambda self, cr, uid, context: context.get('active_id', False), |
2060 | + 'type_id': lambda self, cr, uid, context: self._get_type_id(cr, uid, context), |
2061 | + 'type': lambda self, cr, uid, context: self._get_type(cr, uid, context), |
2062 | + } |
2063 | + |
2064 | + def onchange_type_id(self, cr, uid, ids, type_id, pack_id): |
2065 | + product_ids = [] |
2066 | + prodlot_ids = [] |
2067 | + domain_product_id = [] |
2068 | + domain_prodlot_id = [] |
2069 | + res = {'value': {'type': ''}} |
2070 | + code_type = 'product' |
2071 | + if type_id: |
2072 | + type_obj = self.pool.get('stock.packaging.add.type') |
2073 | + type = type_obj.read(cr, uid, type_id, ['code']) |
2074 | + if type['code']: |
2075 | + code_type = type['code'] |
2076 | + res = {'value': {'type': type['code']}} |
2077 | + return res |
2078 | + |
2079 | + def remove_object(self, cr, uid, ids, context=None): |
2080 | + if context is None: |
2081 | + context = {} |
2082 | + tracking_obj = self.pool.get('stock.tracking') |
2083 | + for current in self.browse(cr, uid, ids, context=context): |
2084 | + code_type = current.type_id.code |
2085 | + pack_id = current.pack_id.id |
2086 | + if code_type == 'product': |
2087 | + product_ids = current.product_ids |
2088 | + tracking_obj._remove_products(cr, uid, pack_id, product_ids, context=context) |
2089 | + elif code_type == 'prodlot': |
2090 | + prodlot_ids = current.prodlot_ids |
2091 | + tracking_obj._remove_prodlot(cr, uid, pack_id, prodlot_ids, context=context) |
2092 | + return {'type': 'ir.actions.act_window_close'} |
2093 | + |
2094 | + """ |
2095 | + DO NOT DELETE THIS: maybe put this part to an other module. |
2096 | + This is getting automatically the products or prodlots found in the pack with the related quantities. |
2097 | + """ |
2098 | +# def _line_data(self, cr, uid, move): |
2099 | +# data = { |
2100 | +# 'product_id' : move.product_id and move.product_id.id or False, |
2101 | +# 'quantity' : move.product_qty or 0, |
2102 | +# 'move_id': move.id, |
2103 | +# 'prodlot_id': move.prodlot_id and move.prodlot_id.id or False, |
2104 | +# } |
2105 | +# return data |
2106 | +# |
2107 | +# def default_get(self, cr, uid, fields, context=None): |
2108 | +# if context is None: context = {} |
2109 | +# code_type = context.get('type_selection') or False |
2110 | +# res = super(stock_packaging_remove, self).default_get(cr, uid, fields, context=context) |
2111 | +# product_ids = [] |
2112 | +# prodlot_ids = [] |
2113 | +# pack_id = context.get('active_id') |
2114 | +# move_ids = context.get('active_ids', []) |
2115 | +# pack_obj = self.pool.get('stock.tracking') |
2116 | +# move_obj = self.pool.get('stock.move') |
2117 | +# if not pack_id: |
2118 | +# return res |
2119 | +# if 'product_ids' in fields and code_type == 'product': |
2120 | +# pack = pack_obj.browse(cr, uid, pack_id, context=context) |
2121 | +# move_ids = pack.current_move_ids |
2122 | +# product = [self._line_data(cr, uid, m) for m in move_ids if not m.prodlot_id] |
2123 | +# res.update(product_ids=product) |
2124 | +# if 'prodlot_ids' in fields and code_type == 'prodlot': |
2125 | +# pack = pack_obj.browse(cr, uid, pack_id, context=context) |
2126 | +# move_ids = pack.current_move_ids |
2127 | +# prodlot = [self._line_data(cr, uid, m) for m in move_ids if m.prodlot_id] |
2128 | +# res.update(prodlot_ids=prodlot) |
2129 | +# return res |
2130 | + |
2131 | +class stock_packaging_remove_line(orm.TransientModel): |
2132 | + |
2133 | + _name = "stock.packaging.remove.line" |
2134 | + _description = "Remove object to a pack" |
2135 | + |
2136 | + _columns = { |
2137 | + 'parent_id': fields.many2one('stock.packaging.remove', 'Parent'), |
2138 | + 'pack_id': fields.many2one('stock.tracking', 'Pack'), |
2139 | + 'product_id': fields.many2one('product.product', 'Product'), |
2140 | + 'prodlot_id': fields.many2one('stock.production.lot', 'Production Lot'), |
2141 | + 'move_id': fields.many2one('stock.move', 'Move'), |
2142 | + 'quantity': fields.float('Quantity'), |
2143 | + } |
2144 | + |
2145 | + def onchange_pack_id(self, cr, uid, ids, pack_id, context=None): |
2146 | + if context is None: |
2147 | + context = {} |
2148 | + res = {} |
2149 | + product_ids = [] |
2150 | + prodlot_ids = [] |
2151 | + domain_product_id = [] |
2152 | + domain_prodlot_id = [] |
2153 | + code_type = context.get('code_type') or 'product' |
2154 | + if pack_id: |
2155 | + move_ids = self.pool.get('stock.tracking').browse(cr, uid, pack_id, context=context).current_move_ids |
2156 | + for move_id in move_ids: |
2157 | + if code_type == 'product' and (move_id.product_id.id not in product_ids) and not move_id.prodlot_id: |
2158 | + product_ids.append(move_id.product_id.id) |
2159 | + for move_id in move_ids: |
2160 | + if code_type == 'prodlot' and move_id.prodlot_id.id not in prodlot_ids: |
2161 | + prodlot_ids.append(move_id.prodlot_id.id) |
2162 | + if code_type == 'product': |
2163 | + var = ('id', 'in', tuple(product_ids)) |
2164 | + domain_product_id.append(var) |
2165 | + res.update({ |
2166 | + 'domain': { |
2167 | + 'product_id': str(domain_product_id), |
2168 | + } |
2169 | + }) |
2170 | + elif code_type == 'prodlot': |
2171 | + var = ('id', 'in', tuple(prodlot_ids)) |
2172 | + domain_prodlot_id.append(var) |
2173 | + res.update({ |
2174 | + 'domain': { |
2175 | + 'prodlot_id': str(domain_prodlot_id), |
2176 | + } |
2177 | + }) |
2178 | + return res |
2179 | + |
2180 | + def onchange_product_id(self, cr, uid, ids, product_id, pack_id, context=None): |
2181 | + if context is None: |
2182 | + context = {} |
2183 | + value = {} |
2184 | + if pack_id and product_id: |
2185 | + tracking_obj = self.pool.get('stock.tracking') |
2186 | + move_obj = self.pool.get('stock.move') |
2187 | + current_moves = tracking_obj.browse(cr, uid, pack_id, context=context).current_move_ids |
2188 | + current_moves_ids = [x.id for x in current_moves] |
2189 | + move_ids = move_obj.search(cr, uid, [ |
2190 | + ('id', 'in', current_moves_ids), |
2191 | + ('product_id', '=', product_id), |
2192 | + ('prodlot_id', '=', False) |
2193 | + ], limit=1, context=context) |
2194 | + if move_ids: |
2195 | + move = move_obj.read(cr, uid, move_ids[0], ['product_qty'], context=context) |
2196 | + value = {'quantity': move['product_qty'], 'move_id': move_ids[0]} |
2197 | + return {'value': value} |
2198 | + |
2199 | + def onchange_prodlot_id(self, cr, uid, ids, prodlot_id, pack_id, context=None): |
2200 | + if context is None: |
2201 | + context = {} |
2202 | + value = {} |
2203 | + if pack_id and prodlot_id: |
2204 | + tracking_obj = self.pool.get('stock.tracking') |
2205 | + move_obj = self.pool.get('stock.move') |
2206 | + current_moves = tracking_obj.browse(cr, uid, pack_id, context=context).current_move_ids |
2207 | + current_moves_ids = [x.id for x in current_moves] |
2208 | + move_ids = move_obj.search(cr, uid, [ |
2209 | + ('id', 'in', current_moves_ids), |
2210 | + ('prodlot_id', '=', prodlot_id), |
2211 | + ], limit=1, context=context) |
2212 | + if move_ids: |
2213 | + move = move_obj.read(cr, uid, move_ids[0], ['product_qty'], context=context) |
2214 | + value = {'quantity': move['product_qty'], 'move_id': move_ids[0]} |
2215 | + return {'value': value} |
2216 | + |
2217 | + _defaults = { |
2218 | + 'quantity': 1.0, |
2219 | + 'pack_id': lambda self, cr, uid, context: context.get('active_id', False), |
2220 | + } |
2221 | + |
2222 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2223 | \ No newline at end of file |
2224 | |
2225 | === added file 'stock_tracking_add_remove/wizard/remove_object_view.xml' |
2226 | --- stock_tracking_add_remove/wizard/remove_object_view.xml 1970-01-01 00:00:00 +0000 |
2227 | +++ stock_tracking_add_remove/wizard/remove_object_view.xml 2013-03-06 10:58:19 +0000 |
2228 | @@ -0,0 +1,55 @@ |
2229 | +<?xml version="1.0" encoding="utf-8"?> |
2230 | +<openerp> |
2231 | + <data> |
2232 | + |
2233 | + <!-- Remove Object --> |
2234 | + <record id="view_stock_packaging_remove_wizard" model="ir.ui.view"> |
2235 | + <field name="name">Stock packaging remove</field> |
2236 | + <field name="model">stock.packaging.remove</field> |
2237 | + <field name="arch" type="xml"> |
2238 | + <form string="Remove object" version="7.0"> |
2239 | + <group colspan="4" col="4"> |
2240 | + <field name="type_id" colspan="1" on_change="onchange_type_id(type_id, pack_id)" widget="selection" invisible="1"/> |
2241 | + <field name="pack_id" invisible="1"/> |
2242 | + <field name="type" invisible="1"/> |
2243 | + </group> |
2244 | + <group colspan="4" col="4"> |
2245 | + <group name="products" colspan="4" col="4"> |
2246 | + <field name="product_ids" colspan="4" nolabel="1" attrs="{'invisible': [('type','!=','product')]}" context="{'active_id':pack_id, 'code_type': type}"> |
2247 | + <tree editable="top"> |
2248 | + <field name="pack_id" invisible="1" on_change="onchange_pack_id(pack_id, context)"/> |
2249 | + <field name="product_id" on_change="onchange_product_id(product_id, pack_id, context)" required="1"/> |
2250 | + <field name="quantity"/> |
2251 | + <field name="move_id" invisible="1"/> |
2252 | + </tree> |
2253 | + </field> |
2254 | + <field name="prodlot_ids" colspan="4" nolabel="1" attrs="{'invisible': [('type','!=','prodlot')]}" context="{'active_id':pack_id, 'code_type': type}"> |
2255 | + <tree editable="top"> |
2256 | + <field name="pack_id" invisible="1" on_change="onchange_pack_id(pack_id, context)"/> |
2257 | + <field name="prodlot_id" on_change="onchange_prodlot_id(prodlot_id, pack_id, context)" required="1"/> |
2258 | + <field name="quantity"/> |
2259 | + <field name="move_id" invisible="1"/> |
2260 | + </tree> |
2261 | + </field> |
2262 | + </group> |
2263 | + </group> |
2264 | + <footer> |
2265 | + <button name="remove_object" string="Remove Object" type="object" class="oe_highlight"/> |
2266 | + or |
2267 | + <button string="Cancel" special="cancel" class="oe_link"/> |
2268 | + </footer> |
2269 | + </form> |
2270 | + </field> |
2271 | + </record> |
2272 | + |
2273 | + <record id="action_stock_packaging_remove" model="ir.actions.act_window"> |
2274 | + <field name="name">Stock packaging remove</field> |
2275 | + <field name="type">ir.actions.act_window</field> |
2276 | + <field name="res_model">stock.packaging.remove</field> |
2277 | + <field name="view_type">form</field> |
2278 | + <field name="view_mode">form</field> |
2279 | + <field name="target">new</field> |
2280 | + </record> |
2281 | + |
2282 | + </data> |
2283 | +</openerp> |
2284 | |
2285 | === added directory 'stock_tracking_add_remove_pack' |
2286 | === added file 'stock_tracking_add_remove_pack/__init__.py' |
2287 | --- stock_tracking_add_remove_pack/__init__.py 1970-01-01 00:00:00 +0000 |
2288 | +++ stock_tracking_add_remove_pack/__init__.py 2013-03-06 10:58:19 +0000 |
2289 | @@ -0,0 +1,25 @@ |
2290 | +# -*- coding: utf-8 -*- |
2291 | +################################################################################# |
2292 | +# |
2293 | +# OpenERP, Open Source Management Solution |
2294 | +# Copyright (C) 2012 Julius Network Solutions SARL <contact@julius.fr> |
2295 | +# |
2296 | +# This program is free software: you can redistribute it and/or modify |
2297 | +# it under the terms of the GNU General Public License as published by |
2298 | +# the Free Software Foundation, either version 3 of the License, or |
2299 | +# (at your option) any later version. |
2300 | +# |
2301 | +# This program is distributed in the hope that it will be useful, |
2302 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2303 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2304 | +# GNU General Public License for more details. |
2305 | +# |
2306 | +# You should have received a copy of the GNU General Public License |
2307 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2308 | +# |
2309 | +################################################################################# |
2310 | + |
2311 | +import wizard |
2312 | +import stock_tracking |
2313 | + |
2314 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2315 | \ No newline at end of file |
2316 | |
2317 | === added file 'stock_tracking_add_remove_pack/__openerp__.py' |
2318 | --- stock_tracking_add_remove_pack/__openerp__.py 1970-01-01 00:00:00 +0000 |
2319 | +++ stock_tracking_add_remove_pack/__openerp__.py 2013-03-06 10:58:19 +0000 |
2320 | @@ -0,0 +1,53 @@ |
2321 | +# -*- coding: utf-8 -*- |
2322 | +################################################################################# |
2323 | +# |
2324 | +# OpenERP, Open Source Management Solution |
2325 | +# Copyright (C) 2012 Julius Network Solutions SARL <contact@julius.fr> |
2326 | +# |
2327 | +# This program is free software: you can redistribute it and/or modify |
2328 | +# it under the terms of the GNU General Public License as published by |
2329 | +# the Free Software Foundation, either version 3 of the License, or |
2330 | +# (at your option) any later version. |
2331 | +# |
2332 | +# This program is distributed in the hope that it will be useful, |
2333 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2334 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2335 | +# GNU General Public License for more details. |
2336 | +# |
2337 | +# You should have received a copy of the GNU General Public License |
2338 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2339 | +# |
2340 | +################################################################################# |
2341 | + |
2342 | +{ |
2343 | + "name" : "Stock tracking add packs", |
2344 | + "version" : "1.0", |
2345 | + "author" : "Julius Network Solutions", |
2346 | + "description" : """Presentation: |
2347 | + |
2348 | +This module add a wizard to fill in packaging. |
2349 | +This wizard is used to add or remove an object from a package. |
2350 | +Adding to the historical movements and parent objects |
2351 | + |
2352 | +""", |
2353 | + "website" : "http://www.julius.fr", |
2354 | + "depends" : [ |
2355 | + "stock_tracking_extended", |
2356 | + "stock_tracking_child", |
2357 | + "stock_tracking_add_remove", |
2358 | + ], |
2359 | + "category" : "Warehouse Management", |
2360 | + "images" : [], |
2361 | + "demo" : [], |
2362 | + "data" : [ |
2363 | + "wizard/add_pack_view.xml", |
2364 | + "wizard/remove_pack_view.xml", |
2365 | + "data/type.xml", |
2366 | + 'stock_view.xml', |
2367 | + ], |
2368 | + 'test': [], |
2369 | + 'installable': True, |
2370 | + 'active': False, |
2371 | +} |
2372 | + |
2373 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2374 | |
2375 | === added directory 'stock_tracking_add_remove_pack/data' |
2376 | === added file 'stock_tracking_add_remove_pack/data/type.xml' |
2377 | --- stock_tracking_add_remove_pack/data/type.xml 1970-01-01 00:00:00 +0000 |
2378 | +++ stock_tracking_add_remove_pack/data/type.xml 2013-03-06 10:58:19 +0000 |
2379 | @@ -0,0 +1,11 @@ |
2380 | +<?xml version="1.0" encoding="utf-8"?> |
2381 | +<openerp> |
2382 | + <data> |
2383 | + |
2384 | + <record id="add_type_pack" model="stock.packaging.add.type"> |
2385 | + <field name="code">pack</field> |
2386 | + <field name="name">Packs</field> |
2387 | + </record> |
2388 | + |
2389 | + </data> |
2390 | +</openerp> |
2391 | |
2392 | === added directory 'stock_tracking_add_remove_pack/security' |
2393 | === added file 'stock_tracking_add_remove_pack/stock_tracking.py' |
2394 | --- stock_tracking_add_remove_pack/stock_tracking.py 1970-01-01 00:00:00 +0000 |
2395 | +++ stock_tracking_add_remove_pack/stock_tracking.py 2013-03-06 10:58:19 +0000 |
2396 | @@ -0,0 +1,79 @@ |
2397 | +# -*- coding: utf-8 -*- |
2398 | +################################################################################# |
2399 | +# |
2400 | +# OpenERP, Open Source Management Solution |
2401 | +# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr> |
2402 | +# |
2403 | +# This program is free software: you can redistribute it and/or modify |
2404 | +# it under the terms of the GNU General Public License as published by |
2405 | +# the Free Software Foundation, either version 3 of the License, or |
2406 | +# (at your option) any later version. |
2407 | +# |
2408 | +# This program is distributed in the hope that it will be useful, |
2409 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2410 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2411 | +# GNU General Public License for more details. |
2412 | +# |
2413 | +# You should have received a copy of the GNU General Public License |
2414 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2415 | +# |
2416 | +################################################################################# |
2417 | + |
2418 | +from openerp.osv import fields, osv, orm |
2419 | +from openerp.tools.translate import _ |
2420 | +from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DEFAULT_SERVER_DATE_FORMAT |
2421 | +import time |
2422 | + |
2423 | +class stock_tracking(orm.Model): |
2424 | + _inherit = 'stock.tracking' |
2425 | + |
2426 | + def _add_pack(self, cr, uid, pack_id, child_ids, context=None): |
2427 | + if context is None: |
2428 | + context = {} |
2429 | + date = time.strftime(DEFAULT_SERVER_DATETIME_FORMAT) |
2430 | + history_obj = self.pool.get('stock.tracking.history') |
2431 | + pack = self.browse(cr, uid, pack_id, context=context) |
2432 | + child = self.browse(cr, uid, child_ids, context=context)[0] |
2433 | + hist_id = history_obj.create(cr, uid, { |
2434 | + 'tracking_id': pack.id, |
2435 | + 'type': 'add_pack', |
2436 | + 'location_id': pack.location_id.id, |
2437 | + 'location_dest_id': pack.location_id.id, |
2438 | + 'child_pack_id': child.id, |
2439 | + 'qty': 1.0, |
2440 | + 'date' : date, |
2441 | + }, context=context) |
2442 | + self.write(cr, uid, child_ids, {'parent_id': pack_id}, context=context) |
2443 | + self.get_products(cr, uid, [pack_id], context=context) |
2444 | + self.get_serials(cr, uid, [pack_id], context=context) |
2445 | + return True |
2446 | + |
2447 | + def _remove_pack(self, cr, uid, pack_id, child_ids, context=None): |
2448 | + if context is None: |
2449 | + context = {} |
2450 | + history_obj = self.pool.get('stock.tracking.history') |
2451 | + pack = self.browse(cr, uid, pack_id, context=context) |
2452 | + child = self.browse(cr, uid, child_ids, context=context)[0] |
2453 | + hist_id = history_obj.create(cr, uid, { |
2454 | + 'tracking_id': pack.id, |
2455 | + 'type': 'remove_pack', |
2456 | + 'location_id': pack.location_id.id, |
2457 | + 'location_dest_id': pack.location_id.id, |
2458 | + 'child_pack_id': child.id, |
2459 | + 'qty': 1.0, |
2460 | + 'date' : date, |
2461 | + }, context=context) |
2462 | + self.write(cr, uid, child_ids, {'parent_id': False}, context=context) |
2463 | + self.get_products(cr, uid, [pack_id], context=context) |
2464 | + self.get_serials(cr, uid, [pack_id], context=context) |
2465 | + return True |
2466 | + |
2467 | +class stock_tracking_history(osv.osv): |
2468 | + |
2469 | + _inherit = "stock.tracking.history" |
2470 | + |
2471 | + _columns = { |
2472 | + 'child_pack_id': fields.many2one('stock.tracking', 'Pack'), |
2473 | + } |
2474 | + |
2475 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2476 | |
2477 | === added file 'stock_tracking_add_remove_pack/stock_view.xml' |
2478 | --- stock_tracking_add_remove_pack/stock_view.xml 1970-01-01 00:00:00 +0000 |
2479 | +++ stock_tracking_add_remove_pack/stock_view.xml 2013-03-06 10:58:19 +0000 |
2480 | @@ -0,0 +1,29 @@ |
2481 | +<?xml version="1.0" encoding="utf-8"?> |
2482 | +<openerp> |
2483 | + <data> |
2484 | + |
2485 | + <record id="view_tracking_form_add_pack" model="ir.ui.view"> |
2486 | + <field name="name">stock.tracking.form.add.pack</field> |
2487 | + <field name="model">stock.tracking</field> |
2488 | + <field name="inherit_id" ref="stock_tracking_child.view_tracking_child_form"/> |
2489 | + <field name="arch" type="xml"> |
2490 | + <div name="child_buttons" position="inside"> |
2491 | + <button name="%(stock_tracking_add_remove.action_stock_packaging_add)d" string="Add packs" colspan="1" type="action" context="{'type_selection':'pack'}"/> |
2492 | + <button name="%(stock_tracking_add_remove.action_stock_packaging_remove)d" string="Remove packs" colspan="1" type="action" context="{'type_selection':'pack'}"/> |
2493 | + </div> |
2494 | + </field> |
2495 | + </record> |
2496 | + |
2497 | + <record id="view_tracking_history_form_inherit" model="ir.ui.view"> |
2498 | + <field name="name">stock.tracking.history.form</field> |
2499 | + <field name="model">stock.tracking.history</field> |
2500 | + <field name="inherit_id" ref="stock_tracking_extended.view_tracking_history_form"/> |
2501 | + <field name="arch" type="xml"> |
2502 | + <form string="History"> |
2503 | + <field name="child_pack_id" attrs="{'invisible': [('type','!=','add_pack'),('type','!=','remove_pack')]}"/> |
2504 | + </form> |
2505 | + </field> |
2506 | + </record> |
2507 | + |
2508 | + </data> |
2509 | +</openerp> |
2510 | |
2511 | === added directory 'stock_tracking_add_remove_pack/wizard' |
2512 | === added file 'stock_tracking_add_remove_pack/wizard/__init__.py' |
2513 | --- stock_tracking_add_remove_pack/wizard/__init__.py 1970-01-01 00:00:00 +0000 |
2514 | +++ stock_tracking_add_remove_pack/wizard/__init__.py 2013-03-06 10:58:19 +0000 |
2515 | @@ -0,0 +1,25 @@ |
2516 | +# -*- coding: utf-8 -*- |
2517 | +################################################################################# |
2518 | +# |
2519 | +# OpenERP, Open Source Management Solution |
2520 | +# Copyright (C) 2012 Julius Network Solutions SARL <contact@julius.fr> |
2521 | +# |
2522 | +# This program is free software: you can redistribute it and/or modify |
2523 | +# it under the terms of the GNU General Public License as published by |
2524 | +# the Free Software Foundation, either version 3 of the License, or |
2525 | +# (at your option) any later version. |
2526 | +# |
2527 | +# This program is distributed in the hope that it will be useful, |
2528 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2529 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2530 | +# GNU General Public License for more details. |
2531 | +# |
2532 | +# You should have received a copy of the GNU General Public License |
2533 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2534 | +# |
2535 | +################################################################################# |
2536 | + |
2537 | +import add_pack |
2538 | +import remove_pack |
2539 | + |
2540 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2541 | \ No newline at end of file |
2542 | |
2543 | === added file 'stock_tracking_add_remove_pack/wizard/add_pack.py' |
2544 | --- stock_tracking_add_remove_pack/wizard/add_pack.py 1970-01-01 00:00:00 +0000 |
2545 | +++ stock_tracking_add_remove_pack/wizard/add_pack.py 2013-03-06 10:58:19 +0000 |
2546 | @@ -0,0 +1,62 @@ |
2547 | +# -*- coding: utf-8 -*- |
2548 | +################################################################################# |
2549 | +# |
2550 | +# OpenERP, Open Source Management Solution |
2551 | +# Copyright (C) 2012 Julius Network Solutions SARL <contact@julius.fr> |
2552 | +# |
2553 | +# This program is free software: you can redistribute it and/or modify |
2554 | +# it under the terms of the GNU General Public License as published by |
2555 | +# the Free Software Foundation, either version 3 of the License, or |
2556 | +# (at your option) any later version. |
2557 | +# |
2558 | +# This program is distributed in the hope that it will be useful, |
2559 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2560 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2561 | +# GNU General Public License for more details. |
2562 | +# |
2563 | +# You should have received a copy of the GNU General Public License |
2564 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2565 | +# |
2566 | +################################################################################# |
2567 | + |
2568 | +from openerp.osv import fields, osv, orm |
2569 | +from openerp.tools.translate import _ |
2570 | + |
2571 | +class stock_packaging_add(orm.TransientModel): |
2572 | + |
2573 | + _inherit = "stock.packaging.add" |
2574 | + |
2575 | + _columns = { |
2576 | + 'location_id': fields.many2one('stock.location', 'Location'), |
2577 | + 'pack_ids': fields.many2many('stock.tracking', 'add_pack_child_rel', 'wizard_id', 'pack_id', 'Packs', domain=[('parent_id', '=', False),('state', '=', 'close')]), |
2578 | + } |
2579 | + |
2580 | + def _get_location_id(self, cr, uid, context): |
2581 | + if context==None: |
2582 | + context={} |
2583 | + location_id = False |
2584 | + active_id = context.get('active_id') |
2585 | + if active_id: |
2586 | + tracking_obj = self.pool.get('stock.tracking') |
2587 | + tracking = tracking_obj.browse(cr, uid, active_id, context=context) |
2588 | + location_id = tracking.location_id and tracking.location_id.id or False |
2589 | + return location_id |
2590 | + |
2591 | + _defaults = { |
2592 | + 'location_id': lambda self, cr, uid, context: self._get_location_id(cr, uid, context), |
2593 | + } |
2594 | + |
2595 | + def add_object(self, cr, uid, ids, context=None): |
2596 | + if context is None: |
2597 | + context = {} |
2598 | + tracking_obj = self.pool.get('stock.tracking') |
2599 | + res = super(stock_packaging_add, self).add_object(cr, uid, ids, context=context) |
2600 | + for current in self.browse(cr, uid, ids, context=context): |
2601 | + code_type = current.type_id.code |
2602 | + pack_id = current.pack_id.id |
2603 | + child_ids = [x.id for x in current.pack_ids] |
2604 | + if code_type == 'pack': |
2605 | + tracking_obj._add_pack(cr, uid, pack_id, child_ids, context=context) |
2606 | + return res |
2607 | + |
2608 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2609 | \ No newline at end of file |
2610 | |
2611 | === added file 'stock_tracking_add_remove_pack/wizard/add_pack_view.xml' |
2612 | --- stock_tracking_add_remove_pack/wizard/add_pack_view.xml 1970-01-01 00:00:00 +0000 |
2613 | +++ stock_tracking_add_remove_pack/wizard/add_pack_view.xml 2013-03-06 10:58:19 +0000 |
2614 | @@ -0,0 +1,21 @@ |
2615 | +<?xml version="1.0" encoding="utf-8"?> |
2616 | +<openerp> |
2617 | + <data> |
2618 | + |
2619 | + <record id="view_stock_packaging_add_wizard" model="ir.ui.view"> |
2620 | + <field name="name">Stock packaging add</field> |
2621 | + <field name="model">stock.packaging.add</field> |
2622 | + <field name="inherit_id" ref="stock_tracking_add_remove.view_stock_packaging_add_wizard"/> |
2623 | + <field name="arch" type="xml"> |
2624 | + <group name="products" position="after"> |
2625 | + <group name="packs" colspan="4" col="4" attrs="{'invisible':[('type','!=','pack')]}"> |
2626 | + <separator string="Add Packs" colspan="4"/> |
2627 | + <field name="location_id" invisible="True"/> |
2628 | + <field name="pack_ids" colspan="4" nolabel="1" domain="[('parent_id', '=', False),('state', '=', 'close'),('location_id', '=', location_id)]"/> |
2629 | + </group> |
2630 | + </group> |
2631 | + </field> |
2632 | + </record> |
2633 | + |
2634 | + </data> |
2635 | +</openerp> |
2636 | |
2637 | === added file 'stock_tracking_add_remove_pack/wizard/remove_pack.py' |
2638 | --- stock_tracking_add_remove_pack/wizard/remove_pack.py 1970-01-01 00:00:00 +0000 |
2639 | +++ stock_tracking_add_remove_pack/wizard/remove_pack.py 2013-03-06 10:58:19 +0000 |
2640 | @@ -0,0 +1,46 @@ |
2641 | +# -*- coding: utf-8 -*- |
2642 | +################################################################################# |
2643 | +# |
2644 | +# OpenERP, Open Source Management Solution |
2645 | +# Copyright (C) 2012 Julius Network Solutions SARL <contact@julius.fr> |
2646 | +# |
2647 | +# This program is free software: you can redistribute it and/or modify |
2648 | +# it under the terms of the GNU General Public License as published by |
2649 | +# the Free Software Foundation, either version 3 of the License, or |
2650 | +# (at your option) any later version. |
2651 | +# |
2652 | +# This program is distributed in the hope that it will be useful, |
2653 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2654 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2655 | +# GNU General Public License for more details. |
2656 | +# |
2657 | +# You should have received a copy of the GNU General Public License |
2658 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2659 | +# |
2660 | +################################################################################# |
2661 | + |
2662 | +from openerp.osv import fields, osv, orm |
2663 | +from openerp.tools.translate import _ |
2664 | + |
2665 | +class stock_packaging_remove(orm.TransientModel): |
2666 | + |
2667 | + _inherit = "stock.packaging.remove" |
2668 | + |
2669 | + _columns = { |
2670 | + 'pack_ids': fields.many2many('stock.tracking', 'remove_pack_child_rel', 'wizard_id', 'pack_id', 'Packs', domain="[('parent_id', '=', pack_id)]"), |
2671 | + } |
2672 | + |
2673 | + def remove_object(self, cr, uid, ids, context=None): |
2674 | + if context is None: |
2675 | + context = {} |
2676 | + tracking_obj = self.pool.get('stock.tracking') |
2677 | + res = super(stock_packaging_remove, self).remove_object(cr, uid, ids, context=context) |
2678 | + for current in self.browse(cr, uid, ids, context=context): |
2679 | + code_type = current.type_id.code |
2680 | + pack_id = current.pack_id.id |
2681 | + child_ids = [x.id for x in current.pack_ids] |
2682 | + if code_type == 'pack': |
2683 | + tracking_obj._remove_pack(cr, uid, pack_id, child_ids, context=context) |
2684 | + return res |
2685 | + |
2686 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2687 | \ No newline at end of file |
2688 | |
2689 | === added file 'stock_tracking_add_remove_pack/wizard/remove_pack_view.xml' |
2690 | --- stock_tracking_add_remove_pack/wizard/remove_pack_view.xml 1970-01-01 00:00:00 +0000 |
2691 | +++ stock_tracking_add_remove_pack/wizard/remove_pack_view.xml 2013-03-06 10:58:19 +0000 |
2692 | @@ -0,0 +1,19 @@ |
2693 | +<?xml version="1.0" encoding="utf-8"?> |
2694 | +<openerp> |
2695 | + <data> |
2696 | + |
2697 | + <record id="view_stock_packaging_remove_wizard" model="ir.ui.view"> |
2698 | + <field name="name">Stock packaging remove</field> |
2699 | + <field name="model">stock.packaging.remove</field> |
2700 | + <field name="inherit_id" ref="stock_tracking_add_remove.view_stock_packaging_remove_wizard"/> |
2701 | + <field name="arch" type="xml"> |
2702 | + <group name="products" position="after"> |
2703 | + <group name="packs" colspan="4" col="4" attrs="{'invisible':[('type','!=','pack')]}"> |
2704 | + <field name="pack_ids" colspan="4" nolabel="1"/> |
2705 | + </group> |
2706 | + </group> |
2707 | + </field> |
2708 | + </record> |
2709 | + |
2710 | + </data> |
2711 | +</openerp> |
2712 | |
2713 | === added directory 'stock_tracking_child' |
2714 | === added file 'stock_tracking_child/__init__.py' |
2715 | --- stock_tracking_child/__init__.py 1970-01-01 00:00:00 +0000 |
2716 | +++ stock_tracking_child/__init__.py 2013-03-06 10:58:19 +0000 |
2717 | @@ -0,0 +1,24 @@ |
2718 | +# -*- coding: utf-8 -*- |
2719 | +################################################################################# |
2720 | +# |
2721 | +# OpenERP, Open Source Management Solution |
2722 | +# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr> |
2723 | +# |
2724 | +# This program is free software: you can redistribute it and/or modify |
2725 | +# it under the terms of the GNU General Public License as published by |
2726 | +# the Free Software Foundation, either version 3 of the License, or |
2727 | +# (at your option) any later version. |
2728 | +# |
2729 | +# This program is distributed in the hope that it will be useful, |
2730 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2731 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2732 | +# GNU General Public License for more details. |
2733 | +# |
2734 | +# You should have received a copy of the GNU General Public License |
2735 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2736 | +# |
2737 | +################################################################################# |
2738 | + |
2739 | +import stock_tracking |
2740 | + |
2741 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2742 | \ No newline at end of file |
2743 | |
2744 | === added file 'stock_tracking_child/__openerp__.py' |
2745 | --- stock_tracking_child/__openerp__.py 1970-01-01 00:00:00 +0000 |
2746 | +++ stock_tracking_child/__openerp__.py 2013-03-06 10:58:19 +0000 |
2747 | @@ -0,0 +1,48 @@ |
2748 | +# -*- coding: utf-8 -*- |
2749 | +################################################################################# |
2750 | +# |
2751 | +# OpenERP, Open Source Management Solution |
2752 | +# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr> |
2753 | +# |
2754 | +# This program is free software: you can redistribute it and/or modify |
2755 | +# it under the terms of the GNU General Public License as published by |
2756 | +# the Free Software Foundation, either version 3 of the License, or |
2757 | +# (at your option) any later version. |
2758 | +# |
2759 | +# This program is distributed in the hope that it will be useful, |
2760 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2761 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2762 | +# GNU General Public License for more details. |
2763 | +# |
2764 | +# You should have received a copy of the GNU General Public License |
2765 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2766 | +# |
2767 | +################################################################################# |
2768 | + |
2769 | +{ |
2770 | + "name" : "Stock Tracking Child", |
2771 | + "version" : "1.0", |
2772 | + "author" : "Julius Network Solutions", |
2773 | + "description" : """ |
2774 | + |
2775 | +Presentation: |
2776 | + |
2777 | +This module allows to define and identify package in parent or child |
2778 | + |
2779 | +""", |
2780 | + "website" : "http://www.julius.fr", |
2781 | + "depends" : [ |
2782 | + "stock", |
2783 | + "stock_tracking_extended", |
2784 | + ], |
2785 | + "category" : "Warehouse Management", |
2786 | + "demo" : [], |
2787 | + "data" : [ |
2788 | + 'stock_tracking_view.xml', |
2789 | + ], |
2790 | + 'test': [], |
2791 | + 'installable': True, |
2792 | + 'active': False, |
2793 | +} |
2794 | + |
2795 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
2796 | |
2797 | === added directory 'stock_tracking_child/i18n' |
2798 | === added file 'stock_tracking_child/i18n/fr.po' |
2799 | --- stock_tracking_child/i18n/fr.po 1970-01-01 00:00:00 +0000 |
2800 | +++ stock_tracking_child/i18n/fr.po 2013-03-06 10:58:19 +0000 |
2801 | @@ -0,0 +1,72 @@ |
2802 | +# Translation of OpenERP Server. |
2803 | +# This file contains the translation of the following modules: |
2804 | +# * stock_tracking_child |
2805 | +# |
2806 | +msgid "" |
2807 | +msgstr "" |
2808 | +"Project-Id-Version: OpenERP Server 7.0\n" |
2809 | +"Report-Msgid-Bugs-To: \n" |
2810 | +"POT-Creation-Date: 2013-02-15 11:58+0000\n" |
2811 | +"PO-Revision-Date: 2013-02-15 11:58+0000\n" |
2812 | +"Last-Translator: <>\n" |
2813 | +"Language-Team: \n" |
2814 | +"MIME-Version: 1.0\n" |
2815 | +"Content-Type: text/plain; charset=UTF-8\n" |
2816 | +"Content-Transfer-Encoding: \n" |
2817 | +"Plural-Forms: \n" |
2818 | + |
2819 | +#. module: stock_tracking_child |
2820 | +#: field:stock.tracking,ul_id:0 |
2821 | +msgid "Logistic unit" |
2822 | +msgstr "Unité logistique" |
2823 | + |
2824 | +#. module: stock_tracking_child |
2825 | +#: field:product.ul,capacity_index:0 |
2826 | +msgid "Capacity index" |
2827 | +msgstr "Indice de capacité" |
2828 | + |
2829 | +#. module: stock_tracking_child |
2830 | +#: model:ir.model,name:stock_tracking_child.model_stock_tracking |
2831 | +msgid "Packs" |
2832 | +msgstr "Colis" |
2833 | + |
2834 | +#. module: stock_tracking_child |
2835 | +#: field:stock.tracking,child_serial_ids:0 |
2836 | +msgid "Child Serials" |
2837 | +msgstr "Numéros de séries enfants" |
2838 | + |
2839 | +#. module: stock_tracking_child |
2840 | +#: constraint:stock.tracking:0 |
2841 | +msgid "Bad parent type selection. Please try again." |
2842 | +msgstr "Mauvais choix du type parent. Veuillez ressayez à nouveau." |
2843 | + |
2844 | +#. module: stock_tracking_child |
2845 | +#: model:ir.model,name:stock_tracking_child.model_product_ul |
2846 | +msgid "Shipping Unit" |
2847 | +msgstr "Unité logistique" |
2848 | + |
2849 | +#. module: stock_tracking_child |
2850 | +#: view:stock.tracking:0 |
2851 | +msgid "Child Packs" |
2852 | +msgstr "Colis enfants" |
2853 | + |
2854 | +#. module: stock_tracking_child |
2855 | +#: view:stock.tracking:0 |
2856 | +msgid "Serial Code" |
2857 | +msgstr "Numéro de série" |
2858 | + |
2859 | +#. module: stock_tracking_child |
2860 | +#: field:stock.tracking,parent_id:0 |
2861 | +msgid "Parent" |
2862 | +msgstr "Parent" |
2863 | + |
2864 | +#. module: stock_tracking_child |
2865 | +#: field:stock.tracking,child_product_ids:0 |
2866 | +msgid "Child Products" |
2867 | +msgstr "Produits enfants" |
2868 | + |
2869 | +#. module: stock_tracking_child |
2870 | +#: field:stock.tracking,child_ids:0 |
2871 | +msgid "Children" |
2872 | +msgstr "Enfants" |
2873 | + |
2874 | |
2875 | === added file 'stock_tracking_child/stock_tracking.py' |
2876 | --- stock_tracking_child/stock_tracking.py 1970-01-01 00:00:00 +0000 |
2877 | +++ stock_tracking_child/stock_tracking.py 2013-03-06 10:58:19 +0000 |
2878 | @@ -0,0 +1,151 @@ |
2879 | + # -*- coding: utf-8 -*- |
2880 | +################################################################################# |
2881 | +# |
2882 | +# OpenERP, Open Source Management Solution |
2883 | +# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr> |
2884 | +# |
2885 | +# This program is free software: you can redistribute it and/or modify |
2886 | +# it under the terms of the GNU General Public License as published by |
2887 | +# the Free Software Foundation, either version 3 of the License, or |
2888 | +# (at your option) any later version. |
2889 | +# |
2890 | +# This program is distributed in the hope that it will be useful, |
2891 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
2892 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2893 | +# GNU General Public License for more details. |
2894 | +# |
2895 | +# You should have received a copy of the GNU General Public License |
2896 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
2897 | +# |
2898 | +################################################################################# |
2899 | + |
2900 | +from openerp.osv import fields, osv, orm |
2901 | +from openerp.tools.translate import _ |
2902 | + |
2903 | +class stock_tracking(orm.Model): |
2904 | + |
2905 | + _inherit = 'stock.tracking' |
2906 | + |
2907 | + def hierarchy_ids(self, tracking): |
2908 | + result_list = [tracking] |
2909 | + for child in tracking.child_ids: |
2910 | + result_list.extend(self.hierarchy_ids(child)) |
2911 | + return result_list |
2912 | + |
2913 | + def _get_child_products(self, cr, uid, ids, field_name, arg, context=None): |
2914 | + packs = self.browse(cr, uid, ids) |
2915 | + res = {} |
2916 | + for pack in packs: |
2917 | + res[pack.id] = [] |
2918 | + childs = self.hierarchy_ids(pack) |
2919 | + for child in childs: |
2920 | + for prod in child.product_ids: |
2921 | + res[pack.id].append(prod.id) |
2922 | + return res |
2923 | + |
2924 | + def _get_child_serials(self, cr, uid, ids, field_name, arg, context=None): |
2925 | + packs = self.browse(cr, uid, ids) |
2926 | + res = {} |
2927 | + for pack in packs: |
2928 | + res[pack.id] = [] |
2929 | + childs = self.hierarchy_ids(pack) |
2930 | + for child in childs: |
2931 | + for serial in child.serial_ids: |
2932 | + res[pack.id].append(serial.id) |
2933 | + return res |
2934 | + |
2935 | + _columns = { |
2936 | + 'parent_id': fields.many2one('stock.tracking', 'Parent'), |
2937 | + 'child_ids': fields.one2many('stock.tracking', 'parent_id', 'Children', readonly=True), |
2938 | + 'ul_id': fields.many2one('product.ul', 'Logistic unit'), |
2939 | + 'child_product_ids': fields.function(_get_child_products, method=True, type='one2many', obj='product.stock.tracking', string='Child Products'), |
2940 | + 'child_serial_ids': fields.function(_get_child_serials, method=True, type='one2many', obj='serial.stock.tracking', string='Child Serials'), |
2941 | + } |
2942 | + |
2943 | + def _create_data_product(self, cr, uid, child, product_list, context=None): |
2944 | + if context is None: |
2945 | + context = {} |
2946 | + stock_track = self.pool.get('product.stock.tracking') |
2947 | + for product in product_list.iterkeys(): |
2948 | + stock_track.create(cr, uid, { |
2949 | + 'product_id': product, |
2950 | + 'quantity': product_list[product], |
2951 | + 'tracking_id': child.id |
2952 | + }, context=context) |
2953 | + return True |
2954 | + |
2955 | + def get_products(self, cr, uid, ids, context=None): |
2956 | + if context is None: |
2957 | + context = {} |
2958 | + pack_ids = self.browse(cr, uid, ids, context=context) |
2959 | + stock_track = self.pool.get('product.stock.tracking') |
2960 | + for pack in pack_ids: |
2961 | + childs = self.hierarchy_ids(pack) |
2962 | + for child in childs: |
2963 | + product_ids = [x.id for x in child.product_ids] |
2964 | + stock_track.unlink(cr, uid, product_ids) |
2965 | + product_list = {} |
2966 | + for x in child.current_move_ids: |
2967 | + if x.location_dest_id.id == child.location_id.id: |
2968 | + product_list.setdefault(x.product_id.id, 0) |
2969 | + product_list[x.product_id.id] += x.product_qty |
2970 | + self._create_data_product(cr, uid, child, product_list, context=context) |
2971 | + return True |
2972 | + |
2973 | + def _create_data_prodlot(self, cr, uid, child, serial_list, context=None): |
2974 | + if context is None: |
2975 | + context = {} |
2976 | + serial_track = self.pool.get('serial.stock.tracking') |
2977 | +# serial_obj = self.pool.get('stock.production.lot') |
2978 | + for serial in serial_list.iterkeys(): |
2979 | + if serial: |
2980 | + serial_track.create(cr, uid, { |
2981 | + 'serial_id': serial, |
2982 | + 'quantity': serial_list[serial], |
2983 | + 'tracking_id': child.id |
2984 | + }, context=context) |
2985 | +# serial_obj.write(cr, uid, [serial], {'tracking_id': child.id}, context=context) |
2986 | + return True |
2987 | + |
2988 | + def get_serials(self, cr, uid, ids, context=None): |
2989 | + if context is None: |
2990 | + context = {} |
2991 | + pack_ids = self.browse(cr, uid, ids, context=context) |
2992 | + serial_track = self.pool.get('serial.stock.tracking') |
2993 | + for pack in pack_ids: |
2994 | + childs = self.hierarchy_ids(pack) |
2995 | + for child in childs: |
2996 | + serial_ids = [x.id for x in child.serial_ids] |
2997 | + serial_track.unlink(cr, uid, serial_ids) |
2998 | + serial_list = {} |
2999 | + for x in child.current_move_ids: |
3000 | + if x.location_dest_id.id == child.location_id.id: |
3001 | + serial_list.setdefault(x.prodlot_id.id, 0) |
3002 | + serial_list[x.prodlot_id.id] += x.product_qty |
3003 | + self._create_data_prodlot(cr, uid, child, serial_list, context=context) |
3004 | + return True |
3005 | + |
3006 | + def _check_parent_id(self, cr, uid, ids, context=None): |
3007 | + trackings = self.browse(cr, uid, ids, context=context) |
3008 | + for track in trackings: |
3009 | + if track.parent_id and track.parent_id.ul_id and track.ul_id and \ |
3010 | + track.ul_id.capacity_index > track.parent_id.ul_id.capacity_index: |
3011 | + return False |
3012 | + return True |
3013 | + |
3014 | + _constraints = [(_check_parent_id, 'Bad parent type selection. The UL is not well set.', ['parent_id']),] |
3015 | + |
3016 | + _defaults = { |
3017 | +# 'location_id': lambda x, y, z, c: c and c.get('location_id') or False, |
3018 | + } |
3019 | + |
3020 | +class product_ul(orm.Model): |
3021 | + _inherit = "product.ul" |
3022 | + |
3023 | + _columns = { |
3024 | + 'capacity_index': fields.integer('Capacity index'), |
3025 | + } |
3026 | + |
3027 | + _order = 'capacity_index' |
3028 | + |
3029 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3030 | |
3031 | === added file 'stock_tracking_child/stock_tracking_view.xml' |
3032 | --- stock_tracking_child/stock_tracking_view.xml 1970-01-01 00:00:00 +0000 |
3033 | +++ stock_tracking_child/stock_tracking_view.xml 2013-03-06 10:58:19 +0000 |
3034 | @@ -0,0 +1,82 @@ |
3035 | +<?xml version="1.0" encoding="utf-8"?> |
3036 | +<openerp> |
3037 | + <data> |
3038 | + |
3039 | + <record id="view_tracking_child_tree" model="ir.ui.view"> |
3040 | + <field name="name">stock.tracking.child.tree</field> |
3041 | + <field name="model">stock.tracking</field> |
3042 | + <field name="inherit_id" ref="stock_tracking_extended.view_tracking_extended_tree"/> |
3043 | + <field name="arch" type="xml"> |
3044 | + <field name="serial" position="after"> |
3045 | + <field name="parent_id"/> |
3046 | + <field name="ul_id"/> |
3047 | + </field> |
3048 | + </field> |
3049 | + </record> |
3050 | + |
3051 | + <record id="view_tracking_child_form" model="ir.ui.view"> |
3052 | + <field name="name">stock.tracking.child.form</field> |
3053 | + <field name="model">stock.tracking</field> |
3054 | + <field name="inherit_id" ref="stock_tracking_extended.view_tracking_extended_form"/> |
3055 | + <field name="arch" type="xml"> |
3056 | + <field name="serial" position="after"> |
3057 | + <field name="parent_id"/> |
3058 | + <field name="ul_id"/> |
3059 | + </field> |
3060 | + <field name="product_ids" position="replace"> |
3061 | + <field name="child_product_ids" nolabel="1" colspan="4" context="{'group_by':'product_id'}"/> |
3062 | + </field> |
3063 | + <field name="serial_ids" position="replace"> |
3064 | + <field name="child_serial_ids" nolabel="1" colspan="4"/> |
3065 | + </field> |
3066 | + <page string="Serial Code" position="after"> |
3067 | + <page string="Child Packs"> |
3068 | + <div name="children_packs"> |
3069 | + <div> |
3070 | + <field name="child_ids" nolabel="1" colspan="4"/> |
3071 | + </div> |
3072 | + <div name="child_buttons"/> |
3073 | + </div> |
3074 | + </page> |
3075 | + </page> |
3076 | + </field> |
3077 | + </record> |
3078 | + |
3079 | + <!--<record id="action_stock_tracking_tree" model="ir.actions.act_window"> |
3080 | + <field name="name">Packs Structure</field> |
3081 | + <field name="res_model">stock.tracking</field> |
3082 | + <field name="type">ir.actions.act_window</field> |
3083 | + <field name="view_type">tree</field> |
3084 | + <field name="view_id" ref="view_stock_tracking_tree"/> |
3085 | + <field name="domain">[('parent_id','=',False)]</field> |
3086 | + </record>--> |
3087 | + |
3088 | + <!--<menuitem |
3089 | + action="action_stock_tracking_tree" |
3090 | + id="menu_action_stock_tracking_tree" |
3091 | + parent="stock.menu_stock_inventory_control" />--> |
3092 | + |
3093 | + <record id="product_ul_tree" model="ir.ui.view"> |
3094 | + <field name="name">product.ul.tree.inherit</field> |
3095 | + <field name="model">product.ul</field> |
3096 | + <field name="inherit_id" ref="product.product_ul_tree"/> |
3097 | + <field name="arch" type="xml"> |
3098 | + <field name="type" position="after"> |
3099 | + <field name="capacity_index"/> |
3100 | + </field> |
3101 | + </field> |
3102 | + </record> |
3103 | + |
3104 | + <record id="product_ul_form_view" model="ir.ui.view"> |
3105 | + <field name="name">product.ul.form.inherit</field> |
3106 | + <field name="model">product.ul</field> |
3107 | + <field name="inherit_id" ref="product.product_ul_form_view"/> |
3108 | + <field name="arch" type="xml"> |
3109 | + <field name="type" position="after"> |
3110 | + <field name="capacity_index"/> |
3111 | + </field> |
3112 | + </field> |
3113 | + </record> |
3114 | + |
3115 | + </data> |
3116 | +</openerp> |
3117 | |
3118 | === modified file 'stock_tracking_extended/__openerp__.py' |
3119 | --- stock_tracking_extended/__openerp__.py 2013-02-13 08:35:37 +0000 |
3120 | +++ stock_tracking_extended/__openerp__.py 2013-03-06 10:58:19 +0000 |
3121 | @@ -21,29 +21,29 @@ |
3122 | |
3123 | { |
3124 | "name" : "Stock Tracking extended", |
3125 | - "version" : "1.0", |
3126 | + "version" : "1.1", |
3127 | "author" : "Julius Network Solutions", |
3128 | "description" : """ |
3129 | |
3130 | Presentation: |
3131 | |
3132 | -This module allows to define and identify package in parent or child |
3133 | +This module adds some info into packs to get a better tracking of products and serial lots inside of these packs |
3134 | |
3135 | """, |
3136 | "website" : "http://www.julius.fr", |
3137 | "depends" : [ |
3138 | "stock", |
3139 | ], |
3140 | - "category" : "Stock", |
3141 | - "init_xml" : [], |
3142 | - "demo_xml" : [], |
3143 | - "images" : ['images/Tracking extended.png'], |
3144 | - "update_xml" : [ |
3145 | + "category" : "Warehouse Management", |
3146 | +# "images" : ['images/Tracking_extended.png'], |
3147 | + "demo" : [], |
3148 | + "data" : [ |
3149 | 'stock_tracking_view.xml', |
3150 | - 'inventory_sequence.xml', |
3151 | "security/ir.model.access.csv", |
3152 | ], |
3153 | 'test': [], |
3154 | - 'installable': False, |
3155 | + 'installable': True, |
3156 | 'active': False, |
3157 | } |
3158 | + |
3159 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3160 | |
3161 | === modified file 'stock_tracking_extended/i18n/fr.po' |
3162 | --- stock_tracking_extended/i18n/fr.po 2012-03-21 18:22:58 +0000 |
3163 | +++ stock_tracking_extended/i18n/fr.po 2013-03-06 10:58:19 +0000 |
3164 | @@ -4,10 +4,10 @@ |
3165 | # |
3166 | msgid "" |
3167 | msgstr "" |
3168 | -"Project-Id-Version: OpenERP Server 6.0.3\n" |
3169 | -"Report-Msgid-Bugs-To: support@openerp.com\n" |
3170 | -"POT-Creation-Date: 2011-12-19 10:42+0000\n" |
3171 | -"PO-Revision-Date: 2011-12-19 10:42+0000\n" |
3172 | +"Project-Id-Version: OpenERP Server 7.0\n" |
3173 | +"Report-Msgid-Bugs-To: \n" |
3174 | +"POT-Creation-Date: 2013-02-15 11:56+0000\n" |
3175 | +"PO-Revision-Date: 2013-02-15 11:56+0000\n" |
3176 | "Last-Translator: <>\n" |
3177 | "Language-Team: \n" |
3178 | "MIME-Version: 1.0\n" |
3179 | @@ -16,76 +16,20 @@ |
3180 | "Plural-Forms: \n" |
3181 | |
3182 | #. module: stock_tracking_extended |
3183 | -#: model:ir.model,name:stock_tracking_extended.model_stock_production_lot |
3184 | -msgid "Production lot" |
3185 | -msgstr "Numéro de série" |
3186 | - |
3187 | -#. module: stock_tracking_extended |
3188 | -#: model:ir.model,name:stock_tracking_extended.model_product_stock_tracking |
3189 | -msgid "product.stock.tracking" |
3190 | -msgstr "product.stock.tracking" |
3191 | - |
3192 | -#. module: stock_tracking_extended |
3193 | -#: field:product.ul,capacity_index:0 |
3194 | -msgid "Capacity index" |
3195 | -msgstr "Indice de capacité" |
3196 | - |
3197 | -#. module: stock_tracking_extended |
3198 | -#: constraint:stock.move:0 |
3199 | -msgid "You must assign a production lot for this product" |
3200 | -msgstr "Vous devez affecter un numéro de série pour ce produit." |
3201 | - |
3202 | -#. module: stock_tracking_extended |
3203 | -#: field:stock.tracking,state:0 |
3204 | -msgid "State" |
3205 | -msgstr "Statut" |
3206 | - |
3207 | -#. module: stock_tracking_extended |
3208 | -#: field:stock.production.lot,tracking_id:0 |
3209 | -msgid "pack" |
3210 | -msgstr "Colis" |
3211 | - |
3212 | -#. module: stock_tracking_extended |
3213 | -#: field:stock.tracking,location_id:0 |
3214 | -msgid "Location" |
3215 | -msgstr "Stockage" |
3216 | - |
3217 | -#. module: stock_tracking_extended |
3218 | -#: view:stock.tracking:0 |
3219 | -msgid "Serial Code" |
3220 | -msgstr "Numéro de série" |
3221 | - |
3222 | -#. module: stock_tracking_extended |
3223 | -#: sql_constraint:stock.production.lot:0 |
3224 | -msgid "The combination of serial number and internal reference must be unique !" |
3225 | -msgstr "La combinaison du numéro de série et de la référence interne doit être unique !" |
3226 | - |
3227 | -#. module: stock_tracking_extended |
3228 | -#: field:stock.tracking.history,type:0 |
3229 | -msgid "Type" |
3230 | -msgstr "Type" |
3231 | - |
3232 | -#. module: stock_tracking_extended |
3233 | -#: code:addons/stock_tracking_extended/stock_tracking.py:118 |
3234 | -#, python-format |
3235 | -msgid "You can't re-open this pack because there is at least one not closed child" |
3236 | -msgstr "Vous ne pouvez pas ré-ouvrir ce colis parce qu'il y a au moins un colis enfant non fermé" |
3237 | - |
3238 | -#. module: stock_tracking_extended |
3239 | #: field:product.stock.tracking,product_id:0 |
3240 | #: field:serial.stock.tracking,product_id:0 |
3241 | msgid "Product" |
3242 | msgstr "Produit" |
3243 | |
3244 | #. module: stock_tracking_extended |
3245 | -#: model:ir.model,name:stock_tracking_extended.model_product_category |
3246 | -msgid "Product Category" |
3247 | -msgstr "Catégorie de produits" |
3248 | +#: field:stock.move,pack_history_id:0 |
3249 | +msgid "Pack history" |
3250 | +msgstr "Historique du Colis" |
3251 | |
3252 | #. module: stock_tracking_extended |
3253 | -#: field:stock.tracking,parent_id:0 |
3254 | -msgid "Parent" |
3255 | -msgstr "Parent" |
3256 | +#: model:ir.model,name:stock_tracking_extended.model_product_stock_tracking |
3257 | +msgid "Products in Packs" |
3258 | +msgstr "Produits du colis" |
3259 | |
3260 | #. module: stock_tracking_extended |
3261 | #: model:ir.model,name:stock_tracking_extended.model_stock_tracking |
3262 | @@ -93,19 +37,29 @@ |
3263 | msgstr "Colis" |
3264 | |
3265 | #. module: stock_tracking_extended |
3266 | -#: constraint:stock.move:0 |
3267 | -msgid "You try to assign a lot which is not from the same product" |
3268 | -msgstr "Vous essayez d'affecter un lot qui appartient à une autre référence." |
3269 | - |
3270 | -#. module: stock_tracking_extended |
3271 | -#: constraint:stock.tracking:0 |
3272 | -msgid "Bad parent type selection. Please try again." |
3273 | -msgstr "Mauvais choix du type parent. Veuillez ressayez à nouveau." |
3274 | - |
3275 | -#. module: stock_tracking_extended |
3276 | -#: view:stock.tracking:0 |
3277 | -msgid "Reset Open" |
3278 | -msgstr "Ré-ouvrir" |
3279 | +#: model:ir.model,name:stock_tracking_extended.model_stock_tracking_history |
3280 | +msgid "Packs history" |
3281 | +msgstr "Historique du Colis" |
3282 | + |
3283 | +#. module: stock_tracking_extended |
3284 | +#: view:stock.tracking:0 |
3285 | +msgid "Move" |
3286 | +msgstr "Mouvements" |
3287 | + |
3288 | +#. module: stock_tracking_extended |
3289 | +#: view:stock.tracking:0 |
3290 | +msgid "Update product list" |
3291 | +msgstr "MàJ de la liste de produit" |
3292 | + |
3293 | +#. module: stock_tracking_extended |
3294 | +#: model:ir.model,name:stock_tracking_extended.model_stock_move |
3295 | +msgid "Stock Move" |
3296 | +msgstr "Mouvement de stock" |
3297 | + |
3298 | +#. module: stock_tracking_extended |
3299 | +#: view:stock.tracking:0 |
3300 | +msgid "Serial Code" |
3301 | +msgstr "Numéro de série" |
3302 | |
3303 | #. module: stock_tracking_extended |
3304 | #: field:product.stock.tracking,quantity:0 |
3305 | @@ -114,84 +68,12 @@ |
3306 | msgstr "Quantité" |
3307 | |
3308 | #. module: stock_tracking_extended |
3309 | -#: code:addons/stock_tracking_extended/stock_tracking.py:113 |
3310 | -#: code:addons/stock_tracking_extended/stock_tracking.py:118 |
3311 | -#: code:addons/stock_tracking_extended/stock_tracking.py:131 |
3312 | -#, python-format |
3313 | -msgid "Not allowed !" |
3314 | -msgstr "Non autorisé !" |
3315 | - |
3316 | -#. module: stock_tracking_extended |
3317 | -#: field:stock.tracking,current_move_ids:0 |
3318 | -msgid "Current moves" |
3319 | -msgstr "Mouvements actuels" |
3320 | - |
3321 | -#. module: stock_tracking_extended |
3322 | -#: view:stock.tracking:0 |
3323 | -#: field:stock.tracking,history_ids:0 |
3324 | -#: view:stock.tracking.history:0 |
3325 | -msgid "History" |
3326 | -msgstr "Historique" |
3327 | - |
3328 | -#. module: stock_tracking_extended |
3329 | -#: model:ir.module.module,description:stock_tracking_extended.module_meta_information |
3330 | -msgid " This Module allows to have parent/child packaging " |
3331 | -msgstr " Ce module permet d'avoir des colis parent/enfant " |
3332 | - |
3333 | -#. module: stock_tracking_extended |
3334 | -#: field:product.category,tracked:0 |
3335 | -msgid "Need a serial code ?" |
3336 | -msgstr "Suivre les numéros de série ?" |
3337 | - |
3338 | -#. module: stock_tracking_extended |
3339 | #: field:product.stock.tracking,tracking_id:0 |
3340 | #: field:serial.stock.tracking,tracking_id:0 |
3341 | msgid "Tracking" |
3342 | msgstr "Suivi" |
3343 | |
3344 | #. module: stock_tracking_extended |
3345 | -#: view:stock.tracking:0 |
3346 | -msgid "Downstream traceability" |
3347 | -msgstr "Traçabilité aval" |
3348 | - |
3349 | -#. module: stock_tracking_extended |
3350 | -#: field:stock.tracking,ul_id:0 |
3351 | -msgid "Logistic unit" |
3352 | -msgstr "Unité logistique" |
3353 | - |
3354 | -#. module: stock_tracking_extended |
3355 | -#: model:ir.actions.act_window,name:stock_tracking_extended.action_stock_tracking_tree |
3356 | -#: model:ir.ui.menu,name:stock_tracking_extended.menu_action_stock_tracking_tree |
3357 | -msgid "Packs Structure" |
3358 | -msgstr "Structure de colis" |
3359 | - |
3360 | -#. module: stock_tracking_extended |
3361 | -#: field:stock.tracking,child_serial_ids:0 |
3362 | -msgid "Child Serials" |
3363 | -msgstr "Numéros de séries enfants" |
3364 | - |
3365 | -#. module: stock_tracking_extended |
3366 | -#: code:addons/stock_tracking_extended/stock_tracking.py:131 |
3367 | -#, python-format |
3368 | -msgid "You can't close this pack because there is at least one not closed child" |
3369 | -msgstr "Vous ne pouvez pas fermer ce colis parce qu'il y a au moins un enfant non fermé" |
3370 | - |
3371 | -#. module: stock_tracking_extended |
3372 | -#: model:ir.model,name:stock_tracking_extended.model_stock_tracking_history |
3373 | -msgid "stock.tracking.history" |
3374 | -msgstr "stock.tracking.history" |
3375 | - |
3376 | -#. module: stock_tracking_extended |
3377 | -#: view:stock.tracking:0 |
3378 | -msgid "Update product list" |
3379 | -msgstr "MàJ de la liste de produit" |
3380 | - |
3381 | -#. module: stock_tracking_extended |
3382 | -#: view:stock.tracking:0 |
3383 | -msgid "Child Packs" |
3384 | -msgstr "Colis enfants" |
3385 | - |
3386 | -#. module: stock_tracking_extended |
3387 | #: view:product.stock.tracking:0 |
3388 | #: view:serial.stock.tracking:0 |
3389 | #: view:stock.tracking:0 |
3390 | @@ -201,79 +83,44 @@ |
3391 | msgstr "Produits" |
3392 | |
3393 | #. module: stock_tracking_extended |
3394 | +#: field:stock.tracking,location_id:0 |
3395 | +msgid "Location" |
3396 | +msgstr "Stockage" |
3397 | + |
3398 | +#. module: stock_tracking_extended |
3399 | +#: field:stock.tracking,current_move_ids:0 |
3400 | +msgid "Current moves" |
3401 | +msgstr "Mouvements actuels" |
3402 | + |
3403 | +#. module: stock_tracking_extended |
3404 | #: view:stock.tracking:0 |
3405 | msgid "Update Serial list" |
3406 | msgstr "MàJ de la liste des NS" |
3407 | |
3408 | #. module: stock_tracking_extended |
3409 | -#: field:stock.tracking.history,tracking_id:0 |
3410 | -msgid "Pack" |
3411 | -msgstr "Colis" |
3412 | - |
3413 | -#. module: stock_tracking_extended |
3414 | -#: model:ir.module.module,shortdesc:stock_tracking_extended.module_meta_information |
3415 | -msgid "Stock Packaging extended" |
3416 | -msgstr "Gestion des colis étendu" |
3417 | - |
3418 | -#. module: stock_tracking_extended |
3419 | -#: model:ir.model,name:stock_tracking_extended.model_stock_move |
3420 | -msgid "Stock Move" |
3421 | -msgstr "Mouvement de stock" |
3422 | - |
3423 | -#. module: stock_tracking_extended |
3424 | -#: field:stock.tracking,child_product_ids:0 |
3425 | -msgid "Child Products" |
3426 | -msgstr "Produits enfants" |
3427 | - |
3428 | -#. module: stock_tracking_extended |
3429 | -#: constraint:product.category:0 |
3430 | -msgid "Error ! You can not create recursive categories." |
3431 | -msgstr "Erreur ! Vous ne pouvez pas créer de catégories récursives" |
3432 | - |
3433 | -#. module: stock_tracking_extended |
3434 | -#: model:ir.model,name:stock_tracking_extended.model_product_ul |
3435 | -msgid "Shipping Unit" |
3436 | -msgstr "Unité de livraison" |
3437 | - |
3438 | -#. module: stock_tracking_extended |
3439 | -#: code:addons/stock_tracking_extended/stock_tracking.py:113 |
3440 | -#, python-format |
3441 | -msgid "You can't re-open this pack because the parent pack is close" |
3442 | -msgstr "Vous ne pouvez pas ré-ouvrir ce colis, car le colis parent est fermé" |
3443 | - |
3444 | -#. module: stock_tracking_extended |
3445 | -#: model:ir.model,name:stock_tracking_extended.model_serial_stock_tracking |
3446 | -msgid "serial.stock.tracking" |
3447 | -msgstr "serial.stock.tracking" |
3448 | - |
3449 | -#. module: stock_tracking_extended |
3450 | -#: view:stock.tracking:0 |
3451 | -#: selection:stock.tracking,state:0 |
3452 | -msgid "Close" |
3453 | -msgstr "Fermer" |
3454 | - |
3455 | -#. module: stock_tracking_extended |
3456 | #: field:serial.stock.tracking,serial_id:0 |
3457 | msgid "Serial" |
3458 | msgstr "Numéro de Série" |
3459 | |
3460 | #. module: stock_tracking_extended |
3461 | #: view:stock.tracking:0 |
3462 | -msgid "Stock Moves" |
3463 | -msgstr "Mouvements de stocks" |
3464 | - |
3465 | -#. module: stock_tracking_extended |
3466 | -#: selection:stock.tracking,state:0 |
3467 | -msgid "Open" |
3468 | -msgstr "Ouvert" |
3469 | - |
3470 | -#. module: stock_tracking_extended |
3471 | -#: field:stock.tracking,child_ids:0 |
3472 | -msgid "Children" |
3473 | -msgstr "Enfant" |
3474 | - |
3475 | -#. module: stock_tracking_extended |
3476 | -#: model:ir.model,name:stock_tracking_extended.model_stock_inventory |
3477 | -msgid "Inventory" |
3478 | -msgstr "Inventaire" |
3479 | +#: field:stock.tracking,history_ids:0 |
3480 | +#: view:stock.tracking.history:0 |
3481 | +msgid "History" |
3482 | +msgstr "Historique" |
3483 | + |
3484 | +#. module: stock_tracking_extended |
3485 | +#: field:stock.tracking.history,type:0 |
3486 | +msgid "Type" |
3487 | +msgstr "Type" |
3488 | + |
3489 | +#. module: stock_tracking_extended |
3490 | +#: model:ir.model,name:stock_tracking_extended.model_serial_stock_tracking |
3491 | +msgid "Serials in Packs" |
3492 | +msgstr "Numéros de séries du colis" |
3493 | + |
3494 | +#. module: stock_tracking_extended |
3495 | +#: field:stock.tracking.history,tracking_id:0 |
3496 | +msgid "Pack" |
3497 | +msgstr "Colis" |
3498 | |
3499 | |
3500 | === removed file 'stock_tracking_extended/images/Tracking extended.png' |
3501 | Binary files stock_tracking_extended/images/Tracking extended.png 2012-04-26 10:42:17 +0000 and stock_tracking_extended/images/Tracking extended.png 1970-01-01 00:00:00 +0000 differ |
3502 | === added file 'stock_tracking_extended/images/Tracking_extended.png' |
3503 | Binary files stock_tracking_extended/images/Tracking_extended.png 1970-01-01 00:00:00 +0000 and stock_tracking_extended/images/Tracking_extended.png 2013-03-06 10:58:19 +0000 differ |
3504 | === removed file 'stock_tracking_extended/inventory_sequence.xml' |
3505 | --- stock_tracking_extended/inventory_sequence.xml 2012-03-07 12:56:37 +0000 |
3506 | +++ stock_tracking_extended/inventory_sequence.xml 1970-01-01 00:00:00 +0000 |
3507 | @@ -1,19 +0,0 @@ |
3508 | -<?xml version="1.0" encoding="utf-8"?> |
3509 | -<openerp> |
3510 | - <data noupdate="1"> |
3511 | - |
3512 | - <!-- Sequences for stock.inventory --> |
3513 | - <record id="seq_type_inventory_order" model="ir.sequence.type"> |
3514 | - <field name="name">Inventory Order</field> |
3515 | - <field name="code">stock.inventory</field> |
3516 | - </record> |
3517 | - |
3518 | - <record id="seq_sale_order" model="ir.sequence"> |
3519 | - <field name="name">Inventory Order</field> |
3520 | - <field name="code">stock.inventory</field> |
3521 | - <field name="prefix">INV</field> |
3522 | - <field name="padding">3</field> |
3523 | - </record> |
3524 | - |
3525 | - </data> |
3526 | -</openerp> |
3527 | |
3528 | === modified file 'stock_tracking_extended/stock_tracking.py' |
3529 | --- stock_tracking_extended/stock_tracking.py 2012-12-11 13:45:06 +0000 |
3530 | +++ stock_tracking_extended/stock_tracking.py 2013-03-06 10:58:19 +0000 |
3531 | @@ -1,4 +1,4 @@ |
3532 | - # -*- coding: utf-8 -*- |
3533 | +# -*- coding: utf-8 -*- |
3534 | ################################################################################# |
3535 | # |
3536 | # OpenERP, Open Source Management Solution |
3537 | @@ -19,175 +19,125 @@ |
3538 | # |
3539 | ################################################################################# |
3540 | |
3541 | -from datetime import datetime |
3542 | -from osv import fields, osv |
3543 | -from tools.translate import _ |
3544 | -import netsvc |
3545 | +from openerp.osv import fields, osv, orm |
3546 | +from openerp.tools.translate import _ |
3547 | |
3548 | class one2many_special(fields.one2many): |
3549 | def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None): |
3550 | - if not values: |
3551 | + if context is None: |
3552 | + context = {} |
3553 | + if self._context: |
3554 | + context = context.copy() |
3555 | + context.update(self._context) |
3556 | + if values is None: |
3557 | values = {} |
3558 | + |
3559 | res = {} |
3560 | location_ids = [] |
3561 | for id in ids: |
3562 | res[id] = [] |
3563 | - location_id = obj.pool.get('stock.tracking').read(cr, user, id, ['location_id'])['location_id'] |
3564 | - if location_id and location_id[0] and location_id[0] not in location_ids: |
3565 | - location_ids.append(location_id[0]) |
3566 | - ids2 = obj.pool.get(self._obj).search(cr, user, self._domain + [(self._fields_id, 'in', ids), ('location_dest_id', 'in', location_ids)], limit=self._limit) |
3567 | + location_id = obj.read(cr, user, id, ['location_id'], context=context)['location_id'] |
3568 | + if isinstance(location_id, (list,tuple)): |
3569 | + location_id = location_id and location_id[0] or False |
3570 | + if location_id and (location_id not in location_ids): |
3571 | + location_ids.append(location_id) |
3572 | + domain = self._domain(obj) if callable(self._domain) else self._domain |
3573 | + domain2 = [(self._fields_id, 'in', ids)] |
3574 | + if location_ids: |
3575 | + domain2 += [('location_dest_id', 'in', location_ids)] |
3576 | + ids2 = obj.pool.get(self._obj).search(cr, user, domain + domain2, limit=self._limit, context=context) |
3577 | for r in obj.pool.get(self._obj)._read_flat(cr, user, ids2, [self._fields_id], context=context, load='_classic_write'): |
3578 | - res[r[self._fields_id]].append( r['id'] ) |
3579 | + if r[self._fields_id] in res: |
3580 | + res[r[self._fields_id]].append(r['id']) |
3581 | return res |
3582 | |
3583 | -class stock_tracking(osv.osv): |
3584 | - |
3585 | +class stock_tracking(orm.Model): |
3586 | _inherit = 'stock.tracking' |
3587 | - |
3588 | - def hierarchy_ids(self, tracking): |
3589 | - result_list = [tracking] |
3590 | - for child in tracking.child_ids: |
3591 | - result_list.extend(self.hierarchy_ids(child)) |
3592 | - return result_list |
3593 | - |
3594 | - def _get_child_products(self, cr, uid, ids, field_name, arg, context=None): |
3595 | - packs = self.browse(cr, uid, ids) |
3596 | - res = {} |
3597 | - for pack in packs: |
3598 | - res[pack.id] = [] |
3599 | - childs = self.hierarchy_ids(pack) |
3600 | - for child in childs: |
3601 | - for prod in child.product_ids: |
3602 | - res[pack.id].append(prod.id) |
3603 | - return res |
3604 | - |
3605 | - def _get_child_serials(self, cr, uid, ids, field_name, arg, context=None): |
3606 | - packs = self.browse(cr, uid, ids) |
3607 | - res = {} |
3608 | - for pack in packs: |
3609 | - res[pack.id] = [] |
3610 | - childs = self.hierarchy_ids(pack) |
3611 | - for child in childs: |
3612 | - for serial in child.serial_ids: |
3613 | - res[pack.id].append(serial.id) |
3614 | - return res |
3615 | + |
3616 | + def _get_default_location(self, cr, uid, context=None): |
3617 | + """ By default we get the location defined on the main warehouse of the user's company """ |
3618 | + # Initialization # |
3619 | + if context is None: |
3620 | + context = {} |
3621 | + if context.get('location_id'): |
3622 | + return context.get('location_id') |
3623 | + location_id = False |
3624 | + warehouse_obj = self.pool.get('stock.warehouse') |
3625 | + user_obj = self.pool.get('res.users') |
3626 | + # Process # |
3627 | + user_data = user_obj.browse(cr, uid, uid, context=context) |
3628 | + warehouse_ids = warehouse_obj.search(cr, uid, [ |
3629 | + ('company_id', '=', user_data.company_id.id), |
3630 | + ], limit=1, context=context) |
3631 | + if warehouse_ids: |
3632 | + warehouse = warehouse_obj.browse(cr, uid, warehouse_ids[0], context=context) |
3633 | + location_id = warehouse.lot_stock_id and warehouse.lot_stock_id.id or False |
3634 | + return location_id |
3635 | |
3636 | _columns = { |
3637 | - 'parent_id': fields.many2one('stock.tracking', 'Parent'), |
3638 | - 'child_ids': fields.one2many('stock.tracking', 'parent_id', 'Children', readonly=True), |
3639 | - 'ul_id': fields.many2one('product.ul', 'Logistic unit', readonly=True, states={'open':[('readonly',False)]}), |
3640 | - 'location_id': fields.many2one('stock.location', 'Location', required=True, readonly=True, states={'open':[('readonly',False)]}), |
3641 | - 'state': fields.selection([('open','Open'),('close','Close')], 'State', readonly=True), |
3642 | + 'location_id': fields.many2one('stock.location', 'Location', readonly=True), |
3643 | 'product_ids': fields.one2many('product.stock.tracking', 'tracking_id', 'Products', readonly=True), |
3644 | - 'child_product_ids': fields.function(_get_child_products, method=True, type='one2many', obj='product.stock.tracking', string='Child Products'), |
3645 | - 'history_ids': fields.one2many('stock.tracking.history', 'tracking_id', 'History'), |
3646 | + 'history_ids': fields.one2many('stock.tracking.history', 'tracking_id', 'History', readonly=True), |
3647 | 'current_move_ids': one2many_special('stock.move', 'tracking_id', 'Current moves', domain=[('pack_history_id', '=', False)], readonly=True), |
3648 | - 'name': fields.char('Pack Reference', size=64, required=True, readonly=True, states={'open':[('readonly',False)]}), |
3649 | - 'date': fields.datetime('Creation Date', required=True, readonly=True, states={'open':[('readonly',False)]}), |
3650 | + 'date': fields.datetime('Creation Date', required=True, readonly=True), |
3651 | 'serial_ids': fields.one2many('serial.stock.tracking', 'tracking_id', 'Products', readonly=True), |
3652 | - 'child_serial_ids': fields.function(_get_child_serials, method=True, type='one2many', obj='serial.stock.tracking', string='Child Serials'), |
3653 | } |
3654 | - |
3655 | - def _check_parent_id(self, cr, uid, ids, context=None): |
3656 | - lines = self.browse(cr, uid, ids, context=context) |
3657 | - |
3658 | - if lines[0].parent_id: |
3659 | - if lines[0].ul_id.capacity_index > lines[0].parent_id.ul_id.capacity_index: |
3660 | - return False |
3661 | - return True |
3662 | - |
3663 | - _constraints = [(_check_parent_id, 'Bad parent type selection. Please try again.',['parent_id'] ),] |
3664 | - |
3665 | + |
3666 | _defaults = { |
3667 | - 'state': 'open', |
3668 | - 'location_id': lambda x, y, z, c: c and c.get('location_id') or False, |
3669 | + 'location_id': lambda self, cr, uid, context: self._get_default_location(cr, uid, context), |
3670 | } |
3671 | - |
3672 | - def reset_open(self, cr, uid, ids, context=None): |
3673 | - pack_ids = self.browse(cr, uid, ids, context=context) |
3674 | - for pack in pack_ids: |
3675 | - allowed = True |
3676 | - if pack.parent_id: |
3677 | - if pack.parent_id and pack.parent_id != 'open': |
3678 | - self.write(cr, uid, [pack.parent_id.id], {'state': 'open'}, context=context) |
3679 | - if allowed: |
3680 | - for child in pack.child_ids: |
3681 | - if child.state == 'open': |
3682 | - allowed = False |
3683 | - raise osv.except_osv(_('Not allowed !'),_('You can\'t re-open this pack because there is at least one not closed child')) |
3684 | - break |
3685 | - if allowed: |
3686 | - self.write(cr, uid, [pack.id], {'state': 'open'}, context=context) |
3687 | - return True |
3688 | - |
3689 | - def set_close(self, cr, uid, ids, context=None): |
3690 | - pack_ids = self.browse(cr, uid, ids, context=context) |
3691 | - for pack in pack_ids: |
3692 | - allowed = True |
3693 | - for child in pack.child_ids: |
3694 | - if child.state == 'open': |
3695 | - allowed = False |
3696 | - raise osv.except_osv(_('Not allowed !'),_('You can\'t close this pack because there is at least one not closed child')) |
3697 | - break |
3698 | - if allowed: |
3699 | - self.write(cr, uid, [pack.id], {'state': 'close'}, context=context) |
3700 | - return True |
3701 | - |
3702 | - def get_products(self, cr, uid, ids, context=None): |
3703 | - pack_ids = self.browse(cr, uid, ids, context) |
3704 | + |
3705 | + def get_products_process(self, cr, uid, pack_ids, context=None): |
3706 | stock_track = self.pool.get('product.stock.tracking') |
3707 | for pack in pack_ids: |
3708 | - childs = self.hierarchy_ids(pack) |
3709 | - for child in childs: |
3710 | - product_ids = [x.id for x in child.product_ids] |
3711 | - stock_track.unlink(cr, uid, product_ids) |
3712 | - product_list = {} |
3713 | - for x in child.current_move_ids: |
3714 | - if x.location_dest_id.id == child.location_id.id: |
3715 | - if x.product_id.id not in product_list.keys(): |
3716 | - product_list.update({x.product_id.id:x.product_qty}) |
3717 | - else: |
3718 | - product_list[x.product_id.id] += x.product_qty |
3719 | - for product in product_list.keys(): |
3720 | - stock_track.create(cr, uid, {'product_id': product, 'quantity': product_list[product], 'tracking_id': child.id}) |
3721 | + product_ids = [x.id for x in pack.product_ids] |
3722 | + stock_track.unlink(cr, uid, product_ids, context=context) |
3723 | + product_list = {} |
3724 | + for x in pack.current_move_ids: |
3725 | + if x.location_dest_id.id == pack.location_id.id: |
3726 | + product_list.setdefault(x.product_id.id, 0) |
3727 | + product_list[x.product_id.id] += x.product_qty |
3728 | + for product in product_list.iterkeys(): |
3729 | + stock_track.create(cr, uid, { |
3730 | + 'product_id': product, |
3731 | + 'quantity': product_list[product], |
3732 | + 'tracking_id': pack.id |
3733 | + }, context=context) |
3734 | return True |
3735 | |
3736 | - def get_serials(self, cr, uid, ids, context=None): |
3737 | - pack_ids = self.browse(cr, uid, ids, context) |
3738 | + def get_serial_process(self, cr, uid, pack_ids, context=None): |
3739 | serial_track = self.pool.get('serial.stock.tracking') |
3740 | serial_obj = self.pool.get('stock.production.lot') |
3741 | for pack in pack_ids: |
3742 | - childs = self.hierarchy_ids(pack) |
3743 | - for child in childs: |
3744 | - serial_ids = [x.id for x in child.serial_ids] |
3745 | - serial_track.unlink(cr, uid, serial_ids) |
3746 | - serial_list = {} |
3747 | - for x in child.current_move_ids: |
3748 | - if x.location_dest_id.id == child.location_id.id: |
3749 | - if x.prodlot_id.id not in serial_list.keys(): |
3750 | - serial_list.update({x.prodlot_id.id:x.product_qty}) |
3751 | - else: |
3752 | - serial_list[x.prodlot_id.id] += x.product_qty |
3753 | - for serial in serial_list.keys(): |
3754 | - if serial: |
3755 | - serial_track.create(cr, uid, {'serial_id': serial, 'quantity': serial_list[serial], 'tracking_id': child.id}, context=context) |
3756 | - serial_obj.write(cr, uid, [serial], {'tracking_id': child.id}, context=context) |
3757 | + serial_ids = [x.id for x in child.serial_ids] |
3758 | + serial_track.unlink(cr, uid, serial_ids) |
3759 | + serial_list = {} |
3760 | + for x in child.current_move_ids: |
3761 | + if x.location_dest_id.id == pack.location_id.id: |
3762 | + serial_list.setdefault(x.prodlot_id.id, 0) |
3763 | + serial_list[x.prodlot_id.id] += x.product_qty |
3764 | + for serial in serial_list.keys(): |
3765 | + if serial: |
3766 | + serial_track.create(cr, uid, { |
3767 | + 'serial_id': serial, |
3768 | + 'quantity': serial_list[serial], |
3769 | + 'tracking_id': pack.id |
3770 | + }, context=context) |
3771 | + serial_obj.write(cr, uid, [serial], {'tracking_id': pack.id}, context=context) |
3772 | return True |
3773 | |
3774 | -stock_tracking() |
3775 | - |
3776 | -class product_ul(osv.osv): |
3777 | - _inherit = "product.ul" |
3778 | - _description = "Shipping Unit" |
3779 | - _columns = { |
3780 | - 'capacity_index': fields.integer('Capacity index'), |
3781 | - } |
3782 | - _order = 'capacity_index' |
3783 | -product_ul() |
3784 | - |
3785 | -class product_stock_tracking(osv.osv): |
3786 | + def get_products(self, cr, uid, ids, context=None): |
3787 | + pack_ids = self.browse(cr, uid, ids, context) |
3788 | + return self.get_products_process(cr, uid, pack_ids, context=context) |
3789 | + |
3790 | + def get_serial(self, cr, uid, ids, context=None): |
3791 | + pack_ids = self.browse(cr, uid, ids, context) |
3792 | + return self.get_serial(cr, uid, pack_ids, context=context) |
3793 | + |
3794 | +class product_stock_tracking(orm.Model): |
3795 | |
3796 | _name = 'product.stock.tracking' |
3797 | + _description = 'Products in Packs' |
3798 | |
3799 | _columns = { |
3800 | 'product_id': fields.many2one('product.product', 'Product'), |
3801 | @@ -195,11 +145,10 @@ |
3802 | 'tracking_id': fields.many2one('stock.tracking', 'Tracking'), |
3803 | } |
3804 | |
3805 | -product_stock_tracking() |
3806 | - |
3807 | -class serial_stock_tracking(osv.osv): |
3808 | +class serial_stock_tracking(orm.Model): |
3809 | |
3810 | _name = 'serial.stock.tracking' |
3811 | + _description = 'Serials in Packs' |
3812 | |
3813 | _order = 'tracking_id,serial_id' |
3814 | |
3815 | @@ -210,105 +159,27 @@ |
3816 | 'tracking_id': fields.many2one('stock.tracking', 'Tracking'), |
3817 | } |
3818 | |
3819 | -serial_stock_tracking() |
3820 | - |
3821 | -class stock_tracking_history(osv.osv): |
3822 | +class stock_tracking_history(orm.Model): |
3823 | |
3824 | _name = "stock.tracking.history" |
3825 | + _description = 'Packs history' |
3826 | |
3827 | - def _get_types(self, cr, uid, context={}): |
3828 | + def _get_types(self, cr, uid, context=None): |
3829 | res = [] |
3830 | return res |
3831 | |
3832 | - |
3833 | _columns = { |
3834 | 'tracking_id': fields.many2one('stock.tracking', 'Pack', required=True), |
3835 | 'type': fields.selection(_get_types, 'Type'), |
3836 | + 'date': fields.datetime('Creation Date', readonly=True), |
3837 | } |
3838 | |
3839 | _rec_name = "tracking_id" |
3840 | |
3841 | -stock_tracking_history() |
3842 | - |
3843 | -'''Add a field in order to store the current pack in a production lot''' |
3844 | -class stock_production_lot(osv.osv): |
3845 | - _inherit = 'stock.production.lot' |
3846 | - _columns = { |
3847 | - 'tracking_id': fields.many2one('stock.tracking', 'pack'), |
3848 | - } |
3849 | - def copy(self, cr, uid, id, default=None, context=None): |
3850 | - if default is None: |
3851 | - default = {} |
3852 | - default.update({ |
3853 | - 'state': 'draft', |
3854 | - 'shipped': False, |
3855 | - 'tracking_id': False, |
3856 | - 'move_ids': [], |
3857 | - }) |
3858 | - return super(stock_production_lot, self).copy(cr, uid, id, default, context=context) |
3859 | - |
3860 | -stock_production_lot() |
3861 | - |
3862 | -class product_category(osv.osv): |
3863 | - _inherit = 'product.category' |
3864 | - _columns = { |
3865 | - 'tracked': fields.boolean('Need a serial code ?'), |
3866 | - } |
3867 | -product_category() |
3868 | - |
3869 | -class stock_inventory(osv.osv): |
3870 | - _inherit = 'stock.inventory' |
3871 | - _defaults = { |
3872 | - 'name': lambda x, y, z, c: x.pool.get('ir.sequence').get(y, z, 'stock.inventory') or '/' |
3873 | - } |
3874 | -stock_inventory() |
3875 | - |
3876 | -class stock_move(osv.osv): |
3877 | +class stock_move(orm.Model): |
3878 | _inherit = 'stock.move' |
3879 | _columns = { |
3880 | - 'move_ori_id': fields.many2one('stock.move', 'Origin Move', select=True), |
3881 | - } |
3882 | - |
3883 | - def write(self, cr, uid, ids, vals, context=None): |
3884 | - result = super(stock_move,self).write(cr, uid, ids, vals, context=context) |
3885 | - if not isinstance(ids, list): |
3886 | - ids = [ids] |
3887 | - for id in ids: |
3888 | - state = self.browse(cr, uid, id, context=context).state |
3889 | - move_ori_id = self.browse(cr, uid, id, context=context).move_ori_id |
3890 | - if state == 'done' and move_ori_id: |
3891 | - self.write(cr, uid, [move_ori_id.id], {'state':'done'}, context=context) |
3892 | - return result |
3893 | - |
3894 | - def create(self, cr, uid, vals, context=None): |
3895 | - production_lot_obj = self.pool.get('stock.production.lot') |
3896 | - stock_tracking_obj = self.pool.get('stock.tracking') |
3897 | - if vals.get('prodlot_id',False): |
3898 | - production_lot_data = production_lot_obj.browse(cr, uid, vals['prodlot_id'], context=context) |
3899 | - last_production_lot_move_id = self.search(cr, uid, [('prodlot_id', '=', production_lot_data.id)], limit=1, order='date', context=context) |
3900 | - if last_production_lot_move_id: |
3901 | - last_production_lot_move = self.browse(cr,uid,last_production_lot_move_id[0]) |
3902 | - if last_production_lot_move.tracking_id: |
3903 | - ids = [last_production_lot_move.tracking_id.id] |
3904 | - stock_tracking_obj.reset_open(cr, uid, ids, context=context) |
3905 | - |
3906 | - return super(stock_move,self).create(cr, uid, vals, context=context) |
3907 | - |
3908 | -stock_move() |
3909 | - |
3910 | -class split_in_production_lot(osv.osv_memory): |
3911 | - _inherit = "stock.move.split" |
3912 | - _columns = { |
3913 | - 'use_exist' : fields.boolean('Existing Lots', invisible=True), |
3914 | - } |
3915 | - _defaults = { |
3916 | - 'use_exist': lambda *a: True, |
3917 | - } |
3918 | - def default_get(self, cr, uid, fields, context=None): |
3919 | - res = super(split_in_production_lot, self).default_get(cr, uid, fields, context=context) |
3920 | - res.update({'use_exist': True}) |
3921 | - return res |
3922 | - |
3923 | -split_in_production_lot() |
3924 | + 'pack_history_id': fields.many2one('stock.tracking.history', 'Pack history'), |
3925 | + } |
3926 | |
3927 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
3928 | |
3929 | === modified file 'stock_tracking_extended/stock_tracking_view.xml' |
3930 | --- stock_tracking_extended/stock_tracking_view.xml 2012-05-21 09:36:07 +0000 |
3931 | +++ stock_tracking_extended/stock_tracking_view.xml 2013-03-06 10:58:19 +0000 |
3932 | @@ -1,280 +1,106 @@ |
3933 | <?xml version="1.0" encoding="utf-8"?> |
3934 | <openerp> |
3935 | <data> |
3936 | - |
3937 | - <!--<record id="search_stock_packs_inherit" model="ir.ui.view"> |
3938 | - <field name="name">Pack Search inherit</field> |
3939 | - <field name="model">stock.tracking</field> |
3940 | - <field name="type">search</field> |
3941 | - <field name="inherit_id" ref="stock.search_stock_packs"/> |
3942 | - <field name="arch" type="xml"> |
3943 | - <filter name="available" position="after"> |
3944 | - <filter icon="gtk-media-pause" name="on_hold" string="On Hold" domain="[('state','in',['on_hold','on_hold_billing','on_hold_paym'])]" help="On Hold Pickings"/> |
3945 | - </filter> |
3946 | - </field> |
3947 | - </record>--> |
3948 | - |
3949 | - <record id="product_category_tracked_form" model="ir.ui.view"> |
3950 | - <field name="name">product.category.property.form.inherit</field> |
3951 | - <field name="model">product.category</field> |
3952 | - <field name="type">form</field> |
3953 | - <field name="inherit_id" ref="product.product_category_form_view"/> |
3954 | - <field name="arch" type="xml"> |
3955 | - <field name="parent_id" position="after"> |
3956 | - <field name="tracked"/> |
3957 | - </field> |
3958 | - </field> |
3959 | - </record> |
3960 | - |
3961 | - <record id="view_tracking_tree_inherit" model="ir.ui.view"> |
3962 | - <field name="name">stock.tracking.tree.inherit</field> |
3963 | - <field name="model">stock.tracking</field> |
3964 | - <field name="type">tree</field> |
3965 | - <field name="inherit_id" ref="stock.view_tracking_tree"/> |
3966 | - <field name="arch" type="xml"> |
3967 | - <field name="serial" position="after"> |
3968 | - <field name="parent_id"/> |
3969 | - <field name="ul_id"/> |
3970 | - <field name="location_id"/> |
3971 | - <field name="state"/> |
3972 | - </field> |
3973 | - </field> |
3974 | - </record> |
3975 | - |
3976 | - <record id="lot_line_tree_inherit" model="ir.ui.view"> |
3977 | - <field name="name">stock.tracking.tree.inherit</field> |
3978 | - <field name="model">stock.tracking</field> |
3979 | - <field name="type">tree</field> |
3980 | - <field name="inherit_id" ref="stock.lot_line_tree"/> |
3981 | - <field name="arch" type="xml"> |
3982 | - <field name="serial" position="after"> |
3983 | - <field name="parent_id"/> |
3984 | - <field name="ul_id"/> |
3985 | - </field> |
3986 | - </field> |
3987 | - </record> |
3988 | - |
3989 | - <record id="view_tracking_form_inherit" model="ir.ui.view"> |
3990 | - <field name="name">stock.tracking.form.inherit</field> |
3991 | - <field name="model">stock.tracking</field> |
3992 | - <field name="type">form</field> |
3993 | - <field name="inherit_id" ref="stock.view_tracking_form"/> |
3994 | - <field name="arch" type="xml"> |
3995 | - <field name="serial" position="after"> |
3996 | - <field name="parent_id"/> |
3997 | - <field name="ul_id"/> |
3998 | - </field> |
3999 | - <page string="Stock Moves" position="before"> |
4000 | - <page string="Products"> |
4001 | - <field name="child_product_ids" nolabel="1" colspan="4" context="{'group_by':'product_id'}"/> |
4002 | - <field name="product_ids" nolabel="1" colspan="4" invisible="True"/> |
4003 | - <button name="get_products" string="Update product list" colspan="2" type="object" icon="gtk-ok"/> |
4004 | - </page> |
4005 | - <page string="Serial Code"> |
4006 | - <field name="child_serial_ids" nolabel="1" colspan="4"/> |
4007 | - <field name="serial_ids" nolabel="1" colspan="4" invisible="True"/> |
4008 | - <button name="get_serials" string="Update Serial list" colspan="2" type="object" icon="gtk-ok"/> |
4009 | - <!-- |
4010 | - <field name="current_move_ids" nolabel="1" colspan="4"> |
4011 | - <tree string="Stock Moves"> |
4012 | - <field name="product_id"/> |
4013 | - <field name="prodlot_id" groups="base.group_extended"/> |
4014 | - </tree> |
4015 | - </field> |
4016 | - --> |
4017 | - </page> |
4018 | - <page string="Child Packs"> |
4019 | - <field name="child_ids" nolabel="1" colspan="2"/> |
4020 | - </page> |
4021 | - <page string="History"> |
4022 | - <field name="history_ids" nolabel="1" colspan="4"/> |
4023 | - </page> |
4024 | - </page> |
4025 | - <button name="action_traceability" string="Downstream traceability" position="after"> |
4026 | - <field name="location_id"/> |
4027 | - </button> |
4028 | - <form position="inside"> |
4029 | - <group colspan="4" col="12"> |
4030 | - <field name="state" colspan="3"/> |
4031 | - <group colspan="9" col="10"> |
4032 | - <button name="reset_open" states="close" string="Reset Open" colspan="2" type="object" icon="gtk-ok"/> |
4033 | - <button name="set_close" states="open" string="Close" colspan="2" type="object" icon="gtk-ok"/> |
4034 | - </group> |
4035 | - </group> |
4036 | - </form> |
4037 | - <!-- |
4038 | - <field name="move_ids" position="before"> |
4039 | - <separator string="Current moves" colspan="4"/> |
4040 | - <field name="current_move_ids" nolabel="1" colspan="4"/> |
4041 | - <separator string="All moves" colspan="4"/> |
4042 | - </field> |
4043 | - --> |
4044 | - </field> |
4045 | - </record> |
4046 | - |
4047 | - <record id="view_stock_tracking_tree" model="ir.ui.view"> |
4048 | - <field name="name">stock.tracking.tree</field> |
4049 | - <field name="model">stock.tracking</field> |
4050 | - <field name="type">tree</field> |
4051 | - <field name="field_parent">child_ids</field> |
4052 | - <field name="arch" type="xml"> |
4053 | - <tree toolbar="1"> |
4054 | - <field name="name"/> |
4055 | - <field name="serial"/> |
4056 | - <field name="ul_id"/> |
4057 | - </tree> |
4058 | - </field> |
4059 | - </record> |
4060 | - |
4061 | - |
4062 | - <record id="action_stock_tracking_tree" model="ir.actions.act_window"> |
4063 | - <field name="name">Packs Structure</field> |
4064 | - <field name="res_model">stock.tracking</field> |
4065 | - <field name="type">ir.actions.act_window</field> |
4066 | - <field name="view_type">tree</field> |
4067 | - <field name="view_id" ref="view_stock_tracking_tree"/> |
4068 | - <field name="domain">[('parent_id','=',False)]</field> |
4069 | - </record> |
4070 | - <menuitem |
4071 | - action="action_stock_tracking_tree" |
4072 | - id="menu_action_stock_tracking_tree" |
4073 | - parent="stock.menu_stock_inventory_control" /> |
4074 | - |
4075 | - <record id="view_picking_form" model="ir.ui.view"> |
4076 | - <field name="name">stock.picking.form</field> |
4077 | - <field name="model">stock.picking</field> |
4078 | - <field name="type">form</field> |
4079 | - <field name="inherit_id" ref="stock.view_picking_form"/> |
4080 | - <field name="arch" type="xml"> |
4081 | - <xpath expr="/form/notebook/page/field[@name='move_lines']/form/group/field[@name='tracking_id']" position="replace"> |
4082 | - <field name="tracking_id" domain="[('state', '=', 'open')]" colspan="3"/> |
4083 | - </xpath> |
4084 | - </field> |
4085 | - </record> |
4086 | - |
4087 | - <record id="view_picking_out_form" model="ir.ui.view"> |
4088 | - <field name="name">stock.picking.out.form</field> |
4089 | - <field name="model">stock.picking</field> |
4090 | - <field name="type">form</field> |
4091 | - <field name="inherit_id" ref="stock.view_picking_out_form"/> |
4092 | - <field name="arch" type="xml"> |
4093 | - <xpath expr="/form/notebook/page/field[@name='move_lines']/form/group/field[@name='tracking_id']" position="replace"> |
4094 | - <field name="tracking_id" domain="[('state', '=', 'open')]" colspan="3"/> |
4095 | - </xpath> |
4096 | - </field> |
4097 | - </record> |
4098 | - |
4099 | - <record id="view_picking_in_form" model="ir.ui.view"> |
4100 | - <field name="name">stock.picking.in.form</field> |
4101 | - <field name="model">stock.picking</field> |
4102 | - <field name="type">form</field> |
4103 | - <field name="inherit_id" ref="stock.view_picking_in_form"/> |
4104 | - <field name="arch" type="xml"> |
4105 | - <xpath expr="/form/notebook/page/field[@name='move_lines']/form/group/field[@name='tracking_id']" position="replace"> |
4106 | - <field name="tracking_id" domain="[('state', '=', 'open')]" colspan="3"/> |
4107 | - </xpath> |
4108 | - </field> |
4109 | - </record> |
4110 | - |
4111 | - <record id="view_product_stock_tracking_tree_inherit" model="ir.ui.view"> |
4112 | - <field name="name">product.stock.tracking.tree</field> |
4113 | - <field name="model">product.stock.tracking</field> |
4114 | - <field name="type">tree</field> |
4115 | - <field name="arch" type="xml"> |
4116 | - <tree string="Products"> |
4117 | - <field name="product_id"/> |
4118 | - <field name="quantity"/> |
4119 | - </tree> |
4120 | - </field> |
4121 | - </record> |
4122 | - |
4123 | - |
4124 | - <record id="view_serial_stock_tracking_tree_inherit" model="ir.ui.view"> |
4125 | - <field name="name">serial.stock.tracking.tree</field> |
4126 | - <field name="model">serial.stock.tracking</field> |
4127 | - <field name="type">tree</field> |
4128 | - <field name="arch" type="xml"> |
4129 | - <tree string="Products"> |
4130 | - <field name="tracking_id"/> |
4131 | - <field name="serial_id"/> |
4132 | - <field name="product_id"/> |
4133 | - <field name="quantity"/> |
4134 | - </tree> |
4135 | - </field> |
4136 | - </record> |
4137 | - |
4138 | - |
4139 | - <!--<record id="view_tracking_form_inherit" model="ir.ui.view"> |
4140 | - <field name="name">stock.tracking.form.inherit</field> |
4141 | - <field name="model">stock.tracking</field> |
4142 | - <field name="type">form</field> |
4143 | - <field name="inherit_id" ref="stock_tracking_extended.view_tracking_form_inherit"/> |
4144 | - <field name="arch" type="xml"> |
4145 | - <notebook position="inside"> |
4146 | - </notebook> |
4147 | - </field> |
4148 | - </record>--> |
4149 | - |
4150 | - <record id="view_tracking_history_tree" model="ir.ui.view"> |
4151 | - <field name="name">stock.tracking.history.tree</field> |
4152 | - <field name="model">stock.tracking.history</field> |
4153 | - <field name="type">tree</field> |
4154 | - <field name="arch" type="xml"> |
4155 | - <tree string="History"> |
4156 | - <field name="type"/> |
4157 | - </tree> |
4158 | - </field> |
4159 | - </record> |
4160 | - |
4161 | - <record id="view_tracking_history_form" model="ir.ui.view"> |
4162 | - <field name="name">stock.tracking.history.form</field> |
4163 | - <field name="model">stock.tracking.history</field> |
4164 | - <field name="type">form</field> |
4165 | - <field name="arch" type="xml"> |
4166 | - <form string="History"> |
4167 | - <field name="type"/> |
4168 | - <!--<newline/> |
4169 | - <separator string="Products" colspan="4"/> |
4170 | - <field name="child_product_ids" nolabel="1" colspan="4"/> |
4171 | - <separator string="Child Packs" colspan="4"/> |
4172 | - <field name="child_pack_ids" nolabel="1" colspan="4"/>--> |
4173 | - </form> |
4174 | - </field> |
4175 | - </record> |
4176 | - |
4177 | - <record id="product_ul_tree" model="ir.ui.view"> |
4178 | - <field name="name">product.ul.tree.inherit</field> |
4179 | - <field name="model">product.ul</field> |
4180 | - <field name="inherit_id" ref="product.product_ul_tree"/> |
4181 | - <field name="type">tree</field> |
4182 | - <field name="arch" type="xml"> |
4183 | - <field name="type" position="after"> |
4184 | - <field name="capacity_index"/> |
4185 | - </field> |
4186 | - </field> |
4187 | - </record> |
4188 | - |
4189 | - <record id="product_ul_form_view" model="ir.ui.view"> |
4190 | - <field name="name">product.ul.form.inherit</field> |
4191 | - <field name="model">product.ul</field> |
4192 | - <field name="inherit_id" ref="product.product_ul_form_view"/> |
4193 | - <field name="type">form</field> |
4194 | - <field name="arch" type="xml"> |
4195 | - <field name="type" position="after"> |
4196 | - <field name="capacity_index"/> |
4197 | - </field> |
4198 | - </field> |
4199 | - </record> |
4200 | - |
4201 | - <record id="view_stock_move_tree_inherit" model="ir.ui.view"> |
4202 | - <field name="name">stock.move.tree</field> |
4203 | - <field name="model">stock.move</field> |
4204 | - <field name="type">tree</field> |
4205 | - <field name="inherit_id" ref="stock.view_move_tree_reception_picking_board"/> |
4206 | - <field name="arch" type="xml"> |
4207 | - <field name="date" position="after"> |
4208 | - <field name="state"/> |
4209 | - </field> |
4210 | + |
4211 | + <record id="view_tracking_extended_tree" model="ir.ui.view"> |
4212 | + <field name="name">stock.tracking.extended.tree</field> |
4213 | + <field name="model">stock.tracking</field> |
4214 | + <field name="inherit_id" ref="stock.view_tracking_tree"/> |
4215 | + <field name="arch" type="xml"> |
4216 | + <field name="serial" position="after"> |
4217 | + <field name="location_id"/> |
4218 | + </field> |
4219 | + </field> |
4220 | + </record> |
4221 | + |
4222 | + <record id="view_tracking_extended_form" model="ir.ui.view"> |
4223 | + <field name="name">stock.tracking.extended.form</field> |
4224 | + <field name="model">stock.tracking</field> |
4225 | + <field name="inherit_id" ref="stock.view_tracking_form"/> |
4226 | + <field name="arch" type="xml"> |
4227 | + <field name="move_ids" position="replace"> |
4228 | + <notebook> |
4229 | + <page string="Products"> |
4230 | + <group name="products"> |
4231 | + <div> |
4232 | + <div> |
4233 | + <field name="product_ids" nolabel="1" colspan="4"/> |
4234 | + </div> |
4235 | + <div name="product_buttons"> |
4236 | + <button name="get_products" string="Update product list" colspan="2" type="object"/> |
4237 | + </div> |
4238 | + </div> |
4239 | + </group> |
4240 | + </page> |
4241 | + <page string="Serial Code"> |
4242 | + <group name="serials"> |
4243 | + <div> |
4244 | + <div> |
4245 | + <field name="serial_ids" nolabel="1" colspan="4"/> |
4246 | + </div> |
4247 | + <div name="prodlot_buttons"> |
4248 | + <button name="get_serials" string="Update Serial list" colspan="2" type="object"/> |
4249 | + </div> |
4250 | + </div> |
4251 | + </group> |
4252 | + </page> |
4253 | + <page string="History"> |
4254 | + <field name="history_ids" nolabel="1" colspan="4"/> |
4255 | + </page> |
4256 | + <page string="Move"> |
4257 | + <field name="move_ids" nolabel="1" colspan="4"/> |
4258 | + </page> |
4259 | + </notebook> |
4260 | + </field> |
4261 | + <field name="serial" position="after"> |
4262 | + <field name="location_id"/> |
4263 | + </field> |
4264 | + </field> |
4265 | + </record> |
4266 | + |
4267 | + <record id="view_product_stock_tracking_tree_inherit" model="ir.ui.view"> |
4268 | + <field name="name">product.stock.tracking.tree</field> |
4269 | + <field name="model">product.stock.tracking</field> |
4270 | + <field name="arch" type="xml"> |
4271 | + <tree string="Products"> |
4272 | + <field name="product_id"/> |
4273 | + <field name="quantity"/> |
4274 | + </tree> |
4275 | + </field> |
4276 | + </record> |
4277 | + |
4278 | + <record id="view_serial_stock_tracking_tree_inherit" model="ir.ui.view"> |
4279 | + <field name="name">serial.stock.tracking.tree</field> |
4280 | + <field name="model">serial.stock.tracking</field> |
4281 | + <field name="arch" type="xml"> |
4282 | + <tree string="Products"> |
4283 | + <field name="tracking_id"/> |
4284 | + <field name="serial_id"/> |
4285 | + <field name="product_id"/> |
4286 | + <field name="quantity"/> |
4287 | + </tree> |
4288 | + </field> |
4289 | + </record> |
4290 | + |
4291 | + <record id="view_tracking_history_tree" model="ir.ui.view"> |
4292 | + <field name="name">stock.tracking.history.tree</field> |
4293 | + <field name="model">stock.tracking.history</field> |
4294 | + <field name="arch" type="xml"> |
4295 | + <tree string="History"> |
4296 | + <field name="date"/> |
4297 | + <field name="type"/> |
4298 | + </tree> |
4299 | + </field> |
4300 | + </record> |
4301 | + |
4302 | + <record id="view_tracking_history_form" model="ir.ui.view"> |
4303 | + <field name="name">stock.tracking.history.form</field> |
4304 | + <field name="model">stock.tracking.history</field> |
4305 | + <field name="arch" type="xml"> |
4306 | + <form string="History"> |
4307 | + <field name="date"/> |
4308 | + <field name="type"/> |
4309 | + </form> |
4310 | </field> |
4311 | </record> |
4312 | |
4313 | |
4314 | === added directory 'stock_tracking_prodlot' |
4315 | === added file 'stock_tracking_prodlot/__init__.py' |
4316 | --- stock_tracking_prodlot/__init__.py 1970-01-01 00:00:00 +0000 |
4317 | +++ stock_tracking_prodlot/__init__.py 2013-03-06 10:58:19 +0000 |
4318 | @@ -0,0 +1,24 @@ |
4319 | +# -*- coding: utf-8 -*- |
4320 | +################################################################################# |
4321 | +# |
4322 | +# OpenERP, Open Source Management Solution |
4323 | +# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr> |
4324 | +# |
4325 | +# This program is free software: you can redistribute it and/or modify |
4326 | +# it under the terms of the GNU General Public License as published by |
4327 | +# the Free Software Foundation, either version 3 of the License, or |
4328 | +# (at your option) any later version. |
4329 | +# |
4330 | +# This program is distributed in the hope that it will be useful, |
4331 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4332 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4333 | +# GNU General Public License for more details. |
4334 | +# |
4335 | +# You should have received a copy of the GNU General Public License |
4336 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
4337 | +# |
4338 | +################################################################################# |
4339 | + |
4340 | +import stock_tracking |
4341 | + |
4342 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4343 | \ No newline at end of file |
4344 | |
4345 | === added file 'stock_tracking_prodlot/__openerp__.py' |
4346 | --- stock_tracking_prodlot/__openerp__.py 1970-01-01 00:00:00 +0000 |
4347 | +++ stock_tracking_prodlot/__openerp__.py 2013-03-06 10:58:19 +0000 |
4348 | @@ -0,0 +1,45 @@ |
4349 | +# -*- coding: utf-8 -*- |
4350 | +################################################################################# |
4351 | +# |
4352 | +# OpenERP, Open Source Management Solution |
4353 | +# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr> |
4354 | +# |
4355 | +# This program is free software: you can redistribute it and/or modify |
4356 | +# it under the terms of the GNU General Public License as published by |
4357 | +# the Free Software Foundation, either version 3 of the License, or |
4358 | +# (at your option) any later version. |
4359 | +# |
4360 | +# This program is distributed in the hope that it will be useful, |
4361 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4362 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4363 | +# GNU General Public License for more details. |
4364 | +# |
4365 | +# You should have received a copy of the GNU General Public License |
4366 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
4367 | +# |
4368 | +################################################################################# |
4369 | + |
4370 | +{ |
4371 | + "name" : "Stock Tracking Prodlot", |
4372 | + "version" : "1.0", |
4373 | + "author" : "Julius Network Solutions", |
4374 | + "description" : """ |
4375 | + |
4376 | +Presentation: |
4377 | + |
4378 | +This module adds the packaging into the production lot |
4379 | + |
4380 | +""", |
4381 | + "website" : "http://www.julius.fr", |
4382 | + "depends" : [ |
4383 | + "stock", |
4384 | + ], |
4385 | + "category" : "Warehouse Management", |
4386 | + "demo" : [], |
4387 | + "data" : [], |
4388 | + 'test': [], |
4389 | + 'installable': True, |
4390 | + 'active': False, |
4391 | +} |
4392 | + |
4393 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4394 | |
4395 | === added file 'stock_tracking_prodlot/stock_tracking.py' |
4396 | --- stock_tracking_prodlot/stock_tracking.py 1970-01-01 00:00:00 +0000 |
4397 | +++ stock_tracking_prodlot/stock_tracking.py 2013-03-06 10:58:19 +0000 |
4398 | @@ -0,0 +1,42 @@ |
4399 | + # -*- coding: utf-8 -*- |
4400 | +################################################################################# |
4401 | +# |
4402 | +# OpenERP, Open Source Management Solution |
4403 | +# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr> |
4404 | +# |
4405 | +# This program is free software: you can redistribute it and/or modify |
4406 | +# it under the terms of the GNU General Public License as published by |
4407 | +# the Free Software Foundation, either version 3 of the License, or |
4408 | +# (at your option) any later version. |
4409 | +# |
4410 | +# This program is distributed in the hope that it will be useful, |
4411 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4412 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4413 | +# GNU General Public License for more details. |
4414 | +# |
4415 | +# You should have received a copy of the GNU General Public License |
4416 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
4417 | +# |
4418 | +################################################################################# |
4419 | + |
4420 | +from openerp.osv import fields, osv, orm |
4421 | +from openerp.tools.translate import _ |
4422 | + |
4423 | +'''Add a field in order to store the current pack in a production lot''' |
4424 | +class stock_production_lot(orm.Model): |
4425 | + _inherit = 'stock.production.lot' |
4426 | + _columns = { |
4427 | + 'tracking_id': fields.many2one('stock.tracking', 'pack'), |
4428 | + } |
4429 | + def copy(self, cr, uid, id, default=None, context=None): |
4430 | + if default is None: |
4431 | + default = {} |
4432 | + default.update({ |
4433 | +# 'state': 'draft', |
4434 | +# 'shipped': False, |
4435 | + 'tracking_id': False, |
4436 | +# 'move_ids': [], |
4437 | + }) |
4438 | + return super(stock_production_lot, self).copy(cr, uid, id, default, context=context) |
4439 | + |
4440 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4441 | |
4442 | === modified file 'stock_tracking_reopen/__openerp__.py' |
4443 | --- stock_tracking_reopen/__openerp__.py 2013-02-13 08:35:37 +0000 |
4444 | +++ stock_tracking_reopen/__openerp__.py 2013-03-06 10:58:19 +0000 |
4445 | @@ -34,16 +34,16 @@ |
4446 | "depends" : [ |
4447 | "stock", |
4448 | "stock_tracking_extended", |
4449 | - "tr_barcode", |
4450 | - ], |
4451 | - "category" : "Customs/Stock", |
4452 | - "init_xml" : [], |
4453 | - "demo_xml" : [], |
4454 | - "images" : ['images/Tracking reopen.png'], |
4455 | - "update_xml" : [ |
4456 | + "stock_tracking_state", |
4457 | + ], |
4458 | + "category" : "Warehouse Management", |
4459 | + "demo" : [], |
4460 | + "data" : [ |
4461 | 'stock_view.xml', |
4462 | ], |
4463 | 'test': [], |
4464 | 'installable': False, |
4465 | 'active': False, |
4466 | } |
4467 | + |
4468 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4469 | |
4470 | === modified file 'stock_tracking_reopen/stock.py' |
4471 | --- stock_tracking_reopen/stock.py 2012-11-02 10:27:23 +0000 |
4472 | +++ stock_tracking_reopen/stock.py 2013-03-06 10:58:19 +0000 |
4473 | @@ -19,11 +19,11 @@ |
4474 | # |
4475 | ################################################################################# |
4476 | |
4477 | -from osv import fields, osv |
4478 | -from tools.translate import _ |
4479 | +from openerp.osv import fields, osv, orm |
4480 | +from openerp.tools.translate import _ |
4481 | import time |
4482 | |
4483 | -class stock_tracking(osv.osv): |
4484 | +class stock_tracking(orm.Model): |
4485 | |
4486 | _inherit = 'stock.tracking' |
4487 | |
4488 | @@ -32,94 +32,101 @@ |
4489 | 'modified': fields.boolean('Modified'), |
4490 | } |
4491 | |
4492 | - _default = { |
4493 | - 'modified': False, |
4494 | + _defaults = { |
4495 | + 'modified': False, |
4496 | } |
4497 | '''Function for pack creation''' |
4498 | - def create_pack(self, cr, uid, ids, context=None): |
4499 | + def _create_pack(self, cr, uid, pack_id, context=None): |
4500 | '''Init''' |
4501 | if context == None: |
4502 | context = {} |
4503 | '''Location determination''' |
4504 | - stock_tracking_data = self.browse(cr, uid, ids[0]) |
4505 | + stock_tracking_data = self.browse(cr, uid, pack_id, context=context) |
4506 | '''Pack Creation''' |
4507 | - tracking_id = self.create(cr, uid, {'ul_id': stock_tracking_data.ul_id.id, 'location_id': stock_tracking_data.location_id.id}) |
4508 | + tracking_id = self.create(cr, uid, { |
4509 | + 'ul_id': stock_tracking_data.ul_id.id, |
4510 | + 'location_id': stock_tracking_data.location_id.id |
4511 | + }, context=context) |
4512 | '''Pack name is returned''' |
4513 | return tracking_id |
4514 | |
4515 | def reset_open(self, cr, uid, ids, context=None): |
4516 | - res = super(stock_tracking, self).reset_open(cr, uid, ids, context) |
4517 | - pack_ids = self.browse(cr, uid, ids, context) |
4518 | + res = super(stock_tracking, self).reset_open(cr, uid, ids, context=context) |
4519 | + history_obj = self.pool.get('stock.tracking.history') |
4520 | + pack_ids = self.browse(cr, uid, ids, context=context) |
4521 | for pack in pack_ids: |
4522 | if pack.state == 'open': |
4523 | - self.pool.get('stock.tracking.history').create(cr, uid, { |
4524 | - 'type': 'reopen', |
4525 | - 'previous_ref': pack.name, |
4526 | - 'tracking_id': pack.id |
4527 | - }, context) |
4528 | + history_obj.create(cr, uid, { |
4529 | + 'type': 'reopen', |
4530 | + 'previous_ref': pack.name, |
4531 | + 'tracking_id': pack.id |
4532 | + }, context=context) |
4533 | return True |
4534 | |
4535 | + #TODO: check this method !! |
4536 | def set_close(self, cr, uid, ids, context=None): |
4537 | |
4538 | - barcode_obj = self.pool.get('tr.barcode') |
4539 | stock_move_obj = self.pool.get('stock.move') |
4540 | history_obj = self.pool.get('stock.tracking.history') |
4541 | - res = super(stock_tracking, self).set_close(cr, uid, ids, context) |
4542 | + res = super(stock_tracking, self).set_close(cr, uid, ids, context=context) |
4543 | if res: |
4544 | - pack_ids = self.browse(cr, uid, ids, context) |
4545 | + pack_ids = self.browse(cr, uid, ids, context=context) |
4546 | for pack in pack_ids: |
4547 | if pack.state == 'open': |
4548 | - if self.pool.get('stock.tracking.history').search(cr,uid,[('type','=','reopen'),('tracking_id','=',pack.id)]) and pack.modified == True: |
4549 | - new_pack_id = self.create_pack(cr, uid, ids, context) |
4550 | - new_pack_data = self.browse(cr, uid, new_pack_id, context) |
4551 | + if history_obj.search(cr, uid, [ |
4552 | + ('type', '=', 'reopen'), |
4553 | + ('tracking_id', '=', pack.id) |
4554 | + ], context=context) and pack.modified == True: |
4555 | + new_pack_id = self._create_pack(cr, uid, pack.id, context=context) |
4556 | + new_pack_data = self.browse(cr, uid, new_pack_id, context=context) |
4557 | '''loop on each move form the old pack to the new pack''' |
4558 | for pack_move in pack.current_move_ids: |
4559 | '''stock move creation''' |
4560 | - barcode_name = pack_move.prodlot_id.name |
4561 | - barcode_data = barcode_obj.search(cr, uid,[('code', '=', barcode_name)], limit=1) |
4562 | move_id = stock_move_obj.create(cr, uid, { |
4563 | - 'name': pack_move.name, |
4564 | - 'state': pack_move.state, |
4565 | - 'product_id': pack_move.product_id.id, |
4566 | - 'product_uom': pack_move.product_uom.id, |
4567 | - 'prodlot_id': pack_move.prodlot_id.id, |
4568 | - 'location_id': pack.location_id.id, |
4569 | - 'location_dest_id': new_pack_data.location_id.id, |
4570 | - 'tracking_id': new_pack_data.id, |
4571 | - }) |
4572 | + 'name': pack_move.name, |
4573 | + 'state': pack_move.state, |
4574 | + 'product_id': pack_move.product_id.id, |
4575 | + 'product_uom': pack_move.product_uom.id, |
4576 | + 'prodlot_id': pack_move.prodlot_id.id, |
4577 | + 'location_id': pack.location_id.id, |
4578 | + 'location_dest_id': new_pack_data.location_id.id, |
4579 | + 'tracking_id': new_pack_data.id, |
4580 | + }, context=context) |
4581 | '''end of loop''' |
4582 | if pack.child_ids: |
4583 | for child_pack_data in pack.child_ids: |
4584 | if child_pack_data.state == 'close': |
4585 | - self.write(cr, uid, child_pack_data.id, {'active': False}) |
4586 | - self.write(cr, uid, [new_child_pack_id], {'parent_id': new_pack_data.id,}) |
4587 | - history_obj.create(cr, uid, {'type': 'pack_in', |
4588 | - 'tracking_id': child_pack_data.id, |
4589 | - 'parent_id': new_pack_data.id, |
4590 | - }) |
4591 | - self.write(cr, uid, new_pack_data.id, {'location_id': child_pack_data.location_id and child_pack_data.location_id.id or False,}) |
4592 | + self.write(cr, uid, child_pack_data.id, {'active': False}, context=context) |
4593 | + self.write(cr, uid, [new_child_pack_id], {'parent_id': new_pack_data.id,}, context=context) |
4594 | + history_obj.create(cr, uid, { |
4595 | + 'type': 'pack_in', |
4596 | + 'tracking_id': child_pack_data.id, |
4597 | + 'parent_id': new_pack_data.id, |
4598 | + }, context=context) |
4599 | + self.write(cr, uid, new_pack_data.id, { |
4600 | + 'location_id': child_pack_data.location_id and child_pack_data.location_id.id or False, |
4601 | + }, context=context) |
4602 | |
4603 | - self.write(cr, uid, [pack.id], {'state': 'close', |
4604 | - 'active': False, |
4605 | - 'modified': False}) |
4606 | + self.write(cr, uid, [pack.id], { |
4607 | + 'state': 'close', |
4608 | + 'active': False, |
4609 | + 'modified': False, |
4610 | + }, context=context) |
4611 | '''Call for a function who will display serial code list and product list in the pack layout''' |
4612 | - self.get_products(cr, uid, [new_pack_data.id], context=None) |
4613 | - self.get_serials(cr, uid, [new_pack_data.id], context=None) |
4614 | - |
4615 | - self.write(cr, uid, [pack.id], {'state': 'close'}) |
4616 | + self.get_products(cr, uid, [new_pack_data.id], context=context) |
4617 | + self.get_serials(cr, uid, [new_pack_data.id], context=context) |
4618 | + self.write(cr, uid, [pack.id], {'state': 'close'}, context=context) |
4619 | return res |
4620 | |
4621 | -stock_tracking() |
4622 | - |
4623 | -class stock_tracking_history(osv.osv): |
4624 | +class stock_tracking_history(orm.Model): |
4625 | |
4626 | _inherit = "stock.tracking.history" |
4627 | |
4628 | def _get_types(self, cr, uid, context={}): |
4629 | - res = super(stock_tracking_history, self)._get_types(cr, uid, context) |
4630 | + res = super(stock_tracking_history, self)._get_types(cr, uid, context=context) |
4631 | if not res: |
4632 | res = [] |
4633 | - res = res + [('reopen','Re Open')] |
4634 | + res = res + [('reopen',_('Re Open'))] |
4635 | return res |
4636 | |
4637 | _columns = { |
4638 | @@ -127,7 +134,5 @@ |
4639 | 'previous_ref': fields.char('Previous reference', size=128), |
4640 | # 'previous_id': fields.many2one('stock.tracking', 'Previous pack'), |
4641 | } |
4642 | - |
4643 | -stock_tracking_history() |
4644 | |
4645 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4646 | |
4647 | === modified file 'stock_tracking_reopen/stock_view.xml' |
4648 | --- stock_tracking_reopen/stock_view.xml 2012-03-07 12:56:37 +0000 |
4649 | +++ stock_tracking_reopen/stock_view.xml 2013-03-06 10:58:19 +0000 |
4650 | @@ -2,29 +2,27 @@ |
4651 | <openerp> |
4652 | <data> |
4653 | |
4654 | - <record id="view_tracking_history_tree" model="ir.ui.view"> |
4655 | - <field name="name">stock.tracking.history.tree.reopen</field> |
4656 | - <field name="model">stock.tracking.history</field> |
4657 | - <field name="type">tree</field> |
4658 | - <field name="inherit_id" ref="stock_tracking_extended.view_tracking_history_tree"/> |
4659 | - <field name="arch" type="xml"> |
4660 | - <field name="type" position="after"> |
4661 | - <field name="previous_ref"/> |
4662 | - </field> |
4663 | - </field> |
4664 | - </record> |
4665 | - |
4666 | - <record id="view_tracking_history_form" model="ir.ui.view"> |
4667 | - <field name="name">stock.tracking.history.form.reopen</field> |
4668 | - <field name="model">stock.tracking.history</field> |
4669 | - <field name="type">form</field> |
4670 | - <field name="inherit_id" ref="stock_tracking_extended.view_tracking_history_form"/> |
4671 | - <field name="arch" type="xml"> |
4672 | - <field name="type" position="after"> |
4673 | - <field name="previous_ref"/> |
4674 | - </field> |
4675 | - </field> |
4676 | - </record> |
4677 | + <record id="view_tracking_history_tree" model="ir.ui.view"> |
4678 | + <field name="name">stock.tracking.history.tree.reopen</field> |
4679 | + <field name="model">stock.tracking.history</field> |
4680 | + <field name="inherit_id" ref="stock_tracking_extended.view_tracking_history_tree"/> |
4681 | + <field name="arch" type="xml"> |
4682 | + <field name="type" position="after"> |
4683 | + <field name="previous_ref"/> |
4684 | + </field> |
4685 | + </field> |
4686 | + </record> |
4687 | + |
4688 | + <record id="view_tracking_history_form" model="ir.ui.view"> |
4689 | + <field name="name">stock.tracking.history.form.reopen</field> |
4690 | + <field name="model">stock.tracking.history</field> |
4691 | + <field name="inherit_id" ref="stock_tracking_extended.view_tracking_history_form"/> |
4692 | + <field name="arch" type="xml"> |
4693 | + <field name="type" position="after"> |
4694 | + <field name="previous_ref"/> |
4695 | + </field> |
4696 | + </field> |
4697 | + </record> |
4698 | |
4699 | </data> |
4700 | </openerp> |
4701 | |
4702 | === added directory 'stock_tracking_state' |
4703 | === added file 'stock_tracking_state/__init__.py' |
4704 | --- stock_tracking_state/__init__.py 1970-01-01 00:00:00 +0000 |
4705 | +++ stock_tracking_state/__init__.py 2013-03-06 10:58:19 +0000 |
4706 | @@ -0,0 +1,24 @@ |
4707 | +# -*- coding: utf-8 -*- |
4708 | +################################################################################# |
4709 | +# |
4710 | +# OpenERP, Open Source Management Solution |
4711 | +# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr> |
4712 | +# |
4713 | +# This program is free software: you can redistribute it and/or modify |
4714 | +# it under the terms of the GNU General Public License as published by |
4715 | +# the Free Software Foundation, either version 3 of the License, or |
4716 | +# (at your option) any later version. |
4717 | +# |
4718 | +# This program is distributed in the hope that it will be useful, |
4719 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4720 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4721 | +# GNU General Public License for more details. |
4722 | +# |
4723 | +# You should have received a copy of the GNU General Public License |
4724 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
4725 | +# |
4726 | +################################################################################# |
4727 | + |
4728 | +import stock_tracking |
4729 | + |
4730 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4731 | \ No newline at end of file |
4732 | |
4733 | === added file 'stock_tracking_state/__openerp__.py' |
4734 | --- stock_tracking_state/__openerp__.py 1970-01-01 00:00:00 +0000 |
4735 | +++ stock_tracking_state/__openerp__.py 2013-03-06 10:58:19 +0000 |
4736 | @@ -0,0 +1,48 @@ |
4737 | +# -*- coding: utf-8 -*- |
4738 | +################################################################################# |
4739 | +# |
4740 | +# OpenERP, Open Source Management Solution |
4741 | +# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr> |
4742 | +# |
4743 | +# This program is free software: you can redistribute it and/or modify |
4744 | +# it under the terms of the GNU General Public License as published by |
4745 | +# the Free Software Foundation, either version 3 of the License, or |
4746 | +# (at your option) any later version. |
4747 | +# |
4748 | +# This program is distributed in the hope that it will be useful, |
4749 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4750 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4751 | +# GNU General Public License for more details. |
4752 | +# |
4753 | +# You should have received a copy of the GNU General Public License |
4754 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
4755 | +# |
4756 | +################################################################################# |
4757 | + |
4758 | +{ |
4759 | + "name" : "Stock Tracking State", |
4760 | + "version" : "1.0", |
4761 | + "author" : "Julius Network Solutions", |
4762 | + "description" : """ |
4763 | + |
4764 | +Presentation: |
4765 | + |
4766 | +This module will add the state field to make changes of closed packed |
4767 | + |
4768 | +""", |
4769 | + "website" : "http://www.julius.fr", |
4770 | + "depends" : [ |
4771 | + "stock", |
4772 | + "stock_tracking_extended", |
4773 | + ], |
4774 | + "category" : "Warehouse Management", |
4775 | + "demo" : [], |
4776 | + "data" : [ |
4777 | + 'stock_tracking_view.xml', |
4778 | + ], |
4779 | + 'test': [], |
4780 | + 'installable': True, |
4781 | + 'active': False, |
4782 | +} |
4783 | + |
4784 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4785 | |
4786 | === added directory 'stock_tracking_state/i18n' |
4787 | === added file 'stock_tracking_state/i18n/fr.po' |
4788 | --- stock_tracking_state/i18n/fr.po 1970-01-01 00:00:00 +0000 |
4789 | +++ stock_tracking_state/i18n/fr.po 2013-03-06 10:58:19 +0000 |
4790 | @@ -0,0 +1,76 @@ |
4791 | +# Translation of OpenERP Server. |
4792 | +# This file contains the translation of the following modules: |
4793 | +# * stock_tracking_state |
4794 | +# |
4795 | +msgid "" |
4796 | +msgstr "" |
4797 | +"Project-Id-Version: OpenERP Server 7.0\n" |
4798 | +"Report-Msgid-Bugs-To: \n" |
4799 | +"POT-Creation-Date: 2013-02-15 14:17+0000\n" |
4800 | +"PO-Revision-Date: 2013-02-15 14:17+0000\n" |
4801 | +"Last-Translator: <>\n" |
4802 | +"Language-Team: \n" |
4803 | +"MIME-Version: 1.0\n" |
4804 | +"Content-Type: text/plain; charset=UTF-8\n" |
4805 | +"Content-Transfer-Encoding: \n" |
4806 | +"Plural-Forms: \n" |
4807 | + |
4808 | +#. module: stock_tracking_state |
4809 | +#: view:stock.tracking:0 |
4810 | +msgid "Close Pack" |
4811 | +msgstr "Fermer Colis" |
4812 | + |
4813 | +#. module: stock_tracking_state |
4814 | +#: model:ir.model,name:stock_tracking_state.model_stock_tracking |
4815 | +msgid "Packs" |
4816 | +msgstr "Colis" |
4817 | + |
4818 | +#. module: stock_tracking_state |
4819 | +#: code:addons/stock_tracking_state/stock_tracking.py:63 |
4820 | +#, python-format |
4821 | +msgid "You can't close this pack because there is at least one not closed child" |
4822 | +msgstr "Vous ne pouvez pas fermer ce colis car il y a au moins un colis enfant non fermé" |
4823 | + |
4824 | +#. module: stock_tracking_state |
4825 | +#: model:ir.model,name:stock_tracking_state.model_stock_move |
4826 | +msgid "Stock Move" |
4827 | +msgstr "Mouvement de stock" |
4828 | + |
4829 | +#. module: stock_tracking_state |
4830 | +#: code:addons/stock_tracking_state/stock_tracking.py:50 |
4831 | +#, python-format |
4832 | +msgid "You can't re-open this pack because there is at least one not closed child" |
4833 | +msgstr "Vous ne pouvez pas ré-ouvrir ce colis car il y a au moins un colis enfant non fermé" |
4834 | + |
4835 | +#. module: stock_tracking_state |
4836 | +#: view:stock.tracking:0 |
4837 | +msgid "Reset Open" |
4838 | +msgstr "Ré-ouvrir" |
4839 | + |
4840 | +#. module: stock_tracking_state |
4841 | +#: field:stock.tracking,state:0 |
4842 | +msgid "State" |
4843 | +msgstr "Statut" |
4844 | + |
4845 | +#. module: stock_tracking_state |
4846 | +#: code:addons/stock_tracking_state/stock_tracking.py:50 |
4847 | +#: code:addons/stock_tracking_state/stock_tracking.py:63 |
4848 | +#, python-format |
4849 | +msgid "Not allowed !" |
4850 | +msgstr "Non autorisé !" |
4851 | + |
4852 | +#. module: stock_tracking_state |
4853 | +#: selection:stock.tracking,state:0 |
4854 | +msgid "Close" |
4855 | +msgstr "Fermé" |
4856 | + |
4857 | +#. module: stock_tracking_state |
4858 | +#: selection:stock.tracking,state:0 |
4859 | +msgid "Open" |
4860 | +msgstr "Ouvert" |
4861 | + |
4862 | +#. module: stock_tracking_state |
4863 | +#: constraint:stock.move:0 |
4864 | +msgid "You cannot choose this pack because it's closed." |
4865 | +msgstr "Vous ne pouvez pas choisir ce colis car il est fermé." |
4866 | + |
4867 | |
4868 | === added file 'stock_tracking_state/stock_tracking.py' |
4869 | --- stock_tracking_state/stock_tracking.py 1970-01-01 00:00:00 +0000 |
4870 | +++ stock_tracking_state/stock_tracking.py 2013-03-06 10:58:19 +0000 |
4871 | @@ -0,0 +1,83 @@ |
4872 | + # -*- coding: utf-8 -*- |
4873 | +################################################################################# |
4874 | +# |
4875 | +# OpenERP, Open Source Management Solution |
4876 | +# Copyright (C) 2011 Julius Network Solutions SARL <contact@julius.fr> |
4877 | +# |
4878 | +# This program is free software: you can redistribute it and/or modify |
4879 | +# it under the terms of the GNU General Public License as published by |
4880 | +# the Free Software Foundation, either version 3 of the License, or |
4881 | +# (at your option) any later version. |
4882 | +# |
4883 | +# This program is distributed in the hope that it will be useful, |
4884 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
4885 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4886 | +# GNU General Public License for more details. |
4887 | +# |
4888 | +# You should have received a copy of the GNU General Public License |
4889 | +# along with this program. If not, see <http://www.gnu.org/licenses/>. |
4890 | +# |
4891 | +################################################################################# |
4892 | + |
4893 | +from openerp.osv import fields, osv, orm |
4894 | +from openerp.tools.translate import _ |
4895 | + |
4896 | +class stock_tracking(orm.Model): |
4897 | + |
4898 | + _inherit = 'stock.tracking' |
4899 | + |
4900 | + _columns = { |
4901 | + 'state': fields.selection([('open','Open'),('close','Close')], 'State', required=True, readonly=True), |
4902 | + 'parent_id': fields.many2one('stock.tracking', 'Parent'), |
4903 | + 'child_ids': fields.one2many('stock.tracking', 'parent_id', 'Children', readonly=True), |
4904 | + } |
4905 | + |
4906 | + _defaults = { |
4907 | + 'state': 'open', |
4908 | + } |
4909 | + |
4910 | + def reset_open(self, cr, uid, ids, context=None): |
4911 | + pack_ids = self.browse(cr, uid, ids, context=context) |
4912 | + for pack in pack_ids: |
4913 | + allowed = True |
4914 | + if pack.parent_id: |
4915 | + if pack.parent_id and pack.parent_id != 'open': |
4916 | + self.write(cr, uid, [pack.parent_id.id], {'state': 'open'}, context=context) |
4917 | + if allowed: |
4918 | + for child in pack.child_ids: |
4919 | + if child.state == 'open': |
4920 | + allowed = False |
4921 | + raise osv.except_osv(_('Not allowed !'),_('You can\'t re-open this pack because there is at least one not closed child')) |
4922 | + break |
4923 | + if allowed: |
4924 | + self.write(cr, uid, [pack.id], {'state': 'open'}, context=context) |
4925 | + return True |
4926 | + |
4927 | + def set_close(self, cr, uid, ids, context=None): |
4928 | + pack_ids = self.browse(cr, uid, ids, context=context) |
4929 | + for pack in pack_ids: |
4930 | + allowed = True |
4931 | + for child in pack.child_ids: |
4932 | + if child.state == 'open': |
4933 | + allowed = False |
4934 | + raise osv.except_osv(_('Not allowed !'),_('You can\'t close this pack because there is at least one not closed child')) |
4935 | + break |
4936 | + if allowed: |
4937 | + self.write(cr, uid, [pack.id], {'state': 'close'}, context=context) |
4938 | + return True |
4939 | + |
4940 | +class stock_move(orm.Model): |
4941 | + _inherit = 'stock.move' |
4942 | + |
4943 | + def _check_tracking_state(self, cr, uid, ids, context=None): |
4944 | + lines = self.browse(cr, uid, ids, context=context) |
4945 | + for l in lines: |
4946 | + if l.tracking_id.state == 'close': |
4947 | + return False |
4948 | + return True |
4949 | + |
4950 | + _constraints = [ |
4951 | + (_check_tracking_state, 'You cannot choose this pack because it\'s closed.', ['tracking_id']), |
4952 | + ] |
4953 | + |
4954 | +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
4955 | |
4956 | === added file 'stock_tracking_state/stock_tracking_view.xml' |
4957 | --- stock_tracking_state/stock_tracking_view.xml 1970-01-01 00:00:00 +0000 |
4958 | +++ stock_tracking_state/stock_tracking_view.xml 2013-03-06 10:58:19 +0000 |
4959 | @@ -0,0 +1,46 @@ |
4960 | +<?xml version="1.0" encoding="utf-8"?> |
4961 | +<openerp> |
4962 | + <data> |
4963 | + |
4964 | + <record id="view_tracking_state_tree" model="ir.ui.view"> |
4965 | + <field name="name">stock.tracking.state.tree</field> |
4966 | + <field name="model">stock.tracking</field> |
4967 | + <field name="inherit_id" ref="stock_tracking_extended.view_tracking_extended_tree"/> |
4968 | + <field name="arch" type="xml"> |
4969 | + <field name="location_id" position="after"> |
4970 | + <field name="state"/> |
4971 | + </field> |
4972 | + </field> |
4973 | + </record> |
4974 | + |
4975 | + <record id="view_tracking_state_form" model="ir.ui.view"> |
4976 | + <field name="name">stock.tracking.state.form</field> |
4977 | + <field name="model">stock.tracking</field> |
4978 | + <field name="inherit_id" ref="stock.view_tracking_form"/> |
4979 | + <field name="arch" type="xml"> |
4980 | + <group position="before"> |
4981 | + <header> |
4982 | + <button name="reset_open" states="close" string="Reset Open" type="object" class="oe_highlight"/> |
4983 | + <button name="set_close" states="open" string="Close Pack" type="object" class="oe_highlight"/> |
4984 | + <field name="state" widget="statusbar" statusbar_visible="open,close" /> |
4985 | + </header> |
4986 | + </group> |
4987 | + </field> |
4988 | + </record> |
4989 | + |
4990 | + <record id="view_tracking_state_extended_form" model="ir.ui.view"> |
4991 | + <field name="name">stock.tracking.state.extended.form</field> |
4992 | + <field name="model">stock.tracking</field> |
4993 | + <field name="inherit_id" ref="stock_tracking_extended.view_tracking_extended_form"/> |
4994 | + <field name="arch" type="xml"> |
4995 | + <div name="product_buttons" position="attributes"> |
4996 | + <attribute name="attrs">{'invisible':[('state', '=', 'close')]}</attribute> |
4997 | + </div> |
4998 | + <div name="prodlot_buttons" position="attributes"> |
4999 | + <attribute name="attrs">{'invisible':[('state', '=', 'close')]}</attribute> |
5000 | + </div> |
Can you split your reviews into smaller chunks please?
That's a real plain to review a 6000 lines diff.
l.223-254 Why do you add 30 lines of commented code?
l.753 remove the lambda,
'use_exist': True,
Please try to wrap the long lines to 80 chars (l.876, 877 for instance
and in _columns in general).
You can use the " continuation for that:
'track_ incoming' : fields.boolean(
'Track Incoming Lots',
help="Forces to specify a Serial Number for all moves containing "
"this product and coming from a Supplier Location"),
l.910-927: indentation is broken (mix tabs and spaces) (in a general
manner, check the xml files, a lot of them seems to contain tabs).
l.1170, can you remove the commented dependency if it not required anymore?
l.1254,1271,etc. use 'if context is None' instead of 'if context == None'
By the way, you don't need to initialize context to {} if you do not use it
in the body of the method
l.1269,etc. the docstring of a methods gos below the declaration, not above
l.1309,1311,etc. prefer the ternary ... if ... else form:
move_data.name if move_data else prodlot_data.name
l.1356- 1358,1482, etc. again can you clean the commented code?
l.1383 use inline comment with #
l.1419,1481 why do you not set `pack_history_id` in the `default` argument of
`copy` the line above?
l.1661- 1664,1856- 1861,etc. you should replace the 4 lines by using the default value of {}.get get('type_ selection' , 'product')
type = context.
l.1677,1877 context. get('active_ id', False)
l.1967,1968 the inline comments here are really misleading
l.2414-2418, very redundant when you can simply do active_id = context. get('active_ id')
l.2780,2801,etc.: for product in product_list: (or .iterkeys())
l.2801: replace by list.set_ default( x.product_ id.id, 0) += x.product_qty
product_
Do not forget to put 'installable' to True on the migrated addons.