This question has been flagged

Hello,

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 ?

Thanks

Avatar
Discard
Author Best Answer

Hi,

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

Thanks

Avatar
Discard
Best Answer

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

    }

account_journal()

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
            else: 
               account = total > 0 and journal_data.default_cp_account_id or journal_data.default_cp_account_id
Avatar
Discard
Author

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

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

Author

I'm using V 6.1, thanks