Odoo change resource model and ID of attached document - openerp-7

in Odoo v7 Knowledge Management:
if I upload from Knowledge > Document > Create, in the "Attached To" section the "Resource model" and "resource ID" fields remain empty:
if I "attach" the file from a specific resource, eg. a partner, those fields get filled with corresponding values (eg. Resource model: partner, Resource ID: xxx)
How could I map a document to another resource (model and ID)?
Those fields are non editable within the Document Creation form: is there any counterissue in making them editable?

Static directories should never return files with res_model/res_id because static dirs are /never/ related to a record.
In fact, files related to some model and parented by the root dir (the default), will NOT be accessible in the node system unless a resource folder for that model exists (with resource_find_all=True).
Having resource attachments in a common folder is bad practice, because they would be visible to all users, and their names may be the same, conflicting.

Related

Creating File to sharepoint based on content type

I am trying to create some files based on content types set in a library that triggers when item is added to a list.
I am using as an action based on a tutorial that i found the "create item" and i place "Documents" on the list selection so the flow gives me the content type Id and all other columns that are needed.
All looks fine but i get an error of:
To add an item to a document library, use
SPFileCollection.Add()\r\nclientRequestId:
b008247b-f143-44a7-b914-316fcd9eb7d0\r\nserviceRequestId:
df3cbf9e-00cc-8000-97f0-36e3a5627bdb
Is there anything that i can do to edit the flow?
You can upload your own template file to your content types. After that you set up your flow as follows:
Item in list created (trigger action)
Get your file content using "get file content" action (you can of course use several
content types with different template files)
Create a new file using the "Create file" action giving it the file Content of your
previous action

Can we create additional uid/cn in Wso2 IS embedded Ldap

I used ApacheDS to view the structure of the Domain & its children (New tenants).
But couldn't create any values on it.
Below image depicts
I want to add uid/cn under each domain[i].com purpose is to just store some extra details about those domains.
Is that possible?
if I add uid, it throws non-structural object exception.
if I add ou, it throws object doesn't exist!
Is that possible?
Edit: or either as a custom attribute for each users/ #domain[i].com level ?

Synchronizing PostgreSQL media tree of folder/file nodes to filesystem paths

In PostgreSQL I have implemented a materialized path tree (ltree) where each node has an an additional parent_id column besides the path.
These nodes can be associated with custom content types such as eg. folder and image.
The home directory for all these files are ./media
So right now i save the url file system reference inside the database like:
tbl_node:
id bigint
name character varying
path ltree (eg. 'nodeid.nodeid.nodeid.etc')
parent_id bigint
node_type int (document, media, template, etc)
tbl_content:
id bigint
node_id bigint
meta json (eg. {alt:"alt text here", caption: "etc", url:"/media/folder/(subfolders)/../image.jpg"})
tab_node.name = filename.filetype or foldername (in filesystem)
If PostgreSQL just had an equivalent to MSSQL's FILESTREAM or if DATALINK was implemented, then my problems would probably be solved, but I need somewhat the same functionality as these would have given me.
So my problem is... my node structure and file structure should always be kept in sync. However I can assume all renaming and moving of files and folders is done through my GUI and not directly in the filesystem.
That means whenever i rename eg. a parent-parent folder node in the database, the sub-sub image node's meta -> url must also reflect this new parent folder name (and of course the filesystem must change as well), so I guess I need to come up with a different solution, instead of saving a reference to the file (filesystem path) in a column inside the node.
Of course if I rename the node (image node) itself, I can easily change the url to point to the new name, and rename the image .jpg file during the db transaction in my golang model (node name = filename is my convention, as well as node hierarchy = folder hierarchy). The problem is when I change a parent node for eg. the parent (or parent-parent-...) folder - since I store the whole url on the children nodes to that image file, and the path has now changed.
Would a good solution to make a trigger fire when the path changes? I hope there's a better way.
What other approaches do exist, now that PostgreSQL does not have the FILESTREAM nor DATA LINK datatypes to help keeping my file system db nodes/tree synchronized with my media file system / directory structure?
Ps.
Since I guess Postgres does not have a clever solution to this, maybe it could be relevant to mention that I'm coding in Go (Golang), if you somehow have some way of coding around this from the application itself.
Thoughts and pseudocode so far:
1) Consider this tree that maps to this file system
Tree, DB:
sample image folder (node.name)
image.jpg (node.name)
Filesystem:
/media/sample image folder
/media/sample image folder/image.jpg
2) First we rename the "sample image folder" node.name to "renamed image folder" (and of course it's corresponding content record's meta->url to "/media/renamed image folder" from the CMS GUI.
3) When renaming the parent folders node.name column and content records meta->url, during the same transaction rename the corresponding folder in the filesystem
4) Later in that same transaction select all children by node path (ltree, materialized path)
5) And by referencing on the node.id and content.node_id, update the corresponding content record's meta->"url" (file system reference) substring(0,lastindexof("/")) - before the filename. - for ALL the child nodes of the folder/node-folder we renamed.
Hopefully all this gives you somewhat a clearer idea of what I'm trying to achieve. :)
Is very hard to understand what you wrote. But for what I get, I don't think you need a database to keep the changes of the file system. The file system IS the database. Now what you can do with the database is to have "virtual" paths pointing to the filesystem paths. But at that point you don't need to move files around in the filesystem, only make the database representation of it consistent.
node_id int
virtual_path string
physical_path string
virtual_attributes
physical_attributes
Hope it helps.
P.s this is not a go question

