This question has been flagged
2 Replies
1253 Views

As of now we can automatically create project from sales order, if sales order lines consist at least one service product.


Is there any way to create automatic project from sales orders. But the sales order line will only have storable product.

Avatar
Discard
Best Answer

Hi,

By default, Odoo allows for the automatic creation of a project from a sales order if the sales order lines contain at least one service product.

if you want to create a project automatically from a sales order with only storable products, you would need to customize the system.

Suppose you want to create project on sale order confirmation you can do as this

Inherit sale.order model and in action_confirm function :

def action_confirm(self):
res = super(SaleOrder, self).action_confirm()
for order in self:
if all(line.product_id.type == 'product' for line in order.order_line):
# Create a project for the sales order
project = self.env['project.project'].create({
'name': order.name,
'sale_order_id': order.id,
# Add any other project field values as needed
})
# Link the project to the sales order
order.project_id = project.id
return res


Hope this will help you
Thanks

Avatar
Discard

Thanks Mehjabin. Any possibility of getting this done through Studio app ?

Best Answer

in Version 16.3 Odoo has given option of creating Project with Storable product SO as well. Check that out

Avatar
Discard

I can't do the same on 16.3. Can you share how to do that? Thx