[Artphotokids] Being able to create a record from FTP
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
SYNERPGY Projects |
New
|
High
|
Vivek poddar |
Bug Description
Hi vivek,
This is an interesting feature I propose to you today : improving the FTP document management.
As you know the dynamic FTP of OpenERP is very interesting :
-You can access ir.attachment of OpenERP directly on a FTP
-You can have a folder created dynamically for each record of an object, and if you push a document in this folder, then it became an attachment of the record.
-We can have an arborescence, access right etc...
There is just one thing which is missing I think : the ability to create a record by creating a new folder in the FTP if his folder parent is a dynamic folder.
I already created the interface, which is quite simple. I let you check the branch and modify directly in. Be cautious I haven't debug it yet.
So in document.directory form, if the type of the directory is "Folders per resources" then the tab "Create from FTP" appears. If we check the checkbox "Create from FTP?", then we have the possibility to create the record from the FTP simply by creating a new folder.
Of course, by creating a folder, we can only specify a name. But maybe the record has some required field. This is why we have the one2many "create_
For example, for the following directory configuration :
Directory (static directory)
-> Order per Partner (dynamic directory, based on res.partner)
-> Partner X (folder of the record partner X from res.partner)
-> Orders (dynamic directory, based on sale.order with domain ['partner_
-> SO245 (folder of the record S0245 from sale.order, which has partner_id = Partner X)
Let's assume the directory 'Order per Partner' define a context 'pricelist_id' which is the pricelist of the partner.
In sale.order we have pricelist_id which is a required field.
Also, in the configuration of 'Orders' directory, we checked "Create from FTP?" and in "create_
name expression
partner_id [active_id]
pricelist_id context(
(or whatever kind of expression you think it'll work)
Now we are in the folder 'Orders' in the FTP, and we want to create a new folder 'SO246'.
If we do it, then a new record 'SO246' is created in sale.order with partner_id = Partner X and pricelist_id = the pricelist of Partner X.
Finally, I also want to make some change in the field resource_name of the directory object. Now it's a many2one, but I'd prefer an expression so we can for example make 'product_id.name' so we can use a field in another object as a name of the folder. We'll need this feature for the project.
Finally, we'll develop this feature in a module, but once it'll work you'll have to propose to merge your code directly in the document official module. I strongly suggest to make your better code quality.