Odoo, Create() Missing 1 Required Positional Argument: 'vals'
I've inherited create function for account_analytic_line. The logic there is that if the field support_ticket_id is coming on vals dictionary, it will execute all the code inside t
Solution 1:
Try with code:
@api.modeldefcreate(self, vals):
if vals.get("support_ticket_id"):
ticket_id = vals.get("support_ticket_id")
ticket = self.env['website.support.ticket'].browse(ticket_id)
if ticket.analytic_account_id:
vals['account_id'] = ticket.analytic_account_id.id
res = super(AccountAnalyticLine, self).create(vals)
return res
Few points improved:
- if you have integer ID of ticket, we can use browse method.
- unnecessary use of for loop
Post a Comment for "Odoo, Create() Missing 1 Required Positional Argument: 'vals'"