From c5d92d9e1f54b6c084f3fecdb8760e03db6557b8 Mon Sep 17 00:00:00 2001 From: "Quentin (OpenERP)" Date: Tue, 1 Apr 2014 15:22:33 +0200 Subject: [PATCH] [REF] mrp: some code cleaning since procure_method and supply_method doesn't exist on the product anymore bzr revid: qdp-launchpad@openerp.com-20140401132233-2odtndrvudu5ka7q --- addons/mrp/mrp.py | 32 ++++---------------------------- addons/mrp/mrp_view.xml | 6 +++--- 2 files changed, 7 insertions(+), 31 deletions(-) diff --git a/addons/mrp/mrp.py b/addons/mrp/mrp.py index b279c163cf6..2fbdff76194 100644 --- a/addons/mrp/mrp.py +++ b/addons/mrp/mrp.py @@ -20,14 +20,12 @@ ############################################################################## import time -from datetime import datetime import openerp.addons.decimal_precision as dp from openerp.osv import fields, osv, orm -from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT, DATETIME_FORMATS_MAP +from openerp.tools import DEFAULT_SERVER_DATETIME_FORMAT from openerp.tools import float_compare from openerp.tools.translate import _ from openerp import tools, SUPERUSER_ID -from openerp import SUPERUSER_ID from openerp.addons.product import _common @@ -194,25 +192,6 @@ class mrp_bom(osv.osv): return result - def _compute_type(self, cr, uid, ids, field_name, arg, context=None): - """ Sets particular method for the selected bom type. - @param field_name: Name of the field - @param arg: User defined argument - @return: Dictionary of values - """ - res = dict.fromkeys(ids, False) - for line in self.browse(cr, uid, ids, context=context): - if line.type == 'phantom' and not line.bom_id: - res[line.id] = 'set' - continue - if line.bom_lines or line.type == 'phantom': - continue - if line.product_id.procure_method == 'make_to_stock': - res[line.id] = 'stock' - else: - res[line.id] = 'order' - return res - _columns = { 'name': fields.char('Name', size=64), 'code': fields.char('Reference', size=16), @@ -221,7 +200,6 @@ class mrp_bom(osv.osv): help= "If a by-product is used in several products, it can be useful to create its own BoM. "\ "Though if you don't want separated production orders for this by-product, select Set/Phantom as BoM type. "\ "If a Phantom BoM is used for a root product, it will be sold and shipped as a set of components, instead of being produced."), - 'method': fields.function(_compute_type, string='Method', type='selection', selection=[('', ''), ('stock', 'On Stock'), ('order', 'On Order'), ('set', 'Set / Pack')]), 'date_start': fields.date('Valid From', help="Validity of this BoM or component. Keep empty if it's always valid."), 'date_stop': fields.date('Valid Until', help="Validity of this BoM or component. Keep empty if it's always valid."), 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of bills of material."), @@ -603,7 +581,7 @@ class mrp_production(osv.osv): 'product_uom': False, 'bom_id': False, 'routing_id': False, - 'product_uos_qty': 0, + 'product_uos_qty': 0, 'product_uos': False }} bom_obj = self.pool.get('mrp.bom') @@ -614,7 +592,6 @@ class mrp_production(osv.osv): bom_point = bom_obj.browse(cr, uid, bom_id, context=context) routing_id = bom_point.routing_id.id or False product_uom_id = product.uom_id and product.uom_id.id or False - product_uos_id = product.uos_id and product.uos_id.id or False result['value'] = {'product_uos_qty': 0, 'product_uos': False, 'product_uom': product_uom_id, 'bom_id': bom_id, 'routing_id': routing_id} if product.uos_id.id: result['value']['product_uos_qty'] = product_qty * product.uos_coeff @@ -643,7 +620,7 @@ class mrp_production(osv.osv): """ 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 @return: product_lines @@ -999,10 +976,9 @@ class mrp_production(osv.osv): '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, - 'procure_method': production_line.product_id.procure_method, 'move_id': shipment_move_id, 'company_id': production.company_id.id, - }) + }) procurement_order.signal_button_confirm(cr, uid, [procurement_id]) return procurement_id diff --git a/addons/mrp/mrp_view.xml b/addons/mrp/mrp_view.xml index f84db02876e..17e5c1c51ef 100644 --- a/addons/mrp/mrp_view.xml +++ b/addons/mrp/mrp_view.xml @@ -189,7 +189,7 @@ - + @@ -347,7 +347,7 @@
- +