Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
  • How to Onchange of product and sets some values in openerp

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 238
    Comment on it

    In product module use onchange function and sets some value and return dictionary of value in on_client_changed function to first inherit the product module class like as product.template class and then use this function in .py file in openerp use this function given below,

    def on_client_changed(self, cr, uid, ids, part, context=None):
            if not part:
                return {'value': {'partner_invoice_id': False, 'partner_shipping_id': False,  'payment_term': False, 'fiscal_position_id': False}}
            part = self.pool.get('res.partner').browse(cr, uid, part, context=context)
            addr = self.pool.get('res.partner').address_get(cr, uid, [], ['delivery', 'invoice', 'contact', 'order'])
            pricelist = part.property_product_pricelist and or False
            payment_term = part.property_payment_term_id and or False
            fiscal_position_id = part.property_account_position_id and or False
            dedicated_salesman = part.user_id and or uid
            val = {
                'partner_invoice_id': addr['invoice'],
                'partner_shipping_id': addr['delivery'],
                'partner_order_id': addr['order'],
                'payment_term_id': payment_term,
                'fiscal_position_id': fiscal_position_id,
                'user_id': dedicated_salesman,
            if pricelist:
                val['pricelist_id'] = pricelist
            return {'value': val}

 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: