Odoo Help


OpenERP 6.1 / Account.Move / Auto counterpart entry

on 5/15/13, 1:44 PM 3,023 views


the OpenERP v6.1 (web client) don't propose automatic generation of counterpart entries when we encode account move lines manually in jouranl entries ? Menu > Accounting > Journal Entries >Journal Entries Try to start encoding a journal item in the journal entry, and press enter to continue the second line, Normally in V5 and V7, it generate a counterpart but in 6.1 no conterpart is generated,

i'm wondering whether it's a bug in 6.1 or a missed configuration ?


On 5/16/13, 8:14 AM


I have solved the problem : here is the solution :
1 - I added a field in the account.move Object :
'line_id_temp': fields.char('lines ids', size=256),
it's a field where I save the last move line
2 - I override the Return of onchange_line_id (in account.py) by
return {'value': {'balance': balance, 'line_id_temp': line_ids and line_ids[0] or False}
3 - Change the context of the line_id field in form view (view_move_form) (in account_view.xml) like this
context="{'balance': balance , 'journal': journal_id, 'line_id_temp': line_id_temp }"
4 - In account_move_line file, update the line (line 227) by
if context.get('lines'):
5 - In account_move_line file, add these line before the line 241 (if account and .... ) at the same level :
data['account_id'] = account.id


On 5/15/13, 2:30 PM

hi, I've already seen this problem,

I solved like this:

I created a new module "account_cp" I added new field in the journal table

class account_journal(osv.osv):
    _inherit = "account.journal"
    _description = "Journal"
    _columns = {

        'default_cp_account_id': fields.many2one('account.account', 'Contre partie', domain="[('type','!=','view')]", help="It acts as a default account for cp amount"),



after that I changed in the module account/account_move_line.py line 277

#pick the good account on the journal accordingly if the next proposed line will be a debit or a credit
            journal_data = journal_obj.browse(cr, uid, context['journal_id'], context=context)
            if not move_id:
               account = total > 0 and journal_data.default_credit_account_id or journal_data.default_debit_account_id
               account = total > 0 and journal_data.default_cp_account_id or journal_data.default_cp_account_id

Hi, Thank you for your quick response, but the patch doesn't work, perhaps I didn't make the right changes in account_move file, can you send me the whole file account_move_line, or the whole function " _default_get ", thanks

on 5/16/13, 6:28 AM

i ok but i changed in V7 give me your adress mail. i have problem with Karma.

on 5/16/13, 6:58 AM

I'm using V 6.1, thanks

on 5/16/13, 7:23 AM

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

1 follower(s)


Asked: 5/15/13, 1:44 PM
Seen: 3023 times
Last updated: 3/16/15, 8:10 AM