diff --git a/addons/l10n_ch/__init__.py b/addons/l10n_ch/__init__.py
index 91ddfdb9f3d..bb4312cf3f3 100644
--- a/addons/l10n_ch/__init__.py
+++ b/addons/l10n_ch/__init__.py
@@ -41,4 +41,5 @@ import payment
import report
import bank
import account_move_line
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_ch/__openerp__.py b/addons/l10n_ch/__openerp__.py
index 7de9b5eb77e..ea4fe527c05 100644
--- a/addons/l10n_ch/__openerp__.py
+++ b/addons/l10n_ch/__openerp__.py
@@ -87,10 +87,9 @@ TODO :
],
"update_xml" : [
"dta_view.xml",
- "dta_wizard.xml",
- "bvr_report.xml",
- "bvr_wizard.xml",
- "bvr_view.xml",
+ "wizard/bvr_import_view.xml",
+ "wizard/bvr_report_view.xml",
+ "wizard/create_dta_view.xml",
"company_view.xml",
"account_invoice.xml",
"bank_view.xml",
diff --git a/addons/l10n_ch/bank.py b/addons/l10n_ch/bank.py
index 18aac869b77..1e3d0339a98 100644
--- a/addons/l10n_ch/bank.py
+++ b/addons/l10n_ch/bank.py
@@ -31,7 +31,6 @@
from osv import fields, osv
-
class Bank(osv.osv):
"""Inherit res.bank class in order to add swiss specific field"""
_inherit = 'res.bank'
diff --git a/addons/l10n_ch/bvr_report.xml b/addons/l10n_ch/bvr_report.xml
deleted file mode 100644
index 13b5e3ee8bc..00000000000
--- a/addons/l10n_ch/bvr_report.xml
+++ /dev/null
@@ -1,26 +0,0 @@
-
-
-
-
-
-
-
diff --git a/addons/l10n_ch/bvr_view.xml b/addons/l10n_ch/bvr_view.xml
deleted file mode 100644
index c91571a2257..00000000000
--- a/addons/l10n_ch/bvr_view.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
- account.bank.statement.form.inherit
- account.bank.statement
- form
-
-
-
-
-
-
-
-
-
diff --git a/addons/l10n_ch/bvr_wizard.xml b/addons/l10n_ch/bvr_wizard.xml
deleted file mode 100644
index 497b6fa6f4f..00000000000
--- a/addons/l10n_ch/bvr_wizard.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/addons/l10n_ch/company.py b/addons/l10n_ch/company.py
index 4d9a1069771..dd2a6b6ee28 100644
--- a/addons/l10n_ch/company.py
+++ b/addons/l10n_ch/company.py
@@ -33,6 +33,7 @@
import netsvc
from osv import fields, osv
+
class res_company(osv.osv):
"""override company in order to add bvr vertical and
Horizontal print delta"""
diff --git a/addons/l10n_ch/dta.py b/addons/l10n_ch/dta.py
index 25b16222b19..67658569add 100644
--- a/addons/l10n_ch/dta.py
+++ b/addons/l10n_ch/dta.py
@@ -31,7 +31,7 @@
##############################################################################
import time
-from osv import osv,fields
+from osv import osv, fields
class account_dta(osv.osv):
"""class that implements bank DTA File format,
diff --git a/addons/l10n_ch/dta_wizard.xml b/addons/l10n_ch/dta_wizard.xml
deleted file mode 100644
index 7fb083d51bd..00000000000
--- a/addons/l10n_ch/dta_wizard.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-
-
-
-
-
-
-
diff --git a/addons/l10n_ch/invoice.py b/addons/l10n_ch/invoice.py
index afdd93c703d..eed4459be35 100644
--- a/addons/l10n_ch/invoice.py
+++ b/addons/l10n_ch/invoice.py
@@ -30,11 +30,10 @@
#
##############################################################################
-import time
-from osv import fields, osv
-from tools import mod10r
from mx import DateTime
+from osv import fields, osv
+from tools import mod10r
class account_invoice(osv.osv):
"""Inherit account.invoice in order to add bvr
diff --git a/addons/l10n_ch/partner.py b/addons/l10n_ch/partner.py
index 2c244eb7fd2..8812ae571fd 100644
--- a/addons/l10n_ch/partner.py
+++ b/addons/l10n_ch/partner.py
@@ -40,13 +40,8 @@ class res_partner(osv.osv):
'ref_companies': fields.one2many('res.company', 'partner_id',
'Companies that refers to partner'),
}
-
-
-
res_partner()
-
-
class res_partner_bank(osv.osv):
_inherit = "res.partner.bank"
_columns = {
diff --git a/addons/l10n_ch/payment.py b/addons/l10n_ch/payment.py
index f1a85adaf1c..d0c1f39d156 100644
--- a/addons/l10n_ch/payment.py
+++ b/addons/l10n_ch/payment.py
@@ -30,8 +30,7 @@
#
##############################################################################
-from osv import fields
-from osv import osv
+from osv import osv, fields
class payment_order(osv.osv):
_inherit = 'payment.order'
diff --git a/addons/l10n_ch/report/__init__.py b/addons/l10n_ch/report/__init__.py
index ee83c9c6f12..a3484e4c2cb 100644
--- a/addons/l10n_ch/report/__init__.py
+++ b/addons/l10n_ch/report/__init__.py
@@ -30,5 +30,6 @@
#
##############################################################################
-import bvr
+import bvr_report
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_ch/report/invoice.rml b/addons/l10n_ch/report/bvr_invoice_report.rml
similarity index 99%
rename from addons/l10n_ch/report/invoice.rml
rename to addons/l10n_ch/report/bvr_invoice_report.rml
index bbc7c9dfdc4..7c8b2185ee9 100755
--- a/addons/l10n_ch/report/invoice.rml
+++ b/addons/l10n_ch/report/bvr_invoice_report.rml
@@ -5,7 +5,7 @@
-
+
diff --git a/addons/l10n_ch/report/bvr.py b/addons/l10n_ch/report/bvr_report.py
similarity index 97%
rename from addons/l10n_ch/report/bvr.py
rename to addons/l10n_ch/report/bvr_report.py
index ce97ac1a1a7..646806b202f 100644
--- a/addons/l10n_ch/report/bvr.py
+++ b/addons/l10n_ch/report/bvr_report.py
@@ -30,15 +30,16 @@
#
##############################################################################
-import time
-from report import report_sxw
-from tools import mod10r
import re
import os
import sys
import shutil
+import time
from mx.DateTime import *
+from report import report_sxw
+from tools import mod10r
+
class account_invoice_bvr(report_sxw.rml_parse):
"""Report class that Allows to print BVR payement vector"""
def __init__(self, cr, uid, name, context):
@@ -111,14 +112,14 @@ class account_invoice_bvr(report_sxw.rml_parse):
report_sxw.report_sxw(
'report.l10n_ch.bvr',
'account.invoice',
- 'addons/l10n_ch/report/bvr.rml',
+ 'addons/l10n_ch/report/bvr_report.rml',
parser=account_invoice_bvr,
header=False)
report_sxw.report_sxw(
'report.l10n_ch.invoice.bvr',
'account.invoice',
- 'addons/l10n_ch/report/invoice.rml',
+ 'addons/l10n_ch/report/bvr_invoice_report.rml',
parser=account_invoice_bvr,
header=False)
diff --git a/addons/l10n_ch/report/bvr.rml b/addons/l10n_ch/report/bvr_report.rml
similarity index 99%
rename from addons/l10n_ch/report/bvr.rml
rename to addons/l10n_ch/report/bvr_report.rml
index b7e3388973a..b38266b560e 100755
--- a/addons/l10n_ch/report/bvr.rml
+++ b/addons/l10n_ch/report/bvr_report.rml
@@ -3,7 +3,7 @@
-
+
diff --git a/addons/l10n_ch/wizard/__init__.py b/addons/l10n_ch/wizard/__init__.py
index ecc5c6a07ba..99fd86f18cc 100644
--- a/addons/l10n_ch/wizard/__init__.py
+++ b/addons/l10n_ch/wizard/__init__.py
@@ -30,8 +30,9 @@
#
##############################################################################
-import dta_wizard
-import wizard_bvr
+import create_dta
+import bvr_report
import bvr_import
import journal_config
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_ch/wizard/bvr_import.py b/addons/l10n_ch/wizard/bvr_import.py
index 12e8012f643..c2f62ca88f5 100644
--- a/addons/l10n_ch/wizard/bvr_import.py
+++ b/addons/l10n_ch/wizard/bvr_import.py
@@ -29,26 +29,15 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
-import wizard
-import pooler
+
import base64
import time
from tools import mod10r
import re
from tools.translate import _
-ASK_FORM = """
-"""
-
-ASK_FIELDS = {
- 'file': {
- 'string': 'BVR file',
- 'type': 'binary',
- 'required': True,
- },
-}
+from osv import osv, fields
+import pooler
def _reconstruct_invoice_ref(cursor, user, reference, context):
###
@@ -104,11 +93,11 @@ def _import(obj, cursor, user, data, context):
if line[0:3] in ('999', '995'):
if find_total:
- raise wizard.except_wizard(_('Error'),
+ raise osv.except_osv(_('Error'),
_('Too much total record found!'))
find_total = True
if lines:
- raise wizard.except_wizard(_('Error'),
+ raise osv.except_osv(_('Error'),
_('Record found after total record!'))
amount = float(line[39:49]) + (float(line[49:51]) / 100)
cost = float(line[69:76]) + (float(line[76:78]) / 100)
@@ -118,10 +107,10 @@ def _import(obj, cursor, user, data, context):
if round(amount - total_amount, 2) >= 0.01 \
or round(cost - total_cost, 2) >= 0.01:
- raise wizard.except_wizard(_('Error'),
+ raise osv.except_osv(_('Error'),
_('Total record different from the computed!'))
if int(line[51:63]) != len(records):
- raise wizard.except_wizard(_('Error'),
+ raise osv.except_osv(_('Error'),
_('Number record different from the computed!'))
else:
record = {
@@ -133,7 +122,7 @@ def _import(obj, cursor, user, data, context):
}
if record['reference'] != mod10r(record['reference'][:-1]):
- raise wizard.except_wizard(_('Error'),
+ raise osv.except_osv(_('Error'),
_('Recursive mod10 is invalid for reference: %s') % \
record['reference'])
@@ -203,7 +192,7 @@ def _import(obj, cursor, user, data, context):
else:
account_id = account_payable
if not account_id :
- raise wizard.except_wizard(_('Error'),
+ raise osv.except_osv(_('Error'),
_('The properties account payable account receivable'))
values['account_id'] = account_id
values['partner_id'] = partner_id
@@ -223,30 +212,23 @@ def _import(obj, cursor, user, data, context):
}, context=context)
return {}
+class bvr_import_wizard(osv.osv_memory):
+ _name='bvr.import.wizard'
+ _columns={'file':fields.binary('BVR File', required=True)}
+
+ def import_bvr(self, cr, uid, ids, context=None):
+ data={}
+ active_ids = context.get('active_ids', [])
+ active_id = context.get('active_id', False)
+ data['form'] = {}
+ data['ids'] = active_ids
+ data['id'] = active_id
+ data['form']['file'] = ''
+ res = self.read(cr, uid, ids[0], ['file'])
+ if res:
+ data['form']['file'] = res['file']
+ _import(self, cr, uid, data, context)
+ return {}
+bvr_import_wizard()
-class BVRImport(wizard.interface):
- states = {
- 'init': {
- 'actions': [],
- 'result': {
- 'type': 'form',
- 'arch': ASK_FORM,
- 'fields': ASK_FIELDS,
- 'state': [
- ('end', 'Cancel', 'gtk-cancel'),
- ('import', 'Import', 'gtk-ok', True),
- ],
- },
- },
- 'import': {
- 'actions': [],
- 'result': {
- 'type': 'action',
- 'action': _import,
- 'state': 'end',
- },
- },
- }
-
-BVRImport('l10n_ch.bvr_import')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_ch/wizard/bvr_import_view.xml b/addons/l10n_ch/wizard/bvr_import_view.xml
new file mode 100644
index 00000000000..7ac2e15c7f0
--- /dev/null
+++ b/addons/l10n_ch/wizard/bvr_import_view.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+ BVR Import Wizard
+ bvr.import.wizard
+ form
+
+
+
+
+
+
+ BVR Import
+ ir.actions.act_window
+ bvr.import.wizard
+ form
+ form
+
+ new
+
+
+
+ account.bank.statement.form.inherit
+ account.bank.statement
+ form
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/addons/l10n_ch/wizard/wizard_bvr.py b/addons/l10n_ch/wizard/bvr_report.py
similarity index 63%
rename from addons/l10n_ch/wizard/wizard_bvr.py
rename to addons/l10n_ch/wizard/bvr_report.py
index 9d7d74b1bc1..608757a1f9f 100644
--- a/addons/l10n_ch/wizard/wizard_bvr.py
+++ b/addons/l10n_ch/wizard/bvr_report.py
@@ -30,23 +30,24 @@
#
##############################################################################
-import wizard
-import pooler
import re
+
+import pooler
+from osv import osv, fields
from tools.translate import _
-def _check(self, cr, uid, data, context):
+def _validate_bank_values(self, cr, uid, data, context):
pool = pooler.get_pool(cr.dbname)
invoice_obj = pool.get('account.invoice')
for invoice in invoice_obj.browse(cr, uid, data['ids'], context):
if not invoice.partner_bank_id:
- raise wizard.except_wizard(_('UserError'),
+ raise osv.except_osv(_('UserError'),
_('No bank specified on invoice:\n%s') % \
invoice_obj.name_get(cr, uid, [invoice.id], context=context)[0][1])
if not re.compile('[0-9][0-9]-[0-9]{3,6}-[0-9]').match(
invoice.partner_bank_id.bvr_number or ''):
- raise wizard.except_wizard(_('UserError'),
+ raise osv.except_osv(_('UserError'),
_('Your bank BVR number should be of the form 0X-XXX-X!\n' \
'Please check your company ' \
'information for the invoice:\n%s') % \
@@ -55,29 +56,51 @@ def _check(self, cr, uid, data, context):
if invoice.partner_bank_id.bvr_adherent_num \
and not re.compile('[0-9]*$').match(
invoice.partner_bank_id.bvr_adherent_num):
- raise wizard.except_wizard(_('UserError'),
- _('Your bank BVR adherent number must contain exactly seven' \
+ raise osv.except_osv(_('UserError'),
+ _('Your bank BVR adherent number must contain exactly seven ' \
'digits!\nPlease check your company ' \
'information for the invoice:\n%s') % \
invoice_obj.name_get(cr, uid, [invoice.id], context=context)[0][1])
return {}
-class wizard_report(wizard.interface):
- states = {
- 'init': {
- 'actions': [_check],
- 'result': {'type':'print', 'report':'l10n_ch.bvr', 'state':'end'}
- }
- }
-wizard_report('l10n_ch.bvr.check')
+class bvr_report(osv.osv_memory):
+ _name="bvr.report"
+ _columns={'name':fields.char('Name', size=10)}
+
+ def view_init(self, cr, uid, fields_list, context=None):
+ data={}
+ active_ids = context.get('active_ids', [])
+ data['form'] = {}
+ data['ids'] = active_ids
+ _validate_bank_values(self, cr, uid, data, context)
+ pass
+
+ def print_bvr_report(self, cr, uid, ids, context):
+ data={}
+ active_ids = context.get('active_ids', [])
+ data['form'] = {}
+ data['ids'] = active_ids
+ return {'type': 'ir.actions.report.xml', 'report_name': 'l10n_ch.bvr', 'datas': data}
+bvr_report()
-class ReportInvoiceBVRCheck(wizard.interface):
- states = {
- 'init': {
- 'actions': [_check],
- 'result': {'type':'print', 'report':'l10n_ch.invoice.bvr', 'state':'end'}
- }
- }
-ReportInvoiceBVRCheck('l10n_ch.invoice.bvr.check')
+class bvr_invoices_report(osv.osv_memory):
+ _name="bvr.invoices.report"
+ _columns={'name':fields.char('Name', size=10)}
+
+ def view_init(self, cr, uid, fields_list, context=None):
+ data={}
+ active_ids = context.get('active_ids', [])
+ data['form'] = {}
+ data['ids'] = active_ids
+ _validate_bank_values(self, cr, uid, data, context)
+ pass
+
+ def print_bvr_invoices_report(self, cr, uid, ids, context):
+ data={}
+ active_ids = context.get('active_ids', [])
+ data['form'] = {}
+ data['ids'] = active_ids
+ return {'type': 'ir.actions.report.xml', 'report_name': 'l10n_ch.invoice.bvr', 'datas': data}
+bvr_invoices_report()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/l10n_ch/wizard/bvr_report_view.xml b/addons/l10n_ch/wizard/bvr_report_view.xml
new file mode 100644
index 00000000000..51450341a7d
--- /dev/null
+++ b/addons/l10n_ch/wizard/bvr_report_view.xml
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+ bvr Report
+ bvr.report
+ form
+
+
+
+
+
+
+ BVR
+ ir.actions.act_window
+ bvr.report
+ form
+ form
+
+ new
+
+
+
+
+
+ BVR
+ client_print_multi
+
+ action
+ account.invoice
+
+
+
+
+ BVR Invoices Report
+ bvr.invoices.report
+ form
+
+
+
+
+
+
+ Invoices BVR
+ ir.actions.act_window
+ bvr.invoices.report
+ form
+ form
+
+ new
+
+
+
+
+
+ Invoices BVR
+ client_print_multi
+
+ action
+ account.invoice
+
+
+
+
\ No newline at end of file
diff --git a/addons/l10n_ch/wizard/dta_wizard.py b/addons/l10n_ch/wizard/create_dta.py
similarity index 89%
rename from addons/l10n_ch/wizard/dta_wizard.py
rename to addons/l10n_ch/wizard/create_dta.py
index 1f8e55c0bc4..8b4eb15da3b 100644
--- a/addons/l10n_ch/wizard/dta_wizard.py
+++ b/addons/l10n_ch/wizard/create_dta.py
@@ -29,15 +29,18 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
-import pooler
-import wizard
-import base64
+
import time
-import pooler
import mx.DateTime
+import base64
+
+from osv import osv, fields
+import pooler
+
from tools.translate import _
+
FORM = """