Odoo Help


1 Answer

Ray Carnes

--Ray Carnes--
| 9 7 10
Greater Los Angeles, United States
--Ray Carnes--

Business Analyst

OpenERP 6.1, 7.0; Odoo 8.0, 9.0, 10.0, 11.0 and 12.0.

Completed Odoo Functional and Technical Training.

Functional Areas:

  • CRM/Sales

  • Inventory

  • Manufacturing

  • Accounting

  • Purchasing

Major Skills:

  • Business Process Reengineering

  • Efficiency Consulting

  • User Needs and GAP Analysis;

  • Functional and Technical Design;

  • Prototyping and Proof of Concepts;

  • Requirements Specifications;

  • Agile Implementation;

  • Data Migration;

  • Configuration & Customization (UI and code);

  • Integration - Odoo and non Odoo Applications and Services;

  • Training and Knowledge Transfer;

  • Go Live Support;

  • Helpdesk;

  • Version Upgrades and Migration.

  • Accounting Expert.

I have over 20 years of experience empowering and enabling users with enterprise information systems that make a real and measurable difference in their ability to proactively manage their businesses and organizations. 

I am a skilled Communicator and I only take the serious things seriously!

Ray Carnes
12/30/14, 1:56 PM

Version 8.0:

WARNING: Updating the PostgreSQL database via SQL is considered a very advanced technique and should never be done unless you have a complete understanding of the Odoo schema and business logic.  You should backup your database and test this on a backup and only do this on a production system if you are 100% certain it works the way you want.

AP and AR accounts for partners are stored in the ir_property table.  Set one partner with the accounts you want and take a look at this table in SQL to get familiar with the structure and how these properties are represented.

Query the table this way:

SELECT name, type, company_id, fields_id, value_reference, res_id FROM ir_property WHERE name = 'property_account_receivable' or name = 'property_account_payable';

An example output would be this:

name, type, company_ud, fields_id, value_reference, res_id

property_account_payable, many2one, 1, 1960, "account.account,64, "res.partner,17"
property_account_receivable, many2one, 1, 1957, "account.account,59", "res.partner,17"


Looking at res_id - this tells you that the property is being attached to record 17 of the res_partner model.

Looking at fields_id - this tells you that the property is being attached to field 1960 (payable) or 1957 (receivable) of the res_partner model. 

Looking at value_reference - this tells you that the property is a link to an account and that ID 64 represents the payable account and ID 59 represents the receivable account.  

Once you verify how this looks on your database, for each partner you run the following two SQL statements:

insert into ir_property (create_uid,create_date, write_date,write_uid, name,type,company_id,fields_id,value_reference,res_id) VALUES (1,current_date,current_date,1,'property_account_receivable','many2one',1,1960,'account.account,64','res.partner,db_id_of_partner'); 


insert into ir_property (create_uid,create_date, write_date,write_uid, name,type,company_id,fields_id,value_reference,res_id) VALUES (1,current_date,current_date,1,'property_account_payable','many2one',1,1957,'account.account,59','res.partner,db_id_of_partner');  

TIP: If you are rusty on your SQL, you can export all of the database id's into a CSV file, prepend the relevant SQL, replace the linefeed character with the end quote and a semicolon, save the result as a *.sql file and import into the database (you can do this in a text editor).  I did this because it was easier for me than working out how to loop through every partner.  


Zura Tsiklauri
3/11/15, 9:08 AM

I have Over 100.000 Partners And I need their payable and receivable accounts changed and also Journal Entries on their account changed accordingly.How?

Ray Carnes
3/11/15, 8:30 PM

Once you have changed the accounts, go to the Journal Entries and update the ID's based on the changes you have made. MAKE SURE you test this and UNDERSTAND what you are doing. Update account_move_line set account_id = NEW where account_id = OLD (provided there are no other entries using this account, if there are you need a query that isolates them).

Ask a Question
Keep Informed
3 follower(s)
About This Community

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now