当前位置: 首页>>代码示例>>Java>>正文


Java ODataRow.put方法代码示例

本文整理汇总了Java中com.odoo.core.orm.ODataRow.put方法的典型用法代码示例。如果您正苦于以下问题:Java ODataRow.put方法的具体用法?Java ODataRow.put怎么用?Java ODataRow.put使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.odoo.core.orm.ODataRow的用法示例。


在下文中一共展示了ODataRow.put方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createOdooInstance

import com.odoo.core.orm.ODataRow; //导入方法依赖的package包/类
public static Odoo createOdooInstance(final Context context, final OUser user) {
        final App app = (App) context.getApplicationContext();
        Odoo odoo = app.getOdoo(user);
        if (odoo == null) {
            odoo = Odoo.createInstance(context,
                    (user.isOAuthLogin()) ? user.getInstanceURL() : user.getHost());
            odoo.helper.OUser mUser =
                    odoo.authenticate(user.getUsername(), user.getPassword(), (user.isOAuthLogin()) ?
                            user.getInstanceDatabase() : user.getDatabase());
            app.setOdoo(odoo, user);
            if (mUser != null) {
                ResCompany company = new ResCompany(context);
                if (company.count("id = ? ", new String[]{user.getCompanyId() + ""}) <= 0) {
                    ODataRow company_details = new ODataRow();
                    company_details.put("id", user.getCompanyId());
                    company.quickCreateRecord(company_details);
                }
            } else {
                // FIXME: Need to check again. Not working properly
                //showSignInErrorNotification(context, user);
//                Toast.makeText(context, OResource.string(context, R.string.toast_something_gone_wrong),
//                        Toast.LENGTH_LONG).show();
            }
        }
        return odoo;
    }
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:27,代码来源:OSyncAdapter.java

示例2: bindView

