itpp-labs/sync-addons

issue for starting the Demo Odoo2Odoo integration

Closed this issue · 1 comments

tried the odoo sync studio (odoo2odoo demo), but was facing the following error,

Traceback (most recent call last):
File "/Users/admin/openerp/oe_v14c/odoo/tools/safe_eval.py", line 330, in safe_eval
return unsafe_eval(c, globals_dict, locals_dict)
File "", line 43, in
File "", line 8, in create_external_partners
File "/Users/admin/openerp/oe_v14_test_addons/sync/models/sync_project_demo.py", line 62, in odoo_execute_kw
json.dumps([method, args, kwargs]),
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/init.py", line 231, in dumps
return _default_encoder.encode(obj)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 199, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 257, in iterencode
return _iterencode(o, 0)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/encoder.py", line 179, in default
raise TypeError(f'Object of type {o.class.name} '
TypeError: Object of type bytes is not JSON serializable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/admin/openerp/oe_v14_test_addons/sync/models/sync_task.py", line 135, in run
result = self.eval(code, function, args, kwargs, eval_context)
File "/Users/admin/openerp/oe_v14_test_addons/sync/models/sync_task.py", line 165, in eval
code, eval_context, mode="exec", nocopy=True
File "/Users/admin/openerp/oe_v14c/odoo/tools/safe_eval.py", line 346, in safe_eval
raise ValueError('%s: "%s" while evaluating\n%r' % (ustr(type(e)), ustr(e), expr))
ValueError: <class 'TypeError'>: "Object of type bytes is not JSON serializable" while evaluating
'\n\ndef create_external_partners(partners, name_prefix=""):\n for partner in partners:\n vals = partner2vals(partner)\n if name_prefix:\n vals["name"] = name_prefix + " " + vals["name"]\n external_partner_id = odoo_execute_kw("res.partner", "create", vals)\n res = odoo_execute_kw("res.partner", "read", [external_partner_id], fields=["create_date"])\n sync_date = res[0]["create_date"]\n partner.set_link(PARTNER_REL, external_partner_id, sync_date)\n\ndef handle_db(records):\n # records are instances of created res.partner\n create_external_partners(records)\n\ndef handle_button():\n # PUSH_ALL_LOCAL_PARTNERS\n chunk = None\n CHUNK_SIZE = 10\n def process_chunk(chunk):\n add_job("create_external_partners")(chunk, name_prefix=texts.UPLOAD_ALL_PARTNER_PREFIX)\n\n #EGL(kalmen)\n for r in env["res.partner"].search([('name','like','sync-cust1')]):\n # check that record is not created yet\n link = r.search_links(PARTNER_REL)\n if link:\n # object already exists\n continue\n\n if not chunk:\n chunk = r\n else:\n chunk |= r\n if len(chunk) == CHUNK_SIZE:\n process_chunk(chunk)\n chunk = None\n if chunk:\n process_chunk(chunk)\n\n \nEXECUTION_RESULT
= create_external_partners(*EXECUTION_ARGS
, **EXECUTION_KWARGS_)\n '

Demo Odoo2odoo Integration for Odoo Sync Studio is setup with

  1. Two local db at localhost , odoo v14.
  2. after enter all the params and secrets , clicked Run button, it created the Job queue but was throwing the above error.
    Any advice ?

Thanks for all feedbacks,
Kalmen

solved , it is because of the search domain i specified has some bugs and also when it comes to xmlrpc i did not make sure my server is "single" db. i.e. db_filter = * , i should use domain & database specific.