Merge lp:~luc-demeyer/openobject-addons/61-update-account_bank_statement_extensions into lp:openobject-addons/6.1

Proposed by Luc De Meyer (Noviat)
Status: Needs review
Proposed branch: lp:~luc-demeyer/openobject-addons/61-update-account_bank_statement_extensions
Merge into: lp:openobject-addons/6.1
Diff against target: 862 lines (+332/-125)
14 files modified
account_bank_statement_extensions/__init__.py (+1/-1)
account_bank_statement_extensions/__openerp__.py (+5/-4)
account_bank_statement_extensions/account_bank_statement.py (+57/-32)
account_bank_statement_extensions/account_bank_statement_view.xml (+5/-4)
account_bank_statement_extensions/report/__init__.py (+25/-25)
account_bank_statement_extensions/report/bank_statement_balance_report.py (+23/-15)
account_bank_statement_extensions/report/bank_statement_balance_report.rml (+45/-26)
account_bank_statement_extensions/res_partner_bank.py (+44/-3)
account_bank_statement_extensions/wizard/__init__.py (+4/-3)
account_bank_statement_extensions/wizard/bank_statement_balance_print.py (+66/-0)
account_bank_statement_extensions/wizard/bank_statement_balance_print.xml (+45/-0)
account_bank_statement_extensions/wizard/cancel_statement_line.py (+5/-5)
account_bank_statement_extensions/wizard/confirm_statement_line.py (+5/-5)
account_bank_statement_extensions/wizard/confirm_statement_line_wizard.xml (+2/-2)
To merge this branch: bzr merge lp:~luc-demeyer/openobject-addons/61-update-account_bank_statement_extensions
Reviewer Review Type Date Requested Status
OpenERP Core Team Pending
Review via email: mp+129562@code.launchpad.net
To post a comment you must log in.

Unmerged revisions

7028. By root <root@oerp61>

