Merge lp:~unifield-team/unifield-wm/pilot-27-supply-bugs into lp:unifield-wm

Proposed by jftempo
Status: Needs review
Proposed branch: lp:~unifield-team/unifield-wm/pilot-27-supply-bugs
Merge into: lp:unifield-wm
Diff against target: 258 lines (+70/-19)
8 files modified
consumption_calculation/history_consumption.py (+2/-1)
kit/kit_creation.py (+44/-6)
kit/kit_creation_view.xml (+4/-2)
msf_doc_import/initial_stock_inventory.py (+1/-1)
msf_outgoing/msf_outgoing.py (+7/-3)
msf_supply_doc_export/msf_supply_doc_export.py (+4/-4)
specific_rules/specific_rules_view.xml (+1/-1)
stock_override/report/report_stock_move.py (+7/-1)
To merge this branch: bzr merge lp:~unifield-team/unifield-wm/pilot-27-supply-bugs
Reviewer Review Type Date Requested Status
UniField Dev Team Pending
Review via email: mp+196101@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

1859. By Quentin THEURET @Amaris

UF-2207 [FIX] Picking Ticket : Display the good actions report

1858. By Quentin THEURET @Amaris

UF-2207 [MERGE] Merge UF-2207 branch
lp:~unifield-team/unifield-wm/uf-2207

1857. By Quentin THEURET @Amaris

UF-2210 [MERGE] Merge UF-2210 branch
lp:~unifield-team/unifield-wm/uf-2210

1856. By Quentin THEURET @Amaris

UF-2209 [MERGE] Merge UF-2209 branch
lp:~unifield-team/unifield-wm/uf-2209

1855. By Quentin THEURET @Amaris

UF-2206 [MERGE] Merge UF-2206 branch
lp:~unifield-team/unifield-wm/uf-2206

1854. By Quentin THEURET @Amaris

UF-2204 [MERGE] Merge UF-2204 branch
lp:~unifield-team/unifield-wm/uf-2204

1853. By Quentin THEURET @Amaris

