Bỏ qua để đến Nội dung
Menu
Câu hỏi này đã bị gắn cờ
2 Trả lời
3382 Lượt xem

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.

Ảnh đại diện
Huỷ bỏ
Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ

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

Câu trả lời hay nhất

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

Ảnh đại diện
Huỷ bỏ

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