Odoo Help

2

0
2 Answers
1
Mohammed Alkathmi
16-05-13 08:14

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

0
le_dilem
15-05-13 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"),

    }

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
3 Comments
Mohammed Alkathmi
16-05-13 06: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
16-05-13 06:58

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

Mohammed Alkathmi
16-05-13 07:23

I'm using V 6.1, thanks

Stel een vraag
Keep Informed
1 volger(s)
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.

Register
Odoo Training Center

Access to our eLearning platform and experience all Odoo Apps through learning videos, use cases and quizzes.

Test it now