تخطي للذهاب إلى المحتوى
القائمة
لقد تم الإبلاغ عن هذا السؤال
1 الرد
5964 أدوات العرض

I have a scenario where I want to test the performance of Odoo with 500,000 products.

Importing this many would take too long.

Is there a faster way?

الصورة الرمزية
إهمال
أفضل إجابة

If you trace the SQL logs on the Server, or understand the schema of Odoo enough, you can use SQL to do this.

Note:  Updating Odoo via SQL bypasses the ORM business layer - meaning nothing is checking your work to make sure it is consistent with Odoo's business rules.  This is a very advanced technique and not recommended for production systems, as it could lead to data corruption if not done properly.  We suggest only doing this on test / duplicate systems.

with template as 
(insert into product_template
(active,sale_ok,default_code,name,type,categ_id, uom_id, uom_po_id, tracking, list_price)
select
't',
't',
left(md5(i::text),10),
md5(random()::text),
'consu',
4,
1,
1,
'none',
random() * 50 + 1
from generate_series(1,500000) s(i)
returning id as id
)
insert into product_product (active, product_tmpl_id)
select 't',id from template;

The SQL above will generate half a million products in just a few minutes.

The fields you need to use will depend on the modules you have installed and the features you want to test, but this approach will work.  There are hardcoded values in this example for Product Category, Unit of Measure, and Purchase Unit of Measure that you can modify.



الصورة الرمزية
إهمال

mass create products for testing

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
مايو 18
4111
1
أكتوبر 22
5750
4
فبراير 19
6611
5
أكتوبر 16
8621
4
يناير 24
15303