[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
This commit is contained in:
Quentin (OpenERP) 2014-04-01 15:22:33 +02:00
parent 588bd37400
commit c5d92d9e1f
2 changed files with 7 additions and 31 deletions

View File

@ -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

View File

@ -189,7 +189,7 @@
<field name="time_stop" widget="float_time"/>
</group>
<group string="Costing Information">
<field name="product_id" on_change="on_change_product_cost(product_id)" context="{'default_supply_method':'produce'}"/>
<field name="product_id" on_change="on_change_product_cost(product_id)"/>
<field name="costs_hour"/>
<field name="costs_hour_account_id" groups="analytic.group_analytic_accounting"/>
<field name="costs_cycle"/>
@ -347,7 +347,7 @@
<form string="Bill of Material" version="7.0">
<group>
<group>
<field name="product_id" on_change="onchange_product_id(product_id, name, product_qty, context)" context="{'default_supply_method':'produce'}" class="oe_inline"/>
<field name="product_id" on_change="onchange_product_id(product_id, name, product_qty, context)" class="oe_inline"/>
<label for="product_qty" string="Quantity"/>
<div>
<field name="product_qty" class="oe_inline" on_change="onchange_product_id(product_id, name, product_qty, context)"/>
@ -519,7 +519,7 @@
<field name="arch" type="xml">
<xpath expr="//filter[@string='Consumable']" position="after">
<separator/>
<filter string="Components" name="components" icon="terp-accessories-archiver" domain="[('bom_ids','not in',[]),('bom_ids.bom_id','!=',False)]" invisible="not context.get('search_default_filter_supply_method_produce', False)"/>
<filter string="Components" name="components" icon="terp-accessories-archiver" domain="[('bom_ids','not in',[]),('bom_ids.bom_id','!=',False)]"/>
</xpath>
</field>
</record>