import com.odoo.core.orm.ODataRow; //导入方法依赖的package包/类
@Override
public void bindView(View view, Context context, Cursor cursor) {
    final ODataRow row = new ODataRow();
    for (String col : cursor.getColumnNames()) {
        row.put(col, getValue(cursor, col));
    }
    if (mBeforeBindUpdateData != null) {
        row.addAll(mBeforeBindUpdateData.updateDataRow(cursor));
    }
    if (view instanceof OForm) {
        OForm form = (OForm) view;
        form.initForm(row);
    }
    if (mOnViewBindListener != null) {
        mOnViewBindListener.onViewBind(view, cursor, row);
    }
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:18,代码来源:OCursorListAdapter.java

示例3: doInBackground

import com.odoo.core.orm.ODataRow; //导入方法依赖的package包/类
@Override
protected Boolean doInBackground(OUser... params) {
    mUser = params[0];
    if (OdooAccountManager.createAccount(OdooLogin.this, mUser)) {
        mUser = OdooAccountManager.getDetails(OdooLogin.this, mUser.getAndroidName());
        OdooAccountManager.login(OdooLogin.this, mUser.getAndroidName());
        FirstLaunchConfig.onFirstLaunch(OdooLogin.this, mUser);
        try {
            // Syncing company details
            ODataRow company_details = new ODataRow();
            company_details.put("id", mUser.getCompanyId());
            ResCompany company = new ResCompany(OdooLogin.this);
            company.quickCreateRecord(company_details);
            Thread.sleep(500);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }
    return false;
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:22,代码来源:OdooLogin.java

示例4: doInBackground

import com.odoo.core.orm.ODataRow; //导入方法依赖的package包/类
@Override
protected Boolean doInBackground(OUser... params) {
    mUser = params[0];
    if (OdooAccountManager.createAccount(OdooLogin.this, mUser)) {
        mUser = OdooAccountManager.getDetails(OdooLogin.this, mUser.getAndroidName());
        OdooAccountManager.login(OdooLogin.this, mUser.getAndroidName());
        FirstLaunchConfig.onFirstLaunch(OdooLogin.this, mUser);
        try {
            // Syncing company details
            ODataRow company_details = new ODataRow();
            company_details.put("id", mUser.getCompanyId());
            ResCompany company = new ResCompany(OdooLogin.this, mUser);
            company.quickCreateRecord(company_details);
            Thread.sleep(500);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }
    return false;
}
 
开发者ID:Odoo-mobile,项目名称:hr,代码行数:22,代码来源:OdooLogin.java

示例5: doInBackground

import com.odoo.core.orm.ODataRow; //导入方法依赖的package包/类
@Override
protected Boolean doInBackground(String... params) {
    try {
        String subject = params[0];
        String body = params[1];
        OArguments args = new OArguments();
        args.add(server_id);
        HashMap<String, Object> data = new HashMap<>();
        data.put("body", body);
        data.put("subject", (subject.equals("false")) ? false : subject);
        data.put("parent_id", false);
        data.put("attachment_ids", attachmentIds);
        List<Integer> partner_ids = new ArrayList<>();
        if (partner_id != -1 && mType == MessageType.Message) {
            partner_ids.add(partner_id);
        }
        data.put("partner_ids", partner_ids);
        HashMap<String, Object> context = new HashMap<>();
        context.put("mail_read_set_read", true);
        context.put("default_res_id", server_id);
        context.put("default_model", mModel.getModelName());
        context.put("mail_post_autofollow", true);
        context.put("mail_post_autofollow_partner_ids", new ArrayList<>());
        data.put("context", context);
        data.put("type", "comment");
        data.put("content_subtype", "plaintext");
        data.put("subtype", (mType == MessageType.Message) ? "mail.mt_comment" : false);
        int newId = (int)
                mModel.getServerDataHelper().callMethod("message_post", args, null, data);
        Thread.sleep(500);
        ODataRow row = new ODataRow();
        row.put("id", newId);
        mailMessage.quickCreateRecord(row);
        return true;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return false;
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:40,代码来源:MailChatterCompose.java

示例6: findAllChild

import com.odoo.core.orm.ODataRow; //导入方法依赖的package包/类
private List<Object> findAllChild(int parent_id) {
    List<Object> items = new ArrayList<>();
    List<ODataRow> rows = db().select(new String[]{"name", "parent_id", "image_medium"}, "parent_id = ?",
            new String[]{parent_id + ""}, "sequence");
    for (ODataRow row : rows) {
        boolean hasChild = db().count("parent_id = ?", new String[]{row.getInt(OColumn.ROW_ID) + ""}) > 0;
        row.put("has_child", hasChild);
        items.add(row);
        if (hasChild) {
            items.addAll(findAllChild(row.getInt(OColumn.ROW_ID)));
        }
    }
    return items;
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:15,代码来源:ProductSubCategories.java

示例7: toDatarow

import com.odoo.core.orm.ODataRow; //导入方法依赖的package包/类
public static ODataRow toDatarow(Cursor cr) {
    ODataRow row = new ODataRow();
    for (String col : cr.getColumnNames()) {
        row.put(col, OCursorUtils.cursorValue(col, cr));
    }
    return row;
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:8,代码来源:OCursorUtils.java

示例8: toDataRow

import com.odoo.core.orm.ODataRow; //导入方法依赖的package包/类
public static ODataRow toDataRow(OdooRecord record) {
    ODataRow row = new ODataRow();
    Set<String> keys = record.keySet();
    for (String key : keys) {
        row.put(key, record.get(key));
    }
    return row;
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:9,代码来源:OdooRecordUtils.java

示例9: onCreate

import com.odoo.core.orm.ODataRow; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.base_profile);
    OAppBarUtils.setAppBar(this, true);
    OUser user = OUser.currentUser(this);
    OForm form = (OForm) findViewById(R.id.profileDetails);
    int color = OStringColorUtil.getStringColor(this, user.getName());
    form.setIconTintColor(color);
    ODataRow userData = new ODataRow();
    userData.put("name", user.getName());
    userData.put("user_login", user.getUsername());
    userData.put("server_url", (user.isOAuthLogin()) ? user.getInstanceURL() : user.getHost());
    userData.put("database", (user.isOAuthLogin()) ? user.getInstanceDatabase() : user.getDatabase());
    userData.put("version", user.getOdooVersion().getServerSerie());
    userData.put("timezone", user.getTimezone());
    form.initForm(userData);

    CollapsingToolbarLayout collapsing_toolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
    collapsing_toolbar.setTitle(userData.getString("name"));
    setTitle(userData.getString("name"));
    Bitmap avatar;
    if (user.getAvatar().equals("false")) {
        avatar = BitmapUtils.getAlphabetImage(this, user.getName());
    } else {
        avatar = BitmapUtils.getBitmapImage(this, user.getAvatar());
    }
    ImageView imageView = (ImageView) findViewById(R.id.image);
    imageView.setImageBitmap(avatar);
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:31,代码来源:Profile.java

示例10: getRecordItems

import com.odoo.core.orm.ODataRow; //导入方法依赖的package包/类
public static List<ODataRow> getRecordItems(OModel model, OColumn column) {
    List<ODataRow> items = new ArrayList<ODataRow>();

    OModel rel_model = model.createInstance(column.getType());
    StringBuffer whr = new StringBuffer();
    List<Object> args_list = new ArrayList<Object>();
    // Skipping onchange domain filter
    if (!column.hasDomainFilterColumn()) {
        for (String key : column.getDomains().keySet()) {
            OColumn.ColumnDomain domain = column.getDomains().get(key);
            if (domain.getConditionalOperator() != null) {
                whr.append(domain.getConditionalOperator());
            } else {
                whr.append(" ");
                whr.append(domain.getColumn());
                whr.append(" ");
                whr.append(domain.getOperator());
                whr.append(" ? ");
                args_list.add(domain.getValue().toString());
            }
        }
    }
    String where = null;
    String[] args = null;
    if (args_list.size() > 0) {
        where = whr.toString();
        args = args_list.toArray(new String[args_list.size()]);
    }
    List<ODataRow> rows = new ArrayList<>();
    rows = rel_model.select(new String[]{rel_model.getDefaultNameColumn()}, where,
            args, rel_model.getDefaultNameColumn());
    ODataRow row = new ODataRow();
    row.put(OColumn.ROW_ID, -1);
    row.put(rel_model.getDefaultNameColumn(), "No " + column.getLabel() + " selected");
    items.add(row);
    items.addAll(rows);
    return items;
}
 
开发者ID:dpr-odoo,项目名称:trainee-om-shop,代码行数:39,代码来源:OSelectionField.java

示例11: doInBackground

import com.odoo.core.orm.ODataRow; //导入方法依赖的package包/类
@Override
protected Boolean doInBackground(String... params) {
    try {
        String subject = params[0];
        String body = params[1];
        OArguments args = new OArguments();
        args.add(server_id);
        HashMap<String, Object> data = new HashMap<>();
        data.put("body", body);
        data.put("subject", (subject.equals("false")) ? false : subject);
        data.put("parent_id", false);
        data.put("attachment_ids", attachmentIds);
        List<Integer> partner_ids = new ArrayList<>();
        if (partner_id != -1 && mType == MessageType.Message) {
            partner_ids.add(partner_id);
        }
        data.put("partner_ids", partner_ids);
        HashMap<String, Object> context = new HashMap<>();
        context.put("mail_read_set_read", true);
        context.put("default_res_id", server_id);
        context.put("default_model", mModel.getModelName());
        context.put("mail_post_autofollow", true);
        context.put("mail_post_autofollow_partner_ids", new ArrayList<>());
        data.put("context", context);
        data.put("type", "comment");
        data.put("content_subtype", "plaintext");
        data.put("subtype", (mType == MessageType.Message) ? "mail.mt_comment" : false);
        Double newId = (double)
                mModel.getServerDataHelper().callMethod("message_post", args, null, data);
        Thread.sleep(500);
        ODataRow row = new ODataRow();
        row.put("id", newId.intValue());
        mailMessage.quickCreateRecord(row);
        return true;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return false;
}
 
开发者ID:Odoo-mobile,项目名称:hr,代码行数:40,代码来源:MailChatterCompose.java

示例12: createOdooInstance

import com.odoo.core.orm.ODataRow; //导入方法依赖的package包/类
public static Odoo createOdooInstance(final Context context, final OUser user) {
        final App app = (App) context.getApplicationContext();
        Odoo odoo = app.getOdoo(user);
        if (odoo == null) {
            odoo = Odoo.createInstance(context,
                    (user.isOAuthLogin()) ? user.getInstanceURL() : user.getHost());
            odoo.helper.OUser mUser =
                    odoo.authenticate(user.getUsername(), user.getPassword(), (user.isOAuthLogin()) ?
                            user.getInstanceDatabase() : user.getDatabase());
            app.setOdoo(odoo, user);
            if (mUser != null) {
                ResCompany company = new ResCompany(context, user);
                if (company.count("id = ? ", new String[]{user.getCompanyId() + ""}) <= 0) {
                    ODataRow company_details = new ODataRow();
                    company_details.put("id", user.getCompanyId());
                    company.quickCreateRecord(company_details);
                }
            } else {
                // FIXME: Need to check again. Not working properly
                //showSignInErrorNotification(context, user);
//                Toast.makeText(context, OResource.string(context, R.string.toast_something_gone_wrong),
//                        Toast.LENGTH_LONG).show();
                Log.e(TAG, OResource.string(context, R.string.toast_something_gone_wrong));
            }
        }
        return odoo;
    }
 
开发者ID:Odoo-mobile,项目名称:hr,代码行数:28,代码来源:OSyncAdapter.java

示例13: onCreate

import com.odoo.core.orm.ODataRow; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.base_profile);
    OAppBarUtils.setAppBar(this, true);
    OUser user = OUser.current(this);
    OForm form = (OForm) findViewById(R.id.profileDetails);
    int color = OStringColorUtil.getStringColor(this, user.getName());
    form.setIconTintColor(color);
    ODataRow userData = new ODataRow();
    userData.put("name", user.getName());
    userData.put("user_login", user.getUsername());
    userData.put("server_url", (user.isOAuthLogin()) ? user.getInstanceURL() : user.getHost());
    userData.put("database", (user.isOAuthLogin()) ? user.getInstanceDatabase() : user.getDatabase());
    userData.put("version", user.getOdooVersion().getServerSerie());
    userData.put("timezone", user.getTimezone());
    form.initForm(userData);

    CollapsingToolbarLayout collapsing_toolbar = (CollapsingToolbarLayout) findViewById(R.id.collapsing_toolbar);
    collapsing_toolbar.setTitle(userData.getString("name"));
    setTitle(userData.getString("name"));
    Bitmap avatar;
    if (user.getAvatar().equals("false")) {
        avatar = BitmapUtils.getAlphabetImage(this, user.getName());
    } else {
        avatar = BitmapUtils.getBitmapImage(this, user.getAvatar());
    }
    ImageView imageView = (ImageView) findViewById(R.id.image);
    imageView.setImageBitmap(avatar);
}
 
开发者ID:Odoo-mobile,项目名称:hr,代码行数:31,代码来源:Profile.java


注:本文中的com.odoo.core.orm.ODataRow.put方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。