Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • How to calculates quantity and Confirms production order in OpenERP

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 260
    Comment on it

    In OpenERP first we create the product and then calculates the quantity of product. In product form picking Id is generated and picking id will return to the value of this product and then product will calculated automatically in stock.

    Use this function given below

    def product_confirm(self, cr, uid, ids):
            picking_id = super(mrp_production,self).action_confirm(cr, uid, ids)
            for production in self.browse(cr, uid, ids):
                source =
                if not production.bom_id:
                for sub_product in production.bom_id.sub_products:
                    qty1 = sub_product.product_qty
                    qty2 = production.product_uos and production.product_uos_qty or False
                    if sub_product.subproduct_type == 'variable':
                        if production.product_qty:
                            qty1 *= production.product_qty / (production.bom_id.product_qty or 1.0)
                        if production.product_uos_qty:
                            qty2 *= production.product_uos_qty / (production.bom_id.product_uos_qty or 1.0)
                    data = {
                        'name': 'PROD:',
                        'date': production.date_planned,
                        'product_qty': qty1,
                        'product_uos_qty': qty2,
                        'product_uos': production.product_uos and or False,
                        'location_id': source,
                        'state': 'waiting',
                    self.pool.get('stock.move').create(cr, uid, data)
            return picking_id


 0 Comment(s)

Sign In

Sign up using

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: