Odoo 10 - debug issue with mail template in sales order - odoo

I am getting this error when trying to send an email in sales order (quote).
When I dismiss the error message I get the modal window for sending email but no template has been selected and I have to select it manually. Then everything works fine
I hence suspect that the issue is that for some reason it is not getting the default template.
Any tips on how to fix this?
File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 640, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 677, in dispatch
result = self._call_function(**self.params)
File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 333, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/odoo/service/model.py", line 101, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 326, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 935, in __call__
return self.method(*args, **kw)
File "/usr/lib/python2.7/dist-packages/odoo/http.py", line 506, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python2.7/dist-packages/odoo/addons/web/controllers/main.py", line 885, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/usr/lib/python2.7/dist-packages/odoo/addons/web/controllers/main.py", line 877, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/usr/lib/python2.7/dist-packages/odoo/api.py", line 689, in call_kw
return call_kw_multi(method, model, args, kwargs)
File "/usr/lib/python2.7/dist-packages/odoo/api.py", line 680, in call_kw_multi
result = method(recs, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/odoo/models.py", line 5491, in onchange
record._onchange_eval(name, field_onchange[name], result)
File "/usr/lib/python2.7/dist-packages/odoo/models.py", line 5389, in _onchange_eval
method_res = method(self)
File "/usr/lib/python2.7/dist-packages/odoo/addons/mail/wizard/mail_compose_message.py", line 342, in onchange_template_id_wrapper
values = self.onchange_template_id(self.template_id.id, self.composition_mode, self.model, self.res_id)['value']
File "/usr/lib/python2.7/dist-packages/odoo/addons/mail/wizard/mail_compose_message.py", line 364, in onchange_template_id
values = self.generate_email_for_composer(template_id, [res_id])[res_id]
File "/usr/lib/python2.7/dist-packages/odoo/addons/mail/wizard/mail_compose_message.py", line 501, in generate_email_for_composer
template_values = self.env['mail.template'].with_context(tpl_partners_only=True).browse(template_id).generate_email(res_ids, fields=fields)
File "/usr/lib/python2.7/dist-packages/odoo/addons/mail/models/mail_template.py", line 482, in generate_email
res_ids_to_templates = self.get_email_template(res_ids)
File "/usr/lib/python2.7/dist-packages/odoo/addons/mail/models/mail_template.py", line 423, in get_email_template
langs = self.render_template(self.lang, self.model, res_ids)
File "/usr/lib/python2.7/dist-packages/odoo/addons/mail/models/mail_template.py", line 380, in render_template
records = self.env[model].browse(filter(None, res_ids)) # filter to avoid browsing [None]
File "/usr/lib/python2.7/dist-packages/odoo/api.py", line 760, in __getitem__
return self.registry[model_name]._browse((), self)
File "/usr/lib/python2.7/dist-packages/odoo/modules/registry.py", line 174, in __getitem__
return self.models[model_name]
KeyError: False

I found an answer here:
Odoo Support forum - Change Default Mail Template
I changed the template (duplicate and deleted the original one) so you have to change the ID which refers to old one.

Related

Odoo 12 Server Error KeyError: 'crm.Stage'

I am a starter in odoo. Can anyone help me to find a solution for the problem mentioned below?
In CRM Module I'm getting this below this error when I save any record in CRM Module, it was working fine for a while but idk after sometime when I create or change any record this error pops up
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 757, in call_kw
return _call_kw_model_create(method, model, args, kwargs)
File "/opt/odoo/odoo-12.0/odoo/api.py", line 737, in _call_kw_model_create
result = method(recs, *args, **kwargs)
File "<decorator-gen-260>", line 2, in create
File "/opt/odoo/odoo-12.0/odoo/api.py", line 461, in _model_create_multi
return create(self, [arg])
File "/opt/odoo/odoo-12.0/addons/base_automation/models/base_automation.py", line 228, in create
records = create.origin(self.with_env(actions.env), vals_list, **kw)
File "<decorator-gen-116>", line 2, in create
File "/opt/odoo/odoo-12.0/odoo/api.py", line 462, in _model_create_multi
return create(self, arg)
File "/opt/odoo/odoo-12.0/addons/mail/models/mail_thread.py", line 272, in create
threads = super(MailThread, self).create(vals_list)
File "<decorator-gen-3>", line 2, in create
File "/opt/odoo/odoo-12.0/odoo/api.py", line 462, in _model_create_multi
return create(self, arg)
File "/opt/odoo/odoo-12.0/odoo/models.py", line 3534, in create
vals = self._add_missing_default_values(vals)
File "/opt/odoo/odoo-12.0/odoo/models.py", line 1700, in _add_missing_default_values
defaults = self.default_get(list(missing_defaults))
File "/opt/odoo/odoo-12.0/odoo/models.py", line 1168, in default_get
defaults[name] = field.default(self)
File "/opt/odoo/odoo-12.0/crm_internal_new/crm_extended/models/crm_lead_extended.py", line 37, in get_default_won_id1
return self.env['crm.Stage'].search([('name', '=', 'Won')]).id
File "/opt/odoo/odoo-12.0/odoo/api.py", line 831, in __getitem__
return self.registry[model_name]._browse((), self)
File "/opt/odoo/odoo-12.0/odoo/modules/registry.py", line 176, in __getitem__
return self.models[model_name]
KeyError: 'crm.Stage'

Odoo issue : missing record does not exist or has been deleted

In Quotation => New
Select customer => Search more
result => Odoo Error : missing record does not exist or has been deleted
POST http://example.net/web/dataset/call_kw/res.partner/name_search 200 OK :
"Traceback (most recent call last):
File "/mnt/odoo-source/odoo/http.py", line 640, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/mnt/odoo-source/odoo/http.py", line 677, in dispatch
result = self._call_function(**self.params)
File "/mnt/odoo-source/odoo/http.py", line 333, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/mnt/odoo-source/odoo/service/model.py", line 101, in wrapper
return f(dbname, *args, **kwargs)
File "/mnt/odoo-source/odoo/http.py", line 326, in checked_call
result = self.endpoint(*a, **kw)
File "/mnt/odoo-source/odoo/http.py", line 935, in __call__
return self.method(*args, **kw)
File "/mnt/odoo-source/odoo/http.py", line 506, in response_wrap
response = f(*args, **kw)
File "/mnt/odoo-source/addons/web/controllers/main.py", line 885, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/mnt/odoo-source/addons/web/controllers/main.py", line 877, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/mnt/odoo-source/odoo/api.py", line 679, in call_kw
return call_kw_model(method, model, args, kwargs)
File "/mnt/odoo-source/odoo/api.py", line 664, in call_kw_model
result = method(recs, *args, **kwargs)
File "/mnt/odoo-source/odoo/addons/base/res/res_partner.py", line 681, in name_search
return super(Partner, self).name_search(name, args, operator=operator, limit=limit)
File "/mnt/odoo-source/odoo/models.py", line 1600, in name_search
return self._name_search(name, args, operator, limit=limit)
File "/mnt/odoo-source/odoo/models.py", line 1615, in _name_search
return recs.sudo(access_rights_uid).name_get()
File "/mnt/odoo-source/odoo/addons/base/res/res_partner.py", line 586, in name_get
name = name + "\n" + partner._display_address(without_company=True)
File "/mnt/odoo-source/odoo/addons/base/res/res_partner.py", line 781, in _display_address
address_format = self.country_id.address_format or \
File "/mnt/odoo-source/odoo/fields.py", line 866, in __get__
value = record._cache[self]
File "/mnt/odoo-source/odoo/models.py", line 5562, in __getitem__
return value.get() if isinstance(value, SpecialValue) else value
File "/mnt/odoo-source/odoo/fields.py", line 48, in get
raise self.exception
MissingError: (u'Enregistrement inexistant ou d\xe9truit.', None)
"
I'm stuck with this issue. Anyone know what could i do ?
The issue is solved.
"Country_id" field in "res_partner" table was referencing an unexisting country in "res_country table".

odoo IndexError: list index out of range

Any ideas on the following odoo error? I Installed the Accounting module and instead of modifying the default Sales and Purchase Taxes entries ODOO created, made my own and deleted theirs. This error started happening when I try accessing different parts of the accounting module. I could try to reinstall the module but have had bad experiences with that.
Odoo Server Error
Traceback (most recent call last):
File "/opt/odoo-9.0.20160620-2/apps/odoo/lib/odoo-9.0rc20160620-py2.7.egg/openerp/http.py", line 646, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo-9.0.20160620-2/apps/odoo/lib/odoo-9.0rc20160620-py2.7.egg/openerp/http.py", line 683, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo-9.0.20160620-2/apps/odoo/lib/odoo-9.0rc20160620-py2.7.egg/openerp/http.py", line 319, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo-9.0.20160620-2/apps/odoo/lib/odoo-9.0rc20160620-py2.7.egg/openerp/service/model.py", line 118, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo-9.0.20160620-2/apps/odoo/lib/odoo-9.0rc20160620-py2.7.egg/openerp/http.py", line 312, in checked_call
result = self.endpoint(*a, **kw)
File "/opt/odoo-9.0.20160620-2/apps/odoo/lib/odoo-9.0rc20160620-py2.7.egg/openerp/http.py", line 962, in __call__
return self.method(*args, **kw)
File "/opt/odoo-9.0.20160620-2/apps/odoo/lib/odoo-9.0rc20160620-py2.7.egg/openerp/http.py", line 512, in response_wrap
response = f(*args, **kw)
File "/opt/odoo-9.0.20160620-2/apps/odoo/lib/odoo-9.0rc20160620-py2.7.egg/openerp/addons/web/controllers/main.py", line 897, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/opt/odoo-9.0.20160620-2/apps/odoo/lib/odoo-9.0rc20160620-py2.7.egg/openerp/addons/web/controllers/main.py", line 889, in _call_kw
return getattr(request.registry.get(model), method)(request.cr, request.uid, *args, **kwargs)
File "/opt/odoo-9.0.20160620-2/apps/odoo/lib/odoo-9.0rc20160620-py2.7.egg/openerp/api.py", line 250, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo-9.0.20160620-2/apps/odoo/lib/odoo-9.0rc20160620-py2.7.egg/openerp/api.py", line 381, in old_api
result = method(recs, *args, **kwargs)
File "/opt/odoo-9.0.20160620-2/apps/odoo/lib/odoo-9.0rc20160620-py2.7.egg/openerp/models.py", line 6054, in onchange
record._onchange_eval(name, field_onchange[name], result)
File "/opt/odoo-9.0.20160620-2/apps/odoo/lib/odoo-9.0rc20160620-py2.7.egg/openerp/models.py", line 5911, in _onchange_eval
method_res = method(self)
File "/opt/odoo-9.0.20160620-2/apps/odoo/lib/odoo-9.0rc20160620-py2.7.egg/openerp/addons/account/models/res_config.py", line 169, in onchange_company_id
self.default_sale_tax_id = isinstance(taxes_id, list) and taxes_id[0] or taxes_id
IndexError: list index out of range
This was a bug that was fixed on commit 1d843884e861252e395e0818b0fbf8aa074cd9d2.
Do a git pull on your branch to update your server files,restart the server and try again.
The problem is that in "res_config.py" you have a list you work with the first element is probably empty
To avoid this problem, you can use taxes_id[0] inside if taxes_id:

Odoo 8 error when trying to open customer

I am using Odoo 8 on Ubuntu.
I have problem opening some customers (some are OK). When I try to open it for editing I get Odoo Server Error...IndexError: list index out of range.
Any idea what could cause this problem ? I tried to search for similar problems but I have not found any solution. So when I want to edit the client I have to create new one, I also tried to merge them after creating new one but the error reappears again.
thank you and here is complete traceback:
Odoo Server Error
Traceback (most recent call last):
File "/opt/odoo/odoo/openerp/http.py", line 530, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/odoo/openerp/http.py", line 567, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo/odoo/openerp/http.py", line 303, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo/odoo/openerp/service/model.py", line 113, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo/odoo/openerp/http.py", line 300, in checked_call
return self.endpoint(*a, **kw)
File "/opt/odoo/odoo/openerp/http.py", line 796, in __call__
return self.method(*args, **kw)
File "/opt/odoo/odoo/openerp/http.py", line 396, in response_wrap
response = f(*args, **kw)
File "/opt/odoo/odoo/addons/web/controllers/main.py", line 949, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/opt/odoo/odoo/addons/web/controllers/main.py", line 932, in _call_kw
records = getattr(request.session.model(model), method)(*args, **kwargs)
File "/opt/odoo/odoo/openerp/http.py", line 900, in proxy
result = meth(cr, request.uid, *args, **kw)
File "/opt/odoo/odoo/openerp/api.py", line 241, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo/openerp/models.py", line 3109, in read
result = BaseModel.read(records, fields, load=load)
File "/opt/odoo/odoo/openerp/api.py", line 239, in wrapper
return new_api(self, *args, **kwargs)
File "/opt/odoo/odoo/openerp/models.py", line 3141, in read
self._read_from_database(stored)
File "/opt/odoo/odoo/openerp/api.py", line 239, in wrapper
return new_api(self, *args, **kwargs)
File "/opt/odoo/odoo/openerp/models.py", line 3305, in _read_from_database
res2 = self._columns[f].get(cr, self._model, ids, f, user, context=context, values=result)
File "/opt/odoo/odoo/openerp/osv/fields.py", line 1361, in get
result = self._fnct(obj, cr, uid, ids, name, self._arg, context)
File "/opt/odoo/odoo/addons/account/partner.py", line 246, in _invoice_total
result[partner.id] = sum(inv.user_currency_price_total for inv in invoices)
File "/opt/odoo/odoo/addons/account/partner.py", line 246, in <genexpr>
result[partner.id] = sum(inv.user_currency_price_total for inv in invoices)
File "/opt/odoo/odoo/openerp/fields.py", line 760, in __get__
self.determine_value(record)
File "/opt/odoo/odoo/openerp/fields.py", line 853, in determine_value
record._prefetch_field(self)
File "/opt/odoo/odoo/openerp/api.py", line 239, in wrapper
return new_api(self, *args, **kwargs)
File "/opt/odoo/odoo/openerp/models.py", line 3196, in _prefetch_field
result = records.read(list(fnames), load='_classic_write')
File "/opt/odoo/odoo/openerp/api.py", line 239, in wrapper
return new_api(self, *args, **kwargs)
File "/opt/odoo/odoo/openerp/models.py", line 3141, in read
self._read_from_database(stored)
File "/opt/odoo/odoo/openerp/api.py", line 239, in wrapper
return new_api(self, *args, **kwargs)
File "/opt/odoo/odoo/openerp/models.py", line 3292, in _read_from_database
res2 = self._columns[fs[0]].get(cr, self._model, ids, fs, user, context=context, values=result)
File "/opt/odoo/odoo/openerp/osv/fields.py", line 1361, in get
result = self._fnct(obj, cr, uid, ids, name, self._arg, context)
File "/opt/odoo/odoo/addons/account/report/account_invoice_report.py", line 40, in _compute_amounts_in_user_currency
currency_rate_id = currency_rate_obj.search(cr, uid, [('rate', '=', 1)], limit=1, context=context)[0]
IndexError: list index out of range
in the searching of currency_rate_id, the search function is getting an empty list and you are trying to select the first element from the empty list which causes the error
The solution is to add an exchange rate for the currency.
1 - Settings->Companies
2 - Edit your commpany
3 - Modify the Currency update configuration
4 - Add values for "Currencies to update" tab
Image 1
Image 2
Image 3

Odoo 8 error when trying to open product with multiple attributes

Our Odoo is version 8 and is running on Ubuntu.
When I try to open product which has multiple attributes (colours, sizes) I get KeyError: 57. Other simple products are OK.
Any idea what can cause this problem ?
here is complete traceback:
Odoo Server Error
Traceback (most recent call last):
File "/opt/odoo/odoo/openerp/http.py", line 530, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/opt/odoo/odoo/openerp/http.py", line 567, in dispatch
result = self._call_function(**self.params)
File "/opt/odoo/odoo/openerp/http.py", line 303, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo/odoo/openerp/service/model.py", line 113, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo/odoo/openerp/http.py", line 300, in checked_call
return self.endpoint(*a, **kw)
File "/opt/odoo/odoo/openerp/http.py", line 796, in __call__
return self.method(*args, **kw)
File "/opt/odoo/odoo/openerp/http.py", line 396, in response_wrap
response = f(*args, **kw)
File "/opt/odoo/odoo/addons/web/controllers/main.py", line 949, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/opt/odoo/odoo/addons/web/controllers/main.py", line 932, in _call_kw
records = getattr(request.session.model(model), method)(*args, **kwargs)
File "/opt/odoo/odoo/openerp/http.py", line 900, in proxy
result = meth(cr, request.uid, *args, **kw)
File "/opt/odoo/odoo/openerp/api.py", line 241, in wrapper
return old_api(self, *args, **kwargs)
File "/opt/odoo/odoo/openerp/models.py", line 3109, in read
result = BaseModel.read(records, fields, load=load)
File "/opt/odoo/odoo/openerp/api.py", line 239, in wrapper
return new_api(self, *args, **kwargs)
File "/opt/odoo/odoo/openerp/models.py", line 3141, in read
self._read_from_database(stored)
File "/opt/odoo/odoo/openerp/api.py", line 239, in wrapper
return new_api(self, *args, **kwargs)
File "/opt/odoo/odoo/openerp/models.py", line 3305, in _read_from_database
res2 = self._columns[f].get(cr, self._model, ids, f, user, context=context, values=result)
File "/opt/odoo/odoo/openerp/osv/fields.py", line 1361, in get
result = self._fnct(obj, cr, uid, ids, name, self._arg, context)
File "/opt/odoo/odoo/addons/sale/sale.py", line 1283, in _sales_count
res[template.id] = sum([p.sales_count for p in template.product_variant_ids])
File "/opt/odoo/odoo/openerp/fields.py", line 760, in __get__
self.determine_value(record)
File "/opt/odoo/odoo/openerp/fields.py", line 853, in determine_value
record._prefetch_field(self)
File "/opt/odoo/odoo/openerp/api.py", line 239, in wrapper
return new_api(self, *args, **kwargs)
File "/opt/odoo/odoo/openerp/models.py", line 3196, in _prefetch_field
result = records.read(list(fnames), load='_classic_write')
File "/opt/odoo/odoo/openerp/api.py", line 239, in wrapper
return new_api(self, *args, **kwargs)
File "/opt/odoo/odoo/openerp/models.py", line 3141, in read
self._read_from_database(stored)
File "/opt/odoo/odoo/openerp/api.py", line 239, in wrapper
return new_api(self, *args, **kwargs)
File "/opt/odoo/odoo/openerp/models.py", line 3308, in _read_from_database
vals[f] = res2[vals['id']]
KeyError: 57
I got same error like your log, but I don't know your code details. You should check field type.
In my case, I used field function.
I was make mistaken like below:
rec = obj.browse(cr,...)
result = {}
# result[id] = val # wrong
result[rec.id] = val # correct
I hope this helps..