Skip to Content
Menu
This question has been flagged
2 Replies
4291 Views

Hi,

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

thanks

Avatar
Discard
Best Answer

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.

Avatar
Discard

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

Best Answer

 

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)">

Regards.

Avatar
Discard