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

anyone can help me with this ? i'm trying to create sale order line on create of sale order using list of products like this [{"default_code":"8630ER","name":"product_1","qte":1,"list_price":0},{"default_code":"7630ER","name":"product_2","qte":1,"list_price":0}]

wich is already created on product template

thank you for helping 

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

Hello Zakaria benomar,


There are two options for entering sale.order.line while creating sale.order

@api.model

def create(self, vals):

data_list = [{"default_code":"8630ER","name":"product_1","qte":1,"list_price":0},

{"default_code":"7630ER","name":"product_2","qte":1,"list_price":0}]

sale_order = super(SaleOrder, self).create(vals)

for data in data_list:

product_id = self.env['product.product'].search([('default_code', '=', data['default_code'])])

if product_id:

self.env['sale.order.line'].create({

'product_id': product_id.id,

'order_id': sale_order.id,

'name': data['name'] or product_id.name,

'product_uom_qty': data['qte'] or 1,

'price_unit': data['list_price'] or product_id.lst_price,

})


return sale_order


2) By xls or csv file.

There are many free and paid modules available on the Odoo Apps store.

By using such modules one can enter the required data in the excel sheet and can import the same file.

Using such modules one can easily import number of sale orders and it's sale order line.

Eg. https://www.odoo.com/apps/modules/10.0/import_purchase_sale_order_xls/


Can you please mark this as a resolved if you are satisfied with my answer.
Ảnh đại diện
Huỷ bỏ
Bài viết liên quan Trả lời Lượt xem Hoạt động
13
thg 10 17
17779
0
thg 12 21
2384
0
thg 3 15
3535
1
thg 1 25
3228
2
thg 8 24
5751