Odoo: How to rename "New" label, in odoo module, in new object form?

Viewed 64

enter image description here

when i create a new meeting in calendar module, it shows like "New" i want rename that label, for example, to "New meeting" is it possible? and where can i find this place in code?

2 Answers

The New value is defined in the basic model of the form view. To change it you can override the getName function like the following:

import BasicModel from 'web.BasicModel';
import core from 'web.core';

var _t = core._t;

BasicModel.include({
    getName: function (id) {
        var record = this.localData[id];
        var returnValue = this._super(id);
        if ( returnValue === _t("New") && record.model == 'calendar.event') {
            return _t('New meeting');
        } else {
            return returnValue;
        }
    }
});

You need to add the file under the assets entry in the __manifest__.py file.

'assets': {
    'web.assets_backend': [
        '{module_name}/static/src/js/basic_model.js',
    ],
}

Edit:

For more details on how to add the js file to the manifest, check the assets documentation.

Hi wald i found some solution:

Inside addons/web/static/src/webclient/actions/action_service.js in you need see this code "New" this is target attribute but i think you do not override and change it like "New Meeting"

enter image description here

Related