Sales app not working


#1

See outcome:

Flectra Server Error

Traceback (most recent call last):
File “/opt/flectra/flectra/fields.py”, line 954, in get
value = record.env.cache.get(record, self)
File “/opt/flectra/flectra/api.py”, line 967, in get
value = self._data[key][field][record._ids[0]]
KeyError: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/opt/flectra/flectra/fields.py”, line 954, in get
value = record.env.cache.get(record, self)
File “/opt/flectra/flectra/api.py”, line 967, in get
value = self._data[key][field][record._ids[0]]
KeyError: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/opt/flectra/flectra/http.py”, line 653, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File “/opt/flectra/flectra/http.py”, line 312, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File “/opt/flectra/flectra/tools/pycompat.py”, line 87, in reraise
raise value
File “/opt/flectra/flectra/http.py”, line 695, in dispatch
result = self._call_function(**self.params)
File “/opt/flectra/flectra/http.py”, line 344, in _call_function
return checked_call(self.db, *args, **kwargs)
File “/opt/flectra/flectra/service/model.py”, line 97, in wrapper
return f(dbname, *args, **kwargs)
File “/opt/flectra/flectra/http.py”, line 337, in checked_call
result = self.endpoint(*a, **kw)
File “/opt/flectra/flectra/http.py”, line 939, in call
return self.method(*args, **kw)
File “/opt/flectra/flectra/http.py”, line 517, in response_wrap
response = f(*args, **kw)
File “/opt/flectra/flectra/addons/web/controllers/main.py”, line 1094, in call_button
action = self._call_kw(model, method, args, {})
File “/opt/flectra/flectra/addons/web/controllers/main.py”, line 1082, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File “/opt/flectra/flectra/api.py”, line 689, in call_kw
return call_kw_multi(method, model, args, kwargs)
File “/opt/flectra/flectra/api.py”, line 680, in call_kw_multi
result = method(recs, *args, **kwargs)
File “”, line 2, in button_immediate_install
File “/opt/flectra/flectra/addons/base/module/module.py”, line 74, in check_and_log
return method(self, *args, **kwargs)
File “/opt/flectra/flectra/addons/base/module/module.py”, line 468, in button_immediate_install
return self._button_immediate_function(type(self).button_install)
File “/opt/flectra/flectra/addons/base/module/module.py”, line 570, in _button_immediate_function
modules.registry.Registry.new(self._cr.dbname, update_module=True)
File “/opt/flectra/flectra/modules/registry.py”, line 85, in new
flectra.modules.load_modules(registry._db, force_demo, status, update_module)
File “/opt/flectra/flectra/modules/loading.py”, line 380, in load_modules
loaded_modules, update_module, models_to_check)
File “/opt/flectra/flectra/modules/loading.py”, line 274, in load_marked_modules
perform_checks=perform_checks, models_to_check=models_to_check
File “/opt/flectra/flectra/modules/loading.py”, line 153, in load_module_graph
registry.init_models(cr, model_names, {‘module’: package.name})
File “/opt/flectra/flectra/modules/registry.py”, line 306, in init_models
model._auto_init()
File “/opt/flectra/flectra/models.py”, line 2220, in _auto_init
new = field.update_db(self, columns)
File “/opt/flectra/flectra/fields.py”, line 1961, in update_db
return super(Many2one, self).update_db(model, columns)
File “/opt/flectra/flectra/fields.py”, line 859, in update_db
self.update_db_notnull(model, column)
File “/opt/flectra/flectra/fields.py”, line 899, in update_db_notnull
model._init_column(self.name)
File “/opt/flectra/flectra/addons/account/models/account_invoice.py”, line 566, in _init_column
super(AccountInvoice, self)._init_column(column_name)
File “/opt/flectra/flectra/models.py”, line 2137, in _init_column
value = field.default(self)
File “/opt/flectra/flectra/addons/sale/models/account_invoice.py”, line 13, in _get_default_team
return self.env[‘crm.team’]._get_default_team_id()
File “/opt/flectra/flectra/addons/sales_team/models/crm_team.py”, line 27, in _get_default_team_id
company_id = self.sudo(user_id).env.user.company_id.id
File “/opt/flectra/flectra/fields.py”, line 958, in get
self.determine_value(record)
File “/opt/flectra/flectra/fields.py”, line 1059, in determine_value
record._prefetch_field(self)
File “/opt/flectra/flectra/models.py”, line 2653, in _prefetch_field
result = records.read([f.name for f in fs], load=’_classic_write’)
File “/opt/flectra/flectra/addons/base_branch_company/models/res_branch.py”, line 100, in read
self.with_context({‘check_branch’: True}).check_missing_branch()
File “/opt/flectra/flectra/addons/base_branch_company/models/res_branch.py”, line 106, in check_missing_branch
if self._context.get(‘check_branch’, False) and user_id.company_id.branch_id and not user_id.default_branch_id:
File “/opt/flectra/flectra/fields.py”, line 958, in get
self.determine_value(record)
File “/opt/flectra/flectra/fields.py”, line 1059, in determine_value
record._prefetch_field(self)
File “/opt/flectra/flectra/models.py”, line 2653, in _prefetch_field
result = records.read([f.name for f in fs], load=’_classic_write’)
File “/opt/flectra/flectra/models.py”, line 2591, in read
self._read_from_database(stored, inherited)
File “/opt/flectra/flectra/models.py”, line 2718, in _read_from_database
cr.execute(query_str, params)
File “/opt/flectra/flectra/sql_db.py”, line 156, in wrapper
return f(self, *args, **kwargs)
File “/opt/flectra/flectra/sql_db.py”, line 233, in execute
res = self._obj.execute(query, params)
psycopg2.ProgrammingError: column res_company.sale_note does not exist
LINE 1: …company".“company_registry” as “company_registry”,"res_compa…
^


