Closed stevenxvii closed 6 years ago
seems like the error from "ConnectionBackend" you need to add that service to the provider
Hi hengkyz,
Thanks for your prompt reply, Can you show me how? As I know that importing HttpModule will also bring both Http and ConnectionBackend.
Anyway, I tried to add ConnectionBackend as
import { ConnectionBackend } from '@angular/http'; and
providers: [ ..., HttpModule, [ConnectionBackend], ... ]
But still error,
Regards
https://stackoverflow.com/questions/40098413/angular-2-no-provider-for-connectionbackend
you need to import it in the app.module instead of add it in the provider
Thanks hengkyz,
After changing to import, it works like a charm
Best regards
Hello hengkyz,
Could you please help me some usage? For example, I want to get all or some records? I tried the following for getting 1 record
odooRPC.call('pos.order', 'read', [1], {}).then(res => { console.log(res) }).catch(err => { console.log(err) });
Thanks in advance
yes there is nothing wrong with that code, what is the error message?
Hi, yes, there is no error, I just want to know how to retrieve all records instead of 1 record, can you help?
i see, then you need to use "searchread" method instead of read
Hi,
odooRPC.call('pos.order', 'read', [0], {}).then(res => {
returns an empty array, and
odooRPC.call('pos.order', 'read', 0, {}).then(res => {
will return error
TypeError: 'int' object has no attribute 'getitem'
What did I wrong?
sorry i edit the comment please read it 1 more time, you should use "searchRead" method instead of read
searchRead is OK, but how can I limit the criteria? For example, what if I want to search for id = 1, 2 (between 1 and 2)?
i dont get it, can you make an example in odoo way, i can tell you how to do it in angular
Hello,
I checked the code and figured out how to implement,
To update what I mean, searchRead takes 4 args (model, domain, fields, limit) and the following code will retrieve all records in the model 'pos.order'
odooRPC.searchRead('pos.order', {}, {}, 0).then(res => {
whereas, the following code will retrieve record with id = 1
odooRPC.searchRead('pos.order', [ [ 'id', '=', 1 ] ], {}, 0).then(res => {
Hello,
I am experiencing some issues when implementing this, after of all installation, I added to my Ionic project (blank project with home page)
But when I run ionic serve, it shows the error
I tried to fix the error but still not OK,
Would appreciate for any help