itpp-labs / sync-addons Goto Github PK
View Code? Open in Web Editor NEW**Sync 🪬 Studio**
Home Page: https://t.me/sync_studio
**Sync 🪬 Studio**
Home Page: https://t.me/sync_studio
This allows to avoid using dynamic relation name like this one:
model_rel = TG_CHAT_MODEL_REL + params.CHAT_MODEL
record_model_link = get_link(model_rel, telegram_user_ref)
if not record_model_link:
# ...
record_model.set_link(model_rel, telegram_user_ref, sync_date=None, allow_many2many=False)
Instead, we can add new parameter model
to get_link
Customer's feedback:
If you can create documentation, please add more description on fields in Models screen :
Call Public methods via API --> not clear
Restrict Public methods --> not clear
Allow Private methods --> not clear
Also many of the steps in the documentation are not obvious and are confusing, at least in 13.0.
We should add an example of using api applying curl.
Using demo data I tried to get model's fields with this request:
curl -X PATCH "http://example.com/api/v1/demo/res.partner/call/search_read" -H "accept: application/json" \ -H "authorization: Basic b3BlbmFwaTpiNmQ1NDA1YS0zMWU3LTQ3MjEtYTQyOC0xMmU1OTYzMTYyYzY=" -H "Content-Type: application/json" \ -d "{ \"args\": [[[\"is_company\", \"=\", \"True\" ]]]}"
And got this:
Traceback (most recent call last):
File "/mnt/addons/sync-addons/openapi/controllers/pinguin.py", line 112, in successful_response
response = json.dumps(data.ids)
AttributeError: 'list' object has no attribute 'ids'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/mnt/addons/sync-addons/openapi/controllers/pinguin.py", line 369, in controller_method_wrapper
response = controller_method(*iargs, **ikwargs)
File "/mnt/addons/sync-addons/openapi/controllers/api.py", line 203, in call_method_multi__PATCH
success_code=pinguin.CODE__success,
File "/mnt/addons/sync-addons/openapi/controllers/pinguin.py", line 691, in wrap__resource__call_method
return successful_response(success_code, data=results)
File "/mnt/addons/sync-addons/openapi/controllers/pinguin.py", line 114, in successful_response
response = json.dumps(data) if data else None
File "/usr/local/lib/python3.7/dist-packages/simplejson/__init__.py", line 395, in dumps
return _default_encoder.encode(obj)
File "/usr/local/lib/python3.7/dist-packages/simplejson/encoder.py", line 298, in encode
chunks = list(chunks)
File "/usr/local/lib/python3.7/dist-packages/simplejson/encoder.py", line 684, in _iterencode
for chunk in _iterencode_list(o, _current_indent_level):
File "/usr/local/lib/python3.7/dist-packages/simplejson/encoder.py", line 531, in _iterencode_list
for chunk in chunks:
File "/usr/local/lib/python3.7/dist-packages/simplejson/encoder.py", line 652, in _iterencode_dict
for chunk in chunks:
File "/usr/local/lib/python3.7/dist-packages/simplejson/encoder.py", line 716, in _iterencode
o = _default(o)
File "/usr/local/lib/python3.7/dist-packages/simplejson/encoder.py", line 273, in default
o.class.name)
TypeError: Object of type datetime is not JSON serializable
This error occurs due to the fact that since odoo 12.0 datetime fields have ceased to be strings
need to fix somewhere here:
12.0: https://github.com/itpp-labs/sync-addons/blob/12.0/openapi/controllers/pinguin.py#L1045-L1064
13.0: https://github.com/itpp-labs/sync-addons/blob/13.0/base_api/lib/pinguin.py#L326-L348
Whenever I use a one2many I seem to be stuck on:
can't adapt type 'dict'
This is the json I use:```
{
"name": "Stock Count",
"line_ids": [
{
"product_id": 1513,
"location_id": 541,
"inventory_id": 1
}
],
"state": "confirm",
"start_empty": "True"
}
I want to create a stock inventory with new lines in the same post.
Steps to reproduce the issue:
Expected behavior: be able to unsubscribe from the channel
Impacted versions: 11, 12, 13
s/run/button_start
sync-addons/sync/views/sync_task_views.xml
Lines 151 to 156 in 8d5fbb3
Some examples:
Request from Joel Willis (who does not have permission to read fields):
curl -X GET "http://localhost/api/v1/demo/res.partner/1" -H "accept: application/json" \ -H "authorization: Basic b3BlbmFwaTpmMTY3OTlhMC1hNWNlLTRjNTYtOTQ5ZC02YWE3NmY2OTAzYmQ="
The answer is 500 Internal Server Error
It was also noted that the responses do not meet the specifications of Openapi
повторное исправление https://github.com/trojikman/sync-addons/commit/f7beb3b5ef9bc6060d96dba744d2f412d962449a , т.к. после форвардпортирование то обновление пропало mentalko@3c27113
Steps to reproduce the error:
Administration/Settings
access rightsIf we try to send the message via the user with Administration/Settings
access rights we'll get this error:
Odoo Server Error
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/usr/lib/python3/dist-packages/odoo/http.py", line 683, in dispatch
result = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 359, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 347, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 912, in __call__
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 531, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1377, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1369, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 396, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 383, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_channel.py", line 416, in message_post
message = super(Channel, self.with_context(mail_create_nosubscribe=True)).message_post(message_type=message_type, moderation_status=moderation_status, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 1888, in message_post
self._notify_thread(new_message, values, **notif_kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_channel.py", line 542, in _notify_thread
super(Channel, self)._notify_thread(message, msg_vals=msg_vals, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/sms/models/mail_thread.py", line 236, in _notify_thread
recipients_data = super(MailThread, self)._notify_thread(message, msg_vals=msg_vals, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 2135, in _notify_thread
self._notify_record_by_inbox(message, rdata, msg_vals=msg_vals, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/mail/models/mail_thread.py", line 2153, in _notify_record_by_inbox
message.write({'channel_ids': [(6, 0, channel_ids)]})
File "/usr/lib/python3/dist-packages/odoo/addons/base_automation/models/base_automation.py", line 348, in write
action._process(records, domain_post=domain_post)
File "/usr/lib/python3/dist-packages/odoo/addons/base_automation/models/base_automation.py", line 273, in _process
raise e
File "/usr/lib/python3/dist-packages/odoo/addons/base_automation/models/base_automation.py", line 270, in _process
self.action_server_id.sudo().with_context(**ctx).run()
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions.py", line 629, in run
res = runner(run_self, eval_context=eval_context)
File "/usr/lib/python3/dist-packages/odoo/addons/website/models/ir_actions.py", line 61, in _run_action_code_multi
res = super(ServerAction, self)._run_action_code_multi(eval_context)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_actions.py", line 498, in _run_action_code_multi
safe_eval(self.code.strip(), eval_context, mode="exec", nocopy=True) # nocopy allows to return 'action'
File "/usr/lib/python3/dist-packages/odoo/tools/safe_eval.py", line 346, in safe_eval
raise ValueError('%s: "%s" while evaluating\n%r' % (ustr(type(e)), ustr(e), expr))
Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 639, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 315, in _handle_exception
raise exception.with_traceback(None) from new_cause
ValueError: <class 'ValueError'>: "<class 'telegram.error.Unauthorized'>: "Forbidden: bot was blocked by the user" while evaluating
'\ndef handle_db(records):\n # records are instances of mail.message\n for mail_message in records:\n for channel in mail_message.channel_ids:\n if channel.channel_type != \'telegram\':\n continue\n channel_link = channel.search_links(TG_CHAT_CHANNEL_REL)\n if not channel_link:\n continue\n\n telegram_user_ref = channel_link.external\n #channel_link = get_link(TG_CHAT_CHANNEL_REL, telegram_user_ref)\n\n if not mail_message.author_id.search_links(TG_PARTNER_REL) and mail_message.author_id.id != odoobot_id:\n log("MESSAGE from odoo: channel_id %s - author_id %s - attachment_ids: %s - message_text: %s" % (mail_message.res_id, mail_message.author_id.id, mail_message.attachment_ids, mail_message.body), LOG_DEBUG)\n\n if mail_message.body:\n message_html = "%s\\n\\n<i>%s</i>" % (mail_message.body, mail_message.author_id.name)\n telegram.sendMessage(telegram_user_ref, message_html, parse_mode=\'HTML\')\n\n if mail_message.attachment_ids:\n for attach in mail_message.attachment_ids:\n log("ATTACHMENT from odoo: attach.id %s - name %s" % (attach.name, attach.id), LOG_INFO)\n\n if attach.mimetype and "/" in attach.mimetype and attach.mimetype.split("/")[0] == "image":\n if attach.file_size < telegram.MAX_SIZE_IMAGE:\n telegram.sendPhoto(telegram_user_ref, attach.datas)\n else:\n channel.message_post(body="You cannot send more than 10 MB for photos.",\n author_id=odoobot_id, message_type="comment", subtype_xmlid="mail.mt_comment")\n else:\n if attach.file_size < telegram.MAX_SIZE_DOCUMENT:\n telegram.sendDocument(telegram_user_ref, attach.name, attach.datas)\n else:\n channel.message_post(body="You cannot send more than 50 MB for documents.",\n author_id=odoobot_id, message_type="comment", subtype_xmlid="mail.mt_comment")\n\n\n\n \nEXECUTION_RESULT_ = handle_db(*EXECUTION_ARGS_, **EXECUTION_KWARGS_)\n '" while evaluating
'env["sync.trigger.automation"].browse(4).sudo().start(records)'
Expected behavior: in cases when the user blocks the Bot in Odoo we need to understand what's happened without any errors
Steps to reproduce:
Sync Projects
Available Tasks
tab and Add a lineAvalable Triggers
tabWebhooks
section add a new line and get the following error:Error:
Odoo Server Error
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 237, in _dispatch
result = request.dispatch()
File "/usr/lib/python3/dist-packages/odoo/http.py", line 683, in dispatch
result = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 359, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 347, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 912, in __call__
return self.method(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 531, in response_wrap
response = f(*args, **kw)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1377, in call_kw
return self._call_kw(model, method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/addons/web/controllers/main.py", line 1369, in _call_kw
return call_kw(request.env[model], method, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 396, in call_kw
result = _call_kw_multi(method, model, args, kwargs)
File "/usr/lib/python3/dist-packages/odoo/api.py", line 383, in _call_kw_multi
result = method(recs, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 6242, in onchange
snapshot1 = Snapshot(record, nametree)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 6047, in __init__
self.fetch(name)
File "/usr/lib/python3/dist-packages/odoo/models.py", line 6057, in fetch
self[name] = record[name]
File "/usr/lib/python3/dist-packages/odoo/models.py", line 5664, in __getitem__
return self._fields[key].__get__(self, type(self))
File "/usr/lib/python3/dist-packages/odoo/fields.py", line 1024, in __get__
raise ValueError("Compute method failed to assign %s.%s" % (record, self.name))
Exception
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/odoo/http.py", line 639, in _handle_exception
return super(JsonRequest, self)._handle_exception(exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 315, in _handle_exception
raise exception.with_traceback(None) from new_cause
ValueError: Compute method failed to assign sync.trigger.webhook(<NewId 0x7f1ab22040f0>,).website_url
Affected versions: the error experienced in 14.0 but we need previous versions after fixing it in 14.0
OpenAPI 13.0.1.2.1
Log Requests = Short
curl -X PATCH "http://demo.server.info/api/v1/demo/res.partner/call/search_read_nested" -H "accept: application/json" -H "authorization: Basic YWRtaW46YTg2NTQwYzYtYWMyZC00NzVhLTgyNzYtNzFhY2MxMTUzYjQ5" -H "Content-Type: application/json" -d "{ "args": [[["id", ">", "0"]], [ "name","id" ] ]}"
<title>500 Internal Server Error</title>The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
2020-09-16 07:29:41,182 13 ERROR demo odoo.addons.openapi.controllers.apijsonrequest: Exception during JSON request handling.
Traceback (most recent call last):
File "/mnt/extra-addons/openapi/controllers/apijsonrequest.py", line 108, in _handle_exception
return super(ApiJsonRequest, self)._handle_exception(exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 310, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 14, in reraise
raise value
File "/mnt/extra-addons/openapi/controllers/apijsonrequest.py", line 159, in dispatch
result = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 350, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 339, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 915, in call
return self.method(*args, **kw)
File "/mnt/extra-addons/openapi/controllers/apijsonrequest.py", line 200, in response_wrap
response = f(*args, **kw)
File "/mnt/extra-addons/openapi/controllers/pinguin.py", line 386, in controller_method_wrapper
create_log_record(**data_for_log)
File "/mnt/extra-addons/openapi/controllers/pinguin.py", line 284, in create_log_record
_create_log_record(env, **kwargs)
File "/mnt/extra-addons/openapi/controllers/pinguin.py", line 323, in _create_log_record
del log_data["request_data"][k]
KeyError: 'form'
2020-09-16 07:29:41,184 13 ERROR demo odoo.addons.openapi.controllers.apijsonrequest: Exception during JSON request handling.
Traceback (most recent call last):
File "/mnt/extra-addons/openapi/controllers/apijsonrequest.py", line 108, in _handle_exception
return super(ApiJsonRequest, self)._handle_exception(exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 310, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 14, in reraise
raise value
File "/mnt/extra-addons/openapi/controllers/apijsonrequest.py", line 159, in dispatch
result = self._call_function(**self.params)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 350, in _call_function
return checked_call(self.db, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/service/model.py", line 94, in wrapper
return f(dbname, *args, **kwargs)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 339, in checked_call
result = self.endpoint(*a, **kw)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 915, in call
return self.method(*args, **kw)
File "/mnt/extra-addons/openapi/controllers/apijsonrequest.py", line 200, in response_wrap
response = f(*args, **kw)
File "/mnt/extra-addons/openapi/controllers/pinguin.py", line 386, in controller_method_wrapper
create_log_record(**data_for_log)
File "/mnt/extra-addons/openapi/controllers/pinguin.py", line 284, in create_log_record
_create_log_record(env, **kwargs)
File "/mnt/extra-addons/openapi/controllers/pinguin.py", line 323, in _create_log_record
del log_data["request_data"][k]
KeyError: 'form'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/mnt/extra-addons/openapi/controllers/apijsonrequest.py", line 108, in _handle_exception
return super(ApiJsonRequest, self)._handle_exception(exception)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 310, in _handle_exception
raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
File "/usr/lib/python3/dist-packages/odoo/tools/pycompat.py", line 14, in reraise
raise value
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 229, in _dispatch
result = request.dispatch()
File "/mnt/extra-addons/openapi/controllers/apijsonrequest.py", line 181, in dispatch
return self._handle_exception(e)
File "/mnt/extra-addons/openapi/controllers/apijsonrequest.py", line 121, in _handle_exception
"code": exception.response.status_code,
AttributeError: 'KeyError' object has no attribute 'response'
2020-09-16 07:29:41,191 13 INFO demo werkzeug: 172.17.0.1 - - [16/Sep/2020 07:29:41] "PATCH /api/v1/demo/res.partner/call/search_read_nested HTTP/1.0" 500 - 28 0.043 0.067
2020-09-16 07:29:41,198 13 ERROR demo werkzeug: Error on request:
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 270, in run_wsgi
execute(self.server.app)
File "/usr/lib/python3/dist-packages/werkzeug/serving.py", line 258, in execute
application_iter = app(environ, start_response)
File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 142, in application
return application_unproxied(environ, start_response)
File "/usr/lib/python3/dist-packages/odoo/service/wsgi_server.py", line 117, in application_unproxied
result = odoo.http.root(environ, start_response)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 1287, in call
return self.dispatch(environ, start_response)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 1257, in call
return self.app(environ, start_wrapped)
File "/usr/lib/python3/dist-packages/werkzeug/wsgi.py", line 766, in call
return self.app(environ, start_response)
File "/usr/lib/python3/dist-packages/odoo/http.py", line 1457, in dispatch
result = ir_http._dispatch()
File "/usr/lib/python3/dist-packages/odoo/addons/auth_signup/models/ir_http.py", line 19, in _dispatch
return super(Http, cls)._dispatch()
File "/usr/lib/python3/dist-packages/odoo/addons/web_editor/models/ir_http.py", line 21, in _dispatch
return super(IrHttp, cls)._dispatch()
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 233, in _dispatch
return cls._handle_exception(e)
File "/usr/lib/python3/dist-packages/odoo/addons/base/models/ir_http.py", line 201, in _handle_exception
return request._handle_exception(exception)
File "/mnt/extra-addons/openapi/controllers/apijsonrequest.py", line 121, in _handle_exception
"code": exception.response.status_code,
AttributeError: 'AttributeError' object has no attribute 'response' - - -
2
class SyncProjectReference(models.Model):
_name = "sync.project.odoo"
_description = "Project References"
_inherit = "sync.project.param.mixin"
def _selection_ref_model(self):
self.ensure_one()
return [(self.model_id.model, self.model_id.name)]
def _get_value_domain(self):
self.ensure_one()
domain = # TODO convert self.domain from string to real domain
return domain
model_id = fields.Many2one()
model_name = fields.Char(realted='model_id.model')
domain = fields.Char()
value = fields.Reference(string='Record', selection=_selection_ref_model, domain=lambda s: s._get_value_domain)
<field name="value" />
<field name="model_id" groups="base.group_no_one" />
<field name="model_name" invisible="1" />
<field name="domain" widget="domain" options="{'model': 'model_name', 'in_dialog': True}" groups="base.group_no_one"/>
usage example: specify User or Group via reference widget rather than just putting ID
sync-addons/sync/models/sync_link.py
Line 153 in 8fe0464
Could be replaced with:
links = self.search(domain)
odoo_links = links.filtered(lambda r: r.system1 == ODOO)
odoo_links_to_delete = odoo_links - odoo_links.exists()
if odoo_links_to_delete:
self._log("Delete obsolete links: {}".format([(link.odoo, link.relation, link.system2, link.ref2, link.date) for link in odoo_links_to_delete))
odoo_links = odoo_links - odoo_links_to_delete
The web editor sends requests directly from browser which leads to CORS error. The user must be aware of it. We need suggest him to copy-paste curl
command and ignore the inline error.
Additional thing to do is provide an instuction how to allows CORS requests. It should be settings on nginx side (plus a note that it's not available on odoo.sh), e.g.
location /api/v1 {
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
if ($request_method = 'POST') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
}
if ($request_method = 'GET') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
}
}
from https://serverfault.com/questions/162429/how-do-i-add-access-control-allow-origin-in-nginx
It should be either a separate file or just updating translation via xml:
https://odoo-development.readthedocs.io/en/latest/dev/translation/overwrite-translation.html
Proof of concept implementation.
The module should just sync list of products (names and photos), similar to sync_woo
Odoo version: 14.0
API: https://shopify.dev/api/admin
Python lib: https://github.com/Shopify/shopify_python_api#private-apps
Shopify is not opensource. You need to signup get a free trial:
https://github.com/itpp-labs/sync-addons/tree/14.0/sync#public-webhook-address
The module docs will be checked first! No docs = no way to check the module. The doc must have instruction how to get access token.
1. Different behavior between curl and Bravado
I have noticed the difference between sending PUT requests to API between curl
and python library Bravado, there will be different behavior because of specification flaw. And because bravado works according to specification it imposes a restriction on freedom of action and completeness of the user experience.
Example:
If we try to create new record via curl
we can fill in the x2many field by passing new record (like [0, 0, values]) but in case of using Bravado we can only pass record id.
What to do:
In this case, I'm not entirely sure which option is more correct but I think that everything should work the same in both cases.
2. Response codes don't meet specification (from #152)
Here are some examples:
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
From #216 we have to backport following updates:
Following updates are already in v12
Versions: 10,11,12
Error:
Odoo Warning - Access Error
Sorry, you are not allowed to access this document. Only users with the following access level are currently allowed to do that:
- OpenAPI/User
- OpenAPI/Manager
(Document model: openapi.namespace) - (Operation: read, User: 5)
Solution: hide block when a user doesn't have access
REF: APPS-40
Hi Guys,
I'm currently trying a different approach with graphql...
Just wanted to let you know. The challenges are the same, but by cutting through the Odoo server itself, a lot of things get easier...
It's growing here: https://github.com/xoe-labs/dodoo/blob/master/dodoo-run/README.md
Steps to reproduce:
Try to find a record existing in one instance applying search method like this:
curl -X PATCH "http://example.com/api/v1/demo/res.partner/call/search" -H "accept: application/json" -H "authorization: Basic b3BlbmFwaTpiNmQ1NDA1YS0zMWU3LTQ3MjEtYTQyOC0xMmU1OTYzMTYyYzY=" -H "Content-Type: application/json" -d "{ \"args\": [[[\"name\", \"=\", \"YourCompany\"]]]}"
you will not get any response
At this time in the odoo logs there are no errors or anything else strange
Built-in odoo groups use name "Administrator" for user with top access
The group should be also renamed in groups
This should be related: #131 (comment)
Version must be
git+https://github.com/python-telegram-bot/[email protected]
because latest doesn't work with python 3.5
odoo_1 | File "/opt/odoo/custom/src/odoo/odoo/modules/module.py", line 82, in load_module
odoo_1 | exec(open(modfile, 'rb').read(), new_mod.__dict__)
odoo_1 | File "<string>", line 3, in <module>
odoo_1 | File "/opt/odoo/auto/addons/sync/models/__init__.py", line 4, in <module>
odoo_1 | from . import sync_project_demo
odoo_1 | File "/opt/odoo/auto/addons/sync/models/sync_project_demo.py", line 10, in <module>
odoo_1 | from telegram import Bot, Update
odoo_1 | File "/usr/local/lib/python3.5/site-packages/telegram/__init__.py", line 21, in <module>
odoo_1 | from .base import TelegramObject
odoo_1 | File "/usr/local/lib/python3.5/site-packages/telegram/base.py", line 42
odoo_1 | _id_attrs: Tuple[Any, ...] = ()
The version must be set in DINAR https://github.com/itpp-labs/sync-addons/blob/13.0/.DINAR/image/dependencies/pip.txt
(v12 at least)
Plus we have to make a note in installation instruction of Sync Studio.
Ideally, we need to switch to this lib instead https://github.com/eternnoir/pyTelegramBotAPI
Either use sudo()
in create_log_record
or grant create
access.
Parameters/Secrets must not be updated on module upgrading.
Create new method create_empty_param(name, description, url, project_id)
On project exporting use the method:
<function model="sync.project.secret" name="create_empty_param" eval="('TRELLO_KEY', '', 'https://trello.com/app-key', ref('sync.trello-github_project'))" />
Currently following node is generated:
<record id="trello-key_project-secret-parameter" model="sync.project.secret">
<field name="key">TRELLO_KEY</field>
<field name="description" />
<field name="url" eval="'https://trello.com/app-key'" />
<field name="project_id" ref="sync.trello-github_project" />
</record>
Hi , not sure is the issue where i found that extra "\n" character at ikwargs , so after removed the extra characters
the openapi , read for multi/single is working again.
it was copy-pasted from sync
module, where telegram is demo and we don't require to installing telegram package
sync-addons/sync_telegram/models/sync_project.py
Lines 39 to 46 in a295cca
no need for try-block
no need to disable pylint
no need to put importing inside _eval_context_telegram
method.
sync-addons/sync_telegram/models/sync_project.py
Lines 35 to 37 in a295cca
sync-addons/sync_telegram/models/sync_project.py
Lines 50 to 53 in a295cca
Use this one instead https://github.com/eternnoir/pyTelegramBotAPI
The current lib is too heavy and we don't need all those features
Create an OpenAPI by demo
Make sure that only the demo user is allowed to use the OpenAPI.
Edit an OpenAPI by Admin
Result: admin and superuser loses access to the Apps and Settings menu
Sorry, you are not allowed to modify documents of type 'Integration' (openapi.namespace). This operation is allowed for the groups:
Sorry, you are not allowed to access documents of type 'Module' (ir.module.module). This operation is allowed for the groups:
currently only secrets are not exported
but other params shall not be exported too, because it'd override custom values on module upgrading
sync-addons/sync/views/sync_project_views.xml
Lines 31 to 43 in 787b45c
sync-addons/sync/views/sync_project_views.xml
Lines 125 to 128 in 787b45c
Hi,
i am using V12 , openapi module but
after installed and tried, it kept throwing ,
"OPTIONS /api/v1/my_test_namespace/res.users/1 HTTP/1.1" 405 - 2 0.008 0.016
not sure what went wrong, i have tried to put the openapi
at my config file in the server_wide_modules = ... , which is the same as load=
at command line right?
and module installed and configured but it seems that not working when
i tried at editor.swagger.io with the token copied from my
user's OpenAPI Token or at the integrations, Identification token.
appreciate any advice.
thanks.
Places for updates:
sync-addons/openapi/controllers/pinguin.py
Lines 683 to 684 in 4cba925
sync-addons/openapi/models/openapi_access.py
Lines 410 to 414 in 4cba925
Depends on #304
Idea is allowing to start POS from local server, push orders to local server, then push order from local server to main server. It could be useful when it's problematic to use main server directly because of connection issues.
As I understand we need these changes from 14.0:
Make a separate module similar to a demo project in sync
module
Eval context should have new methods similar to sync helpers https://github.com/itpp-labs/sync-addons/blob/e924974e60ba40fbc7b700a96b1d95b9932e3640/sync/doc/index.rst#sync-helpers
sync_odoo2odoo_push(model_name, domain=None, fields=None, active_test=True, create=False, update=False)
sync_odoo2odoo_pull(model_name, domain=None, fields=None, active_test=True, create=False, update=False)
create
: boolean value for "create record if it doesn't exist"update
: boolean value for "update record if it exists"domain
: which records of model_name
to syncfields
: which fields to syncactive_test
: value to pass to context on readingI want to use postman to test this endpoint ,but did not
find how to config it
When installing the module on a database with multiple users, all users get the same openapi_token which results in a singleton error when making an API call.
I think the openapi_token should get a unqiue contraint and in addition the token should be regenerated per user when getting the default token, or a token should only be created on request?
@aschenkels-ictstudio
sync
module from this PR #219I'm getting the following error in V14.
No Errors in the Logger
2021-06-01 11:08:45,375 11544 INFO ? werkzeug: 127.0.0.1 - - [01/Jun/2021 11:08:45] "OPTIONS /api/v1/mobile/res.partner HTTP/1.1" 405 - 1 0.003 0.006
Note: Configured the --load openapi,base,web and Authorization have done based on the Documentation.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.