Good afternoon, I have the following error in the call but I do not identify the error. Please appreciate your help.
RELEASE: ODOO12
Odoo Server Error
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 654, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 312, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 87, in reraise
raise value
File "/usr/lib/python3/dist-packages/odoo/http.py", line 696, in dispatch
result = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 344, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 97, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 337, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 939, in __call__
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 517, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 966, in call_button
action = self._call_kw(model, method, args, {})
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 954, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 749, in call_kw
return _call_kw_multi(method, model, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 736, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/sale_management/models/sale_order.py", line 111, in action_confirm
res = super(SaleOrder, self).action_confirm()
File "/usr/lib/python3/dist-packages/odoo/addons/sale/models/sale.py", line 688, in action_confirm
order.message_subscribe([order.partner_id.id])
File "/mnt/extra-addons/stop_auto_subscribe_partners/models/mail_thread.py", line 17, in message_subscribe
return super(MailThread, self).message_subscribe(partner_ids, channel_ids, subtype_ids, force)
TypeError: message_subscribe() takes from 1 to 4 positional arguments but 5 were given
**********
If I just pass (self), I get another error.
def message_subscribe(self):
ir_config = self.env['ir.config_parameter']
app_stop_subscribe = True if ir_config.get_param('app_stop_subscribe') == "True" else False
if app_stop_subscribe:
return
else:
return super(MailThread, self).message_subscribe(self,partner_ids, channel_ids, subtype_ids, force)
Traceback (most recent call last): File "/usr/lib/python3/dist-packages/odoo/http.py", line 654, in _handle_exception return super(JsonRequest, self)._handle_exception(exception) File "/usr/lib/python3/dist-packages/odoo/http.py", line 312, in _handle_exception raise pycompat.reraise(type(exception), exception, sys.exc_info()[2]) File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 87, in reraise raise value File "/usr/lib/python3/dist-packages/odoo/http.py", line 696, in dispatch result = self._call_function(**self.params) File "/usr/lib/python3/dist-packages/odoo/http.py", line 344, in _call_function return checked_call(self.db, *args, **kwargs) File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 97, in wrapper return f(dbname, *args, **kwargs) File "/usr/lib/python3/dist-packages/odoo/http.py", line 337, in checked_call result = self.endpoint(*a, **kw) File "/usr/lib/python3/dist-packages/odoo/http.py", line 939, in __call__ return self.method(*args, **kw) File "/usr/lib/python3/dist-packages/odoo/http.py", line 517, in response_wrap response = f(*args, **kw) File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 966, in call_button action = self._call_kw(model, method, args, {}) File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 954, in _call_kw return call_kw(request.env[model], method, args, kwargs) File "/usr/lib/python3/dist-packages/odoo/api.py", line 749, in call_kw return _call_kw_multi(method, model, args, kwargs) File "/usr/lib/python3/dist-packages/odoo/api.py", line 736, in _call_kw_multi result = method(recs, *args, **kwargs) File "/usr/lib/python3/dist-packages/odoo/addons/sale_management/models/sale_order.py", line 111, in action_confirm res = super(SaleOrder, self).action_confirm() File "/usr/lib/python3/dist-packages/odoo/addons/sale/models/sale.py", line 688, in action_confirm order.message_subscribe([order.partner_id.id]) File "/mnt/extra-addons/stop_auto_subscribe_partners/models/mail_thread.py", line 13, in message_subscribe ir_config = self.env['ir.config_parameter'] AttributeError: 'list' object has no attribute 'env'
from openerp import api, fields, models, _
class MailThread(models.AbstractModel):
_inherit = "mail.thread"
@api.multi
def message_subscribe(self, partner_ids=None, channel_ids=None, subtype_ids=None, force=True):
ir_config = self.env['ir.config_parameter']
app_stop_subscribe = True if ir_config.get_param('app_stop_subscribe') == "True" else False
if app_stop_subscribe:
return
else:
return super(MailThread, self).message_subscribe(partner_ids, channel_ids, subtype_ids, force)
@api.multi
def message_auto_subscribe(self, updated_fields, values=None):
ir_config = self.env['ir.config_parameter']
app_stop_subscribe = True if ir_config.get_param('app_stop_subscribe') == "True" else False
if app_stop_subscribe:
return
else:
return super(MailThread, self).message_auto_subscribe(updated_fields, values)
@api.multi
def _message_auto_subscribe_notify(self, partner_ids):
ir_config = self.env['ir.config_parameter']
app_stop_subscribe = True if ir_config.get_param('app_stop_subscribe') == "True" else False
if app_stop_subscribe:
return
else:
return super(MailThread, self)._message_auto_subscribe_notify(partner_ids)