From d6a478e7889f32fdfdb5f144c1251896f6b38497 Mon Sep 17 00:00:00 2001 From: "qdp-launchpad@tinyerp.com" <> Date: Tue, 24 Aug 2010 13:04:14 +0200 Subject: [PATCH] [IMP] account: put the move_id field of account.move.line object as required on the model object. Force that attribute to False in the views, as the system is already creating a new when needed. This change is not supposed to change the behavior, put it puts a constraint NOT NULL on the link between account.move.line and account.move bzr revid: qdp-launchpad@tinyerp.com-20100824110414-6gj3asrsj8zxc8m1 --- addons/account/account_move_line.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 043f365bac2..7acdb119a11 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -424,7 +424,7 @@ class account_move_line(osv.osv): 'debit': fields.float('Debit', digits_compute=dp.get_precision('Account')), 'credit': fields.float('Credit', digits_compute=dp.get_precision('Account')), 'account_id': fields.many2one('account.account', 'Account', required=True, ondelete="cascade", domain=[('type','<>','view'), ('type', '<>', 'closed')], select=2), - 'move_id': fields.many2one('account.move', 'Move', ondelete="cascade", help="The move of this entry line.", select=2), + 'move_id': fields.many2one('account.move', 'Move', ondelete="cascade", help="The move of this entry line.", select=2, required=True), 'narration': fields.related('move_id','narration', type='text', relation='account.move', string='Narration'), 'ref': fields.char('Ref.', size=64), 'statement_id': fields.many2one('account.bank.statement', 'Statement', help="The bank statement used for bank reconciliation", select=1), @@ -917,6 +917,9 @@ class account_move_line(osv.osv): elif field == 'credit': attrs.append('sum="Total credit"') + elif field == 'move_id': + attrs.append('required="False"') + elif field == 'account_tax_id': attrs.append('domain="[(\'parent_id\',\'=\',False)]"') attrs.append("context=\"{'journal_id':journal_id}\"")