iam trying to get mail when a new record created and modified for a field in CRM Module so i have defined this functions , someone help me with this issue
in py file
@api.multi def write(self, vals): if 'lead_status' in vals and self.ids: for rec in self: template = self.env.ref('crm_extended.crm_lead_mail_template') template.send_mail(rec.id, force_send=True) return super(crm_extended, self).write(vals) @api.model def create(self, vals): rec = super(crm_extended, self).create(vals) if 'opportunity_id' in vals: template = self.env.ref('crm_extended.create_crm_lead_mail_template') for rec in self: template.send_mail (rec.id, force_send=True) return rec @api.multi def create(self, vals): res = super(crm_extended,self).create(vals) if res and res.customer_name: template = self.env.ref ('crm_extended.create_crm_lead_mail_template') template.send_mail (res.id, force_send = True) return res
when the change the state or give save, odoo popping me an error as below
Error:
Odoo Server Error
Traceback (most recent call last):
File "/opt/odoo/odoo-12.0/odoo/http.py", line 656, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/odoo-12.0/odoo/http.py", line 314, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/opt/odoo/odoo-12.0/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/opt/odoo/odoo-12.0/odoo/http.py", line 698, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo/odoo-12.0/odoo/http.py", line 346, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo/odoo-12.0/odoo/service/model.py", line 98, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo/odoo-12.0/odoo/http.py", line 339, in checked_call
result = self.endpoint(*a, **kw)
File "/opt/odoo/odoo-12.0/odoo/http.py", line 941, in __call__
return self.method(*args, **kw)
File "/opt/odoo/odoo-12.0/odoo/http.py", line 519, in response_wrap
response = f(*args, **kw)
File "/opt/odoo/odoo-12.0/addons/web/controllers/main.py", line 962, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/opt/odoo/odoo-12.0/addons/web/controllers/main.py", line 954, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/opt/odoo/odoo-12.0/odoo/api.py", line 759, in call_kw
return _call_kw_multi(method, model, args, kwargs)
File "/opt/odoo/odoo-12.0/odoo/api.py", line 746, in _call_kw_multi
result = method(recs, *args, **kwargs)
TypeError: create() missing 1 required positional argument: 'vals'
idk whats wrong i did , when i duplicate a old record and give save its working this is strange
anyone ?
Odoo Methods: https://goo.gl/4BkizH