~taktik/openobject-addons/hui-extra-6.1

« back to all changes in this revision

Viewing changes to contract_base/wizard/contract_invoice_create.py

  • Committer: Luc De Meyer
  • Date: 2014-08-29 15:19:39 UTC
  • Revision ID: luc.demeyer@noviat.com-20140829151939-vqscyplor81jj4al
update noviat modules

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
#
4
4
#    OpenERP, Open Source Management Solution
5
5
#    
6
 
#    Copyright (c) 2013 Noviat nv/sa (www.noviat.be). All rights reserved.
 
6
#    Copyright (c) 2014 Noviat nv/sa (www.noviat.com). All rights reserved.
7
7
8
8
#    This program is free software: you can redistribute it and/or modify
9
9
#    it under the terms of the GNU Affero General Public License as
12
12
#
13
13
#    This program is distributed in the hope that it will be useful,
14
14
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
16
#    GNU Affero General Public License for more details.
17
17
#
18
18
#    You should have received a copy of the GNU Affero General Public License
19
 
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
19
#    along with this program. If not, see <http://www.gnu.org/licenses/>.
20
20
#
21
21
##############################################################################
22
22
 
23
 
from osv import fields,osv
24
 
from tools.translate import _
25
 
import netsvc
26
 
logger=netsvc.Logger()
27
 
 
28
 
class contract_invoice_create(osv.osv_memory):
 
23
from openerp.osv import orm, fields
 
24
from openerp.tools.translate import _
 
25
 
 
26
 
 
27
class contract_invoice_create(orm.TransientModel):
29
28
    _name = 'contract.invoice.create'
30
29
    _description = 'Create Invoices from Contract Data'
31
30
 
44
43
            return periods[0]
45
44
        else:
46
45
            return False
47
 
    
 
46
 
48
47
    _columns = {
49
48
        'contract_select': fields.selection([
50
49
            ('all_sale','All Customer Contracts'),
75
74
            elif context.get('default_type') == 'purchase':
76
75
                contract_select = 'all_purchase'
77
76
            else:
78
 
                raise osv.except_osv(_('Programming Error !'), _('No contract type specified.'))   
 
77
                raise orm.except_orm(_('Programming Error !'), _('No contract type specified.'))   
79
78
        if not period_id:            
80
 
            raise osv.except_osv(_('Programming Error !'), _('No accounting period specified.'))           
 
79
            raise orm.except_orm(_('Programming Error !'), _('No accounting period specified.'))           
81
80
        if contract_select == 'select':
82
81
            contract_ids = context.get('active_ids') or []
83
82
        else:
84
83
            contract_ids = contract_obj.search(cr, uid, [('type', '=', contract_select[4:])])        
85
84
        contract_obj.create_invoice(cr, uid, contract_ids, period_id, date_invoice, context=context)
86
85
        return {}
87
 
 
88
 
contract_invoice_create