UF-2191 [MERGE] Merge UF-2191 branch
lp:~unifield-team/unifield-wm/uf-2191

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'consumption_calculation/history_consumption.py'
--- consumption_calculation/history_consumption.py 2013-11-05 15:44:32 +0000
+++ consumption_calculation/history_consumption.py 2013-11-21 13:07:07 +0000
@@ -66,7 +66,7 @@
66 _defaults = {66 _defaults = {
67 'date_to': lambda *a: (DateFrom(time.strftime('%Y-%m-%d')) + RelativeDateTime(months=1, day=1, days=-1)).strftime('%Y-%m-%d'),67 'date_to': lambda *a: (DateFrom(time.strftime('%Y-%m-%d')) + RelativeDateTime(months=1, day=1, days=-1)).strftime('%Y-%m-%d'),
68 'requestor_id': lambda obj, cr, uid, c: uid,68 'requestor_id': lambda obj, cr, uid, c: uid,
69 'requestor_date': time.strftime('%Y-%m-%d %H:%M:%S'),69 'requestor_date': lambda *a: time.strftime('%Y-%m-%d %H:%M:%S'),
70 'status': 'draft',70 'status': 'draft',
71 }71 }
7272
@@ -222,6 +222,7 @@
222222
223 import threading223 import threading
224 self.write(cr, uid, ids, {'status': 'in_progress'}, context=context)224 self.write(cr, uid, ids, {'status': 'in_progress'}, context=context)
225 cr.commit()
225 new_thread = threading.Thread(target=self._create_lines, args=(cr, uid, ids, product_ids, new_context))226 new_thread = threading.Thread(target=self._create_lines, args=(cr, uid, ids, product_ids, new_context))
226 new_thread.start()227 new_thread.start()
227 new_thread.join(10.0)228 new_thread.join(10.0)
228229
=== modified file 'kit/kit_creation.py'
--- kit/kit_creation.py 2013-10-07 14:53:32 +0000
+++ kit/kit_creation.py 2013-11-21 13:07:07 +0000
@@ -473,10 +473,11 @@
473 data = {}473 data = {}
474 # moves consolidated474 # moves consolidated
475 move_list = []475 move_list = []
476 move_manual = []
476 477
477 for move in obj.consumed_ids_kit_creation:478 for move in obj.consumed_ids_kit_creation:
478 # the stock move should not be canceled, but... we recycle them in case.479 # the stock move should not be canceled, but... we recycle them in case.
479 if move.state in ['confirmed', 'cancel']:480 if move.state in ['confirmed', 'cancel'] and not move.kol_lot_manual:
480 move_list.append(move.id)481 move_list.append(move.id)
481 # consolidate the moves qty482 # consolidate the moves qty
482 qty = data.setdefault(move.product_id.id, {}).setdefault('uoms', {}).setdefault(move.product_uom.id, {}).setdefault('qty', 0.0)483 qty = data.setdefault(move.product_id.id, {}).setdefault('uoms', {}).setdefault(move.product_uom.id, {}).setdefault('qty', 0.0)
@@ -489,8 +490,10 @@
489 data.setdefault(move.product_id.id, {}).setdefault('uoms', {})[move.product_uom.id]['qty'] = qty490 data.setdefault(move.product_id.id, {}).setdefault('uoms', {})[move.product_uom.id]['qty'] = qty
490 # save object for efficiency491 # save object for efficiency
491 data.setdefault(move.product_id.id, {}).setdefault('object', move.product_id)492 data.setdefault(move.product_id.id, {}).setdefault('object', move.product_id)
493 elif move.kol_lot_manual:
494 move_manual.append(move.id)
492 495
493 return data, move_list496 return data, move_list, move_manual
494 497
495 def consolidate_lines(self, cr, uid, ids, context=None):498 def consolidate_lines(self, cr, uid, ids, context=None):
496 '''499 '''
@@ -510,7 +513,7 @@
510 513
511 for obj in self.browse(cr, uid, ids, context=context):514 for obj in self.browse(cr, uid, ids, context=context):
512 # consolidate data515 # consolidate data
513 data, move_list = self._consolidate_data(cr, uid, obj.id, context=context)516 data, move_list, move_manual = self._consolidate_data(cr, uid, obj.id, context=context)
514 # delete stock moves517 # delete stock moves
515 move_obj.unlink(cr, uid, move_list, context=dict(context, call_unlink=True))518 move_obj.unlink(cr, uid, move_list, context=dict(context, call_unlink=True))
516 # default location519 # default location
@@ -561,16 +564,41 @@
561 loc_obj = self.pool.get('stock.location')564 loc_obj = self.pool.get('stock.location')
562 prodlot_obj = self.pool.get('stock.production.lot')565 prodlot_obj = self.pool.get('stock.production.lot')
563 data_tools_obj = self.pool.get('data.tools')566 data_tools_obj = self.pool.get('data.tools')
567 uom_obj = self.pool.get('product.uom')
564 # load data into the context568 # load data into the context
565 data_tools_obj.load_common_data(cr, uid, ids, context=context)569 data_tools_obj.load_common_data(cr, uid, ids, context=context)
566 570
567 for obj in self.browse(cr, uid, ids, context=context):571 for obj in self.browse(cr, uid, ids, context=context):
568 # consolidate data572 # consolidate data
569 data, move_list = self._consolidate_data(cr, uid, obj.id, context=context)573 data, move_list, move_manual = self._consolidate_data(cr, uid, obj.id, context=context)
574 # default location
575 default_location_id = obj.default_location_src_id_kit_creation.id
576
577 # Check availability of manual moves
578 for move in move_obj.browse(cr, uid, move_manual, context=context):
579 if move.state != 'confirmed' or not move.prodlot_id:
580 continue
581
582 location_ids = loc_obj.search(cr, uid, [('location_id', 'child_of', move.location_id.id)], context=context)
583 needed_qty = move.product_qty
584 for loc in location_ids:
585 available_qty = prodlot_obj.browse(cr, uid, move.prodlot_id.id, context=dict(context, location_id=loc)).stock_virtual
586 diff_qty = available_qty - uom_obj._compute_qty(cr, uid, move.product_uom.id, needed_qty, move.product_id.uom_id.id)
587 if diff_qty >= 0:
588 move_obj.write(cr, uid, [move.id], {'state': 'assigned'}, context=context)
589 break
590 else:
591 if available_qty:
592 move_obj.copy(cr, uid, move.id, {'product_qty': available_qty, 'state': 'assigned'}, context=context)
593 needed_qty -= available_qty
594 move_obj.write(cr, uid, [move.id], {'product_qty': needed_qty}, context=context)
595 else:
596 move_obj.write(cr, uid, [move.id], {'prodlot_id': False, 'kol_lot_manual': False}, context=context)
597
598 data, move_list, move_manual = self._consolidate_data(cr, uid, obj.id, context=context)
570 # delete stock moves599 # delete stock moves
571 move_obj.unlink(cr, uid, move_list, context=dict(context, call_unlink=True))600 move_obj.unlink(cr, uid, move_list, context=dict(context, call_unlink=True))
572 # default location601
573 default_location_id = obj.default_location_src_id_kit_creation.id
574 # create consolidated stock moves602 # create consolidated stock moves
575 for product_id in data.keys():603 for product_id in data.keys():
576 for uom_id in data[product_id]['uoms'].keys():604 for uom_id in data[product_id]['uoms'].keys():
@@ -1250,6 +1278,7 @@
1250 'hidden_creation_state': fields.function(_vals_get_kit_creation, method=True, type='selection', selection=KIT_CREATION_STATE, string='Hidden Creation State', multi='get_vals_kit_creation', store=False, readonly=True),1278 'hidden_creation_state': fields.function(_vals_get_kit_creation, method=True, type='selection', selection=KIT_CREATION_STATE, string='Hidden Creation State', multi='get_vals_kit_creation', store=False, readonly=True),
1251 'assigned_qty_stock_move': fields.function(_vals_get_kit_creation, method=True, type='float', string='Assigned Qty', multi='get_vals_kit_creation', store=False, readonly=True),1279 'assigned_qty_stock_move': fields.function(_vals_get_kit_creation, method=True, type='float', string='Assigned Qty', multi='get_vals_kit_creation', store=False, readonly=True),
1252 'hidden_creation_qty_stock_move': fields.function(_vals_get_kit_creation, method=True, type='integer', string='Hidden Creation Qty', multi='get_vals_kit_creation', store=False, readonly=True),1280 'hidden_creation_qty_stock_move': fields.function(_vals_get_kit_creation, method=True, type='integer', string='Hidden Creation Qty', multi='get_vals_kit_creation', store=False, readonly=True),
1281 'kol_lot_manual': fields.boolean(string='The batch is set manually'),
1253 }1282 }
1254 1283
1255 _defaults = {'to_consume_id_stock_move': False,1284 _defaults = {'to_consume_id_stock_move': False,
@@ -1273,6 +1302,15 @@
1273 # open the selected wizard1302 # open the selected wizard
1274 res = wiz_obj.open_wizard(cr, uid, ids, name=name, model=model, step=step, context=dict(context))1303 res = wiz_obj.open_wizard(cr, uid, ids, name=name, model=model, step=step, context=dict(context))
1275 return res1304 return res
1305
1306 def kol_prodlot_change(self, cr, uid, ids, prodlot_id, context=None):
1307 '''
1308 Set a new attribute on stock move if the prodolt is change manually in the Kit order creation
1309 '''
1310 if prodlot_id:
1311 return {'value': {'kol_lot_manual': True}}
1312
1313 return {'value': {'kol_lot_manual': False}}
1276 1314
1277 def automatic_assignment(self, cr, uid, ids, context=None):1315 def automatic_assignment(self, cr, uid, ids, context=None):
1278 '''1316 '''
12791317
=== modified file 'kit/kit_creation_view.xml'
--- kit/kit_creation_view.xml 2013-10-07 14:53:32 +0000
+++ kit/kit_creation_view.xml 2013-11-21 13:07:07 +0000
@@ -77,7 +77,8 @@
77 attrs="{'readonly': ['|', ('hidden_state', '!=', 'confirmed'), ('hidden_asset_check', '=', False)]}" />77 attrs="{'readonly': ['|', ('hidden_state', '!=', 'confirmed'), ('hidden_asset_check', '=', False)]}" />
78 <field name="prodlot_id"78 <field name="prodlot_id"
79 context="{'location_id':location_id, 'product_id':product_id, 'hidden_perishable_mandatory': hidden_perishable_mandatory,79 context="{'location_id':location_id, 'product_id':product_id, 'hidden_perishable_mandatory': hidden_perishable_mandatory,
80 'search_default_real': True}"80 'search_default_real': True}"
81 on_change="kol_prodlot_change(prodlot_id)"
81 domain="[('product_id', '=', product_id),('check_type','=', True)]"82 domain="[('product_id', '=', product_id),('check_type','=', True)]"
82 attrs="{'readonly': ['|', ('hidden_state', '!=', 'confirmed'), ('hidden_exp_check', '=', False)],83 attrs="{'readonly': ['|', ('hidden_state', '!=', 'confirmed'), ('hidden_exp_check', '=', False)],
83 'required': [('hidden_exp_check', '=', True)]}" />84 'required': [('hidden_exp_check', '=', True)]}" />
@@ -88,7 +89,8 @@
88 domain="[('usage', '=', 'internal')]" />89 domain="[('usage', '=', 'internal')]" />
89 <field name="state" />90 <field name="state" />
90 <field name="lot_check" />91 <field name="lot_check" />
91 <field name="exp_check" />92 <field name="exp_check" />
93 <field name="kol_lot_manual" invisible="True" />
92 <field name="hidden_perishable_mandatory" invisible="True" />94 <field name="hidden_perishable_mandatory" invisible="True" />
93 <field name="hidden_exp_check" invisible="True" />95 <field name="hidden_exp_check" invisible="True" />
94 <field name="hidden_state" invisible="True" />96 <field name="hidden_state" invisible="True" />
9597
=== modified file 'msf_doc_import/initial_stock_inventory.py'
--- msf_doc_import/initial_stock_inventory.py 2013-10-04 14:01:53 +0000
+++ msf_doc_import/initial_stock_inventory.py 2013-11-21 13:07:07 +0000
@@ -250,7 +250,7 @@
250 product = product_obj.browse(cr, uid, product_id)250 product = product_obj.browse(cr, uid, product_id)
251 product_uom = product.uom_id.id251 product_uom = product.uom_id.id
252 hidden_batch_management_mandatory = product.batch_management252 hidden_batch_management_mandatory = product.batch_management
253 hidden_perishable_mandatory = product.perishable253 hidden_perishable_mandatory = product.perishable and not product.batch_management
254 if hidden_batch_management_mandatory and not batch:254 if hidden_batch_management_mandatory and not batch:
255 comment += _('Batch is missing.\n')255 comment += _('Batch is missing.\n')
256 if hidden_perishable_mandatory and not expiry:256 if hidden_perishable_mandatory and not expiry:
257257
=== modified file 'msf_outgoing/msf_outgoing.py'
--- msf_outgoing/msf_outgoing.py 2013-11-07 17:06:54 +0000
+++ msf_outgoing/msf_outgoing.py 2013-11-21 13:07:07 +0000
@@ -497,7 +497,8 @@
497 self.log(cr, uid, draft_shipment_id, _("Packs from the draft Shipment (%s) have been returned to stock.")%(draft_shipment_name,))497 self.log(cr, uid, draft_shipment_id, _("Packs from the draft Shipment (%s) have been returned to stock.")%(draft_shipment_name,))
498 log_flag = True498 log_flag = True
499 res = obj_data.get_object_reference(cr, uid, 'msf_outgoing', 'view_picking_ticket_form')[1]499 res = obj_data.get_object_reference(cr, uid, 'msf_outgoing', 'view_picking_ticket_form')[1]
500 self.pool.get('stock.picking').log(cr, uid, draft_picking_id, _("The corresponding Draft Picking Ticket (%s) has been updated.")%(draft_picking.name,), context={'view_id': res,})500 context.update({'view_id': res, 'picking_type': 'picking.ticket'})
501 self.pool.get('stock.picking').log(cr, uid, draft_picking_id, _("The corresponding Draft Picking Ticket (%s) has been updated.")%(draft_picking.name,), context=context)
501 502
502 # call complete_finished on the shipment object503 # call complete_finished on the shipment object
503 # if everything is alright (all draft packing are finished) the shipment is done also 504 # if everything is alright (all draft packing are finished) the shipment is done also
@@ -517,6 +518,7 @@
517 'res_id': draft_picking_id ,518 'res_id': draft_picking_id ,
518 'type': 'ir.actions.act_window',519 'type': 'ir.actions.act_window',
519 'target': 'crush',520 'target': 'crush',
521 'context': context
520 }522 }
521 523
522 def return_packs_from_shipment(self, cr, uid, ids, context=None):524 def return_packs_from_shipment(self, cr, uid, ids, context=None):
@@ -2849,7 +2851,8 @@
2849 res = obj_data.get_object_reference(cr, uid, 'msf_outgoing', 'view_ppl_form')[1]2851 res = obj_data.get_object_reference(cr, uid, 'msf_outgoing', 'view_ppl_form')[1]
2850 self.log(cr, uid, picking.id, _("Products from Pre-Packing List (%s) have been returned to stock.")%(picking.name,), context={'view_id': res,})2852 self.log(cr, uid, picking.id, _("Products from Pre-Packing List (%s) have been returned to stock.")%(picking.name,), context={'view_id': res,})
2851 res = obj_data.get_object_reference(cr, uid, 'msf_outgoing', 'view_picking_ticket_form')[1]2853 res = obj_data.get_object_reference(cr, uid, 'msf_outgoing', 'view_picking_ticket_form')[1]
2852 self.log(cr, uid, draft_picking_id, _("The corresponding Draft Picking Ticket (%s) has been updated.")%(picking.previous_step_id.backorder_id.name,), context={'view_id': res,})2854 context.update({'view_id': res, 'picking_type': 'picking_ticket'})
2855 self.log(cr, uid, draft_picking_id, _("The corresponding Draft Picking Ticket (%s) has been updated.")%(picking.previous_step_id.backorder_id.name,), context=context)
2853 # if all moves are done or canceled, the ppl is canceled2856 # if all moves are done or canceled, the ppl is canceled
2854 cancel_ppl = True2857 cancel_ppl = True
2855 for move in picking.move_lines:2858 for move in picking.move_lines:
@@ -2935,7 +2938,8 @@
2935 # TODO refactoring needed2938 # TODO refactoring needed
2936 obj_data = self.pool.get('ir.model.data')2939 obj_data = self.pool.get('ir.model.data')
2937 res = obj_data.get_object_reference(cr, uid, 'msf_outgoing', 'view_picking_ticket_form')[1]2940 res = obj_data.get_object_reference(cr, uid, 'msf_outgoing', 'view_picking_ticket_form')[1]
2938 self.log(cr, uid, draft_picking_id, _("The corresponding Draft Picking Ticket (%s) has been updated.")%(picking.backorder_id.name,), context={'view_id': res,})2941 context.update({'view_id': res, 'picking_type': 'picking_ticket'})
2942 self.log(cr, uid, draft_picking_id, _("The corresponding Draft Picking Ticket (%s) has been updated.")%(picking.backorder_id.name,), context=context)
2939 2943
2940 if picking.subtype == 'packing':2944 if picking.subtype == 'packing':
2941 # for each packing we get the draft packing2945 # for each packing we get the draft packing
29422946
=== modified file 'msf_supply_doc_export/msf_supply_doc_export.py'
--- msf_supply_doc_export/msf_supply_doc_export.py 2013-10-30 16:03:55 +0000
+++ msf_supply_doc_export/msf_supply_doc_export.py 2013-11-21 13:07:07 +0000
@@ -299,11 +299,11 @@
299 Delivery_Order = trans_obj.tr_view(cr, 'Delivery Order', context)299 Delivery_Order = trans_obj.tr_view(cr, 'Delivery Order', context)
300 Internal_Moves = trans_obj.tr_view(cr, 'Internal Moves', context)300 Internal_Moves = trans_obj.tr_view(cr, 'Internal Moves', context)
301 for v in values:301 for v in values:
302 if '_terp_view_name' in context and v[2]['report_name'] == 'picking.ticket' and context['_terp_view_name'] in (Picking_Tickets, Picking_Ticket) and context.get('picking_screen', False)\302 if v[2]['report_name'] == 'picking.ticket' and (context.get('_terp_view_name') in (Picking_Tickets, Picking_Ticket) or context.get('picking_type') == 'picking_ticket') and context.get('picking_screen', False)\
303 or '_terp_view_name' in context and v[2]['report_name'] == 'pre.packing.list' and context['_terp_view_name'] in (Pre_Packing_Lists, Pre_Packing_List) and context.get('ppl_screen', False)\303 or v[2]['report_name'] == 'pre.packing.list' and context.get('_terp_view_name') in (Pre_Packing_Lists, Pre_Packing_List) and context.get('ppl_screen', False)\
304 or '_terp_view_name' in context and v[2]['report_name'] == 'labels' and context['_terp_view_name'] in [Picking_Ticket, Picking_Tickets, Pre_Packing_List, Pre_Packing_Lists, Delivery_Orders, Delivery_Order]\304 or v[2]['report_name'] == 'labels' and (context.get('_terp_view_name') in [Picking_Ticket, Picking_Tickets, Pre_Packing_List, Pre_Packing_Lists, Delivery_Orders, Delivery_Order] or context.get('picking_type', False) in ('delivery_order', 'picking_ticket'))\
305 or v[2]['report_name'] in ('internal.move.xls', 'internal.move') and (('_terp_view_name' in context and context['_terp_view_name'] in [Internal_Moves]) or context.get('picking_type') == 'internal_move') \305 or v[2]['report_name'] in ('internal.move.xls', 'internal.move') and (('_terp_view_name' in context and context['_terp_view_name'] in [Internal_Moves]) or context.get('picking_type') == 'internal_move') \
306 or v[2]['report_name'] == 'delivery.order' and context.get('_terp_view_name') in [Delivery_Orders, Delivery_Order]:306 or v[2]['report_name'] == 'delivery.order' and (context.get('_terp_view_name') in [Delivery_Orders, Delivery_Order] or context.get('picking_type', False) == 'delivery_order'):
307 new_act.append(v)307 new_act.append(v)
308 values = new_act308 values = new_act
309 elif context.get('_terp_view_name') and key == 'action' and key2 == 'client_print_multi' and 'shipment' in [x[0] for x in models]:309 elif context.get('_terp_view_name') and key == 'action' and key2 == 'client_print_multi' and 'shipment' in [x[0] for x in models]:
310310
=== modified file 'specific_rules/specific_rules_view.xml'
--- specific_rules/specific_rules_view.xml 2013-10-04 15:24:12 +0000
+++ specific_rules/specific_rules_view.xml 2013-11-21 13:07:07 +0000
@@ -144,7 +144,7 @@
144 <field name="type">tree</field>144 <field name="type">tree</field>
145 <field name="priority" eval="200" />145 <field name="priority" eval="200" />
146 <field name="arch" type="xml">146 <field name="arch" type="xml">
147 <tree string="Expiry Dates" hide_new_button="True" hide_delete_button="True">147 <tree string="Expiry Dates" hide_new_button="True" hide_delete_button="True" colors="red:life_date &lt; current_date">
148 <field name="prefix" invisible="True" />148 <field name="prefix" invisible="True" />
149 <field name="type" invisible="True" />149 <field name="type" invisible="True" />
150 <field name="life_date" />150 <field name="life_date" />
151151
=== modified file 'stock_override/report/report_stock_move.py'
--- stock_override/report/report_stock_move.py 2013-09-03 08:27:31 +0000
+++ stock_override/report/report_stock_move.py 2013-11-21 13:07:07 +0000
@@ -163,7 +163,13 @@
163 sm.prodlot_id as prodlot_id,163 sm.prodlot_id as prodlot_id,
164 sm.comment as comment,164 sm.comment as comment,
165 sm.tracking_id as tracking_id,165 sm.tracking_id as tracking_id,
166 sum((sm.product_qty / pu.factor) * u.factor) as product_qty,166 CASE
167 WHEN sp.type in ('out') THEN
168 sum((-sm.product_qty / pu.factor) * u.factor)
169 WHEN sp.type in ('in') THEN
170 sum((sm.product_qty / pu.factor) * u.factor)
171 ELSE 0.0
172 END AS product_qty,
167 pt.nomen_manda_2 as categ_id,173 pt.nomen_manda_2 as categ_id,
168 sp.partner_id2 as partner_id,174 sp.partner_id2 as partner_id,
169 sm.product_id as product_id,175 sm.product_id as product_id,

Subscribers

People subscribed via source and target branches