1
#!/usr/bin/env python2.3
5
# Created by Nicolas Bessi on 24.06.08.
6
# Modified by Vincent Renaville
7
# Copyright (c) 2008 CamptoCamp. All rights reserved.
9
from osv import osv, fields
14
class invoice_condition_text(osv.osv):
15
"""add info condition in the invoice"""
16
_name = "account.condition_text"
17
_description = "Invoice condition text"
21
'name' : fields.char('Methode', required=True, size=128),
22
'type' : fields.selection([('header','Header'),
25
'type',required=True),
26
'text': fields.text('text', translate=True,required=True),
30
invoice_condition_text()
34
class account_invoice(osv.osv):
35
""" Generated invoice does not advance in the workflow
36
and add text condition"""
38
_inherit = "account.invoice"
39
_description = 'Invoice'
42
def get_trans(self, cr, uid, name, res_id, lang) :
43
sql = " SELECT value from ir_translation where name = '%s' \
44
and res_id = %s and lang ='%s';" %(name, str(res_id), lang)
46
toreturn = cr.fetchone()
52
def set_comment(self, cr,uid,id,commentid):
55
cond = self.pool.get('account.condition_text').browse(
57
translation_obj = self.pool.get('ir.translation')
64
lang = self.browse(cr, uid, id)[0].partner_id.lang
67
res_trans = self.get_trans(cr, uid, 'account.condition_text,text', commentid, lang )
76
def set_note(self, cr,uid,id,commentid):
79
cond = self.pool.get('account.condition_text').browse(
81
translation_obj = self.pool.get('ir.translation')
88
lang = self.browse(cr, uid, id)[0].partner_id.lang
91
res_trans = self.get_trans(cr, uid,
92
'account.condition_text,text', commentid, lang )
103
def create(self, cr, uid, vals, context={}):
104
tmp_id = super(account_invoice,self).create(cr, uid, vals, context)
105
self.action_number(cr, uid, [tmp_id])
109
'text_condition1': fields.many2one('account.condition_text', 'Header'),
110
'text_condition2': fields.many2one('account.condition_text', 'Footer'),
111
'note1' : fields.text('Header'),
112
'note2' : fields.text('Footer'),
113
'project': fields.many2one(
114
'account.analytic.account',
b'\\ No newline at end of file'