Merge lp:~jeffery9/stock-logistic-tracking/stock-logistic-tracking into lp:stock-logistic-tracking
- stock-logistic-tracking
- Merge into 7.0
Status: | Work in progress |
---|---|
Proposed branch: | lp:~jeffery9/stock-logistic-tracking/stock-logistic-tracking |
Merge into: | lp:stock-logistic-tracking |
Diff against target: |
1498 lines (+539/-476) 10 files modified
.bzrignore (+4/-0) stock_barcode_reader/__openerp__.py (+1/-1) stock_barcode_reader/acquisition_view.xml (+164/-160) stock_barcode_reader/package_acquisition.py (+274/-223) stock_barcode_reader/stock.py (+7/-5) stock_barcode_reader/stock_view.xml (+30/-28) stock_barcode_reader/wizard/reference.py (+19/-19) stock_barcode_reader/wizard/reference_view.xml (+38/-38) stock_tracking_add_move/__openerp__.py (+1/-1) stock_tracking_add_move/wizard/add_move_view.xml (+1/-1) |
To merge this branch: | bzr merge lp:~jeffery9/stock-logistic-tracking/stock-logistic-tracking |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alexandre Fayolle - camptocamp | Needs Resubmitting | ||
Yannick Vaucher @ Camptocamp | Needs Information | ||
Guewen Baconnier @ Camptocamp | Needs Information | ||
Maxime Chambreuil (http://www.savoirfairelinux.com) | code review | Approve | |
Review via email: mp+180994@code.launchpad.net |
Commit message
Description of the change
have migrated the stock_barcode_
when select menu Acquisition, qweb report
'''
Uncaught Error: QWeb2 - template[
http://
'''
please fix this bug, thanks
- 20. By jeffery chen fan
-
forget to change the field partner_id 's relationship with res.partnenr
Maxime Chambreuil (http://www.savoirfairelinux.com) (max3903) wrote : | # |
Guewen Baconnier @ Camptocamp (gbaconnier-c2c) wrote : | # |
I don't understand, the description of the change states 'please fix this bug, thanks". Is it fixed?
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote : | # |
@jeffery chen fan can you provide more information about the bug which is still present in this MP?
Were you able to fix it in the mean time?
Yannick Vaucher @ Camptocamp (yvaucher-c2c) wrote : | # |
No activity from author I set it to WIP
Alexandre Fayolle - camptocamp (alexandre-fayolle-c2c) wrote : | # |
The source code management for this project has been moved to https:/
Could you resubmit this MP on the new site?
Unmerged revisions
- 20. By jeffery chen fan
-
forget to change the field partner_id 's relationship with res.partnenr
- 19. By jeffery chen fan
-
format code
- 18. By jeffery chen fan
-
fix partner address reference.
- 17. By jeffery chen fan
-
fix mistaken view reference
Preview Diff
1 | === added file '.bzrignore' |
2 | --- .bzrignore 1970-01-01 00:00:00 +0000 |
3 | +++ .bzrignore 2013-08-20 09:03:46 +0000 |
4 | @@ -0,0 +1,4 @@ |
5 | +./.idea |
6 | +./.project |
7 | +./.pydevproject |
8 | +./.settings |
9 | |
10 | === modified file 'stock_barcode_reader/__openerp__.py' |
11 | --- stock_barcode_reader/__openerp__.py 2013-02-18 09:50:58 +0000 |
12 | +++ stock_barcode_reader/__openerp__.py 2013-08-20 09:03:46 +0000 |
13 | @@ -56,7 +56,7 @@ |
14 | "security/ir.model.access.csv", |
15 | ], |
16 | 'test': [], |
17 | - 'installable': False, |
18 | + 'installable': True, |
19 | 'active': False, |
20 | } |
21 | |
22 | |
23 | === modified file 'stock_barcode_reader/acquisition_view.xml' (properties changed: -x to +x) |
24 | --- stock_barcode_reader/acquisition_view.xml 2012-11-02 10:27:43 +0000 |
25 | +++ stock_barcode_reader/acquisition_view.xml 2013-08-20 09:03:46 +0000 |
26 | @@ -1,163 +1,167 @@ |
27 | <?xml version="1.0" encoding="UTF-8"?> |
28 | <openerp> |
29 | - <data> |
30 | - |
31 | - |
32 | - <act_window |
33 | - context="{'default_type':'inventory', 'default_name': 'Scan Inventory '}" |
34 | - id="inventory_acquisition_link_1" name="Inventory Acquisition" |
35 | - res_model="acquisition.acquisition" |
36 | - src_model="stock.inventory" |
37 | - view_mode="form"/> |
38 | - |
39 | - <!--<act_window domain="[('inventory_id', '=', active_id)]" |
40 | - context="{'default_type':'move_stock', 'default_name': 'Scan Stock Move', 'default_move_stock_destination': location_id}" |
41 | - id="move_stock_acquisition_link_2" name="Move Stock Acquisition" |
42 | - res_model="acquisition.acquisition" |
43 | - src_model="stock.inventory" |
44 | - view_mode="form"/>--> |
45 | - |
46 | - <report |
47 | - auto="False" |
48 | - id="account_invoices" |
49 | - model="account.invoice" |
50 | - name="account.invoice" |
51 | - rml="voltalis_stock_picking_report_aeroo/report/pack_barcode_report.rml" |
52 | - string="Invoices" |
53 | - attachment_use="1" |
54 | - multi="True"/> |
55 | - |
56 | - <record model="ir.ui.view" id="view_stock_tracking_list"> |
57 | - <field name="name">Acquisition.list.view</field> |
58 | - <field name="model">acquisition.list</field> |
59 | - <field name="type">tree</field> |
60 | - <field name="arch" type="xml"> |
61 | - <tree string="Acquisition list"> |
62 | - <field name="barcode_id"/> |
63 | - <field name="type"/> |
64 | - <field name="quantity"/> |
65 | - </tree> |
66 | - </field> |
67 | - </record> |
68 | - |
69 | - <record model="ir.ui.view" id="view_stock_tracking_form"> |
70 | - <field name="name">Acquisition.list.view</field> |
71 | - <field name="model">acquisition.list</field> |
72 | - <field name="type">form</field> |
73 | - <field name="arch" type="xml"> |
74 | - <tree string="Acquisition list"> |
75 | - <field name="acquisition_id" readonly="True"/> |
76 | - <field name="barcode_id" readonly="True"/> |
77 | - <field name="type" readonly="True"/> |
78 | - <field name="quantity" on_change="on_change_quantity(quantity,barcode_id)"/> |
79 | - </tree> |
80 | - </field> |
81 | - </record> |
82 | - |
83 | - <record model="ir.ui.view" id="view_stock_tracking_acquisition_form"> |
84 | - <field name="name">Acquisition.view</field> |
85 | - <field name="model">acquisition.acquisition</field> |
86 | - <field name="type">form</field> |
87 | - <field name="arch" type="xml"> |
88 | - <form string="Acquisition name"> |
89 | - <group width="400" height="100"> |
90 | - <group col="4" colspan="4"> |
91 | - <field name="name"/> |
92 | - <field name="type"/> |
93 | - <field name="origin_id"/> |
94 | - <group col="2" colspan="2" attrs="{'invisible':[('type','!=','pack')]}"> |
95 | - <field name="logistic_unit" attrs="{'required':[('type','=','pack')]}" widget="selection"/> |
96 | - </group> |
97 | - <group col="4" colspan="4" attrs="{'invisible':[('type','!=','order')]}"> |
98 | - <field name="destination_id" attrs="{'required':[('type','=','order')]}" on_change="onchange_destination(destination_id)"/> |
99 | - <field name="address_id" attrs="{'required':[('type','=','order')]}"/> |
100 | - </group> |
101 | - <group col="4" colspan="4" attrs="{'invisible':[('type','!=','move_stock')]}"> |
102 | - <field name="move_stock_destination" attrs="{'required':[('type','=','move_stock')]}"/> |
103 | - <field name="move_stock_date" attrs="{'required':[('type','=','move_stock')]}"/> |
104 | - </group> |
105 | - <group col="2" colspan="2" attrs="{'invisible':[('type','!=','inventory')]}"> |
106 | - <field name="inventory_id" attrs="{'required':[('type','=','inventory')]}" on_change="onchange_inventory(inventory_id)"/> |
107 | - </group> |
108 | - <group col="2" colspan="2" attrs="{'invisible':[('type','!=','move_stock')]}"> |
109 | - <field name="move_stock_id"/> |
110 | - </group> |
111 | - <group col="2" colspan="2" attrs="{'invisible':[('type','!=','order')]}"> |
112 | - <field name="picking_id" readonly="1"/> |
113 | - </group> |
114 | - <group col="2" colspan="2" attrs="{'invisible':[('type','!=','pack')]}"> |
115 | - <field name="pack_id" readonly="1"/> |
116 | - </group> |
117 | - <field name="state" invisible="1"/> |
118 | - <field name="acquisition_ids" colspan="4" nolabel="1"/> |
119 | - <button name="%(action_stock_reference)d" string="Start" type="action" icon="gtk-execute" states="open"/> |
120 | - <button name="process" string="Process" type="object" icon="gtk-ok" states="open"/> |
121 | - </group> |
122 | - </group> |
123 | - </form> |
124 | - </field> |
125 | - </record> |
126 | - |
127 | - <record model="ir.ui.view" id="view_stock_tracking_acquisition_tree"> |
128 | - <field name="name">Acquisition.view</field> |
129 | - <field name="model">acquisition.acquisition</field> |
130 | - <field name="type">tree</field> |
131 | - <field name="arch" type="xml"> |
132 | - <tree string="Acquisition name"> |
133 | - <field name="name"/> |
134 | - <field name="acquisition_ids"/> |
135 | - </tree> |
136 | - </field> |
137 | - </record> |
138 | - |
139 | - <record model="ir.actions.act_window" id="action_stock_tracking_acquisition"> |
140 | - <field name="name">Acquisition</field> |
141 | - <field name="type">ir.actions.act_window</field> |
142 | - <field name="res_model">acquisition.acquisition</field> |
143 | - <field name="view_type">form</field> |
144 | - <field name="view_mode">tree,form</field> |
145 | - <field name="target">current</field> |
146 | - <field name="view_id" ref="view_stock_tracking_acquisition_tree"/> |
147 | - </record> |
148 | - |
149 | - <menuitem id="menu_stock_tracking_acquisition" action="action_stock_tracking_acquisition" parent="stock.menu_traceability" sequence="7"/> |
150 | - |
151 | - <record model="ir.ui.view" id="view_stock_acquisition_setting_form"> |
152 | - <field name="name">Acquisition Setting.view</field> |
153 | - <field name="model">acquisition.setting</field> |
154 | - <field name="type">form</field> |
155 | - <field name="arch" type="xml"> |
156 | - <form string="Acquisistion Setting"> |
157 | - <group colspan="4"> |
158 | - <field name="barcode_id" colspan="2"/> |
159 | - <field name="action_type" colspan="2"/> |
160 | - </group> |
161 | - </form> |
162 | - </field> |
163 | - </record> |
164 | - |
165 | - <record model="ir.ui.view" id="view_stock_acquisition_setting_tree"> |
166 | - <field name="name">Acquisition Setting.view</field> |
167 | - <field name="model">acquisition.setting</field> |
168 | - <field name="type">tree</field> |
169 | - <field name="arch" type="xml"> |
170 | - <tree string="Acquisistion Setting"> |
171 | - <field name="barcode_id"/> |
172 | - <field name="action_type"/> |
173 | - </tree> |
174 | - </field> |
175 | - </record> |
176 | - |
177 | - <record model="ir.actions.act_window" id="action_stock_acquisition_setting"> |
178 | - <field name="name">Acquisition Setting</field> |
179 | - <field name="type">ir.actions.act_window</field> |
180 | - <field name="res_model">acquisition.setting</field> |
181 | - <field name="view_type">form</field> |
182 | - <field name="view_mode">tree,form</field> |
183 | - <field name="view_id" ref="view_stock_acquisition_setting_tree"/> |
184 | - </record> |
185 | - |
186 | - <menuitem id="menu_stock_acquisition_setting" action="action_stock_acquisition_setting" parent="stock.menu_stock_configuration" sequence="7"/> |
187 | - |
188 | - </data> |
189 | + <data> |
190 | + |
191 | + |
192 | + <act_window |
193 | + context="{'default_type':'inventory', 'default_name': 'Scan Inventory '}" |
194 | + id="inventory_acquisition_link_1" name="Inventory Acquisition" |
195 | + res_model="acquisition.acquisition" |
196 | + src_model="stock.inventory" |
197 | + view_mode="form"/> |
198 | + |
199 | + <!--<act_window domain="[('inventory_id', '=', active_id)]" |
200 | + context="{'default_type':'move_stock', 'default_name': 'Scan Stock Move', 'default_move_stock_destination': location_id}" |
201 | + id="move_stock_acquisition_link_2" name="Move Stock Acquisition" |
202 | + res_model="acquisition.acquisition" |
203 | + src_model="stock.inventory" |
204 | + view_mode="form"/>--> |
205 | + |
206 | + <report |
207 | + auto="False" |
208 | + id="account_invoices" |
209 | + model="account.invoice" |
210 | + name="account.invoice" |
211 | + rml="voltalis_stock_picking_report_aeroo/report/pack_barcode_report.rml" |
212 | + string="Invoices" |
213 | + attachment_use="1" |
214 | + multi="True"/> |
215 | + |
216 | + <record model="ir.ui.view" id="view_stock_tracking_list"> |
217 | + <field name="name">Acquisition.list.view</field> |
218 | + <field name="model">acquisition.list</field> |
219 | + <field name="type">tree</field> |
220 | + <field name="arch" type="xml"> |
221 | + <tree string="Acquisition list"> |
222 | + <field name="barcode_id"/> |
223 | + <field name="type"/> |
224 | + <field name="quantity"/> |
225 | + </tree> |
226 | + </field> |
227 | + </record> |
228 | + |
229 | + <record model="ir.ui.view" id="view_stock_tracking_form"> |
230 | + <field name="name">Acquisition.list.view</field> |
231 | + <field name="model">acquisition.list</field> |
232 | + <field name="type">form</field> |
233 | + <field name="arch" type="xml"> |
234 | + <tree string="Acquisition list"> |
235 | + <field name="acquisition_id" readonly="True"/> |
236 | + <field name="barcode_id" readonly="True"/> |
237 | + <field name="type" readonly="True"/> |
238 | + <field name="quantity" on_change="on_change_quantity(quantity,barcode_id)"/> |
239 | + </tree> |
240 | + </field> |
241 | + </record> |
242 | + |
243 | + <record model="ir.ui.view" id="view_stock_tracking_acquisition_form"> |
244 | + <field name="name">Acquisition.view</field> |
245 | + <field name="model">acquisition.acquisition</field> |
246 | + <field name="type">form</field> |
247 | + <field name="arch" type="xml"> |
248 | + <form string="Acquisition name"> |
249 | + <group width="400" height="100"> |
250 | + <group col="4" colspan="4"> |
251 | + <field name="name"/> |
252 | + <field name="type"/> |
253 | + <field name="origin_id"/> |
254 | + <group col="2" colspan="2" attrs="{'invisible':[('type','!=','pack')]}"> |
255 | + <field name="logistic_unit" attrs="{'required':[('type','=','pack')]}" widget="selection"/> |
256 | + </group> |
257 | + <group col="4" colspan="4" attrs="{'invisible':[('type','!=','order')]}"> |
258 | + <field name="destination_id" attrs="{'required':[('type','=','order')]}" |
259 | + on_change="onchange_destination(destination_id)"/> |
260 | + <field name="partner_id" attrs="{'required':[('type','=','order')]}"/> |
261 | + </group> |
262 | + <group col="4" colspan="4" attrs="{'invisible':[('type','!=','move_stock')]}"> |
263 | + <field name="move_stock_destination" attrs="{'required':[('type','=','move_stock')]}"/> |
264 | + <field name="move_stock_date" attrs="{'required':[('type','=','move_stock')]}"/> |
265 | + </group> |
266 | + <group col="2" colspan="2" attrs="{'invisible':[('type','!=','inventory')]}"> |
267 | + <field name="inventory_id" attrs="{'required':[('type','=','inventory')]}" |
268 | + on_change="onchange_inventory(inventory_id)"/> |
269 | + </group> |
270 | + <group col="2" colspan="2" attrs="{'invisible':[('type','!=','move_stock')]}"> |
271 | + <field name="move_stock_id"/> |
272 | + </group> |
273 | + <group col="2" colspan="2" attrs="{'invisible':[('type','!=','order')]}"> |
274 | + <field name="picking_id" readonly="1"/> |
275 | + </group> |
276 | + <group col="2" colspan="2" attrs="{'invisible':[('type','!=','pack')]}"> |
277 | + <field name="pack_id" readonly="1"/> |
278 | + </group> |
279 | + <field name="state" invisible="1"/> |
280 | + <field name="acquisition_ids" colspan="4" nolabel="1"/> |
281 | + <button name="%(action_stock_reference)d" string="Start" type="action" icon="gtk-execute" states="open"/> |
282 | + <button name="process" string="Process" type="object" icon="gtk-ok" states="open"/> |
283 | + </group> |
284 | + </group> |
285 | + </form> |
286 | + </field> |
287 | + </record> |
288 | + |
289 | + <record model="ir.ui.view" id="view_stock_tracking_acquisition_tree"> |
290 | + <field name="name">Acquisition.view</field> |
291 | + <field name="model">acquisition.acquisition</field> |
292 | + <field name="type">tree</field> |
293 | + <field name="arch" type="xml"> |
294 | + <tree string="Acquisition name"> |
295 | + <field name="name"/> |
296 | + <field name="acquisition_ids"/> |
297 | + </tree> |
298 | + </field> |
299 | + </record> |
300 | + |
301 | + <record model="ir.actions.act_window" id="action_stock_tracking_acquisition"> |
302 | + <field name="name">Acquisition</field> |
303 | + <field name="type">ir.actions.act_window</field> |
304 | + <field name="res_model">acquisition.acquisition</field> |
305 | + <field name="view_type">form</field> |
306 | + <field name="view_mode">tree,form</field> |
307 | + <field name="target">current</field> |
308 | + <field name="view_id" ref="view_stock_tracking_acquisition_tree"/> |
309 | + </record> |
310 | + |
311 | + <menuitem id="menu_stock_tracking_acquisition" action="action_stock_tracking_acquisition" |
312 | + parent="stock.menu_traceability" sequence="7"/> |
313 | + |
314 | + <record model="ir.ui.view" id="view_stock_acquisition_setting_form"> |
315 | + <field name="name">Acquisition Setting.view</field> |
316 | + <field name="model">acquisition.setting</field> |
317 | + <field name="type">form</field> |
318 | + <field name="arch" type="xml"> |
319 | + <form string="Acquisistion Setting"> |
320 | + <group colspan="4"> |
321 | + <field name="barcode_id" colspan="2"/> |
322 | + <field name="action_type" colspan="2"/> |
323 | + </group> |
324 | + </form> |
325 | + </field> |
326 | + </record> |
327 | + |
328 | + <record model="ir.ui.view" id="view_stock_acquisition_setting_tree"> |
329 | + <field name="name">Acquisition Setting.view</field> |
330 | + <field name="model">acquisition.setting</field> |
331 | + <field name="type">tree</field> |
332 | + <field name="arch" type="xml"> |
333 | + <tree string="Acquisistion Setting"> |
334 | + <field name="barcode_id"/> |
335 | + <field name="action_type"/> |
336 | + </tree> |
337 | + </field> |
338 | + </record> |
339 | + |
340 | + <record model="ir.actions.act_window" id="action_stock_acquisition_setting"> |
341 | + <field name="name">Acquisition Setting</field> |
342 | + <field name="type">ir.actions.act_window</field> |
343 | + <field name="res_model">acquisition.setting</field> |
344 | + <field name="view_type">form</field> |
345 | + <field name="view_mode">tree,form</field> |
346 | + <field name="view_id" ref="view_stock_acquisition_setting_tree"/> |
347 | + </record> |
348 | + |
349 | + <menuitem id="menu_stock_acquisition_setting" action="action_stock_acquisition_setting" |
350 | + parent="stock.menu_stock_configuration" sequence="7"/> |
351 | + |
352 | + </data> |
353 | </openerp> |
354 | |
355 | === modified file 'stock_barcode_reader/package_acquisition.py' (properties changed: -x to +x) |
356 | --- stock_barcode_reader/package_acquisition.py 2013-02-18 14:34:33 +0000 |
357 | +++ stock_barcode_reader/package_acquisition.py 2013-08-20 09:03:46 +0000 |
358 | @@ -26,61 +26,73 @@ |
359 | import datetime |
360 | from tools import misc |
361 | |
362 | + |
363 | class stock_fill_inventory(orm.TransientModel): |
364 | _inherit = "stock.fill.inventory" |
365 | + |
366 | def fill_inventory(self, cr, uid, ids, context=None): |
367 | res = super(stock_fill_inventory, self).fill_inventory(cr, uid, ids, context=context) |
368 | stock_inventory_obj = self.pool.get('stock.inventory') |
369 | fill_inventory = self.browse(cr, uid, ids[0], context=context) |
370 | if stock_inventory_obj.browse(cr, uid, context.get('active_id', False), context).location_id: |
371 | - stock_inventory_obj.write(cr, uid, context.get('active_id', False), {'location_id': fill_inventory.location_id.id}) |
372 | + stock_inventory_obj.write(cr, uid, context.get('active_id', False), |
373 | + {'location_id': fill_inventory.location_id.id}) |
374 | return res |
375 | |
376 | + |
377 | class acquisition_acquisition(orm.Model): |
378 | - |
379 | _name = "acquisition.acquisition" |
380 | _order = 'id desc' |
381 | |
382 | _columns = { |
383 | - 'state': fields.selection([('open', 'Open'),('done', 'Done'),], 'State', readonly=True), |
384 | - 'name': fields.char('Name', size=128, required=True, readonly=True, states={'open':[('readonly',False)]}), |
385 | - 'acquisition_ids': fields.one2many('acquisition.list','acquisition_id','Acquisition', readonly=True, states={'open':[('readonly',False)]}), |
386 | - 'origin_id': fields.many2one('stock.location', 'Origin Location' , required=True, readonly=True, states={'open':[('readonly',False)]}), |
387 | + 'state': fields.selection([('open', 'Open'), ('done', 'Done'), ], 'State', readonly=True), |
388 | + 'name': fields.char('Name', size=128, required=True, readonly=True, states={'open': [('readonly', False)]}), |
389 | + 'acquisition_ids': fields.one2many('acquisition.list', 'acquisition_id', 'Acquisition', readonly=True, |
390 | + states={'open': [('readonly', False)]}), |
391 | + 'origin_id': fields.many2one('stock.location', 'Origin Location', required=True, readonly=True, |
392 | + states={'open': [('readonly', False)]}), |
393 | 'type': fields.selection([ |
394 | - ('order','Order Preparation'), |
395 | - ('pack','Pack Preparation'), |
396 | - ('inventory','Inventory Preparation'), |
397 | - ('move_stock','Move Stock'), |
398 | - ],'Type', size=128, readonly=True, states={'open':[('readonly',False)]}), |
399 | - 'destination_id': fields.many2one('stock.location', 'Destination Location' , readonly=True, states={'open':[('readonly',False)]}), |
400 | - 'address_id': fields.many2one('res.partner.address','Partner Address', readonly=True, states={'open':[('readonly',False)]}), |
401 | - 'logistic_unit': fields.many2one('product.ul', 'Unit Size', readonly=True, states={'open':[('readonly',False)]}), |
402 | - 'inventory_id': fields.many2one('stock.inventory', 'Inventory', readonly=True, states={'open':[('readonly',False)]}, domain="[('type', '!=', 'move')]"), |
403 | - 'move_stock_id': fields.many2one('stock.inventory', 'Move stock', readonly=True, domain="[('type', '=', 'move')]"), |
404 | + ('order', 'Order Preparation'), |
405 | + ('pack', 'Pack Preparation'), |
406 | + ('inventory', 'Inventory Preparation'), |
407 | + ('move_stock', 'Move Stock'), |
408 | + ], 'Type', size=128, readonly=True, states={'open': [('readonly', False)]}), |
409 | + 'destination_id': fields.many2one('stock.location', 'Destination Location', readonly=True, |
410 | + states={'open': [('readonly', False)]}), |
411 | + 'partner_id': fields.many2one('res.partner', 'Partner', readonly=True, |
412 | + states={'open': [('readonly', False)]}), |
413 | + 'logistic_unit': fields.many2one('product.ul', 'Unit Size', readonly=True, |
414 | + states={'open': [('readonly', False)]}), |
415 | + 'inventory_id': fields.many2one('stock.inventory', 'Inventory', readonly=True, |
416 | + states={'open': [('readonly', False)]}, domain="[('type', '!=', 'move')]"), |
417 | + 'move_stock_id': fields.many2one('stock.inventory', 'Move stock', readonly=True, |
418 | + domain="[('type', '=', 'move')]"), |
419 | 'pack_id': fields.many2one('stock.tracking', 'Pack', readonly=True), |
420 | 'pack_name': fields.related('pack_id', 'name', type='char', string="Pack Name", size=64, readonly=True), |
421 | 'picking_id': fields.many2one('stock.picking', 'Picking', readonly=True), |
422 | - 'picking_name': fields.related('picking_id', 'name', type='char', string="Picking Name", size=64, readonly=True), |
423 | - 'move_stock_destination': fields.many2one('stock.location', 'Destination Location' , readonly=True, states={'open':[('readonly',False)]}), |
424 | - 'move_stock_date': fields.datetime('Move Date', readonly=True, states={'open':[('readonly',False)]}), |
425 | + 'picking_name': fields.related('picking_id', 'name', type='char', string="Picking Name", size=64, |
426 | + readonly=True), |
427 | + 'move_stock_destination': fields.many2one('stock.location', 'Destination Location', readonly=True, |
428 | + states={'open': [('readonly', False)]}), |
429 | + 'move_stock_date': fields.datetime('Move Date', readonly=True, states={'open': [('readonly', False)]}), |
430 | } |
431 | _defaults = { |
432 | 'state': 'open', |
433 | 'type': 'pack', |
434 | - 'name': lambda self,cr,uid,ctx={}: self.pool.get('ir.sequence').get(cr, uid, 'acquisition.acquisition'), |
435 | - 'move_stock_date': lambda * a: datetime.datetime.now().strftime(misc.DEFAULT_SERVER_DATETIME_FORMAT), |
436 | + 'name': lambda self, cr, uid, ctx={}: self.pool.get('ir.sequence').get(cr, uid, 'acquisition.acquisition'), |
437 | + 'move_stock_date': lambda *a: datetime.datetime.now().strftime(misc.DEFAULT_SERVER_DATETIME_FORMAT), |
438 | } |
439 | |
440 | def onchange_destination(self, cr, uid, ids, destination_id=False, context=None): |
441 | - res = {'value':{'address_id': False}} |
442 | + res = {'value': {'partner_id': False}} |
443 | if destination_id: |
444 | destination = self.pool.get('stock.location').browse(cr, uid, destination_id) |
445 | - if destination.address_id: |
446 | - res['value']['address_id'] = destination.address_id.id |
447 | + if destination.partner_id: |
448 | + res['value']['partner_id'] = destination.partner_id.id |
449 | return res |
450 | |
451 | def onchange_inventory(self, cr, uid, ids, inventory_id=False, context=None): |
452 | - res = {'value':{'location_id': False}} |
453 | + res = {'value': {'location_id': False}} |
454 | if inventory_id: |
455 | inventory = self.pool.get('stock.inventory').browse(cr, uid, inventory_id) |
456 | if inventory.location_id: |
457 | @@ -88,23 +100,23 @@ |
458 | res['value']['name'] = inventory.name |
459 | return res |
460 | |
461 | -# def print_pack_report(self, cr, uid, ids, context=None): |
462 | -# '''init''' |
463 | -# if context is None: |
464 | -# context = {} |
465 | -# |
466 | -# '''process''' |
467 | -# data = self.pool.get('stock.tracking').read(cr, uid, ids)[0] |
468 | -# datas = { |
469 | -# 'ids': ids, |
470 | -# 'model': 'stock.tracking', |
471 | -# 'form': data |
472 | -# } |
473 | -# '''print report''' |
474 | -# return {'type': 'ir.actions.report.xml', |
475 | -# 'report_name': 'voltalis.tracking.barcode.report.aeroo', |
476 | -# 'datas': datas |
477 | -# } |
478 | + # def print_pack_report(self, cr, uid, ids, context=None): |
479 | + # '''init''' |
480 | + # if context is None: |
481 | + # context = {} |
482 | + # |
483 | + # '''process''' |
484 | + # data = self.pool.get('stock.tracking').read(cr, uid, ids)[0] |
485 | + # datas = { |
486 | + # 'ids': ids, |
487 | + # 'model': 'stock.tracking', |
488 | + # 'form': data |
489 | + # } |
490 | + # '''print report''' |
491 | + # return {'type': 'ir.actions.report.xml', |
492 | + # 'report_name': 'voltalis.tracking.barcode.report.aeroo', |
493 | + # 'datas': datas |
494 | + # } |
495 | |
496 | def check_production_lot_location(self, cr, uid, origin_id, logistic_unit_id, context=None): |
497 | result = {} |
498 | @@ -119,16 +131,17 @@ |
499 | if stock_production_lot_data.location_id: |
500 | if stock_production_lot_data.location_id.id != origin_id: |
501 | result = stock_move_obj.create(cr, uid, {'name': stock_production_lot_name, |
502 | - 'state': 'draft', |
503 | - 'product_id': product.id, |
504 | - 'product_uom': product.uom_id.id, |
505 | - 'prodlot_id': logistic_unit_number, |
506 | - 'location_id': stock_production_lot_data.location_id.id, |
507 | - 'location_dest_id': origin_id, |
508 | - }) |
509 | + 'state': 'draft', |
510 | + 'product_id': product.id, |
511 | + 'product_uom': product.uom_id.id, |
512 | + 'prodlot_id': logistic_unit_number, |
513 | + 'location_id': stock_production_lot_data.location_id.id, |
514 | + 'location_dest_id': origin_id, |
515 | + }) |
516 | return result |
517 | |
518 | - def update_delivery_order_line(self, cr, uid, product_id=False, res_id=False, order_id=False, origin_id=False, destination_id=False, tracking_id=False, quantity=1, context=None): |
519 | + def update_delivery_order_line(self, cr, uid, product_id=False, res_id=False, order_id=False, origin_id=False, |
520 | + destination_id=False, tracking_id=False, quantity=1, context=None): |
521 | result = {} |
522 | move_obj = self.pool.get('stock.move') |
523 | production_lot_obj = self.pool.get('stock.production.lot') |
524 | @@ -152,9 +165,12 @@ |
525 | """ The move can be split """ |
526 | vals = {} |
527 | split_context = context |
528 | - split_context.update({'active_id': move_ids[0], 'active_ids': [move_ids[0]], 'active_model': 'stock.move', 'tracking_id': tracking_id}) |
529 | + split_context.update( |
530 | + {'active_id': move_ids[0], 'active_ids': [move_ids[0]], 'active_model': 'stock.move', |
531 | + 'tracking_id': tracking_id}) |
532 | split_id = split_obj.create(cr, uid, vals, split_context) |
533 | - split_line_obj.create(cr, uid, {'prodlot_id': res_id, 'wizard_exist_id': split_id, 'quantity':quantity}) |
534 | + split_line_obj.create(cr, uid, |
535 | + {'prodlot_id': res_id, 'wizard_exist_id': split_id, 'quantity': quantity}) |
536 | split_obj.split_lot(cr, uid, [split_id], split_context) |
537 | else: |
538 | """ There are no move """ |
539 | @@ -165,16 +181,16 @@ |
540 | name_list = product_obj.name_get(cr, uid, [product_id], context) |
541 | stock_production_lot_name = name_list[0][1] |
542 | move_id = move_obj.create(cr, uid, { |
543 | - 'name': stock_production_lot_name, |
544 | - 'product_id': product_id, |
545 | - 'product_uom': product.uom_id.id, |
546 | - 'prodlot_id': res_id, |
547 | - 'location_id': origin_id, |
548 | - 'product_qty': quantity, |
549 | - 'location_dest_id': destination_id, |
550 | - 'picking_id': order_id, |
551 | - 'tracking_id': tracking_id, |
552 | - }) |
553 | + 'name': stock_production_lot_name, |
554 | + 'product_id': product_id, |
555 | + 'product_uom': product.uom_id.id, |
556 | + 'prodlot_id': res_id, |
557 | + 'location_id': origin_id, |
558 | + 'product_qty': quantity, |
559 | + 'location_dest_id': destination_id, |
560 | + 'picking_id': order_id, |
561 | + 'tracking_id': tracking_id, |
562 | + }) |
563 | return result |
564 | |
565 | def process(self, cr, uid, ids, context=None): |
566 | @@ -200,9 +216,10 @@ |
567 | """ |
568 | ### DELIVERY ORDER PREPARATION ### |
569 | """ |
570 | + |
571 | def order_preparation(self, cr, uid, acquisition, context=None): |
572 | res = {} |
573 | - if context==None: |
574 | + if context == None: |
575 | context = {} |
576 | first_code = True |
577 | parent_id = None |
578 | @@ -214,16 +231,18 @@ |
579 | return res |
580 | |
581 | '''Updating the order''' |
582 | + |
583 | def update_order(self, cr, uid, acquisition, context=None): |
584 | if context == None: |
585 | context = {} |
586 | stock_picking_obj = self.pool.get('stock.picking') |
587 | - address_id = acquisition.address_id.id |
588 | + partner_id = acquisition.partner_id.id |
589 | picking_id = acquisition.picking_id.id |
590 | - stock_picking_obj.write(cr, uid, picking_id, {'address_id': address_id, 'type': 'out'}) |
591 | + stock_picking_obj.write(cr, uid, picking_id, {'partner_id': partner_id, 'type': 'out'}) |
592 | return picking_id |
593 | |
594 | '''Split moves of the order into different production lot / tracking packs''' |
595 | + |
596 | def update_stock_move(self, cr, uid, line, parent_id=None, context=None): |
597 | stock_tracking_obj = self.pool.get('stock.tracking') |
598 | history_obj = self.pool.get('stock.tracking.history') |
599 | @@ -240,12 +259,12 @@ |
600 | destination_id = acquisition_data.destination_id.id |
601 | |
602 | """ If a barcode creation pack is detected """ |
603 | - acquisition_setting_ids = setting_obj.search(cr, uid, [('barcode_id','=',barcode.id)], limit=1) |
604 | + acquisition_setting_ids = setting_obj.search(cr, uid, [('barcode_id', '=', barcode.id)], limit=1) |
605 | if acquisition_setting_ids: |
606 | acquisition_setting_id = acquisition_setting_ids[0] |
607 | acquisition_setting_data = setting_obj.browse(cr, uid, acquisition_setting_id, context) |
608 | if acquisition_setting_data.action_type == 'create_pack': |
609 | - logistic_unit = self.pool.get('product.ul').search(cr, uid, [('type','=','pack')], limit=1)[0] |
610 | + logistic_unit = self.pool.get('product.ul').search(cr, uid, [('type', '=', 'pack')], limit=1)[0] |
611 | parent_id = setting_obj.create_pack(cr, uid, [line.acquisition_id.id], logistic_unit, context) |
612 | return parent_id |
613 | elif parent_id and acquisition_setting_data.action_type == 'close_pack': |
614 | @@ -259,41 +278,50 @@ |
615 | new_move_id = self.check_production_lot_location(cr, uid, origin_id, res_id, context) |
616 | """ Split in production lot """ |
617 | self.update_delivery_order_line(cr, uid, product_id=False, res_id=res_id, order_id=order_id, \ |
618 | - origin_id=origin_id, destination_id=destination_id, tracking_id=parent_id, quantity=1, context=context) |
619 | + origin_id=origin_id, destination_id=destination_id, tracking_id=parent_id, |
620 | + quantity=1, context=context) |
621 | elif res_model == 'stock.tracking': |
622 | stock_tracking_data = stock_tracking_obj.browse(cr, uid, res_id) |
623 | pack_list = {} |
624 | pack_number = 1 |
625 | """ Check if current pack is available """ |
626 | if stock_tracking_data.parent_id: |
627 | - raise osv.except_osv(_('Warning!'),_('You cannot move this pack because it\'s inside of an other pack: %s.') % (stock_tracking_data.parent_id.name)) |
628 | + raise osv.except_osv(_('Warning!'), |
629 | + _('You cannot move this pack because it\'s inside of an other pack: %s.') % ( |
630 | + stock_tracking_data.parent_id.name)) |
631 | for child in stock_tracking_data.child_ids: |
632 | if child.state != 'close': |
633 | - raise osv.except_osv(_('Warning!'),_('You cannot move this pack because there is a none closed pack inside of it: %s.') % (child.name)) |
634 | + raise osv.except_osv(_('Warning!'), _( |
635 | + 'You cannot move this pack because there is a none closed pack inside of it: %s.') % ( |
636 | + child.name)) |
637 | child_packs = stock_tracking_obj.hierarchy_ids(stock_tracking_data) |
638 | for child_pack in child_packs: |
639 | '''historic creation''' |
640 | hist_id = history_obj.create(cr, uid, { |
641 | - 'tracking_id': child_pack.id, |
642 | - 'type': 'move', |
643 | - 'location_id': child_pack.location_id.id, |
644 | - 'location_dest_id': destination_id, |
645 | - }) |
646 | + 'tracking_id': child_pack.id, |
647 | + 'type': 'move', |
648 | + 'location_id': child_pack.location_id.id, |
649 | + 'location_dest_id': destination_id, |
650 | + }) |
651 | for move_data in child_pack.move_ids: |
652 | """ Split in production lot """ |
653 | - self.update_delivery_order_line(cr, uid, product_id=False, res_id=move_data.prodlot_id.id, order_id=order_id, \ |
654 | - origin_id=origin_id, destination_id=destination_id, tracking_id=res_id, quantity=1, context=context) |
655 | + self.update_delivery_order_line(cr, uid, product_id=False, res_id=move_data.prodlot_id.id, |
656 | + order_id=order_id, \ |
657 | + origin_id=origin_id, destination_id=destination_id, |
658 | + tracking_id=res_id, quantity=1, context=context) |
659 | if res_model == 'product.product': |
660 | self.update_delivery_order_line(cr, uid, product_id=res_id, res_id=False, order_id=order_id, \ |
661 | - origin_id=origin_id, destination_id=destination_id, tracking_id=parent_id, quantity=line.quantity, context=context) |
662 | + origin_id=origin_id, destination_id=destination_id, tracking_id=parent_id, |
663 | + quantity=line.quantity, context=context) |
664 | return parent_id |
665 | |
666 | """ |
667 | ### DELIVERY ORDER CREATION ### |
668 | """ |
669 | + |
670 | def order_creation(self, cr, uid, acquisition, context=None): |
671 | res = {} |
672 | - if context==None: |
673 | + if context == None: |
674 | context = {} |
675 | first_code = True |
676 | acquisition_obj = self.pool.get('acquisition.acquisition') |
677 | @@ -311,6 +339,7 @@ |
678 | return res |
679 | |
680 | ''' Picking Creation ''' |
681 | + |
682 | def create_order(self, cr, uid, ids, context=None): |
683 | '''init''' |
684 | if context == None: |
685 | @@ -320,17 +349,18 @@ |
686 | acquisition_data = acquisition_obj.browse(cr, uid, ids[0]) |
687 | stock_picking_obj = self.pool.get('stock.picking') |
688 | '''variables''' |
689 | - address_id = acquisition_data.address_id.id |
690 | + partner_id = acquisition_data.partner_id.id |
691 | '''order creation''' |
692 | - order_id = stock_picking_obj.create(cr, uid, {'address_id': address_id, 'type': 'out'}) |
693 | -# name = self.pool.get('stock.picking').browse(cr, uid, order_id, context=context).name or False |
694 | -# if name: |
695 | -# vals['name'] = name |
696 | -# self.write(cr, uid, acquisition_data.id, vals, context=context) |
697 | + order_id = stock_picking_obj.create(cr, uid, {'partner_id': partner_id, 'type': 'out'}) |
698 | + # name = self.pool.get('stock.picking').browse(cr, uid, order_id, context=context).name or False |
699 | + # if name: |
700 | + # vals['name'] = name |
701 | + # self.write(cr, uid, acquisition_data.id, vals, context=context) |
702 | '''End''' |
703 | return order_id |
704 | |
705 | ''' Adding move in a picking ''' |
706 | + |
707 | def add_stock_move(self, cr, uid, ids, line, order_id, context=None): |
708 | '''init''' |
709 | res = {} |
710 | @@ -342,87 +372,91 @@ |
711 | stock_tracking_obj = self.pool.get('stock.tracking') |
712 | history_obj = self.pool.get('stock.tracking.history') |
713 | acquisition_obj = self.pool.get('acquisition.acquisition') |
714 | - stock_production_lot_obj = self.pool.get('stock.production.lot') |
715 | - |
716 | - acquisition_data = acquisition_obj.browse(cr, uid, ids[0]) |
717 | - |
718 | - '''process''' |
719 | - origin_id = acquisition_data.origin_id.id |
720 | + stock_production_lot_obj = self.pool.get('stock.production.lot') |
721 | + |
722 | + acquisition_data = acquisition_obj.browse(cr, uid, ids[0]) |
723 | + |
724 | + '''process''' |
725 | + origin_id = acquisition_data.origin_id.id |
726 | destination_id = acquisition_data.destination_id.id |
727 | barcode_data = line.barcode_id |
728 | logistic_unit_id = barcode_data.res_id |
729 | tracking_id = context.get('tracking_id', False) |
730 | - if barcode_data.res_model == 'stock.production.lot': |
731 | + if barcode_data.res_model == 'stock.production.lot': |
732 | stock_production_lot_data = stock_production_lot_obj.browse(cr, uid, logistic_unit_id) |
733 | - logistic_unit_number = stock_production_lot_data.id |
734 | - product = stock_production_lot_data.product_id |
735 | + logistic_unit_number = stock_production_lot_data.id |
736 | + product = stock_production_lot_data.product_id |
737 | name_list = self.pool.get('product.product').name_get(cr, uid, [product.id], context) |
738 | stock_production_lot_name = name_list[0][1] |
739 | '''If the production lot is not in the current stock''' |
740 | - new_move_id = self.check_production_lot_location(cr, uid, origin_id, logistic_unit_id, context) |
741 | + new_move_id = self.check_production_lot_location(cr, uid, origin_id, logistic_unit_id, context) |
742 | ''''stock move creation''' |
743 | move_id = stock_move_obj.create(cr, uid, { |
744 | - 'name': stock_production_lot_name, |
745 | - 'product_id': product.id, |
746 | - 'product_uom': product.uom_id.id, |
747 | - 'prodlot_id': logistic_unit_number, |
748 | - 'location_id': origin_id, |
749 | - 'location_dest_id': destination_id, |
750 | - 'picking_id': order_id, |
751 | - 'move_ori_id': new_move_id, |
752 | - 'tracking_id' : tracking_id, |
753 | - }) |
754 | + 'name': stock_production_lot_name, |
755 | + 'product_id': product.id, |
756 | + 'product_uom': product.uom_id.id, |
757 | + 'prodlot_id': logistic_unit_number, |
758 | + 'location_id': origin_id, |
759 | + 'location_dest_id': destination_id, |
760 | + 'picking_id': order_id, |
761 | + 'move_ori_id': new_move_id, |
762 | + 'tracking_id': tracking_id, |
763 | + }) |
764 | elif barcode_data.res_model == 'product.product': |
765 | product_data = product_obj.browse(cr, uid, logistic_unit_id) |
766 | move_id = stock_move_obj.create(cr, uid, { |
767 | - 'name': product_data.name, |
768 | - 'product_id': product_data.id, |
769 | - 'product_uom': product_data.uom_id.id, |
770 | - 'product_qty': line.quantity, |
771 | - 'location_id': origin_id, |
772 | - 'location_dest_id': destination_id, |
773 | - 'picking_id': order_id, |
774 | - 'tracking_id' : tracking_id, |
775 | - }) |
776 | + 'name': product_data.name, |
777 | + 'product_id': product_data.id, |
778 | + 'product_uom': product_data.uom_id.id, |
779 | + 'product_qty': line.quantity, |
780 | + 'location_id': origin_id, |
781 | + 'location_dest_id': destination_id, |
782 | + 'picking_id': order_id, |
783 | + 'tracking_id': tracking_id, |
784 | + }) |
785 | elif barcode_data.res_model == 'stock.tracking': |
786 | stock_tracking_data = stock_tracking_obj.browse(cr, uid, logistic_unit_id) |
787 | if stock_tracking_data.parent_id: |
788 | - raise osv.except_osv(_('Warning!'),_('You cannot move this pack because it\'s inside of an other pack: %s.') % (stock_tracking_data.parent_id.name)) |
789 | + raise osv.except_osv(_('Warning!'), |
790 | + _('You cannot move this pack because it\'s inside of an other pack: %s.') % ( |
791 | + stock_tracking_data.parent_id.name)) |
792 | for child in stock_tracking_data.child_ids: |
793 | if child.state != 'close': |
794 | - raise osv.except_osv(_('Warning!'),_('You cannot move this pack because there is a none closed pack inside of it: %s.') % (child.name)) |
795 | + raise osv.except_osv(_('Warning!'), _( |
796 | + 'You cannot move this pack because there is a none closed pack inside of it: %s.') % ( |
797 | + child.name)) |
798 | |
799 | for move_data in stock_tracking_data.move_ids: |
800 | if move_data.location_dest_id.id != origin_id: |
801 | new_move_id = stock_move_obj.create(cr, uid, { |
802 | - 'name': move_data.name, |
803 | - 'state': 'draft', |
804 | - 'product_id': move_data.product_id.id, |
805 | - 'product_uom': move_data.product_uom.id, |
806 | - 'prodlot_id': move_data.prodlot_id.id, |
807 | - 'location_id': move_data.location_dest_id.id, |
808 | - 'location_dest_id': origin_id, |
809 | - }) |
810 | + 'name': move_data.name, |
811 | + 'state': 'draft', |
812 | + 'product_id': move_data.product_id.id, |
813 | + 'product_uom': move_data.product_uom.id, |
814 | + 'prodlot_id': move_data.prodlot_id.id, |
815 | + 'location_id': move_data.location_dest_id.id, |
816 | + 'location_dest_id': origin_id, |
817 | + }) |
818 | |
819 | child_packs = stock_tracking_obj.hierarchy_ids(stock_tracking_data) |
820 | for child_pack in child_packs: |
821 | '''historic creation''' |
822 | hist_id = history_obj.create(cr, uid, { |
823 | - 'tracking_id': child_pack.id, |
824 | - 'type': 'move', |
825 | - 'location_id': child_pack.location_id.id, |
826 | - 'location_dest_id': destination_id, |
827 | - }) |
828 | + 'tracking_id': child_pack.id, |
829 | + 'type': 'move', |
830 | + 'location_id': child_pack.location_id.id, |
831 | + 'location_dest_id': destination_id, |
832 | + }) |
833 | for move_data in child_pack.move_ids: |
834 | if move_data.location_dest_id.id != origin_id: |
835 | new_move_id = stock_move_obj.create(cr, uid, {'name': move_data.name, |
836 | - 'state': 'draft', |
837 | - 'product_id': move_data.product_id.id, |
838 | - 'product_uom': move_data.product_uom.id, |
839 | - 'prodlot_id': move_data.prodlot_id.id, |
840 | - 'location_id': move_data.location_dest_id.id, |
841 | - 'location_dest_id': origin_id, |
842 | - }) |
843 | + 'state': 'draft', |
844 | + 'product_id': move_data.product_id.id, |
845 | + 'product_uom': move_data.product_uom.id, |
846 | + 'prodlot_id': move_data.prodlot_id.id, |
847 | + 'location_id': move_data.location_dest_id.id, |
848 | + 'location_dest_id': origin_id, |
849 | + }) |
850 | '''new move creation''' |
851 | for move in child_pack.current_move_ids: |
852 | defaults = { |
853 | @@ -440,9 +474,10 @@ |
854 | """ |
855 | ### PACK PREPARATION ### |
856 | """ |
857 | + |
858 | def pack_preparation(self, cr, uid, acquisition, context=None): |
859 | res = {} |
860 | - if context==None: |
861 | + if context == None: |
862 | context = {} |
863 | first_code = True |
864 | parent_id = False |
865 | @@ -453,9 +488,9 @@ |
866 | logistic_unit = acquisition.logistic_unit.id |
867 | parent_id = setting_obj.create_pack(cr, uid, [acquisition.id], logistic_unit, context) |
868 | vals = {'pack_id': parent_id} |
869 | -# name = self.pool.get('stock.tracking').browse(cr, uid, parent_id, context=context).name or False |
870 | -# if name: |
871 | -# vals['name'] = name |
872 | + # name = self.pool.get('stock.tracking').browse(cr, uid, parent_id, context=context).name or False |
873 | + # if name: |
874 | + # vals['name'] = name |
875 | self.write(cr, uid, acquisition.id, vals, context=context) |
876 | setting_obj.add_child(cr, uid, line.barcode_id.id, parent_id, context) |
877 | if parent_id: |
878 | @@ -465,18 +500,19 @@ |
879 | """ |
880 | ### INVENTORY ### |
881 | """ |
882 | + |
883 | def inventory_preparation(self, cr, uid, acquisition, context=None): |
884 | res = {} |
885 | - if context==None: |
886 | + if context == None: |
887 | context = {} |
888 | inventory_id = acquisition.inventory_id or False |
889 | if not inventory_id: |
890 | - raise osv.except_osv(_('Warning!'),_('There is no inventory, please create one!')) |
891 | + raise osv.except_osv(_('Warning!'), _('There is no inventory, please create one!')) |
892 | if inventory_id.state != 'draft': |
893 | - raise osv.except_osv(_('Warning!'),_('This inventory is not in draft state, you can\'t continue !')) |
894 | + raise osv.except_osv(_('Warning!'), _('This inventory is not in draft state, you can\'t continue !')) |
895 | location_id = acquisition.origin_id or False |
896 | if not location_id: |
897 | - raise osv.except_osv(_('Warning!'),_('There is no location defined, please select one!')) |
898 | + raise osv.except_osv(_('Warning!'), _('There is no location defined, please select one!')) |
899 | for line in acquisition.acquisition_ids: |
900 | self.check_inventory_line(cr, uid, line, context) |
901 | return res |
902 | @@ -507,7 +543,9 @@ |
903 | 'product_qty': 1, |
904 | 'prod_lot_id': lot_id, |
905 | } |
906 | - line_ids = inventory_line_obj.search(cr, uid, [('inventory_id', '=', inventory_id), ('product_id', '=', product.id), ('prod_lot_id', '=', lot_id)]) |
907 | + line_ids = inventory_line_obj.search(cr, uid, |
908 | + [('inventory_id', '=', inventory_id), ('product_id', '=', product.id), |
909 | + ('prod_lot_id', '=', lot_id)]) |
910 | if line_ids: |
911 | inventory_line_obj.write(cr, uid, [line_ids[0]], vals) |
912 | else: |
913 | @@ -522,7 +560,9 @@ |
914 | 'product_id': product.id, |
915 | 'product_uom': product.uom_id.id, |
916 | } |
917 | - line_ids = inventory_line_obj.search(cr, uid, [('inventory_id', '=', inventory_id), ('product_id', '=', product.id), ('location_id', '=', location_id)]) |
918 | + line_ids = inventory_line_obj.search(cr, uid, |
919 | + [('inventory_id', '=', inventory_id), ('product_id', '=', product.id), |
920 | + ('location_id', '=', location_id)]) |
921 | if line_ids: |
922 | qty = inventory_line_obj.read(cr, uid, line_ids[0], ['product_qty'])['product_qty'] |
923 | vals_update = vals |
924 | @@ -536,9 +576,10 @@ |
925 | """ |
926 | ### MOVE STOCK CREATION ### |
927 | """ |
928 | + |
929 | def move_stock_preparation(self, cr, uid, acquisition, context=None): |
930 | res = {} |
931 | - if context==None: |
932 | + if context == None: |
933 | context = {} |
934 | first_code = True |
935 | move_stock_id = False |
936 | @@ -548,100 +589,104 @@ |
937 | if first_code == True: |
938 | first_code = False |
939 | move_stock_id = self.create_move_stock(cr, uid, [acquisition.id], context=context) |
940 | -# name = self.pool.get('stock.inventory').browse(cr, uid, move_stock_id, context=context).name or False |
941 | - self.add_stock_move_line(cr, uid, [acquisition.id], line, move_stock_id, context) |
942 | + # name = self.pool.get('stock.inventory').browse(cr, uid, move_stock_id, context=context).name or False |
943 | + self.add_stock_move_line(cr, uid, [acquisition.id], line, move_stock_id, context) |
944 | if move_stock_id: |
945 | vals['move_stock_id'] = move_stock_id |
946 | self.write(cr, uid, acquisition.id, vals, context=context) |
947 | return res |
948 | - |
949 | + |
950 | def create_move_stock(self, cr, uid, ids, context=None): |
951 | '''init''' |
952 | if context == None: |
953 | context = {} |
954 | acquisition_data = self.browse(cr, uid, ids[0]) |
955 | - stock_inventory_obj = self.pool.get('stock.inventory') |
956 | - |
957 | - '''variables''' |
958 | - origin_id = acquisition_data.origin_id.id |
959 | - destination_id = acquisition_data.move_stock_destination.id |
960 | + stock_inventory_obj = self.pool.get('stock.inventory') |
961 | + |
962 | + '''variables''' |
963 | + origin_id = acquisition_data.origin_id.id |
964 | + destination_id = acquisition_data.move_stock_destination.id |
965 | date = acquisition_data.move_stock_date |
966 | ''''inventory creation''' |
967 | - context.update({'type':'move'}) |
968 | + context.update({'type': 'move'}) |
969 | move_stock_id = stock_inventory_obj.create(cr, uid, { |
970 | - 'type': 'move', |
971 | - 'date_done': date, |
972 | - 'location_id': origin_id, |
973 | - 'location_dest_id': destination_id, |
974 | - }, context=context) |
975 | + 'type': 'move', |
976 | + 'date_done': date, |
977 | + 'location_id': origin_id, |
978 | + 'location_dest_id': destination_id, |
979 | + }, context=context) |
980 | '''End''' |
981 | return move_stock_id |
982 | - |
983 | + |
984 | def add_stock_move_line(self, cr, uid, ids, line, inventory_id, inventory_line_id, context=None): |
985 | - res = {} |
986 | - '''init''' |
987 | + res = {} |
988 | + '''init''' |
989 | if context == None: |
990 | context = {} |
991 | - barcode_obj = self.pool.get('tr.barcode') |
992 | - stock_production_lot_obj = self.pool.get('stock.production.lot') |
993 | - inventory_line_obj = self.pool.get('stock.inventory.line') |
994 | - stock_tracking_obj = self.pool.get('stock.tracking') |
995 | - product_obj = self.pool.get('product.product') |
996 | + barcode_obj = self.pool.get('tr.barcode') |
997 | + stock_production_lot_obj = self.pool.get('stock.production.lot') |
998 | + inventory_line_obj = self.pool.get('stock.inventory.line') |
999 | + stock_tracking_obj = self.pool.get('stock.tracking') |
1000 | + product_obj = self.pool.get('product.product') |
1001 | barcode_id = line.barcode_id.id |
1002 | barcode_data = barcode_obj.browse(cr, uid, barcode_id, context=context) |
1003 | - acquisition_data = self.browse(cr, uid, ids[0], context=context) |
1004 | - |
1005 | + acquisition_data = self.browse(cr, uid, ids[0], context=context) |
1006 | + |
1007 | location_id = acquisition_data.origin_id.id |
1008 | logistic_unit_id = barcode_data.res_id |
1009 | - if barcode_data.res_model == 'stock.production.lot': |
1010 | + if barcode_data.res_model == 'stock.production.lot': |
1011 | stock_production_lot_data = stock_production_lot_obj.browse(cr, uid, logistic_unit_id, context=context) |
1012 | product = stock_production_lot_data.product_id |
1013 | - logistic_unit_number = stock_production_lot_data.id |
1014 | + logistic_unit_number = stock_production_lot_data.id |
1015 | vals = { |
1016 | - 'inventory_id': inventory_id, |
1017 | - 'location_id': location_id, |
1018 | - 'product_id': product.id, |
1019 | - 'product_uom': product.uom_id.id, |
1020 | - 'product_qty': 1, |
1021 | - 'prod_lot_id':logistic_unit_number} |
1022 | + 'inventory_id': inventory_id, |
1023 | + 'location_id': location_id, |
1024 | + 'product_id': product.id, |
1025 | + 'product_uom': product.uom_id.id, |
1026 | + 'product_qty': 1, |
1027 | + 'prod_lot_id': logistic_unit_number} |
1028 | inventory_line_obj.create(cr, uid, vals) |
1029 | elif barcode_data.res_model == 'product.product': |
1030 | product_data = product_obj.browse(cr, uid, logistic_unit_id) |
1031 | vals = { |
1032 | - 'inventory_id': inventory_id, |
1033 | - 'location_id': location_id, |
1034 | - 'product_id': product_data.id, |
1035 | - 'product_uom': product_data.uom_id.id, |
1036 | - 'product_qty': line.quantity} |
1037 | - inventory_line_obj.create(cr, uid, vals) |
1038 | + 'inventory_id': inventory_id, |
1039 | + 'location_id': location_id, |
1040 | + 'product_id': product_data.id, |
1041 | + 'product_uom': product_data.uom_id.id, |
1042 | + 'product_qty': line.quantity} |
1043 | + inventory_line_obj.create(cr, uid, vals) |
1044 | elif barcode_data.res_model == 'stock.tracking': |
1045 | stock_tracking_data = stock_tracking_obj.browse(cr, uid, logistic_unit_id) |
1046 | if stock_tracking_data.parent_id: |
1047 | - raise osv.except_osv(_('Warning!'),_('You cannot move this pack because it\'s inside of an other pack: %s.') % (stock_tracking_data.parent_id.name)) |
1048 | + raise osv.except_osv(_('Warning!'), |
1049 | + _('You cannot move this pack because it\'s inside of an other pack: %s.') % ( |
1050 | + stock_tracking_data.parent_id.name)) |
1051 | for child in stock_tracking_data.child_ids: |
1052 | if child.state != 'close': |
1053 | - raise osv.except_osv(_('Warning!'),_('You cannot move this pack because there is a none closed pack inside of it: %s.') % (child.name)) |
1054 | - |
1055 | - raise osv.except_osv(_('Warning!'),_('Not developed yet')) |
1056 | - |
1057 | + raise osv.except_osv(_('Warning!'), _( |
1058 | + 'You cannot move this pack because there is a none closed pack inside of it: %s.') % ( |
1059 | + child.name)) |
1060 | + |
1061 | + raise osv.except_osv(_('Warning!'), _('Not developed yet')) |
1062 | + |
1063 | return res |
1064 | - |
1065 | -class acquisition_list(orm.Model): |
1066 | - |
1067 | + |
1068 | + |
1069 | +class acquisition_list(orm.Model): |
1070 | _name = "acquisition.list" |
1071 | _columns = { |
1072 | 'name': fields.char('List Name', size=128), |
1073 | 'barcode_id': fields.many2one('tr.barcode', 'Barcode', readonly=True), |
1074 | - 'acquisition_id': fields.many2one('acquisition.acquisition','Acquisition'), |
1075 | + 'acquisition_id': fields.many2one('acquisition.acquisition', 'Acquisition'), |
1076 | 'type': fields.selection([ |
1077 | - ('object','Logistic Unit'), |
1078 | - ('create_add', 'Create a pack and add a logistic unit'), |
1079 | - ('create_pack','Create a pack'), |
1080 | - ('add_child','Add a logistic unit'), |
1081 | - ('close_pack','Close a pack'), |
1082 | - ], 'Action Type', size=32), |
1083 | + ('object', 'Logistic Unit'), |
1084 | + ('create_add', 'Create a pack and add a logistic unit'), |
1085 | + ('create_pack', 'Create a pack'), |
1086 | + ('add_child', 'Add a logistic unit'), |
1087 | + ('close_pack', 'Close a pack'), |
1088 | + ], 'Action Type', size=32), |
1089 | 'quantity': fields.float('Quantity'), |
1090 | - } |
1091 | + } |
1092 | |
1093 | _defaults = { |
1094 | 'quantity': 1, |
1095 | @@ -653,39 +698,39 @@ |
1096 | context = {} |
1097 | if barcode_id: |
1098 | if self.pool.get('tr.barcode').browse(cr, uid, barcode_id).res_model == 'product.product': |
1099 | - res = {'value': {'quantity' : quantity}} |
1100 | + res = {'value': {'quantity': quantity}} |
1101 | return res |
1102 | |
1103 | def _check_quantity(self, cr, uid, ids, context=None): |
1104 | for record in self.browse(cr, uid, ids, context=context): |
1105 | - if record.quantity != 1 and record.barcode_id.res_model!='product.product': |
1106 | + if record.quantity != 1 and record.barcode_id.res_model != 'product.product': |
1107 | return False |
1108 | return True |
1109 | |
1110 | _constraints = [ |
1111 | (_check_quantity, |
1112 | - 'You assigned a wrong quantity for this line', |
1113 | - ['name']), |
1114 | + 'You assigned a wrong quantity for this line', |
1115 | + ['name']), |
1116 | ] |
1117 | |
1118 | + |
1119 | class acquisition_setting(orm.Model): |
1120 | - |
1121 | _name = "acquisition.setting" |
1122 | _columns = { |
1123 | 'barcode_id': fields.many2one('tr.barcode', 'Barcode', required=True, readonly=False), |
1124 | 'action_type': fields.selection([ |
1125 | - ('create_add', 'Create a pack and add a logistic unit'), |
1126 | - ('create_pack','Create a pack'), |
1127 | - ('add_child','Add a logistic unit'), |
1128 | - ('close_pack','Close a pack'), |
1129 | - ], 'Action Type', size=32, required=True, help="Selection of an action"), |
1130 | + ('create_add', 'Create a pack and add a logistic unit'), |
1131 | + ('create_pack', 'Create a pack'), |
1132 | + ('add_child', 'Add a logistic unit'), |
1133 | + ('close_pack', 'Close a pack'), |
1134 | + ], 'Action Type', size=32, required=True, help="Selection of an action"), |
1135 | } |
1136 | |
1137 | -# def create_add(self, cr, uid, ids, ul_id, context=None): |
1138 | -# if context == None: |
1139 | -# context = {} |
1140 | -# tracking_id = self.create_pack(cr, uid, ids, ul_id, context) |
1141 | -# return tracking_id |
1142 | + # def create_add(self, cr, uid, ids, ul_id, context=None): |
1143 | + # if context == None: |
1144 | + # context = {} |
1145 | + # tracking_id = self.create_pack(cr, uid, ids, ul_id, context) |
1146 | + # return tracking_id |
1147 | |
1148 | def do_action(self, cr, uid, ids, action_type, context=None): |
1149 | if context == None: |
1150 | @@ -700,6 +745,7 @@ |
1151 | return tracking_id |
1152 | |
1153 | '''Function for pack creation''' |
1154 | + |
1155 | def create_pack(self, cr, uid, ids, ul_id=None, context=None): |
1156 | '''Init''' |
1157 | res = {} |
1158 | @@ -740,29 +786,34 @@ |
1159 | tracking_obj.set_close(cr, uid, ids, context) |
1160 | '''Call of the function in stock_tracking_reopen''' |
1161 | if self.pool.get('acquisition.acquisition').browse(cr, uid, context.get('current_id'), context).picking_id: |
1162 | - origin_id = self.pool.get('acquisition.acquisition').browse(cr, uid, context.get('current_id'), context).origin_id.id |
1163 | - destination_id = self.pool.get('acquisition.acquisition').browse(cr, uid, context.get('current_id'), context).destination_id.id |
1164 | - stock_move_ids = self.pool.get('stock.move').search(cr, uid, [('tracking_id','=',ids[0])]) |
1165 | + origin_id = self.pool.get('acquisition.acquisition').browse(cr, uid, context.get('current_id'), |
1166 | + context).origin_id.id |
1167 | + destination_id = self.pool.get('acquisition.acquisition').browse(cr, uid, context.get('current_id'), |
1168 | + context).destination_id.id |
1169 | + stock_move_ids = self.pool.get('stock.move').search(cr, uid, [('tracking_id', '=', ids[0])]) |
1170 | for stock_move_id in stock_move_ids: |
1171 | stock_move_data = self.pool.get('stock.move').browse(cr, uid, stock_move_id, context) |
1172 | - self.pool.get('stock.move').write(cr, uid, stock_move_id, {'state':'done', 'picking_id': False, 'location_dest_id': origin_id}, context) |
1173 | + self.pool.get('stock.move').write(cr, uid, stock_move_id, |
1174 | + {'state': 'done', 'picking_id': False, 'location_dest_id': origin_id}, |
1175 | + context) |
1176 | self.pool.get('stock.move').create(cr, uid, {'name': stock_move_data.name, |
1177 | 'state': 'draft', |
1178 | 'product_id': stock_move_data.product_id.id, |
1179 | 'product_uom': stock_move_data.product_uom.id, |
1180 | 'prodlot_id': stock_move_data.prodlot_id.id, |
1181 | 'tracking_id': stock_move_data.tracking_id.id, |
1182 | - 'picking_id': self.pool.get('acquisition.acquisition').browse(cr, uid, context.get('current_id'), context).picking_id.id, |
1183 | + 'picking_id': self.pool.get( |
1184 | + 'acquisition.acquisition').browse(cr, uid, context.get( |
1185 | + 'current_id'), context).picking_id.id, |
1186 | 'location_id': stock_move_data.location_dest_id.id, |
1187 | 'location_dest_id': destination_id, |
1188 | - }) |
1189 | + }) |
1190 | '''Call for a function who will display serial code list and product list in the pack layout''' |
1191 | tracking_obj.get_products(cr, uid, ids, context=None) |
1192 | tracking_obj.get_serials(cr, uid, ids, context=None) |
1193 | return True |
1194 | |
1195 | |
1196 | - |
1197 | # def create_inventory(self, cr, uid, ids, context=None): |
1198 | # '''init''' |
1199 | # if context == None: |
1200 | |
1201 | === modified file 'stock_barcode_reader/stock.py' (properties changed: -x to +x) |
1202 | --- stock_barcode_reader/stock.py 2013-03-04 17:29:43 +0000 |
1203 | +++ stock_barcode_reader/stock.py 2013-08-20 09:03:46 +0000 |
1204 | @@ -22,6 +22,7 @@ |
1205 | from openerp.osv import osv, fields, orm |
1206 | from openerp.tools.translate import _ |
1207 | |
1208 | + |
1209 | class stock_picking(orm.Model): |
1210 | _inherit = "stock.picking" |
1211 | |
1212 | @@ -31,9 +32,9 @@ |
1213 | active = self.browse(cr, uid, ids[0]) |
1214 | name = active.name |
1215 | action_context = {'default_type': 'order', 'default_name': 'Preparation ' + name, 'default_picking_id': ids[0]} |
1216 | - address_id = active.address_id and active.address_id.id or False |
1217 | - if address_id: |
1218 | - action_context.update({'default_address_id': address_id}) |
1219 | + partner_id = active.partner_id and active.partner_id.id or False |
1220 | + if partner_id: |
1221 | + action_context.update({'default_address_id': partner_id}) |
1222 | location_id = False |
1223 | for move in active.move_lines: |
1224 | location_id = move.location_dest_id and move.location_dest_id.id or False |
1225 | @@ -45,8 +46,9 @@ |
1226 | 'view_type': 'form', |
1227 | 'view_mode': 'form', |
1228 | 'res_model': 'acquisition.acquisition', |
1229 | - 'view_id': self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock_barcode_reader', 'view_stock_tracking_acquisition_form')[1], |
1230 | -# 'menu_id': self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'menu_stock_root')[1], |
1231 | + 'view_id': self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock_barcode_reader', |
1232 | + 'view_stock_tracking_acquisition_form')[1], |
1233 | + # 'menu_id': self.pool.get('ir.model.data').get_object_reference(cr, uid, 'stock', 'menu_stock_root')[1], |
1234 | 'context': action_context |
1235 | } |
1236 | return action |
1237 | |
1238 | === modified file 'stock_barcode_reader/stock_view.xml' |
1239 | --- stock_barcode_reader/stock_view.xml 2012-11-02 10:27:43 +0000 |
1240 | +++ stock_barcode_reader/stock_view.xml 2013-08-20 09:03:46 +0000 |
1241 | @@ -1,31 +1,33 @@ |
1242 | <?xml version="1.0" encoding="UTF-8"?> |
1243 | <openerp> |
1244 | - <data> |
1245 | - |
1246 | - <record id="view_picking_form" model="ir.ui.view"> |
1247 | - <field name="name">stock.picking.form</field> |
1248 | - <field name="model">stock.picking</field> |
1249 | - <field name="type">form</field> |
1250 | - <field eval="12" name="priority"/> |
1251 | - <field name="inherit_id" ref="stock.view_picking_form"/> |
1252 | - <field name="arch" type="xml"> |
1253 | - <button name="action_process" position="before"> |
1254 | - <button name="start_acquisition" string="Start Acquisition" states="assigned,confirmed,draft" type="object" icon="gtk-go-forward"/> |
1255 | - </button> |
1256 | - </field> |
1257 | - </record> |
1258 | - |
1259 | - <record id="view_delivery_order_inherit_stock_barcode" model="ir.ui.view"> |
1260 | - <field name="name">stock.picking.out.barcode.form</field> |
1261 | - <field name="type">form</field> |
1262 | - <field name="model">stock.picking</field> |
1263 | - <field name="inherit_id" ref="stock.view_picking_out_form"/> |
1264 | - <field name="arch" type="xml"> |
1265 | - <button name="action_process" position="before"> |
1266 | - <button name="start_acquisition" string="Start Acquisition" states="assigned,confirmed,draft" type="object" icon="gtk-go-forward"/> |
1267 | - </button> |
1268 | - </field> |
1269 | - </record> |
1270 | - |
1271 | - </data> |
1272 | + <data> |
1273 | + |
1274 | + <record id="view_picking_form" model="ir.ui.view"> |
1275 | + <field name="name">stock.picking.form</field> |
1276 | + <field name="model">stock.picking</field> |
1277 | + <field name="type">form</field> |
1278 | + <field eval="12" name="priority"/> |
1279 | + <field name="inherit_id" ref="stock.view_picking_form"/> |
1280 | + <field name="arch" type="xml"> |
1281 | + <button name="action_process" position="before"> |
1282 | + <button name="start_acquisition" string="Start Acquisition" states="assigned,confirmed,draft" type="object" |
1283 | + icon="gtk-go-forward"/> |
1284 | + </button> |
1285 | + </field> |
1286 | + </record> |
1287 | + |
1288 | + <record id="view_delivery_order_inherit_stock_barcode" model="ir.ui.view"> |
1289 | + <field name="name">stock.picking.out.barcode.form</field> |
1290 | + <field name="type">form</field> |
1291 | + <field name="model">stock.picking</field> |
1292 | + <field name="inherit_id" ref="stock.view_picking_out_form"/> |
1293 | + <field name="arch" type="xml"> |
1294 | + <button name="action_process" position="before"> |
1295 | + <button name="start_acquisition" string="Start Acquisition" states="assigned,confirmed,draft" type="object" |
1296 | + icon="gtk-go-forward"/> |
1297 | + </button> |
1298 | + </field> |
1299 | + </record> |
1300 | + |
1301 | + </data> |
1302 | </openerp> |
1303 | |
1304 | === modified file 'stock_barcode_reader/wizard/reference.py' |
1305 | --- stock_barcode_reader/wizard/reference.py 2013-03-04 17:29:43 +0000 |
1306 | +++ stock_barcode_reader/wizard/reference.py 2013-08-20 09:03:46 +0000 |
1307 | @@ -22,24 +22,24 @@ |
1308 | from openerp.osv import fields, osv, orm |
1309 | from openerp.tools.translate import _ |
1310 | |
1311 | + |
1312 | class stock_reference(orm.TransientModel): |
1313 | - |
1314 | _name = "stock.reference" |
1315 | _description = 'Products Acquisition' |
1316 | |
1317 | -# _rec_name = 'reference' |
1318 | + # _rec_name = 'reference' |
1319 | |
1320 | def _get_track_id(self, cr, uid, context=None): |
1321 | if context is None: |
1322 | context = {} |
1323 | - return context.get('active_id',False) |
1324 | + return context.get('active_id', False) |
1325 | |
1326 | _columns = { |
1327 | -# 'barcode_id': fields.many2one('tr.barcode', 'Reference', required=True), |
1328 | + # 'barcode_id': fields.many2one('tr.barcode', 'Reference', required=True), |
1329 | 'reference': fields.char('Reference', size=128, required=True), |
1330 | - 'track_id': fields.many2one('acquisition.acquisition','Track id', required=True), |
1331 | - 'text': fields.text('Barcode list',readonly=True), |
1332 | -# 'bad_barcode': fields.text('Bad barcode list',readonly=True), |
1333 | + 'track_id': fields.many2one('acquisition.acquisition', 'Track id', required=True), |
1334 | + 'text': fields.text('Barcode list', readonly=True), |
1335 | + # 'bad_barcode': fields.text('Bad barcode list',readonly=True), |
1336 | } |
1337 | |
1338 | _defaults = { |
1339 | @@ -60,12 +60,13 @@ |
1340 | if not barcode_ids: |
1341 | reference2 = reference |
1342 | while len(reference2.split('-')) > 1: |
1343 | - reference2 = reference2.replace('-','') |
1344 | + reference2 = reference2.replace('-', '') |
1345 | barcode_ids = barcode_obj.search(cr, uid, [('code2', '=', reference2)], limit=1) |
1346 | |
1347 | if barcode_ids: |
1348 | barcode_type = 'object' |
1349 | - line_ids = acquisition_list.search(cr, uid, [('barcode_id', '=', barcode_ids[0]), ('acquisition_id', '=', track_id)]) |
1350 | + line_ids = acquisition_list.search(cr, uid, [('barcode_id', '=', barcode_ids[0]), |
1351 | + ('acquisition_id', '=', track_id)]) |
1352 | setting_ids = acquisition_setting.search(cr, uid, [('barcode_id', '=', barcode_ids[0])], limit=1) |
1353 | |
1354 | if setting_ids: |
1355 | @@ -75,24 +76,23 @@ |
1356 | if line_ids: |
1357 | create = False |
1358 | line_barcode = barcode_obj.read(cr, uid, barcode_ids[0], ['res_model']) |
1359 | - if line_barcode.get('res_model',False) == 'product.product' or setting_ids: |
1360 | + if line_barcode.get('res_model', False) == 'product.product' or setting_ids: |
1361 | create = True |
1362 | if create: |
1363 | acquisition_list.create(cr, uid, { |
1364 | 'barcode_id': barcode_ids[0], |
1365 | 'acquisition_id': track_id, |
1366 | 'type': barcode_type, |
1367 | - }) |
1368 | + }) |
1369 | text = reference + '\n' + text |
1370 | |
1371 | else: |
1372 | - raise osv.except_osv(_('Warning!'),_('Barcode Not found!')) # Return of the wraning msg !! |
1373 | -## bad_barcode = bad_barcode_list or '' |
1374 | -# bad_barcode += reference |
1375 | -# if bad_barcode: |
1376 | -# bad_barcode += '\n' |
1377 | - |
1378 | - |
1379 | - return {'value': {'reference' : False, 'text' : text}} |
1380 | + raise osv.except_osv(_('Warning!'), _('Barcode Not found!')) # Return of the wraning msg !! |
1381 | + ## bad_barcode = bad_barcode_list or '' |
1382 | + # bad_barcode += reference |
1383 | + # if bad_barcode: |
1384 | + # bad_barcode += '\n' |
1385 | + |
1386 | + return {'value': {'reference': False, 'text': text}} |
1387 | |
1388 | # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
1389 | |
1390 | === modified file 'stock_barcode_reader/wizard/reference_view.xml' |
1391 | --- stock_barcode_reader/wizard/reference_view.xml 2012-11-02 10:27:43 +0000 |
1392 | +++ stock_barcode_reader/wizard/reference_view.xml 2013-08-20 09:03:46 +0000 |
1393 | @@ -1,41 +1,41 @@ |
1394 | <?xml version="1.0" encoding="UTF-8"?> |
1395 | <openerp> |
1396 | - <data> |
1397 | - |
1398 | - <record id="view_stock_reference" model="ir.ui.view" > |
1399 | - <field name="name">Acquisition.reference.view</field> |
1400 | - <field name="model">stock.reference</field> |
1401 | - <field name="type">form</field> |
1402 | - <field name="arch" type="xml"> |
1403 | - <form string="Reference acquisistion"> |
1404 | - <group width="400" height="100"> |
1405 | - <group colspan="4"> |
1406 | - <field name="reference" on_change="onchange_reference(reference,track_id,text)" colspan="4"/> |
1407 | - <field name="track_id" colspan="2" invisible="1"/> |
1408 | - <newline/> |
1409 | - <separator string="End of Acquisition" colspan="4"/> |
1410 | - <button special="cancel" string="Close" icon="gtk-ok"/> |
1411 | - <newline/> |
1412 | - <separator string="Barcode list" colspan="4"/> |
1413 | - <field name="text" colspan="4" nolabel="1"/> |
1414 | - <!--<newline/> |
1415 | - <separator string="Bad Barcode" colspan="4"/> |
1416 | - <field name="bad_barcode" colspan="2" nolabel="1"/>--> |
1417 | - </group> |
1418 | - </group> |
1419 | - </form> |
1420 | - </field> |
1421 | - </record> |
1422 | - |
1423 | - <record id="action_stock_reference" model="ir.actions.act_window"> |
1424 | - <field name="name">Reference</field> |
1425 | - <field name="type">ir.actions.act_window</field> |
1426 | - <field name="res_model">stock.reference</field> |
1427 | - <field name="view_type">form</field> |
1428 | - <field name="view_mode">form</field> |
1429 | - <field name="view_id" ref="view_stock_reference"/> |
1430 | - <field name="target">new</field> |
1431 | - </record> |
1432 | - |
1433 | - </data> |
1434 | + <data> |
1435 | + |
1436 | + <record id="view_stock_reference" model="ir.ui.view"> |
1437 | + <field name="name">Acquisition.reference.view</field> |
1438 | + <field name="model">stock.reference</field> |
1439 | + <field name="type">form</field> |
1440 | + <field name="arch" type="xml"> |
1441 | + <form string="Reference acquisistion"> |
1442 | + <group width="400" height="100"> |
1443 | + <group colspan="4"> |
1444 | + <field name="reference" on_change="onchange_reference(reference,track_id,text)" colspan="4"/> |
1445 | + <field name="track_id" colspan="2" invisible="1"/> |
1446 | + <newline/> |
1447 | + <separator string="End of Acquisition" colspan="4"/> |
1448 | + <button special="cancel" string="Close" icon="gtk-ok"/> |
1449 | + <newline/> |
1450 | + <separator string="Barcode list" colspan="4"/> |
1451 | + <field name="text" colspan="4" nolabel="1"/> |
1452 | + <!--<newline/> |
1453 | + <separator string="Bad Barcode" colspan="4"/> |
1454 | + <field name="bad_barcode" colspan="2" nolabel="1"/>--> |
1455 | + </group> |
1456 | + </group> |
1457 | + </form> |
1458 | + </field> |
1459 | + </record> |
1460 | + |
1461 | + <record id="action_stock_reference" model="ir.actions.act_window"> |
1462 | + <field name="name">Reference</field> |
1463 | + <field name="type">ir.actions.act_window</field> |
1464 | + <field name="res_model">stock.reference</field> |
1465 | + <field name="view_type">form</field> |
1466 | + <field name="view_mode">form</field> |
1467 | + <field name="view_id" ref="view_stock_reference"/> |
1468 | + <field name="target">new</field> |
1469 | + </record> |
1470 | + |
1471 | + </data> |
1472 | </openerp> |
1473 | |
1474 | === modified file 'stock_tracking_add_move/__openerp__.py' |
1475 | --- stock_tracking_add_move/__openerp__.py 2013-02-18 17:47:26 +0000 |
1476 | +++ stock_tracking_add_move/__openerp__.py 2013-08-20 09:03:46 +0000 |
1477 | @@ -47,7 +47,7 @@ |
1478 | "security/ir.model.access.csv", |
1479 | ], |
1480 | 'test': [], |
1481 | - 'installable': False, |
1482 | + 'installable': True, |
1483 | 'active': False, |
1484 | } |
1485 | |
1486 | |
1487 | === modified file 'stock_tracking_add_move/wizard/add_move_view.xml' |
1488 | --- stock_tracking_add_move/wizard/add_move_view.xml 2013-03-04 17:29:43 +0000 |
1489 | +++ stock_tracking_add_move/wizard/add_move_view.xml 2013-08-20 09:03:46 +0000 |
1490 | @@ -66,7 +66,7 @@ |
1491 | <record id="view_tracking_form_inherit" model="ir.ui.view"> |
1492 | <field name="name">stock.tracking.form.inherit</field> |
1493 | <field name="model">stock.tracking</field> |
1494 | - <field name="inherit_id" ref="stock_tracking_extended.view_tracking_form_inherit"/> |
1495 | + <field name="inherit_id" ref="stock_tracking_state.view_tracking_state_form"/> |
1496 | <field name="arch" type="xml"> |
1497 | <button name="reset_open" position="after"> |
1498 | <button name="%(pack_add_move)d" states="open" string="Add object" colspan="2" type="action" icon="gtk-ok"/> |
LGTM