From 40ddf9586768c15f3d6cb7c8ce16b4e21fd6aaea Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Wed, 23 Apr 2014 11:40:26 +0200 Subject: [PATCH 1/8] [IMP] Remove procurement creation when confirming production without produce line bzr revid: jco@openerp.com-20140423094026-gfmghsgpxvk5vng9 --- addons/mrp/mrp.py | 48 ----------------------------------------------- 1 file changed, 48 deletions(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index d2ff8553a35..61b6b598d7e 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -697,8 +697,6 @@ class mrp_production(osv.osv): for production in self.browse(cr, uid, ids, context=context): if not production.move_created_ids: self._make_production_produce_line(cr, uid, production, context=context) - for scheduled in production.product_lines: - self._make_production_line_procurement(cr, uid, scheduled, False, context=context) if production.move_prod_id and production.move_prod_id.location_id.id != production.location_dest_id.id: move_obj.write(cr, uid, [production.move_prod_id.id], @@ -960,52 +958,6 @@ class mrp_production(osv.osv): res = True return res - def _make_production_line_procurement(self, cr, uid, production_line, shipment_move_id, context=None): - procurement_order = self.pool.get('procurement.order') - production = production_line.production_id - location_id = production.location_src_id.id - date_planned = production.date_planned - procurement_name = (production.origin or '').split(':')[0] + ':' + production.name - procurement_id = procurement_order.create(cr, uid, { - 'name': procurement_name, - 'origin': procurement_name, - 'date_planned': date_planned, - 'product_id': production_line.product_id.id, - 'product_qty': production_line.product_qty, - 'product_uom': production_line.product_uom.id, - 'product_uos_qty': production_line.product_uos and production_line.product_qty or False, - 'product_uos': production_line.product_uos and production_line.product_uos.id or False, - 'location_id': location_id, - 'move_id': shipment_move_id, - 'company_id': production.company_id.id, - }) - procurement_order.signal_button_confirm(cr, uid, [procurement_id]) - return procurement_id - - def _make_production_produce_line(self, cr, uid, production, context=None): - stock_move = self.pool.get('stock.move') - source_location_id = production.product_id.property_stock_production.id - destination_location_id = production.location_dest_id.id - data = { - 'name': production.name, - 'date': production.date_planned, - 'product_id': production.product_id.id, - 'product_qty': production.product_qty, - 'product_uom': production.product_uom.id, - 'product_uom_qty': production.product_qty, - 'product_uos_qty': production.product_uos and production.product_uos_qty or False, - 'product_uos': production.product_uos and production.product_uos.id or False, - 'location_id': source_location_id, - 'location_dest_id': destination_location_id, - 'move_dest_id': production.move_prod_id.id, - 'company_id': production.company_id.id, - 'production_id': production.id, - 'origin': production.name, - } - move_id = stock_move.create(cr, uid, data, context=context) - #a phantom bom cannot be used in mrp order so it's ok to assume the list returned by action_confirm - #is 1 element long, so we can take the first. - return stock_move.action_confirm(cr, uid, [move_id], context=context)[0] def _get_raw_material_procure_method(self, cr, uid, product, context=None): '''This method returns the procure_method to use when creating the stock move for the production raw materials''' From af0468c418194d8139e4a8736260bc46a72e17e4 Mon Sep 17 00:00:00 2001 From: Josse Colpaert Date: Wed, 23 Apr 2014 11:48:07 +0200 Subject: [PATCH 2/8] [WIP] Remove picking except state on mrp order bzr revid: jco@openerp.com-20140423094807-za7855wkx2vlr0di --- addons/mrp/mrp.py | 8 +------- addons/mrp/mrp_view.xml | 12 +++++------- addons/mrp_operations/mrp_operations.py | 2 +- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index 61b6b598d7e..19b1625b105 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -493,7 +493,7 @@ class mrp_production(osv.osv): 'workcenter_lines': fields.one2many('mrp.production.workcenter.line', 'production_id', 'Work Centers Utilisation', readonly=True, states={'draft': [('readonly', False)]}), 'state': fields.selection( - [('draft', 'New'), ('cancel', 'Cancelled'), ('picking_except', 'Picking Exception'), ('confirmed', 'Awaiting Raw Materials'), + [('draft', 'New'), ('cancel', 'Cancelled'), ('confirmed', 'Awaiting Raw Materials'), ('ready', 'Ready to Produce'), ('in_production', 'Production Started'), ('done', 'Done')], string='Status', readonly=True, track_visibility='onchange', @@ -614,12 +614,6 @@ class mrp_production(osv.osv): } return {'value': result} - def action_picking_except(self, cr, uid, ids): - """ Changes the state to Exception. - @return: True - """ - self.write(cr, uid, ids, {'state': 'picking_except'}) - return True def _action_compute_lines(self, cr, uid, ids, properties=None, context=None): """ Compute product_lines and workcenter_lines from BoM structure diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index 417d4236b21..84ad35382ec 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -674,12 +674,10 @@