From 8806ee77ca9bc79a4cc7328ce35f8163e27ab27f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20Delavall=C3=A9e?= Date: Wed, 19 Dec 2012 13:15:20 +0100 Subject: [PATCH] [FIX] account: fixed crash when evaluating some subtypes because of unread field. Modified tracked (old name) to track_visibility. Added description on subtypes of account. bzr revid: tde@openerp.com-20121219121520-riwt9w52ntsa9dhm --- addons/account/account_invoice.py | 12 +++++++----- addons/account/data/account_data.xml | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/addons/account/account_invoice.py b/addons/account/account_invoice.py index 239bd30bfe0..c2ef99e65e8 100644 --- a/addons/account/account_invoice.py +++ b/addons/account/account_invoice.py @@ -185,9 +185,11 @@ class account_invoice(osv.osv): _description = 'Invoice' _order = "id desc" _track = { + 'type': { + }, 'state': { - 'account.mt_invoice_paid': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'paid' and obj['type'] in ('out_invoice','out_refund'), - 'account.mt_invoice_validated': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'open' and obj['type'] in ('out_invoice','out_refund'), + 'account.mt_invoice_paid': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'paid' and obj['type'] in ('out_invoice', 'out_refund'), + 'account.mt_invoice_validated': lambda self, cr, uid, obj, ctx=None: obj['state'] == 'open' and obj['type'] in ('out_invoice', 'out_refund'), }, } _columns = { @@ -199,7 +201,7 @@ class account_invoice(osv.osv): ('in_invoice','Supplier Invoice'), ('out_refund','Customer Refund'), ('in_refund','Supplier Refund'), - ],'Type', readonly=True, select=True, change_default=True), + ],'Type', readonly=True, select=True, change_default=True, track_visibility=2), 'number': fields.related('move_id','name', type='char', readonly=True, size=64, relation='account.move', store=True, string='Number'), 'internal_number': fields.char('Invoice Number', size=32, readonly=True, help="Unique number of the invoice, computed automatically when the invoice is created."), @@ -215,7 +217,7 @@ class account_invoice(osv.osv): ('open','Open'), ('paid','Paid'), ('cancel','Cancelled'), - ],'Status', select=True, readonly=True, tracked=True, + ],'Status', select=True, readonly=True, track_visibility=1, help=' * The \'Draft\' status is used when a user is encoding a new and unconfirmed Invoice. \ \n* The \'Pro-forma\' when invoice is in Pro-forma status,invoice does not have an invoice number. \ \n* The \'Open\' status is used when user create invoice,a invoice number is generated.Its in open status till user does not pay invoice. \ @@ -283,7 +285,7 @@ class account_invoice(osv.osv): help="Remaining amount due."), 'payment_ids': fields.function(_compute_lines, relation='account.move.line', type="many2many", string='Payments'), 'move_name': fields.char('Journal Entry', size=64, readonly=True, states={'draft':[('readonly',False)]}), - 'user_id': fields.many2one('res.users', 'Salesperson', readonly=True, tracked=True, states={'draft':[('readonly',False)]}, track_visibility=1), + 'user_id': fields.many2one('res.users', 'Salesperson', readonly=True, track_visibility=1, states={'draft':[('readonly',False)]}), 'fiscal_position': fields.many2one('account.fiscal.position', 'Fiscal Position', readonly=True, states={'draft':[('readonly',False)]}) } _defaults = { diff --git a/addons/account/data/account_data.xml b/addons/account/data/account_data.xml index 96b021650ce..60990adad76 100644 --- a/addons/account/data/account_data.xml +++ b/addons/account/data/account_data.xml @@ -156,10 +156,12 @@ Validated account.invoice + Invoice <b>validated</b> Paid account.invoice + Invoice <b>paid</b>