mirror of
https://github.com/OCA/knowledge.git
synced 2025-07-26 18:38:41 -06:00
migrate document_choose_directory to v9
This commit is contained in:
parent
a2c06fbd64
commit
ee6261b3a9
@ -26,13 +26,19 @@
|
|||||||
"license": "AGPL-3",
|
"license": "AGPL-3",
|
||||||
"complexity": "normal",
|
"complexity": "normal",
|
||||||
"category": "Knowledge",
|
"category": "Knowledge",
|
||||||
|
'description': """
|
||||||
|
The Technical module name is changed
|
||||||
|
document to document_document
|
||||||
|
==============================================
|
||||||
|
|
||||||
|
""",
|
||||||
"depends": [
|
"depends": [
|
||||||
'document',
|
'document_document',
|
||||||
'web',
|
'web',
|
||||||
],
|
],
|
||||||
"data": [
|
"data": [
|
||||||
"view/qweb.xml",
|
"view/qweb.xml",
|
||||||
"view/document_directory.xml",
|
"view/document_directory.xml","view/attachement_view.xml"
|
||||||
],
|
],
|
||||||
"js": [
|
"js": [
|
||||||
'static/src/js/document_choose_directory.js',
|
'static/src/js/document_choose_directory.js',
|
||||||
@ -46,8 +52,8 @@
|
|||||||
"test": [
|
"test": [
|
||||||
],
|
],
|
||||||
"auto_install": False,
|
"auto_install": False,
|
||||||
'installable': False,
|
'installable': True,
|
||||||
"application": False,
|
"application": True,
|
||||||
"external_dependencies": {
|
"external_dependencies": {
|
||||||
'python': [],
|
'python': [],
|
||||||
},
|
},
|
||||||
|
@ -25,6 +25,7 @@ from openerp.addons.web.controllers.main import Binary
|
|||||||
class Binary(Binary):
|
class Binary(Binary):
|
||||||
@http.route('/web/binary/upload_attachment', type='http', auth="user")
|
@http.route('/web/binary/upload_attachment', type='http', auth="user")
|
||||||
def upload_attachment(self, callback, model, id, ufile, directory_id=None):
|
def upload_attachment(self, callback, model, id, ufile, directory_id=None):
|
||||||
|
print '22222222'
|
||||||
if directory_id:
|
if directory_id:
|
||||||
# we can't use default_parent_id because of
|
# we can't use default_parent_id because of
|
||||||
# the ir_attachment.create overwrite in document
|
# the ir_attachment.create overwrite in document
|
||||||
|
@ -30,3 +30,40 @@ li.oe_attachment_directory
|
|||||||
{
|
{
|
||||||
cursor: default !important;
|
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 = [];
|
attachments_per_directory = [];
|
||||||
_.chain(attachments)
|
_.chain(attachments)
|
||||||
.groupBy(
|
.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) {
|
.sortBy(function(attachments) {
|
||||||
|
|
||||||
|
console.log("attachments[0].parent_id[1]");
|
||||||
|
console.log(attachments[0].parent_id[1]);
|
||||||
return attachments[0].parent_id[1];
|
return attachments[0].parent_id[1];
|
||||||
})
|
})
|
||||||
.each(
|
.each(
|
||||||
function(group)
|
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({
|
attachments_per_directory.push({
|
||||||
name: _.first(group).parent_id[1] ||
|
name: _.first(group).parent_id[1] ||instance.web._t('No directory'),classname: 'oe_attachment_directory',
|
||||||
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)
|
self.sort_attachments(group).each(function(a)
|
||||||
{
|
|
||||||
|
{ console.log("a");
|
||||||
|
console.log(a);
|
||||||
attachments_per_directory.push(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)
|
sort_attachments: function(attachments)
|
||||||
{
|
{ console.log("_.chain(attachments).sortBy('name');");
|
||||||
|
console.log(_.chain(attachments).sortBy('name'));
|
||||||
return _.chain(attachments).sortBy('name');
|
return _.chain(attachments).sortBy('name');
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
@ -1,13 +1,18 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<templates>
|
<templates>
|
||||||
<t t-extend="Sidebar">
|
<t t-extend="Sidebar">
|
||||||
|
<!-- t t-jquery=".oe_sidebar_add_attachment" t-operation="before"> -->
|
||||||
|
|
||||||
|
|
||||||
<t t-jquery=".oe_sidebar_add_attachment span" t-operation="before">
|
<t t-jquery=".oe_sidebar_add_attachment span" t-operation="before">
|
||||||
|
|
||||||
<select name="directory_id">
|
<select name="directory_id">
|
||||||
<option value="" selected="selected">Choose directory</option>
|
<option value="" selected="selected">Choose directory</option>
|
||||||
<option t-foreach="widget.directory_candidates" t-as="directory" t-att-value="directory.id">
|
<option t-foreach="widget.directory_candidates" t-as="directory" t-att-value="directory.id">
|
||||||
<t t-esc="directory.name" />
|
<t t-esc="directory.name" />
|
||||||
</option>
|
</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</t>
|
</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'");
|
this.attr('t-if', "section.name == 'files' and !item.callback and item.classname != 'oe_attachment_directory'");
|
||||||
@ -17,3 +22,4 @@
|
|||||||
</t>
|
</t>
|
||||||
</t>
|
</t>
|
||||||
</templates>
|
</templates>
|
||||||
|
|
||||||
|
@ -3,15 +3,15 @@
|
|||||||
<data>
|
<data>
|
||||||
<record id="view_document_directory_form" model="ir.ui.view">
|
<record id="view_document_directory_form" model="ir.ui.view">
|
||||||
<field name="model">document.directory</field>
|
<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">
|
<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" />
|
<attribute name="attrs" />
|
||||||
</xpath>
|
</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>
|
<attribute name="attrs">{'invisible': [('type', '!=', 'ressource')]}</attribute>
|
||||||
</xpath>
|
</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>
|
<attribute name="attrs">{'invisible': [('type', '!=', 'ressource')]}</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
|
Loading…
Reference in New Issue
Block a user