Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

contract.contract._create_build #129

Open
killday opened this issue Jun 7, 2022 · 6 comments
Open

contract.contract._create_build #129

killday opened this issue Jun 7, 2022 · 6 comments

Comments

@killday
Copy link

killday commented Jun 7, 2022

I'm doing the scenario where user choose apps with try now. Database draft is created but contract creation is failing whit the following error:

Traceback (most recent call last):
File "/odoo14/odoo14-server/odoo/http.py", line 1470, in _dispatch_nodb
result = request.dispatch()
File "/odoo14/odoo14-server/odoo/http.py", line 808, in dispatch
r = self._call_function(**self.params)
File "/odoo14/odoo14-server/odoo/http.py", line 362, in _call_function
return self.endpoint(*args, **kwargs)
File "/odoo14/odoo14-server/odoo/http.py", line 914, in call
return self.method(*args, **kw)
File "/odoo14/odoo14-server/odoo/http.py", line 533, in response_wrap
response = f(*args, **kw)
File "/odoo14/custom/saas/queue_job/controllers/main.py", line 73, in runjob
self._try_perform_job(env, job)
File "/odoo14/custom/saas/queue_job/controllers/main.py", line 32, in _try_perform_job
job.perform()
File "/odoo14/custom/saas/queue_job/job.py", line 516, in perform
self.result = self.func(*tuple(self.args), **self.kwargs)
File "/odoo14/custom/saas/saas_apps_signup/models/contract_contract.py", line 163, in _create_build
build = template_operator.create_db(
File "/odoo14/custom/saas/saas/models/saas_template.py", line 232, in create_db
build.create_db(
File "/odoo14/custom/saas/saas/models/saas_db.py", line 32, in create_db
self.state = 'done'
File "/odoo14/odoo14-server/odoo/fields.py", line 1129, in set
records.write({self.name: write_value})
File "/odoo14/custom/saas/saas_limit_max_users/models/saas_db.py", line 26, in write
return super(SaasDb, self).write(vals)
File "/odoo14/custom/saas/saas_domain_names/models/saas_db.py", line 39, in write
res = super(SaasDb, self).write(vals)
File "/odoo14/custom/saas/saas_build_admin/models/saas_db.py", line 21, in write
return super(SaasDb, self).write(vals)
File "/odoo14/custom/saas/saas/models/saas_db.py", line 59, in write
self.refresh_data()
File "/odoo14/custom/saas/saas/models/saas_db.py", line 66, in refresh_data
vals = record.read_values_from_build()
File "/odoo14/custom/saas/saas_apps_signup/models/saas_db.py", line 36, in read_values_from_build
vals = super(SaasDb, self).read_values_from_build()
File "/odoo14/custom/saas/saas_limit_max_users/models/saas_db.py", line 59, in read_values_from_build
users_count=self.execute_kw(
File "/odoo14/custom/saas/saas/models/saas_db.py", line 80, in execute_kw
return self.operator_id.build_execute_kw(self, model, method, args, kwargs)
File "/odoo14/custom/saas/saas/models/saas_operator.py", line 148, in build_execute_kw
return self._build_execute_kw(build.name, model, method, args, kwargs)
File "/odoo14/custom/saas/saas_operator_remote/models/saas_operator.py", line 98, in _build_execute_kw
return super(SaasOperator, self)._build_execute_kw(
File "/odoo14/custom/saas/saas/models/saas_operator.py", line 142, in _build_execute_kw
return cluster.execute_kw(db_name, model, method, args, kwargs)
File "/odoo14/custom/saas/saas_cluster_simple/main.py", line 124, in execute_kw
return execute(db_name, SUPERUSER_ID, model, method, *args, **kwargs)
File "/odoo14/odoo14-server/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/odoo14/odoo14-server/odoo/service/model.py", line 175, in execute
res = execute_cr(cr, uid, obj, method, *args, **kw)
File "/odoo14/odoo14-server/odoo/service/model.py", line 159, in execute_cr
result = odoo.api.call_kw(recs, method, args, kw)
File "/odoo14/odoo14-server/odoo/api.py", line 395, in call_kw
result = _call_kw_model(method, model, args, kwargs)
File "/odoo14/odoo14-server/odoo/api.py", line 368, in _call_kw_model
result = method(recs, *args, **kwargs)
File "/odoo14/odoo14-server/odoo/models.py", line 1685, in search_count
res = self.search(args, count=True)
File "/odoo14/odoo14-server/odoo/models.py", line 1708, in search
res = self._search(args, offset=offset, limit=limit, order=order, count=count)
File "/odoo14/odoo14-server/odoo/addons/base/models/res_users.py", line 539, in _search
return super(Users, self)._search(args, offset=offset, limit=limit, order=order, count=count,
File "/odoo14/odoo14-server/odoo/models.py", line 4514, in _search
query = self._where_calc(args)
File "/odoo14/odoo14-server/odoo/models.py", line 4270, in _where_calc
return expression.expression(domain, self).query
File "/odoo14/odoo14-server/odoo/osv/expression.py", line 442, in init
self.parse()
File "/odoo14/odoo14-server/odoo/osv/expression.py", line 654, in parse
raise ValueError("Invalid field %s.%s in leaf %s" % (model._name, path[0], str(leaf)))
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/werkzeug/serving.py", line 306, in run_wsgi
execute(self.server.app)
File "/usr/local/lib/python3.8/dist-packages/werkzeug/serving.py", line 294, in execute
application_iter = app(environ, start_response)
File "/odoo14/odoo14-server/odoo/service/server.py", line 441, in app
return self.app(e, s)
File "/odoo14/odoo14-server/odoo/service/wsgi_server.py", line 113, in application
return application_unproxied(environ, start_response)
File "/odoo14/odoo14-server/odoo/service/wsgi_server.py", line 88, in application_unproxied
result = odoo.http.root(environ, start_response)
File "/odoo14/odoo14-server/odoo/http.py", line 1307, in call
return self.dispatch(environ, start_response)
File "/odoo14/odoo14-server/odoo/http.py", line 1273, in call
return self.app(environ, start_wrapped)
File "/usr/local/lib/python3.8/dist-packages/werkzeug/middleware/shared_data.py", line 220, in call
return self.app(environ, start_response)
File "/odoo14/odoo14-server/odoo/http.py", line 1499, in dispatch
result = _dispatch_nodb()
File "/odoo14/odoo14-server/odoo/http.py", line 1472, in _dispatch_nodb
return request._handle_exception(e)
File "/odoo14/odoo14-server/odoo/http.py", line 746, in _handle_exception
return super(HttpRequest, self)._handle_exception(exception)
File "/odoo14/odoo14-server/odoo/http.py", line 317, in _handle_exception
raise exception.with_traceback(None) from new_cause
ValueError: Invalid field res.users.is_excluded_from_limiting in leaf ('is_excluded_from_limiting', '=', False) - - -

@killday
Copy link
Author

killday commented Jun 20, 2022

The problem is this code which I don't understand what it is doing as there is now field is_excluded_from_limiting in res_users (/saas_limit_max_users/models/saas_db.py", line 58):

vals.update(
            users_count=self.execute_kw(
                "res.users",
                "search_count",
                [(("is_excluded_from_limiting", "=", False))],
            )
        ) 

@glupeksha
Copy link

glupeksha commented Jun 22, 2022

I got this same error, might be from the same issue as in #117 .

Exception Information

Exception:ValueError
Traceback (most recent call last): File "/odoo/custom/queue/queue_job/controllers/main.py", line 107, in runjob self._try_perform_job(env, job) File "/odoo/custom/queue/queue_job/controllers/main.py", line 37, in _try_perform_job job.perform() File "/odoo/custom/queue/queue_job/job.py", line 520, in perform self.result = self.func(*tuple(self.args), **self.kwargs) File "/odoo/custom/saas-addons/saas/models/saas_db.py", line 32, in create_db self.state = 'done' File "/odoo/odoo-server/odoo/fields.py", line 1129, in set records.write({self.name: write_value}) File "/odoo/custom/saas-addons/saas_limit_max_users/models/saas_db.py", line 26, in write return super(SaasDb, self).write(vals) File "/odoo/custom/saas-addons/saas/models/saas_db.py", line 59, in write self.refresh_data() File "/odoo/custom/saas-addons/saas/models/saas_db.py", line 66, in refresh_data vals = record.read_values_from_build() File "/odoo/custom/saas-addons/saas_limit_max_users/models/saas_db.py", line 59, in read_values_from_build users_count=self.execute_kw( File "/odoo/custom/saas-addons/saas/models/saas_db.py", line 80, in execute_kw return self.operator_id.build_execute_kw(self, model, method, args, kwargs) File "/odoo/custom/saas-addons/saas/models/saas_operator.py", line 148, in build_execute_kw return self._build_execute_kw(build.name, model, method, args, kwargs) File "/odoo/custom/saas-addons/saas/models/saas_operator.py", line 142, in _build_execute_kw return cluster.execute_kw(db_name, model, method, args, kwargs) File "/odoo/custom/saas-addons/saas_cluster_simple/main.py", line 124, in execute_kw return execute(db_name, SUPERUSER_ID, model, method, *args, **kwargs) File "/odoo/odoo-server/odoo/service/model.py", line 94, in wrapper return f(dbname, *args, **kwargs) File "/odoo/odoo-server/odoo/service/model.py", line 175, in execute res = execute_cr(cr, uid, obj, method, *args, **kw) File "/odoo/odoo-server/odoo/service/model.py", line 159, in execute_cr result = odoo.api.call_kw(recs, method, args, kw) File "/odoo/odoo-server/odoo/api.py", line 395, in call_kw result = _call_kw_model(method, model, args, kwargs) File "/odoo/odoo-server/odoo/api.py", line 368, in _call_kw_model result = method(recs, *args, **kwargs) File "/odoo/odoo-server/odoo/models.py", line 1685, in search_count res = self.search(args, count=True) File "/odoo/odoo-server/odoo/models.py", line 1708, in search res = self._search(args, offset=offset, limit=limit, order=order, count=count) File "/odoo/odoo-server/odoo/addons/base/models/res_users.py", line 539, in _search return super(Users, self)._search(args, offset=offset, limit=limit, order=order, count=count, File "/odoo/odoo-server/odoo/models.py", line 4514, in _search query = self._where_calc(args) File "/odoo/odoo-server/odoo/models.py", line 4270, in _where_calc return expression.expression(domain, self).query File "/odoo/odoo-server/odoo/osv/expression.py", line 442, in init self.parse() File "/odoo/odoo-server/odoo/osv/expression.py", line 654, in parse raise ValueError("Invalid field %s.%s in leaf %s" % (model._name, path[0], str(leaf))) ValueError: Invalid field res.users.is_excluded_from_limiting in leaf ('is_excluded_from_limiting', '=', False)

Steps to recreate the above exception:

  1. Installed fresh odoo14 instance.
  2. Installed SaaS base.
  3. Followed SaaS base doc instructions and everything worked.
  4. Installed SaaS limit max users.
  5. Tried to create a build from the template.
  6. Got the above error.

Way to resolve it

  1. I deleted the failed build.
  2. Went to the template I created the build from.
  3. Click install missing modules button in the template database.
  4. Again created a build.
  5. Didn't get the above exception

@killday May be this will solve your problem.

@killday
Copy link
Author

killday commented Jun 22, 2022

Thank you very much for that but in my case, I don't use a template but apps. I will try your solution anyway. Thanks again

@killday
Copy link
Author

killday commented Jun 23, 2022

With a clean install, first error I get is:

Traceback (most recent call last):
File "/opt/odoo14/custom/auth_signup_verify_email/controllers/main.py", line 59, in passwordless_signup
sudo_users.signup(values, qcontext.get("token"))
File "/opt/odoo14/custom/saas_apps_signup/models/res_users.py", line 31, in signup
return self.signup_to_try(values, *args, **kwargs)
File "/opt/odoo14/custom/saas_apps_signup/models/res_users.py", line 43, in signup_to_try
operator_id = int(values.pop("operator_id"))
KeyError: 'operator_id'

My workaround for that is:

/saas_apps_signup/controllers/main.py

@route("/saas_apps_signup/make_database_for_trial", auth="public", type="http", website=True)
def make_database_for_trial(self, period, max_users_limit, database_name=None, installing_modules=None, saas_template_id=None,operator_id=None, **kw):
if operator_id == None:
template = request.env.ref("saas_apps.base_template")
operator_id = template._random_ready_operator_id()
print(operator_id)
print(template)
params = {
"max_users_limit": max_users_limit,
"period": period,
"installing_modules": installing_modules or "",
"saas_template_id": saas_template_id or "",
"operator_id":operator_id or "",
}

/saas_apps_signup/controllers/auth_signup.py

class Main(SignupVerifyEmail):
def get_auth_signup_qcontext(self):
values = request.params
d = super(Main, self).get_auth_signup_qcontext()
if "max_users_limit" in values:
d["installing_modules"] = values.get("installing_modules", "").split(",")
d["saas_template_id"] = values.get("saas_template_id", "")
d["max_users_limit"] = int(values.get("max_users_limit", 1))
d["period"] = values.get("period", "")
d["operator_id"] = values.get("operator_id")
d["sale_order_id"] = values.get("sale_order_id")
else:
return d

After that when I go for try now with apps the error is the one from this post and if I go for template I get:

Traceback (most recent call last):
File "/opt/odoo14/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/opt/odoo14/odoo/odoo/http.py", line 806, in dispatch
r = self._call_function(**self.params)
File "/opt/odoo14/odoo/odoo/http.py", line 359, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo14/odoo/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo14/odoo/odoo/http.py", line 347, in checked_call
result = self.endpoint(*a, **kw)
File "/opt/odoo14/odoo/odoo/http.py", line 912, in call
return self.method(*args, **kw)
File "/opt/odoo14/odoo/odoo/http.py", line 531, in response_wrap
response = f(*args, **kw)
File "/opt/odoo14/custom/auth_signup_verify_email/controllers/main.py", line 21, in web_auth_signup
return super().web_auth_signup(*args, **kw)
File "/opt/odoo14/odoo/odoo/http.py", line 531, in response_wrap
response = f(*args, **kw)
File "/opt/odoo14/odoo/addons/auth_signup/controllers/main.py", line 30, in web_auth_signup
qcontext = self.get_auth_signup_qcontext()
File "/opt/odoo14/custom/saas_apps_signup/controllers/auth_signup.py", line 37, in get_auth_signup_qcontext
assert not (d["installing_modules"] and d["saas_template_id"])
Exception

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/opt/odoo14/odoo/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/opt/odoo14/odoo/odoo/http.py", line 806, in dispatch
r = self._call_function(**self.params)
File "/opt/odoo14/odoo/odoo/http.py", line 359, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/opt/odoo14/odoo/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/opt/odoo14/odoo/odoo/http.py", line 347, in checked_call
result = self.endpoint(*a, **kw)
File "/opt/odoo14/odoo/odoo/http.py", line 912, in call
return self.method(*args, **kw)
File "/opt/odoo14/odoo/odoo/http.py", line 531, in response_wrap
response = f(*args, **kw)
File "/opt/odoo14/custom/auth_signup_verify_email/controllers/main.py", line 21, in web_auth_signup
return super().web_auth_signup(*args, **kw)
File "/opt/odoo14/odoo/odoo/http.py", line 531, in response_wrap
response = f(*args, **kw)
File "/opt/odoo14/odoo/addons/auth_signup/controllers/main.py", line 30, in web_auth_signup
qcontext = self.get_auth_signup_qcontext()
File "/opt/odoo14/custom/saas_apps_signup/controllers/auth_signup.py", line 37, in get_auth_signup_qcontext
assert not (d["installing_modules"] and d["saas_template_id"])
AssertionError

@killday
Copy link
Author

killday commented Jul 31, 2022

Hi @glupeksha ,

Did you manage to fix the sign in process and build creation from the website frontend?

@glupeksha
Copy link

glupeksha commented Aug 9, 2022

@killday Yeah, it worked. This is how I solved the problem #132 . But not sure whether it is correct or not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants