Autocreate project on order ?

Asked by Jonathan Liuti

Is there a way to autocreate a project based on a sale order confirmation ?

I know how to generate tasks based on the order, but no project is created.

Does it have to be done in workflows or something ?

Creating the project by hand wouldn't be a problem if there was a way to assign multiple task to one project from list view, but afaik it's not possible. Correct me if I'm wrong.

Thanks,
John.

Question information

Language:
English Edit question
Status:
Solved
For:
Odoo Server (MOVED TO GITHUB) Edit question
Assignee:
No assignee Edit question
Solved by:
Jonathan Liuti
Solved:
Last query:
Last reply:
Revision history for this message
Jonathan Liuti (liuti-john) said :
#1

Just to let people know:

After struggling with the server_action 'create_object' without success..
( I managed to create the project with this but it was duplicated and all in all i had a hard time figuring out how the chaining between action occured...), I finally achieved what i wanted with the following python code used in the sale_order_basic workflow (right after the router):

project = self.pool.get('project.project')
new_project_id = project.create(cr, uid, {
    'name': obj.name + "-" + obj.partner_id.name + "-" + obj.date_confirm,
    'partner_id': obj.partner_id.id,
    'contact_id': obj.partner_invoice_id.id,
    })
task_obj = self.pool.get('project.task')
task_ids = task_obj.search(cr, uid, [('name', 'like', obj.name)])
for task_id in task_ids:
    task_obj.write(cr, uid, [task_id], {'project_id': new_project_id})

It could offcourse be improved by assigning task to people and so on, but for now i'm happy with this.
Hope this can help someone around.

I may release a module later on to ease the process by the way.

Revision history for this message
m.karrer (m-karrer) said :
#2

Thanks a lot - same needs here in Austria for service companies!

Revision history for this message
Christophe Hanon (www.adins.be) (chanon) said :
#3

Sorry if this is not your need but have you checked : project_mrp module?

Revision history for this message
Raphaël Valyi - http://www.akretion.com (rvalyi) said :
#4

Please check our branch, we did it:
https://code.launchpad.net/~akretion-team/+junk/advanced-project-management

--
Raphaël Valyi
Founder and consultant
+55 21 3010 9965
www.akretion.com

On Tue, May 17, 2011 at 5:35 AM, Christophe Hanon (www.adins.be) <
<email address hidden>> wrote:

> Question #144238 on OpenERP Server changed:
> https://answers.launchpad.net/openobject-server/+question/144238
>
> Christophe Hanon (www.adins.be) posted a new comment:
> Sorry if this is not your need but have you checked : project_mrp
> module?
>
> --
> You received this question notification because you are a member of
> OpenERP Committers, which is an answer contact for OpenERP Server.
>