在Openerp中自定义“添加项”

时间:2014-11-18 05:29:50

标签: openerp openerp-7 odoo

我需要更改"添加项目的名称"在树视图中。无需在基类中进行编辑。

从" web / static / src / js / view_form.js"触发添加项目。

那么如何更改名称"添加项目"到"添加"

 var $cell = $('<td>', {
        colspan: columns,
        'class': this._add_row_class || ''
    }).append(
        $('<a>', {href: '#'}).text(_t("Add an item"))
            .mousedown(function () {
                // FIXME: needs to be an official API somehow
                if (self.view.editor.is_editing()) {
                    self.view.__ignore_blur = true;
                }
            })

或者创建一个新的js文件,以及如何反映我的项目

1 个答案:

答案 0 :(得分:0)

(function () {
    "use strict";
    openerp.web.form.AddAnItemList.include({
        pad_table_to : function() {
            var self = this;
            this._super.apply(this, arguments);
            //for one2may field
            self.$current.find('.oe_form_field_one2many_list_row_add a').text('Your Text');
            //for many2many field
            self.$current.find('.oe_form_field_many2many_list_row_add a').text('Your Text');
        }  
    });
}) ();

将上面的代码放在你的js文件中,我想你能够访问你的js文件中的openerp实例,希望这可以帮助你:)

相关问题