#2

I have a lot of such messages. I try to understand and correct. This is a working condition when you try to remake something for yourself.
From your message almost nothing is clear. Maybe you changed something. It’s hard to determine. As a rule, a description of the actions that lead to this error helps.


#3

to begin with, this error “psycopg2.ProgrammingError: column res_company.sale_note does not exist”
you could have included the py (model) xml (views) , that way its easier to get an answer


#4

I am getting the exact same error on a brand new installation.

column res_company.sale_note does not exist

Below I have pasted the full stack trace.

Error:
Flectra Server Error

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/flectra/fields.py", line 954, in __get__
    value = record.env.cache.get(record, self)
  File "/usr/lib/python3/dist-packages/flectra/api.py", line 967, in get
    value = self._data[key][field][record._ids[0]]
KeyError: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/flectra/fields.py", line 954, in __get__
    value = record.env.cache.get(record, self)
  File "/usr/lib/python3/dist-packages/flectra/api.py", line 967, in get
    value = self._data[key][field][record._ids[0]]
KeyError: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/flectra/http.py", line 653, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/usr/lib/python3/dist-packages/flectra/http.py", line 312, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/usr/lib/python3/dist-packages/flectra/tools/pycompat.py", line 87, in reraise
    raise value
  File "/usr/lib/python3/dist-packages/flectra/http.py", line 695, in dispatch
    result = self._call_function(**self.params)
  File "/usr/lib/python3/dist-packages/flectra/http.py", line 344, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/flectra/service/model.py", line 97, in wrapper
    return f(dbname, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/flectra/http.py", line 337, in checked_call
    result = self.endpoint(*a, **kw)
  File "/usr/lib/python3/dist-packages/flectra/http.py", line 939, in __call__
    return self.method(*args, **kw)
  File "/usr/lib/python3/dist-packages/flectra/http.py", line 517, in response_wrap
    response = f(*args, **kw)
  File "/usr/lib/python3/dist-packages/flectra/addons/web/controllers/main.py", line 1094, in call_button
    action = self._call_kw(model, method, args, {})
  File "/usr/lib/python3/dist-packages/flectra/addons/web/controllers/main.py", line 1082, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/usr/lib/python3/dist-packages/flectra/api.py", line 689, in call_kw
    return call_kw_multi(method, model, args, kwargs)
  File "/usr/lib/python3/dist-packages/flectra/api.py", line 680, in call_kw_multi
    result = method(recs, *args, **kwargs)
  File "<decorator-gen-42>", line 2, in button_immediate_install
  File "/usr/lib/python3/dist-packages/flectra/addons/base/module/module.py", line 74, in check_and_log
    return method(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/flectra/addons/base/module/module.py", line 468, in button_immediate_install
    return self._button_immediate_function(type(self).button_install)
  File "/usr/lib/python3/dist-packages/flectra/addons/base/module/module.py", line 570, in _button_immediate_function
    modules.registry.Registry.new(self._cr.dbname, update_module=True)
  File "/usr/lib/python3/dist-packages/flectra/modules/registry.py", line 85, in new
    flectra.modules.load_modules(registry._db, force_demo, status, update_module)
  File "/usr/lib/python3/dist-packages/flectra/modules/loading.py", line 380, in load_modules
    loaded_modules, update_module, models_to_check)
  File "/usr/lib/python3/dist-packages/flectra/modules/loading.py", line 274, in load_marked_modules
    perform_checks=perform_checks, models_to_check=models_to_check
  File "/usr/lib/python3/dist-packages/flectra/modules/loading.py", line 153, in load_module_graph
    registry.init_models(cr, model_names, {'module': package.name})
  File "/usr/lib/python3/dist-packages/flectra/modules/registry.py", line 306, in init_models
    model._auto_init()
  File "/usr/lib/python3/dist-packages/flectra/models.py", line 2220, in _auto_init
    new = field.update_db(self, columns)
  File "/usr/lib/python3/dist-packages/flectra/fields.py", line 1961, in update_db
    return super(Many2one, self).update_db(model, columns)
  File "/usr/lib/python3/dist-packages/flectra/fields.py", line 859, in update_db
    self.update_db_notnull(model, column)
  File "/usr/lib/python3/dist-packages/flectra/fields.py", line 899, in update_db_notnull
    model._init_column(self.name)
  File "/usr/lib/python3/dist-packages/flectra/addons/account/models/account_invoice.py", line 566, in _init_column
    super(AccountInvoice, self)._init_column(column_name)
  File "/usr/lib/python3/dist-packages/flectra/models.py", line 2137, in _init_column
    value = field.default(self)
  File "/usr/lib/python3/dist-packages/flectra/addons/sale/models/account_invoice.py", line 13, in _get_default_team
    return self.env['crm.team']._get_default_team_id()
  File "/usr/lib/python3/dist-packages/flectra/addons/sales_team/models/crm_team.py", line 27, in _get_default_team_id
    company_id = self.sudo(user_id).env.user.company_id.id
  File "/usr/lib/python3/dist-packages/flectra/fields.py", line 958, in __get__
    self.determine_value(record)
  File "/usr/lib/python3/dist-packages/flectra/fields.py", line 1059, in determine_value
    record._prefetch_field(self)
  File "/usr/lib/python3/dist-packages/flectra/models.py", line 2653, in _prefetch_field
    result = records.read([f.name for f in fs], load='_classic_write')
  File "/usr/lib/python3/dist-packages/flectra/addons/base_branch_company/models/res_branch.py", line 100, in read
    self.with_context({'check_branch': True}).check_missing_branch()
  File "/usr/lib/python3/dist-packages/flectra/addons/base_branch_company/models/res_branch.py", line 106, in check_missing_branch
    if self._context.get('check_branch', False) and user_id.company_id.branch_id and not user_id.default_branch_id:
  File "/usr/lib/python3/dist-packages/flectra/fields.py", line 958, in __get__
    self.determine_value(record)
  File "/usr/lib/python3/dist-packages/flectra/fields.py", line 1059, in determine_value
    record._prefetch_field(self)
  File "/usr/lib/python3/dist-packages/flectra/models.py", line 2653, in _prefetch_field
    result = records.read([f.name for f in fs], load='_classic_write')
  File "/usr/lib/python3/dist-packages/flectra/models.py", line 2591, in read
    self._read_from_database(stored, inherited)
  File "/usr/lib/python3/dist-packages/flectra/models.py", line 2718, in _read_from_database
    cr.execute(query_str, params)
  File "/usr/lib/python3/dist-packages/flectra/sql_db.py", line 156, in wrapper
    return f(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/flectra/sql_db.py", line 233, in execute
    res = self._obj.execute(query, params)
psycopg2.ProgrammingError: column res_company.sale_note does not exist
LINE 1: ...t_setup_bar_closed" as "account_setup_bar_closed","res_compa...
                                                             ^

#5

I got it to work my manually adding the sale_note column as type text to the res_companies table.