[Fix]: Bug #689678 Error when manufacturing a subproduct with quantity = 0

bzr revid: rha@tinyerp.com-20101215094644-btbc1b2q3n2pgr69
This commit is contained in:
rha@tinyerp.com
2010-12-15 15:16:44 +05:30
parent 0b0a33c0d6
commit 37c862c83b
+8 -5
View File
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
##############################################################################
#
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
@@ -15,7 +15,7 @@
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
@@ -35,7 +35,10 @@ class mrp_subproduct(osv.osv):
_defaults={
'subproduct_type': lambda *args: 'fixed'
}
_sql_constraints = [
('_check_product_qty', 'CHECK (product_qty > 0)', 'Enter valid product quantity !'),
]
def onchange_product_id(self, cr, uid, ids, product_id,context={}):
""" Changes UoM if product_id changes.
@param product_id: Changed product_id
@@ -53,7 +56,7 @@ class mrp_bom(osv.osv):
_name = 'mrp.bom'
_description = 'Bill of Material'
_inherit='mrp.bom'
_columns={
'sub_products':fields.one2many('mrp.subproduct', 'bom_id', 'sub_products'),
}
@@ -62,7 +65,7 @@ mrp_bom()
class mrp_production(osv.osv):
_name = 'mrp.production'
_description = 'Production'
_inherit= 'mrp.production'
_inherit= 'mrp.production'
def action_confirm(self, cr, uid, ids):
""" Confirms production order and calculates quantity based on subproduct_type.