<commit_before># -*- coding: utf-8 -*-
##############################################################################
#    
#    OpenERP, Open Source Management Solution
#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    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/>.     
#
##############################################################################

import time
import ir
from osv.osv import except_osv
from osv import fields, osv
import netsvc
from tools.translate import _

class change_production_qty(osv.osv_memory):
    _name = 'change.production.qty'
    _description = 'Change Quantity of Products'
    
    _columns = {
        'product_qty': fields.float('Product Qty', required=True),
    }

    def default_get(self, cr, uid, fields, context):
        """ 
             To get default values for the object.
            
             @param self: The object pointer.
             @param cr: A database cursor
             @param uid: ID of the user currently logged in
             @param fields: List of fields for which we want default values 
             @param context: A standard dictionary 
             
             @return: A dictionary which of fields with values. 
        
        """        
        res = {}
        record_id = context and context.get('active_id',False)
        if not record_id:
           return res
        prod_obj = self.pool.get('mrp.production')
        prod = prod_obj.browse(cr, uid, record_id)
        if prod.state in ('in_production','cancel', 'done'):
            raise osv.except_osv(_('Warning !'), _('The production is in "%s" state. You can not change the production quantity anymore') % (prod.state).upper() )
 
        res['product_qty'] = prod.product_qty        
        return res
    
    def change_prod_qty(self, cr, uid, ids, context):
        """ 
             Changes the Quantity of Product.
            
             @param self: The object pointer.
             @param cr: A database cursor
             @param uid: ID of the user currently logged in
             @param ids: List of IDs selected 
             @param context: A standard dictionary 
             
             @return:  
        
        """
        record_id = context and context.get('active_id',False)
        assert record_id, _('Active Id is not found')<commit_msg>[REF] mrp: Removed 'raise..' from 'Change Qty' wizard. Not needed.<commit_after># -*- coding: utf-8 -*-
##############################################################################
#    
#    OpenERP, Open Source Management Solution
#    Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU Affero General Public License as
#    published by the Free Software Foundation, either version 3 of the
#    License, or (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    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/>.     
#
##############################################################################

import time
import ir
from osv.osv import except_osv
from osv import fields, osv
import netsvc
from tools.translate import _

class change_production_qty(osv.osv_memory):
    _name = 'change.production.qty'
    _description = 'Change Quantity of Products'
    
    _columns = {
        'product_qty': fields.float('Product Qty', required=True),
    }

    def default_get(self, cr, uid, fields, context):
        """ 
             To get default values for the object.
            
             @param self: The object pointer.
             @param cr: A database cursor
             @param uid: ID of the user currently logged in
             @param fields: List of fields for which we want default values 
             @param context: A standard dictionary 
             
             @return: A dictionary which of fields with values. 
        
        """        
        res = {}
        record_id = context and context.get('active_id',False)
        if not record_id:
           return res
        prod_obj = self.pool.get('mrp.production')
        prod = prod_obj.browse(cr, uid, record_id)
        res['product_qty'] = prod.product_qty        
        return res
        
    def change_prod_qty(self, cr, uid, ids, context):
        """ 
             Changes the Quantity of Product.
            
             @param self: The object pointer.
             @param cr: A database cursor
             @param uid: ID of the user currently logged in
             @param ids: List of IDs selected 
             @param context: A standard dictionary 
             
             @return:  
        
        """
        record_id = context and context.get('active_id',False)
        assert record_id, _('Active Id is not found')
{'fraction_non_alphanumeric': 0.12901545407188747, 'fraction_numerical': 0.0034728251432540372, 'mean_word_length': 2.2914285714285714, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '515629', 'n_tokens_mistral': 1500, 'n_tokens_neox': 1437, 'n_words': 584}