Skip to content

Commit

Permalink
[FIX] fixed order line selection issue, calendar event issue, convert…
Browse files Browse the repository at this point in the history
… to quotation in odoo 7.0
  • Loading branch information
dpr-odoo committed Apr 9, 2015
1 parent 5d85460 commit 9d22aa0
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
import com.odoo.core.orm.fields.types.OVarchar;
import com.odoo.core.support.OUser;

import org.json.JSONArray;

import odoo.ODomain;

public class CalendarEvent extends OModel {
Expand Down Expand Up @@ -128,10 +130,11 @@ public ODomain defaultDomain() {
if (getOdooVersion().getVersion_number() <= 7) {
domain.add("|");
domain.add("user_id", "=", getUser().getUser_id());
domain.add("partner_ids.id", "=", getUser().getPartner_id());
domain.add("partner_ids", "in", new JSONArray().put(getUser().getPartner_id()));
} else {
domain.add("partner_ids.id", "=", getUser().getPartner_id());
domain.add("partner_ids", "in", new JSONArray().put(getUser().getPartner_id()));
}
domain.add("recurrency", "=", false);
return domain;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import android.widget.ImageView;
import android.widget.ListView;

import com.odoo.R;
import com.odoo.addons.sale.models.ProductProduct;
import com.odoo.core.orm.ODataRow;
import com.odoo.core.orm.ServerDataHelper;
Expand All @@ -25,7 +26,6 @@
import com.odoo.core.utils.OAlert;
import com.odoo.core.utils.OControls;
import com.odoo.core.utils.OResource;
import com.odoo.R;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down
13 changes: 9 additions & 4 deletions app/src/main/java/com/odoo/addons/sale/SalesDetail.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public class SalesDetail extends ActionBarActivity implements View.OnClickListen
private TextView txvType, currency1, currency2, currency3, untaxedAmt, taxesAmt, total_amt;
private ODataRow currencyObj;
private ResPartner partner = null;
private ProductProduct products = null;
private String mSOType = "";
private LinearLayout layoutAddItem = null;
private Type mType;
Expand All @@ -95,9 +96,10 @@ public void onCreate(Bundle savedInstanceState) {
extra = getIntent().getExtras();
mType = Type.valueOf(extra.getString("type"));
currencyObj = sale.currency();
partner = new ResPartner(this, null);
products = new ProductProduct(this, null);
init();
initAdapter();
partner = new ResPartner(this, null);
}

private void init() {
Expand Down Expand Up @@ -159,7 +161,7 @@ private void initAdapter() {
if (extra != null && record != null) {
List<ODataRow> lines = record.getO2MRecord("order_line").browseEach();
for (ODataRow line : lines) {
int product_id = line.getInt("product_id");
int product_id = products.selectServerId(line.getInt("product_id"));
if (product_id != 0) {
lineValues.put(product_id + "", line.getFloat("product_uom_qty"));
lineIds.put(product_id + "", line.getInt("id"));
Expand Down Expand Up @@ -460,14 +462,17 @@ protected List<ODataRow> doInBackground(HashMap<String, Float>... params) {
? false : customer.getString("fiscal_position");
arguments.add(fiscal_position);// fiscal position
arguments.add(false); // flag
if (stockInstalled) {
int version = saleLine.getOdooVersion().getVersion_number();
if (stockInstalled && version > 7) {
arguments.add(false);
}
JSONObject context = new JSONObject();
context.put("partner_id", customer.getInt("id"));
context.put("quantity", qty);
context.put("pricelist", pricelist);
String method = (stockInstalled) ? "product_id_change_with_wh" : "product_id_change";

// Fixed for Odoo 7.0 no product_id_change_with_wh available for v7
String method = (stockInstalled && version > 7) ? "product_id_change_with_wh" : "product_id_change";
JSONObject response = ((JSONObject) helper.callMethod(method, arguments, context));
JSONObject res = response.getJSONObject("value");
if (response.has("warning") && !response.getString("warning").equals("false")) {
Expand Down
5 changes: 2 additions & 3 deletions app/src/main/java/com/odoo/core/account/About.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
*/
package com.odoo.core.account;

import android.content.pm.PackageInfo;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.os.Bundle;
Expand All @@ -33,9 +32,9 @@
import android.widget.Toast;

import com.odoo.R;
import com.odoo.base.addons.ir.IrModel;
import com.odoo.core.utils.IntentUtils;
import com.odoo.core.utils.OActionBarUtils;
import com.odoo.base.addons.ir.IrModel;
import com.odoo.core.utils.OPreferenceManager;
import com.odoo.datas.OConstants;

Expand All @@ -56,7 +55,7 @@ protected void onCreate(Bundle savedInstanceState) {
findViewById(R.id.abtus_header).setOnClickListener(this);
TextView versionName, aboutLine2, aboutLine3, aboutLine4;
versionName = (TextView) findViewById(R.id.txvVersionName);
handler = getWindow().getDecorView().getHandler();
handler = new Handler();
try {
PackageManager packageManager = getPackageManager();
// setting version name from manifest file
Expand Down
4 changes: 2 additions & 2 deletions local.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
# Location of the SDK. This is only used by Gradle.
# For customization when using a Version Control System, please read the
# header note.
#Fri Apr 03 12:09:41 IST 2015
sdk.dir=/home/sla/sla/Android/sdk
#Wed Apr 08 14:16:10 IST 2015
sdk.dir=/home/dpr/eclipse-adt/sdk

0 comments on commit 9d22aa0

Please sign in to comment.