Giter Site home page Giter Site logo

Comments (4)

dptks19 avatar dptks19 commented on September 7, 2024

Here is the reference example of Many2Many

the 'attachment_ids' from crm;

https://github.com/Odoo-mobile/crm/blob/1e06c465bf4a624ebfd3afe25e5a13109d47cc5b/app/src/main/java/com/odoo/base/addons/mail/widget/MailDetailDialog.java :
Line no 81+

the 'partner_ids' from messaging
https://github.com/Odoo-mobile/messaging/blob/0fc384ef747802516e65fe848c4aab8212abc3bd/src/com/odoo/addons/mail/services/MailSyncService.java
Line no 77+

Hope this will help you!!

from framework.

dpr-odoo avatar dpr-odoo commented on September 7, 2024

Hello @sailing135

As you mention, you are tyring to give condition on ManyToMany column. That actually does not exist in database table. But, system had created seperate table for maintaining the relation between two different tables. So, it's not possible to directly give condition using where.

The way you are trying to get record by conditioning on relation column (such as ManyToMany and OneToMany) is not possible with use of CursorLoader mechanism.

A CursorLoader runs an asynchronous query in the background against a ContentProvider, and returns the results in Cursor object.

How to do that?

For that, You need to create one join query.

CursorLoader works with ContentProvider. You can find tutorial for how to create custom provider for your model. Also for execute your query you need to create one custom URI that will invoke your custom query with join and return value in cursor.

Please refer this link to understand how to create custom provider and your own URI to execute your required query with CursorLoader

http://mobile.odoo.co.in/v2/getting-started/working-with-odoo-mobile/components/base-classes.html#basemodelprovider-java

Also here is sample code for execute query:

Note applicaiton:

https://github.com/Odoo-mobile/notes/blob/master/app/src/main/java/com/odoo/addons/notes/providers/NoteProvider.java#L54

Refering the method, which returns cursor.

https://github.com/Odoo-mobile/notes/blob/master/app/src/main/java/com/odoo/addons/notes/models/NoteNote.java#L95,L105

Hope this help

from framework.

sailing135 avatar sailing135 commented on September 7, 2024

thanks all so much, I will try it !!

from framework.

rkhoudi avatar rkhoudi commented on September 7, 2024

In Notes.java , it is not clear how you did use CursorLoader to fetch data from the two different tables ( notes and tags in your project ) , would you explain it more please?

from framework.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.