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

When I create a partner (company) within OpenERP, I've noticed that records are automatically created in ir_property table.

I'm looking to import partners through direct SQL insert queries, in the res_partner table.

Is it necessary to make inserts in the ir_property table too ?

If yes, could someone explain why ? And what is the purpose ?

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

Hi cd,

when customers are created in OpenERP the model res.users updates both tabel res.users and also tabel ir_property for a number of properties such as

  • property_payment_term -property_product_pricelist -property_delivery_carrier -many more... (see screenshot) image description

In order to ensure that the correct tabel in updated by any inserts/updates and deletes it is recommended that instead of directly updating a singele tabel with a SQL-statement that you instead utilise the OpenERP model itself. In this way you guarantee data integrity.

There are many methods to insert records using the OpenERP models for example: -program a script for it called XML/RPC -Use the inbuilt OpenERP csv import functionality -Use Talend which has available OpenERP connectors (my persona;l favourite)

hope this helps

Paul

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

Never use SQL to change data unless you know EXACTLY what you are doing - it can easily result in an inconsistent database. It bypasses all of the business logic and validation checks built in to the software. You should use XML-RPC if you want to script data imports.

الكاتب أفضل إجابة

Thank you. But I would like to go further.

I would of course never use direct INSERT SQL queries for sales, invoices etc... but to import partners and products, at the setup of a new database, it would make sense to try, especially with thousands of references.

CSV and even XML-RPC imports are -unfortunatly- rather slow.

Some people seem to use SQL to import products, successfully (videos on youtube).

On a fresh DB install, I've noticed that if I choose a "chart of account", and then create a partner, the compulsory fields for the partner "account receivable" and "account payable" are automatically filled.

But OpenERP doesn't create records in ir_property table.

However, when I choose a payment term for a partner, or if i change the AR or AP accounts, then records are added into the ir_property table.

So i'm rather lost.

I believe it would be good for the community to have a clear understanding of the mechanism, regarding importation of products (the most important point) and partners, in order to know once and for all if a proper set of direct INSERT SQL queries could do the job.

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

You can understand the SQL used to create new partner records (including related records in the ir_property table) you should run the server with SQL logging enabled and watch what happens when you enter a record via the UI. See http://help.openerp.com/question/895/how-can-i-log-all-sql-queries-to-a-file/

المنشورات ذات الصلة الردود أدوات العرض النشاط
1
نوفمبر 24
3751
2
مايو 25
1194
4
مايو 25
4870
1
أغسطس 24
2170
1
فبراير 24
3006