Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to create Account Analytic Line class to compute the line in odoo-9

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 383
    Comment on it

    To create Account Analytic Line to compute the line and inherit the class account_analytic_line in odoo-9 then write this function in .py file in your module in odoo.
    Use this code show in given below

    def _compute_accountanalytic(self, domain=None):
            lines = {}
            if not domain:
                domain = [('so_line', 'in', self.ids), ('amount', '<=', 0.0)]
            data = self.env['account.analytic.line'].read_group(
                domain,
                ['so_line', 'unit_amount', 'product_uom_id'], ['product_uom_id', 'so_line'], lazy=False
            )
            for d in data:
                if not d['product_uom_id']:
                    continue
                line = self.browse(d['so_line'][0])
                lines.setdefault(line, 0.0)
                uom = self.env['product.uom'].browse(d['product_uom_id'][0])
                if line.product_uom.category_id == uom.category_id:
                    qty = self.env['product.uom']._compute_qty_obj(uom, d['unit&#95;amount'], line.product_uom)
                else:
                    qty = d['unit_amount']
                lines[line] += qty
    
            for line, qty in lines.items():
                line.qty_delivered = qty
            return True  
    

 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: