Skip to content

Commit

Permalink
Merge branch 'framework-one-to-many-issue'
Browse files Browse the repository at this point in the history
  • Loading branch information
Dharmang Soni committed Jun 17, 2014
2 parents f1d8697 + 29a108f commit d53590d
Show file tree
Hide file tree
Showing 23 changed files with 821 additions and 611 deletions.
21 changes: 21 additions & 0 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,27 @@
android:name="android.provider.CONTACTS_STRUCTURE"
android:resource="@xml/contacts" />
</service>

<!-- Idea Library Provider -->
<provider
android:name="com.odoo.addons.idea.providers.library.LibraryProvider"
android:authorities="com.odoo.addons.idea.providers.library"
android:enabled="true"
android:exported="true"
android:label="Library Data"
android:syncable="true" />
<!-- Idea Library Provider -->
<service
android:name="com.odoo.addons.idea.services.LibraryService"
android:exported="true" >
<intent-filter>
<action android:name="android.content.SyncAdapter" />
</intent-filter>

<meta-data
android:name="android.content.SyncAdapter"
android:resource="@xml/sync_library_data" />
</service>
</application>

</manifest>
Binary file modified libs/odoo-v2.jar
Binary file not shown.
19 changes: 0 additions & 19 deletions res/layout/fragment_idea_detail.xml

This file was deleted.

16 changes: 0 additions & 16 deletions res/layout/fragment_idea_list_item.xml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,14 @@
android:orientation="vertical"
android:paddingTop="?android:attr/actionBarSize" >

<include
android:id="@+id/loadingProgress"
layout="@layout/listview_data_loading_progress"
android:paddingBottom="5dp"
android:paddingTop="5dp" />

<ListView
android:id="@+id/listview"
android:id="@+id/listRecords"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ListView>
Expand Down
21 changes: 21 additions & 0 deletions res/layout/fragment_library_custom_view.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
android:padding="15dp" >

<TextView
android:id="@+id/txvName"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-condensed"
android:textAppearance="?android:attr/textAppearanceLarge" />

<TextView
android:id="@+id/txvValues"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fontFamily="sans-serif-light"
android:textAppearance="?android:attr/textAppearanceSmall" />

</LinearLayout>
6 changes: 6 additions & 0 deletions res/xml/sync_library_data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:accountType="com.odoo.auth"
android:contentAuthority="com.odoo.addons.idea.providers.library"
android:supportsUploading="true"
android:userVisible="true" />

159 changes: 159 additions & 0 deletions src/com/odoo/addons/idea/BooksDB.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
/*
* Odoo, Open Source Management Solution
* Copyright (C) 2012-today Odoo SA (<http:www.odoo.com>)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http:www.gnu.org/licenses/>
*
*/

package com.odoo.addons.idea;

import java.util.ArrayList;
import java.util.List;

import android.content.Context;

import com.odoo.orm.OEColumn;
import com.odoo.orm.OEDatabase;
import com.odoo.orm.OEFields;

public class BooksDB extends OEDatabase {

Context mContext = null;

public BooksDB(Context context) {
super(context);
mContext = context;
}

@Override
public String getModelName() {
return "book.book";
}

@Override
public List<OEColumn> getModelColumns() {
List<OEColumn> columns = new ArrayList<OEColumn>();
columns.add(new OEColumn("name", "Book Name", OEFields.varchar(100)));
columns.add(new OEColumn("language", "Book Language", OEFields
.varchar(64)));
columns.add(new OEColumn("author_id", "Book Author", OEFields
.manyToOne(new BookAuthor(mContext))));
columns.add(new OEColumn("student_id", "Book Student", OEFields
.manyToOne(new BookStudent(mContext))));
columns.add(new OEColumn("category_ids", "Book Categories", OEFields
.manyToMany(new BookCategory(mContext))));
columns.add(new OEColumn("description", "Book Description", OEFields
.text()));
return columns;
}

static class BookCategory extends OEDatabase {

public BookCategory(Context context) {
super(context);
}

@Override
public String getModelName() {
return "book.category";
}

@Override
public List<OEColumn> getModelColumns() {
List<OEColumn> columns = new ArrayList<OEColumn>();
columns.add(new OEColumn("name", "Category Name", OEFields
.varchar(100)));
columns.add(new OEColumn("description", "Category Description",
OEFields.text()));
return columns;
}

}

static class BookAuthor extends OEDatabase {
Context mContext = null;

public BookAuthor(Context context) {
super(context);
mContext = context;
}

@Override
public String getModelName() {
return "book.author";
}

@Override
public List<OEColumn> getModelColumns() {
List<OEColumn> columns = new ArrayList<OEColumn>();
columns.add(new OEColumn("name", "Author Name", OEFields
.varchar(100)));
columns.add(new OEColumn("country_id", "Author Country", OEFields
.manyToOne(new ResCountry(mContext))));
columns.add(new OEColumn("description", "About Author", OEFields
.text()));
return columns;
}
}

static class ResCountry extends OEDatabase {

public ResCountry(Context context) {
super(context);
}

@Override
public String getModelName() {
return "res.country";
}

@Override
public List<OEColumn> getModelColumns() {
List<OEColumn> columns = new ArrayList<OEColumn>();
columns.add(new OEColumn("name", "Country Name", OEFields
.varchar(100)));
return columns;
}
}

static class BookStudent extends OEDatabase {
Context mContext = null;

public BookStudent(Context context) {
super(context);
mContext = context;
}

@Override
public String getModelName() {
return "book.student";
}

@Override
public List<OEColumn> getModelColumns() {
List<OEColumn> columns = new ArrayList<OEColumn>();
columns.add(new OEColumn("name", "Student Name", OEFields
.varchar(100)));
columns.add(new OEColumn("course", "Course Name", OEFields
.varchar(100)));
columns.add(new OEColumn("contact", "Student Contact", OEFields
.varchar(15)));
columns.add(new OEColumn("book_ids", "Assigned Books", OEFields
.oneToMany(new BooksDB(mContext), "student_id")));
return columns;
}
}

}
120 changes: 0 additions & 120 deletions src/com/odoo/addons/idea/Idea.java

This file was deleted.

Loading

0 comments on commit d53590d

Please sign in to comment.