Odoo Help


2 回答
Mohammed Alkathmi サウジアラビア
2013/05/16 8:14


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


le_dilem カナダ
2013/05/15 14:30

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
3 コメント
Mohammed Alkathmi サウジアラビア
2013/05/16 6:28

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

le_dilem カナダ
2013/05/16 6:58

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

Mohammed Alkathmi サウジアラビア
2013/05/16 7:23

I'm using V 6.1, thanks

Keep Informed
1 フォロワー
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