Skip to content

Commit

Permalink
Merge branch 'master-relation_data_mapping-dpr'
Browse files Browse the repository at this point in the history
  • Loading branch information
dpr-odoo committed Jun 24, 2016
2 parents 5db4efa + a605884 commit 48c8bf9
Show file tree
Hide file tree
Showing 23 changed files with 576 additions and 346 deletions.
22 changes: 17 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
<img src="https://raw.githubusercontent.com/Odoo-mobile/framework/master-relation_data_mapping-dpr/app/src/main/res/drawable-nodpi/odoo_mobile_small.png" width="280" alt="Odoo Mobile"/>
<br/>v2.1.0alpha (Build 5)
<img src="https://github.com/Odoo-mobile/framework/blob/master/odoo_mobile.png" alt="Odoo Mobile"/>
<br/>v2.2.0 (Build 6)


Odoo Mobile v2.1.0 (Framework)
Odoo Mobile v2.2.0 (Framework)
==============================

Odoo Mobile is open-source framework allows you to integrate Odoo into your Android app.
Expand All @@ -19,10 +18,21 @@ It has pre-developed services,providers, controls and more other features to mak

**Odoo Mobile** is a part of The Odoo (India)

CHANGELOG
=========

- June 2016
- Sync performance improved
- Easy relation record creation (Fix for: https://github.com/Odoo-mobile/framework/issues/138)
- ManyToOne, OneToMany and ManyToMany
- Minor bug fixes

SUPPORTED ODOO VERSIONS
=======================

Odoo 7.0, 8.0, 9.0
- [x] Odoo 7.0
- [x] Odoo 8.0
- [x] Odoo 9.0

HOW TO START
============
Expand All @@ -41,3 +51,5 @@ GIVE FEEDBACK

- Please report bug or issues [https://github.com/Odoo-mobile/framework/issues](https://github.com/Odoo-mobile/framework/issues)
- You can also write us on **android@odoo.co.in**

Follow us on Twitter: <a href="https://twitter.com/odoomobile">@odoomobile</a>
22 changes: 13 additions & 9 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
compileSdkVersion 24
buildToolsVersion "24.0.0"
defaultConfig {
//FIXME: Change application name as your requirement
manifestPlaceholders = [applicationName: "Odoo"]
//FIXME: Please change the application id as your requirement
applicationId "com.odoo"
minSdkVersion 14
targetSdkVersion 23
versionCode 5
versionName "2.1.0alpha"
targetSdkVersion 24
versionCode 6
versionName "2.2.0"
multiDexEnabled true
}
dexOptions {
javaMaxHeapSize "2g"
}
buildTypes {
release {
Expand All @@ -24,10 +28,10 @@ android {

dependencies {
compile fileTree(include: ['*.jar'], dir: 'libs')
compile 'com.android.support:appcompat-v7:23.3.0'
compile 'com.android.support:cardview-v7:23.3.0'
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:design:23.3.0'
compile 'com.android.support:appcompat-v7:24.0.0'
compile 'com.android.support:cardview-v7:24.0.0'
compile 'com.google.android.gms:play-services:9.0.2'
compile 'com.android.support:design:24.0.0'
compile project(':intro-slider-lib')
compile project(':odoo-rpc-v3')
}
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/java/com/odoo/addons/customers/Customers.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public class Customers extends BaseFragment implements ISyncStatusObserverListen
public static final String EXTRA_KEY_TYPE = "extra_key_type";
private View mView;
private String mCurFilter = null;
private ListView mPartnersList = null;
private OCursorListAdapter mAdapter = null;
private boolean syncRequested = false;

Expand All @@ -87,7 +86,7 @@ public void onViewCreated(View view, Bundle savedInstanceState) {
setHasSwipeRefreshView(view, R.id.swipe_container, this);
mView = view;
mType = Type.valueOf(getArguments().getString(EXTRA_KEY_TYPE));
mPartnersList = (ListView) view.findViewById(R.id.listview);
ListView mPartnersList = (ListView) view.findViewById(R.id.listview);
mAdapter = new OCursorListAdapter(getActivity(), null, R.layout.customer_row_item);
mAdapter.setOnViewBindListener(this);
mAdapter.setHasSectionIndexers(true, "name");
Expand All @@ -96,6 +95,7 @@ public void onViewCreated(View view, Bundle savedInstanceState) {
mPartnersList.setOnItemClickListener(this);
setHasFloatingButton(view, R.id.fabButton, mPartnersList, this);
getLoaderManager().initLoader(0, null, this);

}

@Override
Expand Down
6 changes: 6 additions & 0 deletions app/src/main/java/com/odoo/base/addons/res/ResPartner.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ public class ResPartner extends OModel {
.setLocalColumn();
OColumn large_image = new OColumn("Image", OBlob.class).setDefaultValue("false").setLocalColumn();

OColumn category_id = new OColumn("Tags", ResPartnerCategory.class,
OColumn.RelationType.ManyToMany);

OColumn child_ids = new OColumn("Contacts", ResPartner.class, OColumn.RelationType.OneToMany)
.setRelatedColumn("parent_id");

public ResPartner(Context context, OUser user) {
super(context, "res.partner", user);
setHasMailChatter(true);
Expand Down
17 changes: 17 additions & 0 deletions app/src/main/java/com/odoo/base/addons/res/ResPartnerCategory.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package com.odoo.base.addons.res;

import android.content.Context;

import com.odoo.core.orm.OModel;
import com.odoo.core.orm.fields.OColumn;
import com.odoo.core.orm.fields.types.OVarchar;
import com.odoo.core.support.OUser;

public class ResPartnerCategory extends OModel {

OColumn name = new OColumn("Name", OVarchar.class);

public ResPartnerCategory(Context context, OUser user) {
super(context, "res.partner.category", user);
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/**
* Odoo, Open Source Management Solution
* Copyright (C) 2012-today Odoo SA (<http:www.odoo.com>)
*
* <p/>
* 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
*
* <p/>
* 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
*
* <p/>
* 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/>
*
* <p/>
* Created on 16/2/15 12:52 PM
*/
package com.odoo.core.account;
Expand All @@ -27,7 +27,6 @@
import android.os.AsyncTask;
import android.os.Bundle;
import android.os.Handler;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.AppCompatActivity;
import android.text.TextUtils;
import android.view.View;
Expand All @@ -43,7 +42,6 @@
import com.odoo.core.service.OSyncAdapter;
import com.odoo.core.utils.BitmapUtils;
import com.odoo.core.utils.OResource;
import com.odoo.core.utils.notification.ONotificationBuilder;

import odoo.Odoo;
import odoo.helper.OUser;
Expand All @@ -66,8 +64,6 @@ protected void onCreate(Bundle savedInstanceState) {
getSupportActionBar().hide();
action = getIntent().getAction();
mApp = (App) getApplicationContext();
// Removing notification
ONotificationBuilder.cancelNotification(this, OSyncAdapter.REQUEST_SIGN_IN_ERROR);
user = OdooAccountManager.getDetails(this, getIntent().getStringExtra("android_name"));
if (action.equals("remove_account")) {
findViewById(R.id.layoutSavePassword).setVisibility(View.GONE);
Expand Down Expand Up @@ -131,7 +127,6 @@ public void onClick(DialogInterface dialog, int which) {

@Override
public void onClick(View v) {
ONotificationBuilder.cancelNotification(this, OSyncAdapter.REQUEST_SIGN_IN_ERROR);
switch (v.getId()) {
case R.id.cancel:
finish();
Expand Down
14 changes: 6 additions & 8 deletions app/src/main/java/com/odoo/core/account/OdooLogin.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,12 @@ public class OdooLogin extends AppCompatActivity implements View.OnClickListener
private Boolean mConnectedToServer = false;
private Boolean mAutoLogin = false;
private Boolean mRequestedForAccount = false;
private AccountCreater accountCreator = null;
private AccountCreator accountCreator = null;
private Spinner databaseSpinner = null;
private List<String> databases = new ArrayList<>();
private TextView mLoginProcessStatus = null;
private TextView mTermsCondition;
private App mApp;
private Odoo mOdoo;
private odoo.helper.OUser mUser;

@Override
protected void onCreate(Bundle savedInstanceState) {
Expand Down Expand Up @@ -90,7 +88,7 @@ protected void onCreate(Bundle savedInstanceState) {

private void init() {
mLoginProcessStatus = (TextView) findViewById(R.id.login_process_status);
mTermsCondition = (TextView) findViewById(R.id.termsCondition);
TextView mTermsCondition = (TextView) findViewById(R.id.termsCondition);
mTermsCondition.setMovementMethod(LinkMovementMethod.getInstance());
findViewById(R.id.btnLogin).setOnClickListener(this);
findViewById(R.id.forgot_password).setOnClickListener(this);
Expand Down Expand Up @@ -214,6 +212,8 @@ private void loginUser() {
}
if (databaseSpinner != null && databases.size() > 1 && databaseSpinner.getSelectedItemPosition() == 0) {
Toast.makeText(this, OResource.string(this, R.string.label_select_database), Toast.LENGTH_LONG).show();
findViewById(R.id.controls).setVisibility(View.VISIBLE);
findViewById(R.id.login_progress).setVisibility(View.GONE);
return;
}

Expand Down Expand Up @@ -243,7 +243,6 @@ private void loginUser() {
loginProcess(null, serverURL, databaseName);
} else {
mAutoLogin = true;
Log.v("", "Testing URL: " + serverURL);
try {
Odoo.createInstance(OdooLogin.this, serverURL).setOnConnect(OdooLogin.this);
} catch (OdooVersionException e) {
Expand Down Expand Up @@ -347,7 +346,6 @@ private void loginProcess(final OdooInstance instance, String url, final String
@Override
public void onLoginSuccess(Odoo odoo, odoo.helper.OUser oUser) {
mOdoo = odoo;
mUser = oUser;
mOdoo.getSaasInstances(new IOdooInstanceListener() {
@Override
public void onInstancesLoad(List<OdooInstance> odooInstances) {
Expand Down Expand Up @@ -409,7 +407,7 @@ public void onLoginSuccess(Odoo odoo, odoo.helper.OUser oUser) {
if (accountCreator != null) {
accountCreator.cancel(true);
}
accountCreator = new AccountCreater();
accountCreator = new AccountCreator();
OUser user = new OUser();
user.setFromBundle(oUser.getAsBundle());
accountCreator.execute(user);
Expand All @@ -426,7 +424,7 @@ private void loginFail(OdooError error) {
edtUsername.setError(OResource.string(this, R.string.error_invalid_username_or_password));
}

private class AccountCreater extends AsyncTask<OUser, Void, Boolean> {
private class AccountCreator extends AsyncTask<OUser, Void, Boolean> {

private OUser mUser;

Expand Down
10 changes: 5 additions & 5 deletions app/src/main/java/com/odoo/core/auth/OdooAccountManager.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/**
* Odoo, Open Source Management Solution
* Copyright (C) 2012-today Odoo SA (<http:www.odoo.com>)
* <p/>
* <p>
* 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
* <p/>
* <p>
* 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
* <p/>
* <p>
* 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/>
* <p/>
* <p>
* Created on 17/12/14 6:21 PM
*/
package com.odoo.core.auth;
Expand Down Expand Up @@ -46,7 +46,7 @@ public class OdooAccountManager {
* @return List of OUser instances if any
*/
public static List<OUser> getAllAccounts(Context context) {
List<OUser> users = new ArrayList<OUser>();
List<OUser> users = new ArrayList<>();
AccountManager aManager = AccountManager.get(context);
for (Account account : aManager.getAccountsByType(KEY_ACCOUNT_TYPE)) {
OUser user = new OUser();
Expand Down
12 changes: 7 additions & 5 deletions app/src/main/java/com/odoo/core/auth/OdooAuthenticator.java
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
/**
* Odoo, Open Source Management Solution
* Copyright (C) 2012-today Odoo SA (<http:www.odoo.com>)
*
* <p>
* 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
*
* <p>
* 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
*
* <p>
* 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/>
*
* <p>
* Created on 17/12/14 6:21 PM
*/
package com.odoo.core.auth;
Expand All @@ -29,6 +29,7 @@
import android.os.Bundle;
import android.support.annotation.NonNull;

import com.odoo.App;
import com.odoo.core.account.OdooLogin;
import com.odoo.core.orm.OSQLite;
import com.odoo.core.support.OUser;
Expand Down Expand Up @@ -66,11 +67,12 @@ public Bundle getAccountRemovalAllowed(AccountAuthenticatorResponse response, Ac
&& !result.containsKey(AccountManager.KEY_INTENT)) {
final boolean removalAllowed = result
.getBoolean(AccountManager.KEY_BOOLEAN_RESULT);

if (removalAllowed) {
OUser user = OdooAccountManager.getDetails(mContext, account.name);
OSQLite sqLite = new OSQLite(mContext, user);
sqLite.dropDatabase();
App app = (App) mContext.getApplicationContext();
app.setOdoo(null, user);
}
}
return result;
Expand Down
Loading

0 comments on commit 48c8bf9

Please sign in to comment.