Content Organizer Rule Creation Issue

I am using the Content Organizer feature to move documents of a specific content type into a specific folder in a document library in the same site. I created a content organizaer rule with a property setting that uses the property testcolumn. Testcolumn is a site column defined as a lookup to column on a custom List, testlist, and then added to a site content type. The items in this list are displayed in the Value dropdown list and I can select the specific value I want to use for this rule.
The problem is that I can create and save rules provided that there are no more than 19 items in the testlist list. When I have 20 items in the testlist, it looks like the rule was saved by the UI. If I open the rule and go to edit it, the Value for the testcolumn property is (None). If I look at the item in powershell, the Value property is equal to '0' and not the ID of the item I saved in the UI. If I delete a record in the testlist so that the total number of items drops below 20, I can save the rule without issue. I have tried different combinaitions of items in the list in case it was a text issue, but when I have 20 items or more in the list, the rule is not saved.
I have looked at the ULS logs and it states the "Routing Engine: UpdateRule() has successfully updated the rule, rule.Name=TestRule1" when I save the rule.
Thanks for your help.
The answer is partially listed here. Looks like the page renders the control differently if the number of items is 20 or greater. The content organizer rule creation page does not handle this change and does not show any error when saving the information.
I was able to get around this limitation in the UI by adding the rules through code during my feature creation event. A link to creating rules through code is here.

How do you move a SharePoint 2010 DocumentSet from one list to another?

I've tried many variations.
Send To Library - That creates a Zipped file in the Drop Off Library, then it doesn't route via the rules in Content Organizer
API - I've tried to do an Export, Import, but always receive the same error. This is per this MSDN documentation: http://msdn.microsoft.com/en-us/library/microsoft.office.documentmanagement.documentsets.documentset.create.aspx
Sample snippet:
byte[] exportedFile = set.Export();
DocumentSet.Import(exportedFile, DocSetNameToCreate, targetFolder, dsCt.Id, properties, web.CurrentUser);
Error Received:
DocID: Site prefix not set.
Finally got it to run. This is related to the Document ID Feature. Make sure it is activated in each site. Let is run over night (timer jobs need to run). Then the content organizer will successfully move and unpackage your document sets.
You don't have to activate the document id feature, just ensure that in the property bag of the root web of the destination site collection (where the document set will be imported again) exists a property named "docid_msft_hier_siteprefix" with an value of "" (empty string).
Use this powershell-script:
$site = Get-SPSite http://host/sites/yoursite
$properties = $site.RootWeb.Properties
if ($properties["docid_msft_hier_siteprefix"] -eq $null)
{
$properties["docid_msft_hier_siteprefix"] = ""
$properties.Update()
}
Note that i use the old property bag RootWeb.Properties instead of the new hashtable RootWeb.AllProperties, thats because the class Microsoft.Office.DocumentManagement.Internal.OobProvider still uses that.
So why is it failing when a document set is imported? The function DocumentSet.ImportProperties() catches an ArgumentException while trying to set the document id of the document set list item (so there's no problem if the document id column doesn't exist yet).
But they missed that the function OobProvider.GetSitePrefix() which is called through the function OobProvider.GenerateDocumentId() throws an InvalidOperationException if the property bag doesn't contain the prefix property.