Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to change product id in your account module in OpenERP(Odoo-8)?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 1.07k
    Comment on it

    In OpenERP, create a custom module like: demo and then create file like: demo.py file in your demo module and demo.py file pass in your other file __init__.py file. And then create other file demo.xml file and pass this file in your other file like as a __openerp__.py file. Then create a function in your demo.py file and pass this function in the demo.xml file.

    Using this code given below

    def productid_change(self,cr,uid,ids, product ,uom_id,  qty=0, name='', type='out_invoice',
                partner_id=False, fposition_id=False, price_unit=False, currency_id=False,
                company_id=None,context=None):
            res = super(account_invoice_line, self).product_id_change(cr,uid,ids,product, uom_id, qty, name,type, partner_id, fposition_id,price_unit, currency_id,company_id,context)
            if res['value'].get('name', False):
                name = res['value'].get('name', False)
                name = name.split(" ")
                prod_name=name[0]
                prod_name=prod_name.replace("["," ")
                prod_name=prod_name.replace("]"," ")
                prod_name=prod_name.strip()
                result=res['value'] 
                product_obj=self.pool.get('product.product')
                var=product_obj.search(cr, uid, [('default_code', '=',prod_name)])
                product_obj1 = product_obj.browse(cr, uid, var, context=context)
                prod_type = product_obj1.supp_ref
                prod_price = product_obj1.lst_price
                squ_meter = product_obj1.squ_meter
                subtotal = (qty) * (prod_price)
                result['price_subtotal'] = subtotal
                result['qty_char'] = qty * squ_meter
                return {'value' : result}
    
            return res

     

 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: