tinyerp / odooly Goto Github PK
View Code? Open in Web Editor NEWPython library and CLI to interact with Odoo and OpenERP.
Home Page: https://odooly.rtfd.io/
License: Other
Python library and CLI to interact with Odoo and OpenERP.
Home Page: https://odooly.rtfd.io/
License: Other
Hi,
Anyone tried to call masive import ?
It's posible run this task from odooly?
When I execute
from odooly import *
cl = Client.from_config('testing')
env = cl.env
env.cr
I get the following error
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-48-c4e964fa0ffc> in <module>
----> 1 env.cr
~/.local/lib/python3.7/site-packages/odooly.py in cr(self)
611 return self.__dict__.get('cr') or _memoize(
612 self, 'cr', self.registry.db.cursor()
--> 613 if self.client.version_info < 8.0 else self.registry.cursor())
614
615 @property
~/.local/lib/python3.7/site-packages/odooly.py in registry(self)
616 def registry(self):
617 """Return the environment's registry."""
--> 618 return self.client._server._get_pool(self.db_name)
619
620 def __call__(self, user=None, password=None, context=None):
AttributeError: 'str' object has no attribute '_get_pool'
Looking at the Odooly source, it seems to me that env.registry
only exists if env.client._server
was set with start_odoo_services
. Is there a way to get a cursor on a remote server? Or more to the point, can I use Odooly to execute an SQL query on a remote server?
Thanks.
I am trying to do something like
client.env['product.product'].create(values) where values is a list of dicts like [{'name': 'AAA'}, {'name': 'BBB'}]
I was expecting to be able to make it work but I see the create method is expecting only a dict, and not a list of dict. Speccially the method _unbrowse_values
.
Any idea on how can I use create multi?
I hope this is not an error from my side but I installed odooly in a python virtualenvironment (version 2.7) using pip.
I have a remote method that when executed it creates a project and returns the recordset.
This is what odooly throws when that value is sent:
File "/opt/docker/simply-solar/odoo/custom/src/simply-solar/venv/local/lib/python2.7/site-packages/odooly.py", line 1800, in wrapper
res = self._execute(attr, [self.id], *params, **kwargs)
File "/opt/docker/simply-solar/odoo/custom/src/simply-solar/venv/local/lib/python2.7/site-packages/odooly.py", line 706, in execute
res = self._execute_kw(obj, method, params, *kw)
File "/opt/docker/simply-solar/odoo/custom/src/simply-solar/venv/local/lib/python2.7/site-packages/odooly.py", line 445, in <lambda>
wrapper = lambda s, *args: s._dispatch(name, args)
File "/usr/lib/python2.7/xmlrpclib.py", line 1602, in __request
verbose=self.__verbose
File "/usr/lib/python2.7/xmlrpclib.py", line 1283, in request
return self.single_request(host, handler, request_body, verbose)
File "/usr/lib/python2.7/xmlrpclib.py", line 1316, in single_request
return self.parse_response(response)
File "/usr/lib/python2.7/xmlrpclib.py", line 1493, in parse_response
return u.close()
File "/usr/lib/python2.7/xmlrpclib.py", line 800, in close
raise Fault(**self._stack[0])
xmlrpclib.Fault: <Fault cannot marshal <class 'collections.defaultdict'> objects: 'Traceback (most recent call last):\n File "/usr/local/lib/python3.5/xmlrpc/client.py", line 509, in __dump\n f = self.dispatch[type(value)]\nKeyError: <class \'collections.defaultdict\'>\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File "/opt/odoo/custom/src/odoo/odoo/service/wsgi_server.py", line 125, in wsgi_xmlrpc\n response = xmlrpclib.dumps((result,), methodresponse=1, allow_none=False)\n File "/usr/local/lib/python3.5/xmlrpc/client.py", line 951, in dumps\n data = m.dumps(params)\n File "/usr/local/lib/python3.5/xmlrpc/client.py", line 501, in dumps\n dump(v, write)\n File "/usr/local/lib/python3.5/xmlrpc/client.py", line 523, in __dump\n f(self, value, write)\n File "/usr/local/lib/python3.5/xmlrpc/client.py", line 614, in dump_instance\n self.dump_struct(value.__dict__, write)\n File "/usr/local/lib/python3.5/xmlrpc/client.py", line 594, in dump_struct\n dump(v, write)\n File "/usr/local/lib/python3.5/xmlrpc/client.py", line 523, in __dump\n f(self, value, write)\n File "/usr/local/lib/python3.5/xmlrpc/client.py", line 614, in dump_instance\n self.dump_struct(value.__dict__, write)\n File "/usr/local/lib/python3.5/xmlrpc/client.py", line 594, in dump_struct\n dump(v, write)\n File "/usr/local/lib/python3.5/xmlrpc/client.py", line 513, in __dump\n raise TypeError("cannot marshal %s objects" % type(value))\nTypeError: cannot marshal <class \'collections.defaultdict\'> objects\n'>
Many thanks for opensourcing this great lib, best way to execute remote rpc for Odoo by far.
Hello,
I just noticed that oodly
breaks with odoo 15
We recently decided to upgrade from odoo 12
to 15
and noticed that the client login fails due to step where the major version is computed.
sr/local/Cellar/[email protected]/3.8.12_1/Frameworks/Python.framework/Versions/3.8/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 843, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/cdvx/Desktop/he-online-order-app-backend/src/djangodoo/__init__.py", line 28, in <module>
set_odoo_client()
File "/Users/cdvx/Desktop/he-online-order-app-backend/src/djangodoo/__init__.py", line 11, in set_odoo_client
settings.odoo = odooly.Client(
File "/Users/cdvx/Desktop/he-online-order-app-backend/venv/lib/python3.8/site-packages/odooly.py", line 912, in __init__
self._set_services(server, transport, verbose)
File "/Users/cdvx/Desktop/he-online-order-app-backend/venv/lib/python3.8/site-packages/odooly.py", line 945, in _set_services
self.major_version = re.match(r'\d+\.?\d*', ver).group()
AttributeError: 'NoneType' object has no attribute 'group'
I noticed this in erppeek
first then here when I found oodly
as a recomendation for odoo14
upgrade in one of the erppeek issues.
Can we get support for odoo 15, it would really be helpful since we widely depend on erppeek
/oodly
in our application.
Thanks for creating this wonderful tool. I have started to use it and it works great. I am wondering if there is active development or a roadmap in place? I ask because the last commit was made in October 2019.
Today I went to the ERPpeek github and saw the fork notice pointing to Odooly.
For people coming in for the first time I believe it is important to add on your documentation or README an explanation of why/how the fork happened and try to explain why people should use Odooly instead of ERPpeek now.
We have 3 options right now (Odooly, OdooRPC and ERPpeek), you should address this directly to help people choose.
Sorry to make this an issue, consider this a documentation issue maybe.
When a JSONRPC call returns None, the response dictionary doesn't contain a 'result' key, therefore it produces a KeyError.
Regards,
What a great job, I would like to know if it is possible to give support to work with: https://github.com/prompt-toolkit/ptpython
Thank you
odooly.Client(...).env.uninstall('some_module')
I get:
One or more of the selected modules have already been uninstalled
Because of this line that is executed before the button_uninstall method is actually called:
sel.write({'state': 'to remove'})
Odoo checks if the module's state is either "installed" or "to upgrade" before uninstalling and if it is not, it throws said error.
If I comment out the write line in odooly, it works fine.
Now the line just above it is a comment that says "# A trick to uninstall dependent add-ons" so I wouldn't call removing the line a sure fix yet...
I'm not sure if v14 is supported by odooly, but when first trying to run it, I've immediately hit an error:
TypeError: cannot marshal <class \'odoo.tools.misc.frozendict\'> objects
(apparently from core file odoo/tools/misc.py)
The error is the same in both interactive and non-interactive modes; it occurs when running odooly --env test, and prevents all usage of the tool.
ERPpeek in the same virtualenv and config, allows most operations without issue.
This is using Python 3.8 in Ubuntu 20.04
This is a question, not an issue.
I am using the library (and by the way its great) but I want to convert the read data to JSON.
If I have for example sa sale.order.line, and inside I have a product, I would like to have something like:
[{'line': [{'product_id': {'id': 5, 'name': 'Product Name'}}]}]; instead of having an instance of odooly.Record<product.product>
Is this possible? any hint?
Thanks in advance
How do I create expenses with tax correctly calculated?
When I use odooly to create an expense, I am able to create the expense, with the correct product chosen, and the specified date and amount.
However the total is not correct, because the product I choose should have a TAX on it.
Since all transactions on my expenses must show excluding and including VAT.
**The goal here is: That the tax amount on the expense created by Odooly is calculated correctly. **
My server/Odoo instance: In my case it works perfectly when manually entered, and the views and frontend calculate the tax value correctly when I use the mouse to select the correct product, the correct values are also then persisted to the database when clicking save.
The command I have tried to run is the following:
``
env['hr.expense'].create({'name': "Tiny Lasagna", 'product_uom_id': '1', 'quantity': '1', 'company_id': '1', 'unit_amount': '20', 'date': '2020-01-19','currency_id': '14','account_id': '205','payment_mode': 'own_account','analytic_account_id': '' ,'create_uid': '6','product_id': '5','company_currency_id': '14','sale_order_id': '','currency_id': '14','analytic_tag_ids': '','tax_ids':'','can_be_reinvoiced': '1','sale_order_id':'','description':'Little Bits','reference': 'Interdimensional Cable'})
I have tried the following:
There seems to be a hint from a tangentially related question on the Odoo forums: - https://www.odoo.com/fr_FR/forum/aide-1/question/account-invoice-tax-is-not-calculated-from-line-data-imported-to-account-invoice-136828
Maybe the clue lies in the view for hr.expense located at Views ---> hr.expense.sheet.form, which refers to several fields that seem relevant to tax on expense.
But I can't figure it out... And now I've exhausted all options
Any help or pointers?
Hi, thanks for odooly!
I am experienced with odoorpc and immediatelly I missed the timeout parameter when setting the connection parameters. Some requests take quite long and it is important to have a configurable timeout.
Hi @florentx Are there any plans to support version 13?
Thanks for your work with odooly. odooly is my right hand when developing in Odoo.
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.