update 6.1 account_bank_statement_extensions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'account_bank_statement_extensions/__init__.py' (properties changed: -x to +x)
2--- account_bank_statement_extensions/__init__.py 2012-01-31 13:36:57 +0000
3+++ account_bank_statement_extensions/__init__.py 2012-10-13 15:27:19 +0000
4@@ -3,7 +3,7 @@
5 #
6 # OpenERP, Open Source Management Solution
7 #
8-# Copyright (c) 2011 Noviat nv/sa (www.noviat.be). All rights reserved.
9+# Copyright (c) 2012 Noviat nv/sa (www.noviat.be). All rights reserved.
10 #
11 # This program is free software: you can redistribute it and/or modify
12 # it under the terms of the GNU Affero General Public License as
13
14=== modified file 'account_bank_statement_extensions/__openerp__.py' (properties changed: -x to +x)
15--- account_bank_statement_extensions/__openerp__.py 2012-04-25 08:31:05 +0000
16+++ account_bank_statement_extensions/__openerp__.py 2012-10-13 15:27:19 +0000
17@@ -3,7 +3,7 @@
18 #
19 # OpenERP, Open Source Management Solution
20 #
21-# Copyright (c) 2011 Noviat nv/sa (www.noviat.be). All rights reserved.
22+# Copyright (c) 2012 Noviat nv/sa (www.noviat.be). All rights reserved.
23 #
24 # This program is free software: you can redistribute it and/or modify
25 # it under the terms of the GNU Affero General Public License as
26@@ -21,16 +21,17 @@
27 ##############################################################################
28 {
29 'name': 'Bank Statement extensions to support e-banking',
30- 'version': '0.3',
31+ 'version': '1.3',
32 'license': 'AGPL-3',
33 'author': 'Noviat',
34 'category': 'Generic Modules/Accounting',
35 'description': '''
36 Module that extends the standard account_bank_statement_line object for improved e-banking support.
37-
38+
39 Adds
40 - valuta date
41 - batch payments
42+- Payment Reference field to support SEPA EndToEndReference (simple or batch. detail) or PaymentInformationIdentification (batch)
43 - traceability of changes to bank statement lines
44 - bank statement line views
45 - bank statements balances report
46@@ -44,9 +45,9 @@
47 'update_xml' : [
48 'security/ir.model.access.csv',
49 'account_bank_statement_view.xml',
50- 'account_bank_statement_report.xml',
51 'wizard/confirm_statement_line_wizard.xml',
52 'wizard/cancel_statement_line_wizard.xml',
53+ 'wizard/bank_statement_balance_print.xml',
54 'data/account_bank_statement_extensions_data.xml',
55 ],
56 'auto_install': False,
57
58=== modified file 'account_bank_statement_extensions/account_bank_statement.py' (properties changed: -x to +x)
59--- account_bank_statement_extensions/account_bank_statement.py 2012-02-10 13:46:06 +0000
60+++ account_bank_statement_extensions/account_bank_statement.py 2012-10-13 15:27:19 +0000
61@@ -2,9 +2,9 @@
62 ##############################################################################
63 #
64 # OpenERP, Open Source Management Solution
65-#
66-# Copyright (c) 2011 Noviat nv/sa (www.noviat.be). All rights reserved.
67-#
68+#
69+# Copyright (c) 2012 Noviat nv/sa (www.noviat.be). All rights reserved.
70+#
71 # This program is free software: you can redistribute it and/or modify
72 # it under the terms of the GNU Affero General Public License as
73 # published by the Free Software Foundation, either version 3 of the
74@@ -23,39 +23,42 @@
75 import time
76 from osv import osv, fields
77 import decimal_precision as dp
78-import netsvc
79 from tools.translate import _
80+import logging
81+_logger = logging.getLogger(__name__)
82
83 class account_bank_statement(osv.osv):
84 _inherit = 'account.bank.statement'
85
86 def write(self, cr, uid, ids, vals, context=None):
87 if context is None:
88- context = {}
89- # bypass obsolete statement line resequencing
90- if vals.get('line_ids', False) or context.get('ebanking_import', False):
91- res = super(osv.osv, self).write(cr, uid, ids, vals, context=context)
92- else:
93- res = super(account_bank_statement, self).write(cr, uid, ids, vals, context=context)
94- return res
95+ context = {}
96+ for statement in self.browse(cr, uid, ids, context):
97+ st_type = statement.journal_id.type
98+ #if vals.get('line_ids', False) or context.get('ebanking_import', False):
99+ if st_type == 'bank':
100+ # bypass statement line resequencing (replaced by sequencing via statement line create method)
101+ super(osv.osv, self).write(cr, uid, [statement.id], vals, context=context)
102+ else:
103+ super(account_bank_statement, self).write(cr, uid, [statement.id], vals, context=context)
104+ return True
105
106 def button_confirm_bank(self, cr, uid, ids, context=None):
107 super(account_bank_statement, self).button_confirm_bank(cr, uid, ids, context=context)
108 for st in self.browse(cr, uid, ids, context=context):
109 cr.execute("UPDATE account_bank_statement_line \
110 SET state='confirm' WHERE id in %s ",
111- (tuple([x.id for x in st.line_ids]),))
112+ (tuple([x.id for x in st.line_ids]),))
113 return True
114-
115+
116 def button_cancel(self, cr, uid, ids, context=None):
117 super(account_bank_statement, self).button_cancel(cr, uid, ids, context=context)
118 for st in self.browse(cr, uid, ids, context=context):
119- if st.line_ids:
120- cr.execute("UPDATE account_bank_statement_line \
121- SET state='draft' WHERE id in %s ",
122- (tuple([x.id for x in st.line_ids]),))
123+ cr.execute("UPDATE account_bank_statement_line \
124+ SET state='draft' WHERE id in %s ",
125+ (tuple([x.id for x in st.line_ids]),))
126 return True
127-
128+
129 account_bank_statement()
130
131 class account_bank_statement_line_global(osv.osv):
132@@ -68,11 +71,14 @@
133 'parent_id': fields.many2one('account.bank.statement.line.global', 'Parent Code', ondelete='cascade'),
134 'child_ids': fields.one2many('account.bank.statement.line.global', 'parent_id', 'Child Codes'),
135 'type': fields.selection([
136- ('iso20022', 'ISO 20022'),
137- ('coda', 'CODA'),
138+ ('iso20022', 'ISO 20022'),
139+ ('coda', 'CODA'),
140 ('manual', 'Manual'),
141 ], 'Type', required=True),
142 'amount': fields.float('Amount', digits_compute=dp.get_precision('Account')),
143+ 'payment_reference': fields.char('Payment Reference', size=35,
144+ help="Payment Reference. For SEPA (SCT or SDD) transactions, the PaymentInformationIdentification "\
145+ "is recorded in this field."),
146 'bank_statement_line_ids': fields.one2many('account.bank.statement.line', 'globalisation_id', 'Bank Statement Lines'),
147 }
148 _rec_name = 'code'
149@@ -83,47 +89,50 @@
150 _sql_constraints = [
151 ('code_uniq', 'unique (code)', 'The code must be unique !'),
152 ]
153-
154+
155 def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100):
156 if not args:
157 args = []
158 ids = []
159 if name:
160- ids = self.search(cr, user, [('code', 'ilike', name)] + args, limit=limit)
161+ ids = self.search(cr, user, [('code', '=ilike', name)] + args, limit=limit)
162 if not ids:
163 ids = self.search(cr, user, [('name', operator, name)] + args, limit=limit)
164 if not ids and len(name.split()) >= 2:
165 #Separating code and name for searching
166 operand1, operand2 = name.split(' ', 1) #name can contain spaces
167- ids = self.search(cr, user, [('code', 'like', operand1), ('name', operator, operand2)] + args, limit=limit)
168+ ids = self.search(cr, user, [('code', '=like', operand1), ('name', operator, operand2)] + args, limit=limit)
169 else:
170 ids = self.search(cr, user, args, context=context, limit=limit)
171 return self.name_get(cr, user, ids, context=context)
172-
173+
174 account_bank_statement_line_global()
175
176 class account_bank_statement_line(osv.osv):
177 _inherit = 'account.bank.statement.line'
178 _columns = {
179 'date': fields.date('Entry Date', required=True, states={'confirm': [('readonly', True)]}),
180- 'val_date': fields.date('Valuta Date', states={'confirm': [('readonly', True)]}),
181+ 'val_date': fields.date('Valuta Date', states={'confirm': [('readonly', True)]}),
182 'globalisation_id': fields.many2one('account.bank.statement.line.global', 'Globalisation ID',
183 states={'confirm': [('readonly', True)]},
184 help="Code to identify transactions belonging to the same globalisation level within a batch payment"),
185- 'globalisation_amount': fields.related('globalisation_id', 'amount', type='float',
186+ 'globalisation_amount': fields.related('globalisation_id', 'amount', type='float',
187 relation='account.bank.statement.line.global', string='Glob. Amount', readonly=True),
188 'journal_id': fields.related('statement_id', 'journal_id', type='many2one', relation='account.journal', string='Journal', store=True, readonly=True),
189 'state': fields.selection([('draft', 'Draft'), ('confirm', 'Confirmed')],
190 'State', required=True, readonly=True),
191 'counterparty_name': fields.char('Counterparty Name', size=35),
192- 'counterparty_bic': fields.char('Counterparty BIC', size=11),
193- 'counterparty_number': fields.char('Counterparty Number', size=34),
194- 'counterparty_currency': fields.char('Counterparty Currency', size=3),
195+ 'counterparty_bic': fields.char('Counterparty BIC', size=11),
196+ 'counterparty_number': fields.char('Counterparty Number', size=34),
197+ 'counterparty_currency': fields.char('Counterparty Currency', size=3),
198+ 'payment_reference': fields.char('Payment Reference', size=35,
199+ help="Payment Reference. For SEPA (SCT or SDD) transactions, the EndToEndReference "\
200+ "is recorded in this field."),
201 }
202 _defaults = {
203 'state': 'draft',
204 }
205-
206+
207 def unlink(self, cr, uid, ids, context=None):
208 if context is None:
209 context = {}
210@@ -132,6 +141,22 @@
211 Please go to the associated bank statement in order to delete and/or modify this bank statement line'))
212 return super(account_bank_statement_line, self).unlink(cr, uid, ids, context=context)
213
214+ def create(self, cr, uid, vals, context=None):
215+ #_logger.warn('create, vals = %s', vals)
216+
217+ # The GTK 6.1-1 client doesn't pass the 'statement_id' when hitting a button in a o2m child object.
218+ # In order to bypass this issue, the end-user needs to save the parent object first (e.g. via the Compute button)
219+ if not vals.get('statement_id'):
220+ raise osv.except_osv(_('Error !'),
221+ _("Please recalculate the statement balance first via the 'Compute' button"))
222+
223+ if not vals.get('sequence'):
224+ l_ids = self.search(cr, uid, [('statement_id','=', vals['statement_id'])], order='sequence desc', limit=1)
225+ if l_ids:
226+ l_seq = self.read(cr, uid, l_ids[0], ['sequence'])['sequence']
227+ else:
228+ l_seq = 0
229+ vals['sequence'] = l_seq + 1
230+ return super(account_bank_statement_line, self).create(cr, uid, vals, context=context)
231+
232 account_bank_statement_line()
233-
234-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
235\ No newline at end of file
236
237=== modified file 'account_bank_statement_extensions/account_bank_statement_view.xml' (properties changed: -x to +x)
238--- account_bank_statement_extensions/account_bank_statement_view.xml 2012-05-28 10:15:13 +0000
239+++ account_bank_statement_extensions/account_bank_statement_view.xml 2012-10-13 15:27:19 +0000
240@@ -10,11 +10,12 @@
241 <field name="type">form</field>
242 <field name="arch" type="xml">
243 <form string="Batch Payment Info">
244- <field name="name"/>
245+ <field name="payment_reference"/>
246 <field name="amount"/>
247 <field name="code"/>
248 <field name="parent_id"/>
249 <field name="type"/>
250+ <field name="name"/>
251 <notebook colspan="4">
252 <page string="Transactions">
253 <field colspan="4" name="bank_statement_line_ids" nolabel="1"/>
254@@ -46,7 +47,7 @@
255 <field name="val_date"/>
256 </xpath>
257 <xpath expr="/form/notebook/page[@name='statement_line_ids']/field[@name='line_ids']/tree/field[@name='amount']" position="after">
258- <field name="globalisation_id" string="Glob. Id"/>
259+ <field name="globalisation_id" string="Glob. Id" invisible="1"/>
260 <field name="state" invisible="1"/>
261 </xpath>
262 <xpath expr="/form/notebook/page[@name='statement_line_ids']/field[@name='line_ids']/form/field[@name='date']" position="after">
263@@ -77,7 +78,7 @@
264 <field name="ref" readonly="1"/>
265 <field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
266 <field name="type" on_change="onchange_type(partner_id, type)"/>
267- <field name="account_id" domain="[('journal_id','=',parent.journal_id)]"/>
268+ <field name="account_id" domain="[('type', '!=', 'view'),('journal_id', '=', journal_id)]"/>
269 <field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]"/>
270 <field name="amount" readonly="1" sum="Total Amount"/>
271 <field name="globalisation_id" string="Glob. Id"/>
272@@ -101,7 +102,7 @@
273 <field name="ref" readonly="0"/>
274 <field name="partner_id" on_change="onchange_partner_id(partner_id)"/>
275 <field name="type" on_change="onchange_type(partner_id, type)"/>
276- <field domain="[('journal_id', '=', parent.journal_id), ('type', '&lt;&gt;', 'view')]" name="account_id"/>
277+ <field name="account_id" domain="[('type', '!=', 'view'),('journal_id', '=', journal_id)]"/>
278 <field name="analytic_account_id" groups="analytic.group_analytic_accounting" domain="[('company_id', '=', parent.company_id), ('type', '&lt;&gt;', 'view')]"/>
279 <field name="amount"/>
280 <field name="globalisation_id"/>
281
282=== modified file 'account_bank_statement_extensions/data/account_bank_statement_extensions_data.xml' (properties changed: -x to +x)
283=== modified file 'account_bank_statement_extensions/i18n/account_bank_statement_extensions.pot' (properties changed: -x to +x)
284=== modified file 'account_bank_statement_extensions/i18n/ar.po' (properties changed: -x to +x)
285=== modified file 'account_bank_statement_extensions/i18n/de.po' (properties changed: -x to +x)
286=== modified file 'account_bank_statement_extensions/i18n/es.po' (properties changed: -x to +x)
287=== modified file 'account_bank_statement_extensions/i18n/es_CR.po' (properties changed: -x to +x)
288=== modified file 'account_bank_statement_extensions/i18n/es_EC.po' (properties changed: -x to +x)
289=== modified file 'account_bank_statement_extensions/i18n/fi.po' (properties changed: -x to +x)
290=== modified file 'account_bank_statement_extensions/i18n/fr.po' (properties changed: -x to +x)
291=== modified file 'account_bank_statement_extensions/i18n/gu.po' (properties changed: -x to +x)
292=== modified file 'account_bank_statement_extensions/i18n/it.po' (properties changed: -x to +x)
293=== modified file 'account_bank_statement_extensions/i18n/ja.po' (properties changed: -x to +x)
294=== modified file 'account_bank_statement_extensions/i18n/mn.po' (properties changed: -x to +x)
295=== modified file 'account_bank_statement_extensions/i18n/nb.po' (properties changed: -x to +x)
296=== modified file 'account_bank_statement_extensions/i18n/nl.po' (properties changed: -x to +x)
297=== modified file 'account_bank_statement_extensions/i18n/pl.po' (properties changed: -x to +x)
298=== modified file 'account_bank_statement_extensions/i18n/pt.po' (properties changed: -x to +x)
299=== modified file 'account_bank_statement_extensions/i18n/pt_BR.po' (properties changed: -x to +x)
300=== modified file 'account_bank_statement_extensions/i18n/ro.po' (properties changed: -x to +x)
301=== modified file 'account_bank_statement_extensions/i18n/sr@latin.po' (properties changed: -x to +x)
302=== modified file 'account_bank_statement_extensions/i18n/sv.po' (properties changed: -x to +x)
303=== modified file 'account_bank_statement_extensions/i18n/tr.po' (properties changed: -x to +x)
304=== modified file 'account_bank_statement_extensions/i18n/zh_CN.po' (properties changed: -x to +x)
305=== modified file 'account_bank_statement_extensions/i18n/zh_TW.po' (properties changed: -x to +x)
306=== modified file 'account_bank_statement_extensions/report/__init__.py' (properties changed: -x to +x)
307--- account_bank_statement_extensions/report/__init__.py 2011-12-23 11:56:02 +0000
308+++ account_bank_statement_extensions/report/__init__.py 2012-10-13 15:27:19 +0000
309@@ -1,25 +1,25 @@
310-# -*- encoding: utf-8 -*-
311-##############################################################################
312-#
313-# OpenERP, Open Source Management Solution
314-#
315-# Copyright (c) 2011 Noviat nv/sa (www.noviat.be). All rights reserved.
316-#
317-# This program is free software: you can redistribute it and/or modify
318-# it under the terms of the GNU Affero General Public License as
319-# published by the Free Software Foundation, either version 3 of the
320-# License, or (at your option) any later version.
321-#
322-# This program is distributed in the hope that it will be useful,
323-# but WITHOUT ANY WARRANTY; without even the implied warranty of
324-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
325-# GNU Affero General Public License for more details.
326-#
327-# You should have received a copy of the GNU Affero General Public License
328-# along with this program. If not, see <http://www.gnu.org/licenses/>.
329-#
330-##############################################################################
331-
332-import bank_statement_balance_report
333-
334-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
335+# -*- encoding: utf-8 -*-
336+##############################################################################
337+#
338+# OpenERP, Open Source Management Solution
339+#
340+# Copyright (c) 2012 Noviat nv/sa (www.noviat.be). All rights reserved.
341+#
342+# This program is free software: you can redistribute it and/or modify
343+# it under the terms of the GNU Affero General Public License as
344+# published by the Free Software Foundation, either version 3 of the
345+# License, or (at your option) any later version.
346+#
347+# This program is distributed in the hope that it will be useful,
348+# but WITHOUT ANY WARRANTY; without even the implied warranty of
349+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
350+# GNU Affero General Public License for more details.
351+#
352+# You should have received a copy of the GNU Affero General Public License
353+# along with this program. If not, see <http://www.gnu.org/licenses/>.
354+#
355+##############################################################################
356+
357+import bank_statement_balance_report
358+
359+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
360\ No newline at end of file
361
362=== modified file 'account_bank_statement_extensions/report/bank_statement_balance_report.py' (properties changed: -x to +x)
363--- account_bank_statement_extensions/report/bank_statement_balance_report.py 2011-12-23 11:56:02 +0000
364+++ account_bank_statement_extensions/report/bank_statement_balance_report.py 2012-10-13 15:27:19 +0000
365@@ -2,9 +2,9 @@
366 ##############################################################################
367 #
368 # OpenERP, Open Source Management Solution
369-#
370-# Copyright (c) 2011 Noviat nv/sa (www.noviat.be). All rights reserved.
371-#
372+#
373+# Copyright (c) 2012 Noviat nv/sa (www.noviat.be). All rights reserved.
374+#
375 # This program is free software: you can redistribute it and/or modify
376 # it under the terms of the GNU Affero General Public License as
377 # published by the Free Software Foundation, either version 3 of the
378@@ -22,34 +22,42 @@
379
380 import time
381 from report import report_sxw
382+from osv import osv
383+from tools.translate import _
384 import pooler
385-import netsvc
386-logger=netsvc.Logger()
387+import logging
388+_logger = logging.getLogger(__name__)
389
390 class bank_statement_balance_report(report_sxw.rml_parse):
391
392 def set_context(self, objects, data, ids, report_type=None):
393- #logger.notifyChannel('addons.'+__name__, netsvc.LOG_WARNING, 'set_context, objects = %s, data = %s, ids = %s' % (objects, data, ids))
394+ #_logger.warn('set_context, objects = %s, data = %s, ids = %s', objects, data, ids)
395 cr = self.cr
396 uid = self.uid
397 context = self.context
398-
399- cr.execute('SELECT s.name as s_name, s.date AS s_date, j.code as j_code, s.balance_end_real as s_balance ' \
400+ date_balance = data['date_balance']
401+ journal_ids = data['journal_ids']
402+ cr.execute('SELECT s.name AS s_name, s.date AS s_date, j.code AS j_code, s.balance_end_real AS s_balance ' \
403 'FROM account_bank_statement s ' \
404- 'INNER JOIN account_journal j on s.journal_id = j.id ' \
405+ 'INNER JOIN account_journal j ON s.journal_id = j.id ' \
406 'INNER JOIN ' \
407- '(SELECT journal_id, max(date) as max_date FROM account_bank_statement ' \
408- 'GROUP BY journal_id) d ' \
409+ '(SELECT journal_id, max(date) AS max_date FROM account_bank_statement ' \
410+ 'WHERE date <= %s GROUP BY journal_id) d ' \
411 'ON (s.journal_id = d.journal_id AND s.date = d.max_date) ' \
412- 'ORDER BY j.code')
413+ 'WHERE s.journal_id in %s ' \
414+ 'ORDER BY j.code', (date_balance, tuple(journal_ids)))
415 lines = cr.dictfetchall()
416-
417+ if not lines:
418+ raise osv.except_osv(_('No Data Available'), _('No records found for your selection!'))
419+ total = reduce(lambda x, y: x+y, [x['s_balance'] for x in lines])
420+
421 self.localcontext.update( {
422 'lines': lines,
423+ 'total': total,
424+ 'date_balance': date_balance,
425 })
426 super(bank_statement_balance_report, self).set_context(objects, data, ids, report_type=report_type)
427
428-
429 def __init__(self, cr, uid, name, context):
430 if context is None:
431 context = {}
432@@ -58,7 +66,7 @@
433 'time': time,
434 })
435 self.context = context
436-
437+
438 report_sxw.report_sxw(
439 'report.bank.statement.balance.report',
440 'account.bank.statement',
441
442=== modified file 'account_bank_statement_extensions/report/bank_statement_balance_report.rml' (properties changed: -x to +x)
443--- account_bank_statement_extensions/report/bank_statement_balance_report.rml 2011-12-23 10:36:37 +0000
444+++ account_bank_statement_extensions/report/bank_statement_balance_report.rml 2012-10-13 15:27:19 +0000
445@@ -29,21 +29,26 @@
446 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
447 <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
448 </blockTableStyle>
449+ <blockTableStyle id="Table3">
450+ <blockAlignment value="LEFT"/>
451+ <blockValign value="TOP"/>
452+ </blockTableStyle>
453 <initialize>
454 <paraStyle name="all" alignment="justify"/>
455 </initialize>
456 <paraStyle name="P1" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="CENTER"/>
457 <paraStyle name="P2" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT"/>
458 <paraStyle name="P3" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT"/>
459- <paraStyle name="P4" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
460- <paraStyle name="P5" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
461- <paraStyle name="P6" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
462- <paraStyle name="P7" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
463- <paraStyle name="P8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
464- <paraStyle name="P9" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
465- <paraStyle name="P10" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
466+ <paraStyle name="P4" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT"/>
467+ <paraStyle name="P5" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT"/>
468+ <paraStyle name="P6" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
469+ <paraStyle name="P7" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
470+ <paraStyle name="P8" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica-Bold" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
471+ <paraStyle name="P9" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
472+ <paraStyle name="P10" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
473 <paraStyle name="P11" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
474- <paraStyle name="P12" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT"/>
475+ <paraStyle name="P12" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
476+ <paraStyle name="P13" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
477 <paraStyle name="Standard" fontName="Helvetica"/>
478 <paraStyle name="Heading" fontName="Helvetica" fontSize="12.0" leading="15" spaceBefore="12.0" spaceAfter="6.0"/>
479 <paraStyle name="Text_20_body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
480@@ -79,44 +84,44 @@
481 </stylesheet>
482 <images/>
483 <story>
484- <para style="P8">[[ ]]</para>
485+ <para style="P10">[[ ]]</para>
486 <blockTable colWidths="539.0" style="Table4">
487 <tr>
488 <td>
489 <para style="P1">
490 <font color="white"> </font>
491 </para>
492- <para style="P1">Bank Statement Balances Report</para>
493+ <para style="P1">Bank Statement Balances Report [[date_balance]]</para>
494 </td>
495 </tr>
496 </blockTable>
497- <para style="P7">
498+ <para style="P9">
499 <font color="white"> </font>
500 </para>
501- <para style="P7">
502+ <para style="P9">
503 <font color="white"> </font>
504 </para>
505 <blockTable colWidths="163.0,146.0,103.0,127.0" style="Table1">
506 <tr>
507 <td>
508- <para style="P9">Name</para>
509- </td>
510- <td>
511- <para style="P9">Date</para>
512- </td>
513- <td>
514- <para style="P11">Journal</para>
515- </td>
516- <td>
517- <para style="P10">Closing Balance</para>
518+ <para style="P11">Name</para>
519+ </td>
520+ <td>
521+ <para style="P11">Date</para>
522+ </td>
523+ <td>
524+ <para style="P13">Journal</para>
525+ </td>
526+ <td>
527+ <para style="P12">Closing Balance</para>
528 </td>
529 </tr>
530 </blockTable>
531- <para style="P6">
532+ <para style="P8">
533 <font color="white"> </font>
534 </para>
535 <section>
536- <para style="P4">[[ repeatIn(lines, 'l') ]]</para>
537+ <para style="P6">[[ repeatIn(lines, 'l') ]]</para>
538 <blockTable colWidths="163.0,146.0,103.0,127.0" style="Table2">
539 <tr>
540 <td>
541@@ -133,11 +138,25 @@
542 </td>
543 </tr>
544 </blockTable>
545- <para style="P6">
546+ <para style="P8">
547 <font color="white"> </font>
548 </para>
549 </section>
550- <para style="P5">
551+ <blockTable colWidths="412.0,127.0" style="Table3">
552+ <tr>
553+ <td>
554+ <para style="P5">
555+ <font color="white"> </font>
556+ </para>
557+ </td>
558+ <td>
559+ <para style="P4">
560+ <u>[[ formatLang(total) ]]</u>
561+ </para>
562+ </td>
563+ </tr>
564+ </blockTable>
565+ <para style="P7">
566 <font color="white"> </font>
567 </para>
568 </story>
569
570=== modified file 'account_bank_statement_extensions/res_partner_bank.py' (properties changed: -x to +x)
571--- account_bank_statement_extensions/res_partner_bank.py 2011-12-23 16:30:47 +0000
572+++ account_bank_statement_extensions/res_partner_bank.py 2012-10-13 15:27:19 +0000
573@@ -2,9 +2,9 @@
574 ##############################################################################
575 #
576 # OpenERP, Open Source Management Solution
577-#
578-# Copyright (c) 2011 Noviat nv/sa (www.noviat.be). All rights reserved.
579-#
580+#
581+# Copyright (c) 2012 Noviat nv/sa (www.noviat.be). All rights reserved.
582+#
583 # This program is free software: you can redistribute it and/or modify
584 # it under the terms of the GNU Affero General Public License as
585 # published by the Free Software Foundation, either version 3 of the
586@@ -21,6 +21,28 @@
587 ##############################################################################
588
589 from osv import osv
590+import logging
591+_logger = logging.getLogger(__name__)
592+from base_iban.base_iban import _ref_iban, _format_iban, _pretty_iban
593+
594+def check_iban(iban):
595+ '''
596+ Check the IBAN number (logic copied from base_iban module, cf. is_iban_valid method)
597+ '''
598+ iban = _format_iban(iban).lower()
599+ if iban[:2] in _ref_iban and len(iban) != len(_format_iban(_ref_iban[iban[:2]])):
600+ return False
601+ #the four first digits have to be shifted to the end
602+ iban = iban[4:] + iban[:4]
603+ #letters have to be transformed into numbers (a = 10, b = 11, ...)
604+ iban2 = ""
605+ for char in iban:
606+ if char.isalpha():
607+ iban2 += str(ord(char)-87)
608+ else:
609+ iban2 += char
610+ #iban is correct if modulo 97 == 1
611+ return int(iban2) % 97 == 1
612
613 class res_partner_bank(osv.osv):
614 _inherit = 'res.partner.bank'
615@@ -35,5 +57,24 @@
616 ids = self.search(cr, user, args, context=context, limit=limit)
617 return self.name_get(cr, user, ids, context=context)
618
619+ def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False):
620+ '''
621+ format iban before search
622+ '''
623+ i = 0
624+ for arg in args:
625+ if arg[0] == 'acc_number' and arg[2]:
626+ acc_number = arg[2].replace(' ','').replace('-', '')
627+ cr.execute("SELECT id FROM res_partner_bank " \
628+ "WHERE replace(replace(acc_number, ' ', ''), '-','') LIKE '%%'||'%s'||'%%'" %acc_number)
629+ res = cr.fetchall()
630+ if res:
631+ rpb_ids = map(lambda x: x[0], res)
632+ args[i] = ('id', 'in', rpb_ids)
633+ i += 1
634+ #_logger.warn('args=%s', args)
635+ return super(res_partner_bank,self).search(cr, uid, args, offset, limit, order, context=context, count=count)
636+
637 res_partner_bank()
638+
639 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
640
641=== modified file 'account_bank_statement_extensions/security/ir.model.access.csv' (properties changed: -x to +x)
642=== modified file 'account_bank_statement_extensions/wizard/__init__.py' (properties changed: -x to +x)
643--- account_bank_statement_extensions/wizard/__init__.py 2011-12-23 11:56:02 +0000
644+++ account_bank_statement_extensions/wizard/__init__.py 2012-10-13 15:27:19 +0000
645@@ -2,9 +2,9 @@
646 ##############################################################################
647 #
648 # OpenERP, Open Source Management Solution
649-#
650-# Copyright (c) 2011 Noviat nv/sa (www.noviat.be). All rights reserved.
651-#
652+#
653+# Copyright (c) 2012 Noviat nv/sa (www.noviat.be). All rights reserved.
654+#
655 # This program is free software: you can redistribute it and/or modify
656 # it under the terms of the GNU Affero General Public License as
657 # published by the Free Software Foundation, either version 3 of the
658@@ -22,5 +22,6 @@
659
660 import confirm_statement_line
661 import cancel_statement_line
662+import bank_statement_balance_print
663
664 # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
665
666=== added file 'account_bank_statement_extensions/wizard/bank_statement_balance_print.py'
667--- account_bank_statement_extensions/wizard/bank_statement_balance_print.py 1970-01-01 00:00:00 +0000
668+++ account_bank_statement_extensions/wizard/bank_statement_balance_print.py 2012-10-13 15:27:19 +0000
669@@ -0,0 +1,66 @@
670+# -*- encoding: utf-8 -*-
671+##############################################################################
672+#
673+# OpenERP, Open Source Management Solution
674+#
675+# Copyright (c) 2012 Noviat nv/sa (www.noviat.be). All rights reserved.
676+#
677+# This program is free software: you can redistribute it and/or modify
678+# it under the terms of the GNU Affero General Public License as
679+# published by the Free Software Foundation, either version 3 of the
680+# License, or (at your option) any later version.
681+#
682+# This program is distributed in the hope that it will be useful,
683+# but WITHOUT ANY WARRANTY; without even the implied warranty of
684+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
685+# GNU Affero General Public License for more details.
686+#
687+# You should have received a copy of the GNU Affero General Public License
688+# along with this program. If not, see <http://www.gnu.org/licenses/>.
689+#
690+##############################################################################
691+
692+from osv import fields,osv
693+import time
694+from tools.translate import _
695+import logging
696+_logger = logging.getLogger(__name__)
697+
698+class bank_statement_balance_print(osv.osv_memory):
699+ _name = 'bank.statement.balance.print'
700+ _description = 'Bank Statement Balances Report'
701+ _columns = {
702+ 'date_balance': fields.date('Date', required=True),
703+ 'journal_ids': fields.many2many('account.journal', 'account_journal_rel', 'bsbp_id', 'journal_id', 'Financial Journal(s)',
704+ domain=[('type', '=', 'bank')],
705+ help = 'Select here the Financial Journal(s) you want to include in your Bank Statement Balances Report.'),
706+ }
707+ _defaults = {
708+ 'date_balance': lambda *a: time.strftime('%Y-%m-%d'),
709+ }
710+
711+ def balance_print(self, cr, uid, ids, context=None):
712+ if context is None:
713+ context = {}
714+ try:
715+ data = self.read(cr, uid, ids, [], context=context)[0]
716+ except:
717+ raise osv.except_osv(_('Error!'), _('Wizard in incorrect state. Please hit the Cancel button!'))
718+ return {}
719+ #_logger.warn('balance_print, data = %s', data)
720+ journal_ids = data['journal_ids']
721+ if not journal_ids:
722+ raise osv.except_osv(_('Warning'), _('No Financial Journals selected!'))
723+ datas = {
724+ 'ids': [],
725+ 'model': 'account.bank.statement',
726+ 'date_balance': data['date_balance'],
727+ 'journal_ids': journal_ids,
728+ }
729+ return {
730+ 'type': 'ir.actions.report.xml',
731+ 'report_name': 'bank.statement.balance.report',
732+ 'datas': datas,
733+ }
734+
735+bank_statement_balance_print()
736
737=== added file 'account_bank_statement_extensions/wizard/bank_statement_balance_print.xml'
738--- account_bank_statement_extensions/wizard/bank_statement_balance_print.xml 1970-01-01 00:00:00 +0000
739+++ account_bank_statement_extensions/wizard/bank_statement_balance_print.xml 2012-10-13 15:27:19 +0000
740@@ -0,0 +1,45 @@
741+<?xml version="1.0" ?>
742+<openerp>
743+ <data>
744+
745+ <record id="bank_statement_balance_print_view" model="ir.ui.view">
746+ <field name="name">Bank Statement Balances Report</field>
747+ <field name="model">bank.statement.balance.print</field>
748+ <field name="type">form</field>
749+ <field name="priority">1</field>
750+ <field name="arch" type="xml">
751+ <form string="Bank Statement Balances Report">
752+ <group col="2" colspan="4">
753+ <separator string="Bank Statement Balances Report Selection Criteria :" colspan="4"/>
754+ <field name="date_balance"/>
755+ <separator string="Financial Journals" colspan="4"/>
756+ <field name="journal_ids" nolabel="1" colspan="4" height="200" width="550"/>
757+ </group>
758+ <separator colspan="4"/>
759+ <group colspan="4">
760+ <button special="cancel" string="_Cancel" icon="gtk-cancel"/>
761+ <button name="balance_print" string="_Print" type="object" icon="gtk-print"/>
762+ </group>
763+ </form>
764+ </field>
765+ </record>
766+
767+ <record id="action_bank_statement_balance_print" model="ir.actions.act_window">
768+ <field name="name">Bank Statement Balances Report</field>
769+ <field name="type">ir.actions.act_window</field>
770+ <field name="res_model">bank.statement.balance.print</field>
771+ <field name="view_type">form</field>
772+ <field name="view_mode">form</field>
773+ <field name="target">new</field>
774+ <field name="view_id" ref="bank_statement_balance_print_view"/>
775+ </record>
776+
777+ <act_window name="Bank Statement Balances Report"
778+ res_model="bank.statement.balance.print"
779+ src_model="account.bank.statement"
780+ view_type="form" view_mode="form" target="new"
781+ key2="client_print_multi" multi="True"
782+ id="act_bank_statement_balance_print"/>
783+
784+ </data>
785+</openerp>
786
787=== modified file 'account_bank_statement_extensions/wizard/cancel_statement_line.py' (properties changed: -x to +x)
788--- account_bank_statement_extensions/wizard/cancel_statement_line.py 2011-12-23 16:30:47 +0000
789+++ account_bank_statement_extensions/wizard/cancel_statement_line.py 2012-10-13 15:27:19 +0000
790@@ -2,9 +2,9 @@
791 ##############################################################################
792 #
793 # OpenERP, Open Source Management Solution
794-#
795-# Copyright (c) 2011 Noviat nv/sa (www.noviat.be). All rights reserved.
796-#
797+#
798+# Copyright (c) 2012 Noviat nv/sa (www.noviat.be). All rights reserved.
799+#
800 # This program is free software: you can redistribute it and/or modify
801 # it under the terms of the GNU Affero General Public License as
802 # published by the Free Software Foundation, either version 3 of the
803@@ -25,8 +25,8 @@
804 class cancel_statement_line(osv.osv_memory):
805 _name = 'cancel.statement.line'
806 _description = 'Cancel selected statement lines'
807-
808- def cancel_lines(self, cr, uid, ids, context):
809+
810+ def cancel_lines(self, cr, uid, ids, context):
811 line_ids = context['active_ids']
812 line_obj = self.pool.get('account.bank.statement.line')
813 line_obj.write(cr, uid, line_ids, {'state': 'draft'}, context=context)
814
815=== modified file 'account_bank_statement_extensions/wizard/cancel_statement_line_wizard.xml' (properties changed: -x to +x)
816=== modified file 'account_bank_statement_extensions/wizard/confirm_statement_line.py' (properties changed: -x to +x)
817--- account_bank_statement_extensions/wizard/confirm_statement_line.py 2011-12-23 16:30:47 +0000
818+++ account_bank_statement_extensions/wizard/confirm_statement_line.py 2012-10-13 15:27:19 +0000
819@@ -2,9 +2,9 @@
820 ##############################################################################
821 #
822 # OpenERP, Open Source Management Solution
823-#
824-# Copyright (c) 2011 Noviat nv/sa (www.noviat.be). All rights reserved.
825-#
826+#
827+# Copyright (c) 2012 Noviat nv/sa (www.noviat.be). All rights reserved.
828+#
829 # This program is free software: you can redistribute it and/or modify
830 # it under the terms of the GNU Affero General Public License as
831 # published by the Free Software Foundation, either version 3 of the
832@@ -25,8 +25,8 @@
833 class confirm_statement_line(osv.osv_memory):
834 _name = 'confirm.statement.line'
835 _description = 'Confirm selected statement lines'
836-
837- def confirm_lines(self, cr, uid, ids, context):
838+
839+ def confirm_lines(self, cr, uid, ids, context):
840 line_ids = context['active_ids']
841 line_obj = self.pool.get('account.bank.statement.line')
842 line_obj.write(cr, uid, line_ids, {'state': 'confirm'}, context=context)
843
844=== modified file 'account_bank_statement_extensions/wizard/confirm_statement_line_wizard.xml' (properties changed: -x to +x)
845--- account_bank_statement_extensions/wizard/confirm_statement_line_wizard.xml 2012-02-01 14:12:44 +0000
846+++ account_bank_statement_extensions/wizard/confirm_statement_line_wizard.xml 2012-10-13 15:27:19 +0000
847@@ -1,6 +1,6 @@
848 <?xml version="1.0" ?>
849 <openerp>
850- <data>
851+ <data>
852
853 <!-- Confirm selected statement lines -->
854
855@@ -40,6 +40,6 @@
856 <field name="value" eval="'ir.actions.act_window,' +str(ref('action_confirm_statement_line'))" />
857 <field name="model">account.bank.statement.line</field>
858 </record>
859-
860+
861 </data>
862 </openerp>