Odoo Help


How to make Account Receivable and Account Payable fields auto-incriment

on 9/11/15, 12:34 PM 1,055 views


i want to make  Account Receivable and Account Payable fields auto incriment exp, in the accounting chart ;custumer account is : 411100

for the custumer 1 with the name c1, i want to creat automaticlly an Account Receivable 411101 c1

for the custumer 2 with the name c2, i want to creat automaticlly an Account Receivable 411102 c2


Axel Mendoza
On 9/12/15, 2:08 PM

You will be ending with one account per customer, why?, you could use an account.analytic.account by put an inherits with that model instead to don't mess the account chart like are done for project.project. Analytic accounts are more suitable for this, just my opinion, if you have requirements for that then move on, also account.journal could be used too for that.

+1 What anis wants is contrary to collective accounts for the purpose of a regular accounts payable/receivable management.

Ermin Trevisan
on 9/14/15, 3:22 AM
Drees Far
On 9/11/15, 1:43 PM


Hey friend try to create a function which will add for each customer do like this:

1. add 411101 + custmer..id

2. concatenate the first result with the name of the customer

Which means a function like this:

def get_inputs(self, cr, uid,ids, field_id, context=None): 

obj = self.pool.get('table_of_cutomers') 

id_var = self.read(cr, uid,ids,['id','name_customer'])

obj_ids = obj.search(cr, uid, [('name_customer', '=', field_id)])

and then you will add (411101 + id) put it in a variable and concatenate i as i told you.

To call your function you can call an on_change function like this:

def on_change_customer_id(self, cr, uid, ids, field_id, context=None):

res = {'value':{'customer_ids': self.get_inputs(cr, uid, ids, field_id, context=context),


return res

Dont forget the xml:

<field name="field_id" on_change="on_change_customer_id(field_id)">


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

Question tools

2 follower(s)


Asked: 9/11/15, 12:34 PM
Seen: 1055 times
Last updated: 9/12/15, 2:08 PM