[imp] mado o2m compatible with graph view
[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 osv import fields, osv
25 import time
26 from tools.translate import _
27 import netsvc
28 logger=netsvc.Logger()
29
30 class res_partner(osv.osv):  
31     """ add field to indicate default 'Communication Type' on customer invoices """
32     _inherit = 'res.partner'
33     
34     def _get_comm_type(self, cr, uid, context=None):
35         res = self.pool.get('account.invoice')._get_reference_type(cr, uid,context=context)
36         return res
37     
38     _columns = {
39         'out_inv_comm_type': fields.selection(_get_comm_type, 'Communication Type', change_default=True,
40             help='Select Default Communication Type for Outgoing Invoices.' ),
41         'out_inv_comm_algorithm': fields.selection([
42             ('random','Random'),
43             ('date','Date'),
44             ('partner_ref','Customer Reference'),
45             ], 'Communication Algorithm',
46             help='Select Algorithm to generate the Structured Communication on Outgoing Invoices.' ),
47     }
48
49     _default = {
50         'out_inv_comm_type': 'none',
51     }
52 res_partner()