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