mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-23 04:22:04 -06:00
[IMP]comment from lp, create line for attachement if we don't get a res_model
This commit is contained in:
parent
97503d09ae
commit
e1bf00a575
@ -36,6 +36,7 @@ class document_file(orm.Model):
|
||||
context = {}
|
||||
for line in self.browse(cr, uid, ids, context=context):
|
||||
if line.attachmentdocument_ids:
|
||||
# Get the first document
|
||||
first_id = min(line.attachmentdocument_ids)
|
||||
|
||||
result = self.write(cr, uid, ids, {'res_id': first_id.res_id,
|
||||
|
@ -9,7 +9,6 @@ var _t = instance.web._t,
|
||||
self.$el.find('.oe_sidebar_add_attachment').after(QWeb.render('AddDocfromserver', {widget: self}))
|
||||
self.$el.find('.open').on('click', function (e) {
|
||||
self.on_call_new_view_function();
|
||||
//this.$('.oe_btn_class_name').on('click', this.on_call_new_view_function);
|
||||
});
|
||||
},
|
||||
on_call_new_view_function: function(state) {
|
||||
@ -23,7 +22,7 @@ var _t = instance.web._t,
|
||||
};
|
||||
// the action dictionary variable sends data in the "self.do_action" method
|
||||
var action = {
|
||||
name: _t("Add Document"),
|
||||
name: _t("Add existing document/attachment"),
|
||||
type: 'ir.actions.act_window',
|
||||
res_model: 'ir.attachment.wizard',
|
||||
view_mode: 'form',
|
||||
|
@ -52,7 +52,12 @@ class document_wizard(orm.Model):
|
||||
'res_name': name,
|
||||
'attachment_id': attach.id,
|
||||
}
|
||||
ir_attach_doc_obj.create(cr, uid, data_attach, context=context)
|
||||
#Created attachment_document_ids
|
||||
if attach.res_model:
|
||||
ir_attach_doc_obj.create(cr, uid, data_attach, context=context)
|
||||
# Updated attachment line
|
||||
else:
|
||||
ir_attach_obj.write(cr, uid, [attach.id], data_attach, context=context)
|
||||
return {'type': 'ir.actions.act_window_close'}
|
||||
|
||||
# vim:expandtab:smartindent:toabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
Loading…
Reference in New Issue
Block a user