created_move_ids = []
asset_ids = []
for line in self.browse(cr, uid, ids, context=context):
- depreciation_date = context.get('depreciation_date') or time.strftime('%Y-%m-%d')
+ depreciation_date = context.get('depreciation_date') or line.depreciation_date or time.strftime('%Y-%m-%d')
- ctx = dict(context, account_period_prefer_normal=True)
- period_ids = period_obj.find(cr, uid, depreciation_date, context=ctx)
+ period_ids = period_obj.find(cr, uid, depreciation_date, context=context)
company_currency = line.asset_id.company_id.currency_id.id
current_currency = line.asset_id.currency_id.id
context.update({'date': depreciation_date})
$(window).on(this.fileupload_id, _.bind(this.on_file_loaded, this));
},
start: function() {
- this._super(this);
+ this._super();
+ instance.web.form.ReinitializeFieldMixin.start.call(this);
this.$el.on('change', 'input.oe_form_binary_file', this.on_file_change );
- this.on("change:effective_readonly", this, function () {
- this.render_value();
- });
},
set_value: function(value_) {
- var value_ = value_ || [];
- var self = this;
- var ids = [];
- _.each(value_, function(command) {
- if (isNaN(command) && command.id == undefined) {
- switch (command[0]) {
- case commands.CREATE:
- ids = ids.concat(command[2]);
- return;
- case commands.REPLACE_WITH:
- ids = ids.concat(command[2]);
- return;
- case commands.UPDATE:
- ids = ids.concat(command[2]);
- return;
- case commands.LINK_TO:
- ids = ids.concat(command[1]);
- return;
- case commands.DELETE:
- ids = _.filter(ids, function (id) { return id != command[1];});
- return;
- case commands.DELETE_ALL:
- ids = [];
- return;
- }
- } else {
- ids.push(command);
- }
- });
- this._super( ids );
+ value_ = value_ || [];
+ if (value_.length >= 1 && value_[0] instanceof Array) {
+ value_ = value_[0][2];
+ }
+ this._super(value_);
},
get_value: function() {
- return _.map(this.get('value'), function (value) { return commands.link_to( isNaN(value) ? value.id : value ); });
+ var tmp = [commands.replace_with(this.get("value"))];
+ return tmp;
},
get_file_url: function (attachment) {
return this.session.url('/web/binary/saveas', {model: 'ir.attachment', field: 'datas', filename_field: 'datas_fname', id: attachment['id']});