1
# -*- ecoding: utf-8 -*-
2
##############################################################################
4
# OpenERP, Open Source Management Solution
5
# Copyright (C) 2011 NovaPoint Group LLC (<http://www.novapointgroup.com>)
6
# Copyright (C) 2004-2010 OpenERP SA (<http://www.openerp.com>)
8
# This program is free software: you can redistribute it and/or modify
9
# it under the terms of the GNU General Public License as published by
10
# the Free Software Foundation, either version 3 of the License, or
11
# (at your option) any later version.
13
# This program is distributed in the hope that it will be useful,
14
# but WITHOUT ANY WARRANTY; without even the implied warranty of
15
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
# GNU General Public License for more details.
18
# You should have received a copy of the GNU General Public License
19
# along with this program. If not, see <http://www.gnu.org/licenses/>
21
##############################################################################
25
class procurement(osv.osv):
26
_inherit="procurement.order"
28
def action_produce_assign_product(self, cr, uid, ids, context=None):
30
Blocks the procurement being run for products with assembly bom
31
@param self: The object pointer.
32
@param ids: ids of the procurement order document
33
@param context: standard dictionary
34
@comment: Blocks the procurement to be run for products with assembly bom
35
@return: returns either the Manufacturing order id or 0
37
procurement_obj = self.pool.get('procurement.order')
38
bom_obj = self.pool.get('mrp.bom')
39
sale_line_obj = self.pool.get('sale.order.line')
41
for procure_record in procurement_obj.browse(cr, uid, ids, context=context):
42
sale_line_ids = sale_line_obj.search(cr, uid, [('procurement_id', '=', procure_record.id)], context=context)
43
sale_line_id = sale_line_ids and sale_line_ids[0] or False
45
line = sale_line_obj.browse(cr, uid, sale_line_id, context=context)
47
bom_ids = bom_obj.search(cr, uid, [('product_id', '=', line.product_id.id), ('type', '=', 'assembly')], context=context)
48
bom_id = bom_ids and bom_ids[0] or False
51
return super(procurement, self).action_produce_assign_product(cr, uid, [procure_record.id], context=context)
55
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
b'\\ No newline at end of file'