mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-26 02:18:40 -06:00
migrate document_choose_directory to v9
This commit is contained in:
parent
a2c06fbd64
commit
ee6261b3a9
@ -26,13 +26,19 @@
|
||||
"license": "AGPL-3",
|
||||
"complexity": "normal",
|
||||
"category": "Knowledge",
|
||||
'description': """
|
||||
The Technical module name is changed
|
||||
document to document_document
|
||||
==============================================
|
||||
|
||||
""",
|
||||
"depends": [
|
||||
'document',
|
||||
'document_document',
|
||||
'web',
|
||||
],
|
||||
"data": [
|
||||
"view/qweb.xml",
|
||||
"view/document_directory.xml",
|
||||
"view/document_directory.xml","view/attachement_view.xml"
|
||||
],
|
||||
"js": [
|
||||
'static/src/js/document_choose_directory.js',
|
||||
@ -46,8 +52,8 @@
|
||||
"test": [
|
||||
],
|
||||
"auto_install": False,
|
||||
'installable': False,
|
||||
"application": False,
|
||||
'installable': True,
|
||||
"application": True,
|
||||
"external_dependencies": {
|
||||
'python': [],
|
||||
},
|
||||
|
@ -25,6 +25,7 @@ from openerp.addons.web.controllers.main import Binary
|
||||
class Binary(Binary):
|
||||
@http.route('/web/binary/upload_attachment', type='http', auth="user")
|
||||
def upload_attachment(self, callback, model, id, ufile, directory_id=None):
|
||||
print '22222222'
|
||||
if directory_id:
|
||||
# we can't use default_parent_id because of
|
||||
# the ir_attachment.create overwrite in document
|
||||
|
@ -30,3 +30,40 @@ li.oe_attachment_directory
|
||||
{
|
||||
cursor: default !important;
|
||||
}
|
||||
|
||||
.openerp .oe_hidden_input_file input.o_form_input_file {
|
||||
z-index: 0;
|
||||
line-height: 0;
|
||||
font-size: 12px;
|
||||
position: initial;
|
||||
top: 1px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
opacity: 0;
|
||||
filter: alpha(opacity=0);
|
||||
-ms-filter: "alpha(opacity=0)";
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.openerp input, .openerp textarea, .openerp select {
|
||||
padding: 2px 4px;
|
||||
border: 1px solid #ccc;
|
||||
-moz-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
background: white;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
|
||||
.fa-trash-o {
|
||||
display: inline-block;
|
||||
font: normal normal normal 14px/1 FontAwesome;
|
||||
font-size: inherit;
|
||||
text-rendering: auto;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
margin-right: -5px;
|
||||
color: brown;
|
||||
}
|
@ -56,21 +56,39 @@ openerp.document_choose_directory = function(instance)
|
||||
attachments_per_directory = [];
|
||||
_.chain(attachments)
|
||||
.groupBy(
|
||||
function(a) { return a.parent_id[0] })
|
||||
function(a) {
|
||||
console.log("a.parent_id[0]");
|
||||
console.log(a.parent_id[0]);
|
||||
return a.parent_id[0] })
|
||||
.sortBy(function(attachments) {
|
||||
|
||||
console.log("attachments[0].parent_id[1]");
|
||||
console.log(attachments[0].parent_id[1]);
|
||||
return attachments[0].parent_id[1];
|
||||
})
|
||||
.each(
|
||||
function(group)
|
||||
{
|
||||
|
||||
{ console.log("attachments_per_directory");
|
||||
console.log(attachments_per_directory);
|
||||
console.log("group");
|
||||
console.log(group);
|
||||
console.log(".first(group).parent_id[1]");
|
||||
console.log(_.first(group).parent_id[1]);
|
||||
|
||||
|
||||
attachments_per_directory.push({
|
||||
name: _.first(group).parent_id[1] ||
|
||||
instance.web._t('No directory'),
|
||||
classname: 'oe_attachment_directory',
|
||||
name: _.first(group).parent_id[1] ||instance.web._t('No directory'),classname: 'oe_attachment_directory',
|
||||
});
|
||||
|
||||
console.log("attachments_per_directory");
|
||||
console.log(attachments_per_directory);
|
||||
self.sort_attachments(group).each(function(a)
|
||||
{
|
||||
|
||||
{ console.log("a");
|
||||
console.log(a);
|
||||
attachments_per_directory.push(a);
|
||||
console.log(attachments_per_directory);
|
||||
});
|
||||
});
|
||||
|
||||
@ -85,7 +103,8 @@ openerp.document_choose_directory = function(instance)
|
||||
});
|
||||
},
|
||||
sort_attachments: function(attachments)
|
||||
{
|
||||
{ console.log("_.chain(attachments).sortBy('name');");
|
||||
console.log(_.chain(attachments).sortBy('name'));
|
||||
return _.chain(attachments).sortBy('name');
|
||||
},
|
||||
});
|
||||
|
@ -1,15 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<templates>
|
||||
<t t-extend="Sidebar">
|
||||
<t t-jquery=".oe_sidebar_add_attachment span" t-operation="before">
|
||||
<!-- t t-jquery=".oe_sidebar_add_attachment" t-operation="before"> -->
|
||||
|
||||
|
||||
<t t-jquery=".oe_sidebar_add_attachment span" t-operation="before">
|
||||
|
||||
<select name="directory_id">
|
||||
<option value="" selected="selected">Choose directory</option>
|
||||
<option t-foreach="widget.directory_candidates" t-as="directory" t-att-value="directory.id">
|
||||
<t t-esc="directory.name" />
|
||||
</option>
|
||||
</select>
|
||||
|
||||
</t>
|
||||
<t t-jquery=".oe_sidebar_delete_item">
|
||||
<t t-jquery=".oe_sidebar_delete_item">
|
||||
this.attr('t-if', "section.name == 'files' and !item.callback and item.classname != 'oe_attachment_directory'");
|
||||
</t>
|
||||
<t t-jquery="button.oe_dropdown_toggle t[t-if]">
|
||||
@ -17,3 +22,4 @@
|
||||
</t>
|
||||
</t>
|
||||
</templates>
|
||||
|
||||
|
@ -3,15 +3,15 @@
|
||||
<data>
|
||||
<record id="view_document_directory_form" model="ir.ui.view">
|
||||
<field name="model">document.directory</field>
|
||||
<field name="inherit_id" ref="document.view_document_directory_form" />
|
||||
<field name="inherit_id" ref="document_document.view_document_directory_form" />
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//page[@string='Definition']/group[2]" position="attributes">
|
||||
<xpath expr="//page[@name='definition']/group[2]" position="attributes">
|
||||
<attribute name="attrs" />
|
||||
</xpath>
|
||||
<xpath expr="//page[@string='Definition']/group[2]/field[@name='resource_field']" position="attributes">
|
||||
<xpath expr="//page[@name='definition']/group[2]/field[@name='resource_field']" position="attributes">
|
||||
<attribute name="attrs">{'invisible': [('type', '!=', 'ressource')]}</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//page[@string='Definition']/group[2]/field[@name='ressource_tree']" position="attributes">
|
||||
<xpath expr="//page[@name='definition']/group[2]/field[@name='ressource_tree']" position="attributes">
|
||||
<attribute name="attrs">{'invisible': [('type', '!=', 'ressource')]}</attribute>
|
||||
</xpath>
|
||||
</field>
|
||||
|
Loading…
Reference in New Issue
Block a user