My Original code in sale_analytic.py
class AccountAnalyticLine(models.Model):
_inherit = "account.analytic.line"
@api.multi
def write(self, values):
if self._context.get('create', False):
return super(AccountAnalyticLine, self).write(values)
todo = self.mapped('so_line')
result = super(AccountAnalyticLine, self).write(values)
if 'so_line' in values:
todo |= self.mapped('so_line')
for line in self:
res = self._get_sale_order_line(vals=values)
super(AccountAnalyticLine, line).write(res)
if 'so_line' in res:
todo |= line.mapped('so_line')
todo._compute_analytic()
return result
Here I have an new file named sample.py
I have inherited same class.
class AccountAnalyticLine(models.Model):
_inherit = "account.analytic.line"
@api.multi
def write(self, values):
if self._context.get('create', False):
return super(AccountAnalyticLine, self).write(values)
todo = self.mapped('so_line')
result = super(AccountAnalyticLine, self).write(values)
if 'so_line' in values:
todo |= self.mapped('so_line')
for line in self:
res = line._get_sale_order_line(vals=values)
super(AccountAnalyticLine, line).write(res)
if 'so_line' in res:
todo |= line.mapped('so_line')
todo._compute_analytic()
return result
Instead of this line "res = self._get_sale_order_line(vals=values)" I need to change it as
"res = line._get_sale_order_line(vals=values)"
Can anyone please help me?