php-odoo-api-client icon indicating copy to clipboard operation
php-odoo-api-client copied to clipboard

[8.x] Expected updates and features

Open Ang3 opened this issue 3 years ago β€’ 9 comments

  • Client
    • [x] JSON-RPC instead of XML-RPC for PHP8 native support
      • [x] Tests
  • DBAL
    • [x] DBAL features architecture update
    • [x] Schema
      • [ ] Tests
    • [x] Type converter
      • [x] Tests
    • [x] Metadata cache
      • [ ] Tests
    • [x] Query builder
      • [x] Tests
    • [x] Repositories
      • [x] Tests
    • [x] Lazy results
      • [ ] Tests

Ang3 avatar Jan 22 '22 12:01 Ang3

Hi, I don't know if you started to develop the implementation of JSONRPC, but I do have an implmentation of JSONRPC that works well on my fork. I'm going to open a PR. That's just a test but we can work from this if you want to.

I did some tests and it seems that JSONRPC is really faster than XMLRPC.

PR : #25

jsayer101 avatar Jan 22 '22 18:01 jsayer101

Hi, thank you very much for your share mate, but I already did it (branch 8.x ). πŸ˜„ There is many subtil things about arguments into JSON-RPC. I tried all methods on local. Like you, I just need to handle exceptions, so I have to make some functionnal local tests to know how Odoo replies in case of failure.

For performance, no doubt about. I already think about requests multiplexing to perform bulk operations (just an idea atm). ☺️

Ang3 avatar Jan 22 '22 21:01 Ang3

Following PR #25 and branch 8.x - We have to decide: symfony/http-client package (curl or PHP native) dependency or PHP native support for requests. πŸ˜•

Ang3 avatar Jan 22 '22 22:01 Ang3

@Ang3 Cool ! Hope we can get JSONRPC fast. I think we can use a package that is actively maintained but maybe not using curl ? So you don't have to activate any other php extensions ?

In some companies they have active restrictions on which extensions they can activate or not.. etc. This was the main reason I can think of for using native streams.

The real question is Are there any real advantages to use curl and not native streams ? In the other hand, "many" web hosting companies desactivate "allow_url_fopen = 0" so file_get_content fails but curl is activated.

jsayer101 avatar Jan 22 '22 22:01 jsayer101

Btw I think i'm going to close my PR so you can work on your side freely. You worked too fast for me lol. Just a junior dev trying to work on opensource projects that I use in my company 😒

jsayer101 avatar Jan 22 '22 22:01 jsayer101

Same here with my company ☺️ I copied your code for PHP native stream (I didn't know well) and marked you as co-author πŸ˜‰

Ang3 avatar Jan 22 '22 23:01 Ang3

The real question is Are there any real advantages to use curl and not native streams ? In the other hand, "many" web hosting companies desactivate "allow_url_fopen = 0" so file_get_content fails but curl is activated.

Atm, I implemented a transport layer to be able to choose how to send data. By default, I think PHP stream must be the first (basic) choice because curl needs the extension php-curl. But later we could add a system to prefer curl if the extension is enabled.

Ang3 avatar Jan 22 '22 23:01 Ang3

Hi, I think this could be a great idea to add a new feature that helps to download reports from Odoo

It is already implemented in OdooRPC for example https://pythonhosted.org/OdooRPC/ref_report.html

(Actually we're trying to download a report from a stock.picking and send back to the user with HTTP attachment)

jsayer101 avatar Jan 28 '22 10:01 jsayer101

Hi,

Indeed, there are many things to do with Odoo. The aim of this repository is to provide a client for Odoo, basically. The DBAL features should be detached into another repository, like ORM or "actions" features like you described. I named that "actions" because I know we can call public methods from python objects like API controller actions (generating invoices for example). I will try to find how to organize that better, probably with the version 8. :-)

Ang3 avatar Nov 05 '23 22:11 Ang3