Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Odoo-mobile/crm into mast…
Browse files Browse the repository at this point in the history
…er-crm-studio-dpr
  • Loading branch information
dpr-odoo committed Mar 27, 2015
2 parents 652285a + dbf74bc commit 1c53784
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 29 deletions.
22 changes: 21 additions & 1 deletion app/src/main/java/com/odoo/base/addons/mail/MailMessage.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public class MailMessage extends OModel {
OColumn attachment_ids = new OColumn("Attachments", IrAttachment.class,
OColumn.RelationType.ManyToMany);
OColumn type = new OColumn("Type", OVarchar.class);

OColumn subtype_id = new OColumn("Subtype", MailMessageSubType.class, OColumn.RelationType.ManyToOne);
@Odoo.Functional(method = "authorName", depends = {"author_id", "email_from"}, store = true)
OColumn author_name = new OColumn("Author Name", OVarchar.class).setLocalColumn();

Expand Down Expand Up @@ -108,4 +108,24 @@ public List<Integer> getServerIds(String model, int res_server_id) {
}
return ids;
}

@Override
public boolean checkForWriteDate() {
return false;
}

@Override
public boolean allowCreateRecordOnServer() {
return false;
}

@Override
public boolean allowDeleteRecordOnServer() {
return false;
}

@Override
public boolean allowUpdateRecordOnServer() {
return false;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* 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/>
*
* Created on 27/3/15 12:33 PM
*/
package com.odoo.base.addons.mail;

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 MailMessageSubType extends OModel {
public static final String TAG = MailMessageSubType.class.getSimpleName();

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

public MailMessageSubType(Context context, OUser user) {
super(context, "mail.message.subtype", user);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import android.content.res.TypedArray;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.os.AsyncTask;
import android.os.Bundle;
import android.util.AttributeSet;
Expand Down Expand Up @@ -181,16 +182,21 @@ public void setRecordServerId(int record_server_id) {
@Override
public View getView(int position, View view, ViewGroup parent) {
ODataRow row = (ODataRow) chatterItems.get(position);

if (row.getString("subtype_id").equals("false")) {
view.setBackgroundResource(R.color.base_chatter_view_note_background);
} else {
view.setBackgroundColor(Color.WHITE);
}
view.findViewById(R.id.imgAttachments).setVisibility(
(row.getBoolean("has_attachments")) ?
View.VISIBLE :
View.GONE
);

if (row.getString("subject").equals("false")) {
OControls.setText(view, R.id.chatterSubject, "");
OControls.setGone(view, R.id.chatterSubject);
} else {
OControls.setVisible(view, R.id.chatterSubject);
OControls.setText(view, R.id.chatterSubject, row.getString("subject"));
}
String date = ODateUtils.convertToDefault(row.getString("date"),
Expand Down
47 changes: 21 additions & 26 deletions app/src/main/res/layout/base_mail_chatter_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,33 +33,18 @@
android:layout_weight="1"
android:layout_height="wrap_content">

<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="wrap_content">

<TextView
android:id="@+id/chatterSubject"
android:textAppearance="?android:textAppearanceSmall"
android:fontFamily="@string/font_normal"
android:layout_marginBottom="5dp"
android:layout_width="0dp"
android:layout_weight="1"
android:singleLine="true"
android:ellipsize="middle"
android:textStyle="bold"
android:textColor="@color/body_text_1"
android:layout_height="wrap_content" />

<ImageView
android:id="@+id/imgAttachments"
android:visibility="gone"
android:layout_gravity="right"
android:tint="@color/theme_secondary"
android:src="@drawable/ic_action_file_attachment"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<TextView
android:id="@+id/chatterSubject"
android:textAppearance="?android:textAppearanceSmall"
android:fontFamily="@string/font_normal"
android:layout_marginBottom="5dp"
android:layout_width="match_parent"
android:singleLine="true"
android:ellipsize="middle"
android:textStyle="bold"
android:textColor="@color/body_text_1"
android:layout_height="wrap_content" />

<TextView
android:id="@+id/chatterBody"
Expand All @@ -73,6 +58,7 @@
<LinearLayout
android:layout_width="match_parent"
android:orientation="horizontal"
android:gravity="center_vertical"
android:layout_marginTop="5dp"
android:layout_height="wrap_content">

Expand All @@ -87,6 +73,15 @@
android:textColor="@color/body_text_3"
android:layout_height="wrap_content" />

<ImageView
android:id="@+id/imgAttachments"
android:visibility="gone"
android:layout_gravity="right"
android:tint="@color/theme_secondary"
android:src="@drawable/ic_action_file_attachment"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />

<TextView
android:singleLine="true"
android:id="@+id/chatterDate"
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@
<color name="actionbar_spinner_text_color">#414141</color>

<color name="base_chatter_view_background">#f3f3f3</color>
<color name="base_chatter_view_note_background">#dadada</color>
</resources>

0 comments on commit 1c53784

Please sign in to comment.