[FIX] mail: no_auto_thread default True if the model has no mail.thread
[odoo/odoo.git] / addons / l10n_be_invoice_bba / partner.py
1 # -*- encoding: utf-8 -*-
2 ##############################################################################
3 #
4 #    OpenERP, Open Source Management Solution
5 #    
6 #    Created by Luc De Meyer
7 #    Copyright (c) 2010 Noviat nv/sa (www.noviat.be). All rights reserved.
8
9 #    This program is free software: you can redistribute it and/or modify
10 #    it under the terms of the GNU General Public License as published by
11 #    the Free Software Foundation, either version 3 of the License, or
12 #    (at your option) any later version.
13 #
14 #    This program is distributed in the hope that it will be useful,
15 #    but WITHOUT ANY WARRANTY; without even the implied warranty of
16 #    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 #    GNU General Public License for more details.
18 #
19 #    You should have received a copy of the GNU General Public License
20 #    along with this program.  If not, see <http://www.gnu.org/licenses/>.
21 #
22 ##############################################################################
23
24 from openerp.osv import fields, osv
25 import time
26 from openerp.tools.translate import _
27
28 class res_partner(osv.osv):  
29     """ add field to indicate default 'Communication Type' on customer invoices """
30     _inherit = 'res.partner'
31     
32     def _get_comm_type(self, cr, uid, context=None):
33         res = self.pool.get('account.invoice')._get_reference_type(cr, uid,context=context)
34         return res
35     
36     _columns = {
37         'out_inv_comm_type': fields.selection(_get_comm_type, 'Communication Type', change_default=True,
38             help='Select Default Communication Type for Outgoing Invoices.' ),
39         'out_inv_comm_algorithm': fields.selection([
40             ('random','Random'),
41             ('date','Date'),
42             ('partner_ref','Customer Reference'),
43             ], 'Communication Algorithm',
44             help='Select Algorithm to generate the Structured Communication on Outgoing Invoices.' ),
45     }
46
47     def _commercial_fields(self, cr, uid, context=None):
48         return super(res_partner, self)._commercial_fields(cr, uid, context=context) + \
49             ['out_inv_comm_type', 'out_inv_comm_algorithm']
50
51
52     _default = {
53         'out_inv_comm_type': 'none',
54     }
55
56 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: