summaryrefslogtreecommitdiff
path: root/addons/document/static/src/js/document.js
diff options
context:
space:
mode:
authorGéry Debongnie <ged@odoo.com>2015-03-10 08:44:41 +0100
committerGéry Debongnie <ged@odoo.com>2015-03-18 09:01:52 +0100
commit858e46e977de772c36d3073d0d61b2a3c5958117 (patch)
tree2fc1680684c77260e70c0bd38f1dc0c0b2139a18 /addons/document/static/src/js/document.js
parent824dbe13ad7f415e4028c62d5c764a0fb1fed184 (diff)
[REF] update various small addons to the new module system
Diffstat (limited to 'addons/document/static/src/js/document.js')
-rw-r--r--addons/document/static/src/js/document.js57
1 files changed, 32 insertions, 25 deletions
diff --git a/addons/document/static/src/js/document.js b/addons/document/static/src/js/document.js
index 5b353d5b0dd..c3b47ee7380 100644
--- a/addons/document/static/src/js/document.js
+++ b/addons/document/static/src/js/document.js
@@ -1,25 +1,32 @@
-openerp.document = function (instance) {
- _t = instance.web._t;
- instance.web.Sidebar.include({
- init : function(){
- this._super.apply(this, arguments);
- if (this.getParent().view_type == "form"){
- this.sections.splice(1, 0, { 'name' : 'files', 'label' : _t('Attachment(s)'), });
- this.items['files'] = [];
- }
- },
- on_attachments_loaded: function(attachments) {
- //to display number in name if more then one attachment which has same name.
- var self = this;
- _.chain(attachments)
- .groupBy(function(attachment) { return attachment.name})
- .each(function(attachment){
- if(attachment.length > 1)
- _.map(attachment, function(attachment, i){
- attachment.name = _.str.sprintf(_t("%s (%s)"), attachment.name, i+1)
- })
- })
- self._super(attachments);
- },
- });
-};
+odoo.define('document.document', ['web.core', 'web.Sidebar'], function(require) {
+"use strict";
+
+var core = require('web.core');
+var Sidebar = require('web.Sidebar');
+
+var _t = core._t;
+
+Sidebar.include({
+ init : function(){
+ this._super.apply(this, arguments);
+ if (this.getParent().view_type == "form"){
+ this.sections.splice(1, 0, { 'name' : 'files', 'label' : _t('Attachment(s)'), });
+ this.items.files = [];
+ }
+ },
+ on_attachments_loaded: function(attachments) {
+ //to display number in name if more then one attachment which has same name.
+ var self = this;
+ _.chain(attachments)
+ .groupBy(function(attachment) { return attachment.name; })
+ .each(function(attachment){
+ if(attachment.length > 1)
+ _.map(attachment, function(attachment, i){
+ attachment.name = _.str.sprintf(_t("%s (%s)"), attachment.name, i+1);
+ });
+ });
+ self._super(attachments);
+ },
+});
+
+});