Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to check product quantity in openerp

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 193
    Comment on it

    To check product quantity in openerp
    You have to write this function in .py file to check product quantity in product module and relate his to the inventory management. See code given below

    def check_product_quantity(self, cr, uid, product, quantity):
            """
            This method is not called from a constraint. It checks if there is enough quantity of this product,
            and return a 'warning usable' dictionary, or an empty one.
            """
            warning = {}
            if product.type != 'product':
                return warning
            if product.qty_available < quantity: # We use the real quantity, not the virtual one for renting !
                warning = {
                    'title' : _("Not enought quantity !"),
                    'message' : _("You don't have enought quantity of this product. You asked %d, but there are "
                                  "%d available. You can continue, but you are warned.") % (quantity, product.qty_available)
                }
            return warning
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: