From 2b142c0a318456984a99224736627066874ab776 Mon Sep 17 00:00:00 2001 From: Yannick Vaucher Date: Fri, 16 Sep 2011 16:32:55 +0200 Subject: [PATCH] [MRG] from c2c l10n_ch bzr revid: yannick.vaucher@camptocamp.com-20110916143255-7btktl8u1u23cwn0 --- addons/l10n_ch/__openerp__.py | 26 +- addons/l10n_ch/account_wizard.py | 6 +- addons/l10n_ch/bank.py | 115 ++- addons/l10n_ch/bank_view.xml | 170 +++- addons/l10n_ch/company.py | 25 +- addons/l10n_ch/company_view.xml | 20 +- addons/l10n_ch/demo/demo.xml | 7 +- addons/l10n_ch/demo/dta_demo.xml | 9 +- addons/l10n_ch/dta.py | 85 -- addons/l10n_ch/dta_data.xml | 100 +- addons/l10n_ch/dta_view.xml | 37 - addons/l10n_ch/invoice.py | 20 +- addons/l10n_ch/journal_data.xml | 6 +- addons/l10n_ch/partner.py | 31 - addons/l10n_ch/report/bvr.mako | 47 +- addons/l10n_ch/report/report_webkit_html.mako | 2 +- addons/l10n_ch/report/report_webkit_html.py | 212 ++-- .../report/report_webkit_html_view.xml | 100 +- addons/l10n_ch/sterchi_chart/account.xml | 925 +++++++++--------- .../l10n_ch/sterchi_chart/fiscal_position.xml | 4 +- addons/l10n_ch/test/l10n_ch_dta.yml | 221 +++++ addons/l10n_ch/test/l10n_ch_report.yml | 4 +- addons/l10n_ch/test/l10n_ch_v11.yml | 161 +++ addons/l10n_ch/test/l10n_ch_v11_part.yml | 292 ++++++ addons/l10n_ch/test/test.v11 | 2 + addons/l10n_ch/test/test_part_1.v11 | 2 + addons/l10n_ch/test/test_part_2.v11 | 2 + addons/l10n_ch/wizard.xml | 1 - addons/l10n_ch/wizard/__init__.py | 5 +- addons/l10n_ch/wizard/bvr_import.py | 19 +- addons/l10n_ch/wizard/create_dta.py | 86 +- addons/l10n_ch/wizard/create_dta_view.xml | 17 +- addons/l10n_ch/wizard/unicode2ascii.py | 592 +++++++++++ 33 files changed, 2377 insertions(+), 974 deletions(-) delete mode 100644 addons/l10n_ch/dta.py delete mode 100644 addons/l10n_ch/dta_view.xml create mode 100644 addons/l10n_ch/test/l10n_ch_dta.yml create mode 100644 addons/l10n_ch/test/l10n_ch_v11.yml create mode 100644 addons/l10n_ch/test/l10n_ch_v11_part.yml create mode 100755 addons/l10n_ch/test/test.v11 create mode 100755 addons/l10n_ch/test/test_part_1.v11 create mode 100755 addons/l10n_ch/test/test_part_2.v11 create mode 100644 addons/l10n_ch/wizard/unicode2ascii.py diff --git a/addons/l10n_ch/__openerp__.py b/addons/l10n_ch/__openerp__.py index d3398ccf23a..1c6bb5688d7 100644 --- a/addons/l10n_ch/__openerp__.py +++ b/addons/l10n_ch/__openerp__.py @@ -2,7 +2,7 @@ ############################################################################## # # Author: Nicolas Bessi. Copyright Camptocamp SA -# Donors: Hasa Sàrl, Open Net Sàrl and Prisme Solutions Informatique SA +# Donors: Hasa SA, Open Net SA and Prisme Solutions Informatique SA # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -21,10 +21,8 @@ { "name" : "Switzerland - localization with 2011 taxes", - "description" : """ -Swiss localisation. -=================== - + "description" : """ +Swiss localisation : - DTA generation for a lot of payment types - BVR management (number generation, report, etc..) - Import account move from the bank file (like v11 etc..) @@ -33,9 +31,11 @@ Swiss localisation. You can also add ZIP and bank completion with: - l10n_ch_zip - l10n_ch_bank + + Author: Camptocamp SA + Donors: Hasa Sàrl, Open Net Sàrl and Prisme Solutions Informatique SA -Author: Camptocamp SA -Donors: Hasa Sàrl, Open Net Sàrl and Prisme Solutions Informatique SA +------------------------------------------------------------------------ Module incluant la localisation Suisse de TinyERP revu et corrigé par Camptocamp. Cette nouvelle version comprend la gestion et l'émissionde BVR, le paiement électronique via DTA (pour les banques, le système postal est en développement) @@ -47,10 +47,11 @@ Par ailleurs, conjointement à ce module, nous proposons la complétion NPA: Vous pouvez ajouter la completion des banques et des NPA avec with: - l10n_ch_zip - l10n_ch_bank - + Auteur: Camptocamp SA Donateurs: Hasa Sàrl, Open Net Sàrl and Prisme Solutions Informatique SA +-------------------------------------------------------------------------- TODO : - Implement bvr import partial reconciliation - Replace wizard by osv_memory when possible @@ -60,8 +61,8 @@ TODO : """, - "version" : "6.0", - "author" : "Camptocamp SA", + "version" : "6.1", + "author" : "Camptocamp", "category" : "Finance", "website": "http://www.camptocamp.com", @@ -83,10 +84,10 @@ TODO : ], "demo_xml" : [ "demo/demo.xml", + "demo/dta_demo.xml", ], "update_xml" : [ "wizard.xml", - "dta_view.xml", "wizard/bvr_import_view.xml", "wizard/create_dta_view.xml", "company_view.xml", @@ -97,6 +98,9 @@ TODO : ], 'test' : [ 'test/l10n_ch_report.yml', + 'test/l10n_ch_dta.yml', + 'test/l10n_ch_v11.yml', + 'test/l10n_ch_v11_part.yml', ], "active": False, "installable": True, diff --git a/addons/l10n_ch/account_wizard.py b/addons/l10n_ch/account_wizard.py index 08c969dd654..f9b2600adca 100644 --- a/addons/l10n_ch/account_wizard.py +++ b/addons/l10n_ch/account_wizard.py @@ -32,13 +32,13 @@ class WizardMultiChartsAccounts(osv.osv_memory): 'sale_tax': False, 'purchase_tax':False } - + def execute(self, cr, uid, ids, context=None): """Override of code in order to be able to link journal with account in XML""" res = super(WizardMultiChartsAccounts, self).execute(cr, uid, ids, context) path = addons.get_module_resource(os.path.join('l10n_ch','sterchi_chart','account_journal_rel.xml')) tools.convert_xml_import(cr, 'l10n_ch', path, idref=None, mode='init', noupdate=True, report=None) return res - -WizardMultiChartsAccounts() + +WizardMultiChartsAccounts() diff --git a/addons/l10n_ch/bank.py b/addons/l10n_ch/bank.py index d64d57436a9..ab633a66718 100644 --- a/addons/l10n_ch/bank.py +++ b/addons/l10n_ch/bank.py @@ -19,12 +19,15 @@ # ############################################################################## +from tools.translate import _ from osv import fields, osv class Bank(osv.osv): """Inherit res.bank class in order to add swiss specific field""" _inherit = 'res.bank' _columns = { + ### Internal reference + 'code': fields.char('Code', size=64), ###Swiss unik bank identifier also use in IBAN number 'clearing': fields.char('Clearing number', size=64), ### city of the bank @@ -33,15 +36,113 @@ class Bank(osv.osv): Bank() -class bvr_checkbox(osv.osv): - """ Add function to generate function """ + +class ResPartnerBank(osv.osv): _inherit = "res.partner.bank" _columns = { - 'print_bank' : fields.boolean('Print Bank on BVR'), - 'print_account' : fields.boolean('Print Account Number on BVR'), - } + 'name': fields.char('Description', size=128, required=True), + 'post_number': fields.char('Post number', size=64), + 'bvr_adherent_num': fields.char('BVR adherent number', size=11), + 'dta_code': fields.char('DTA code', size=5), + 'print_bank': fields.boolean('Print Bank on BVR'), + 'print_account': fields.boolean('Print Account Number on BVR'), + 'acc_number': fields.char('Account/IBAN Number', size=64), + + } -bvr_checkbox() + def name_get(self, cursor, uid, ids, context=None): + if not len(ids): + return [] + bank_type_obj = self.pool.get('res.partner.bank.type') -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: + type_ids = bank_type_obj.search(cursor, uid, []) + bank_type_names = {} + for bank_type in bank_type_obj.browse(cursor, uid, type_ids, + context=context): + bank_type_names[bank_type.code] = bank_type.name + res = [] + for r in self.read(cursor, uid, ids, ['name','state'], context): + res.append((r['id'], r['name']+' : '+bank_type_names.get(r['state'], ''))) + return res + + def post_write(self, cr, uid, ids, context={}): + """ Override of post_write method. + In Switzerland with post accounts you can either have a postal account + with a required bank number (BVR Bank) or a postal number alone (BV Post, BVR Post). + So acc_number is not always mandatory and postal and bank number are not the same field """ + + obj_acc = self.pool.get('account.account') + obj_data = self.pool.get('ir.model.data') + for bank in self.browse(cr, uid, ids, context): + if bank.company_id and not bank.journal_id: + # Find the code and parent of the bank account to create + dig = 6 + current_num = 1 + ids = obj_acc.search(cr, uid, [('type','=','liquidity')], context=context) + # No liquidity account exists, no template available + if not ids: continue + + ref_acc_bank_temp = obj_acc.browse(cr, uid, ids[0], context=context) + ref_acc_bank = ref_acc_bank_temp.parent_id + while True: + new_code = str(ref_acc_bank.code.ljust(dig-len(str(current_num)), '0')) + str(current_num) + ids = obj_acc.search(cr, uid, [('code', '=', new_code), ('company_id', '=', bank.company_id.id)]) + if not ids: + break + current_num += 1 + + # Here is the test + if not bank.acc_number: + number = bank.post_number + else: + number = bank.acc_number + + acc = { + 'name': (bank.bank_name or '')+' '+ number, + 'currency_id': bank.company_id.currency_id.id, + 'code': new_code, + 'type': 'liquidity', + 'user_type': ref_acc_bank_temp.user_type.id, + 'reconcile': False, + 'parent_id': ref_acc_bank.id, + 'company_id': bank.company_id.id, + } + acc_bank_id = obj_acc.create(cr,uid,acc,context=context) + + # Get the journal view id + data_id = obj_data.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_journal_bank_view')]) + data = obj_data.browse(cr, uid, data_id[0], context=context) + view_id_cash = data.res_id + + jour_obj = self.pool.get('account.journal') + new_code = 1 + while True: + code = _('BNK')+str(new_code) + ids = jour_obj.search(cr, uid, [('code','=',code)], context=context) + if not ids: + break + new_code += 1 + + #create the bank journal + vals_journal = { + 'name': (bank.bank_name or '')+' '+number, + 'code': code, + 'type': 'bank', + 'company_id': bank.company_id.id, + 'analytic_journal_id': False, + 'currency_id': False, + 'default_credit_account_id': acc_bank_id, + 'default_debit_account_id': acc_bank_id, + 'view_id': view_id_cash + } + journal_id = jour_obj.create(cr, uid, vals_journal, context=context) + + self.write(cr, uid, [bank.id], {'journal_id': journal_id}, context=context) + return True + + + _sql_constraints = [('bvr_adherent_uniq', 'unique (bvr_adherent_num)', + 'The BVR adherent number must be unique !')] + +ResPartnerBank() diff --git a/addons/l10n_ch/bank_view.xml b/addons/l10n_ch/bank_view.xml index 339e5cf887a..5558cbafc3c 100644 --- a/addons/l10n_ch/bank_view.xml +++ b/addons/l10n_ch/bank_view.xml @@ -1,54 +1,184 @@ + res.bank.form res.bank form + + + + + res.bank.tree res.bank tree + - + + - - - res.partner_bank.form - res.partner.bank - form - - - - - - - - - - res.partner_partner_bank.form + + + + + + res.partner_bank.form.hide.f1 res.partner form + - - - - + + + res.partner_bank.form.hide.f2 + res.partner + form + + + + + + + + + + res.partner_bank.form.hide.f2 + res.partner + form + + + + + + + + + + + + + + + + + + + + + + + + + + + + + res.partner_bank.form.hide.acc_number.frominvoice + res.partner.bank + form + + + + + + + + + + res.partner_bank.form.hide.bank.frominvoice + res.partner.bank + form + + + + + + + + + + res.partner_bank.form.hide.frominvoice + res.partner.bank + form + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + res.partner.form.bank_details.list + res.partner + + form + + + + + + + + + + + + res.partner.bank.tree.from_invoice + res.partner.bank + + tree + + + + + + + + + diff --git a/addons/l10n_ch/company.py b/addons/l10n_ch/company.py index 20f6b6168ec..e37e787f9a5 100644 --- a/addons/l10n_ch/company.py +++ b/addons/l10n_ch/company.py @@ -29,19 +29,36 @@ class res_company(osv.osv): _columns = { 'bvr_delta_horz': fields.float('BVR Horz. Delta (mm)', help='horiz. delta in mm 1.2 will print the bvr 1.2mm lefter, negative value is possible'), - + 'bvr_delta_vert': fields.float('BVR Vert. Delta (mm)', help='vert. delta in mm 1.2 will print the bvr 1.2mm lower, negative value is possible'), - + + 'bvr_scan_line_vert': fields.float('BVR vert. position for scan line (mm)', + help='Vert. position in mm for scan line'), + + 'bvr_scan_line_horz': fields.float('BVR horiz. position for scan line(mm)', + help='Horiz. position in mm for scan line'), + + 'bvr_scan_line_font_size': fields.float('BVR scan line font size (pt)'), + + 'bvr_scan_line_letter_spacing':fields.float('BVR scan line letter spacing'), + 'bvr_background': fields.boolean('Insert BVR background ?'), - + 'bvr_only': fields.boolean('Separated BVR only ?', help='Print only the BVR separated page'), - + 'invoice_only': fields.boolean('Invoice only (Do not use with bvr only)?', help='Print only the invoice without BVR'), } + _defaults = { + 'bvr_scan_line_vert': lambda *a: 232, + 'bvr_scan_line_horz': lambda *a: 72, + 'bvr_scan_line_font_size': lambda *a: 12, + 'bvr_scan_line_letter_spacing': lambda *a: 0, + } + res_company() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_ch/company_view.xml b/addons/l10n_ch/company_view.xml index df49cf123be..0d107f63723 100644 --- a/addons/l10n_ch/company_view.xml +++ b/addons/l10n_ch/company_view.xml @@ -8,13 +8,21 @@ - - - - - + + + + + + + + + + + + + - + \ No newline at end of file diff --git a/addons/l10n_ch/demo/demo.xml b/addons/l10n_ch/demo/demo.xml index 8df7be446bd..fbe09024966 100644 --- a/addons/l10n_ch/demo/demo.xml +++ b/addons/l10n_ch/demo/demo.xml @@ -13,10 +13,8 @@ bvrbank 11-1234-1 - CH9100767000S00023455 + 0000000 - - @@ -24,7 +22,6 @@ banq Banque - @@ -48,7 +45,6 @@ http://camptocamp.com ProLibre - @@ -58,7 +54,6 @@ http://camptocamp.com camptocamp SA - My bank - 123456 - 123456 + + dta_company - CH9100767000S00023455 + + CH9100767000S00023455 diff --git a/addons/l10n_ch/dta.py b/addons/l10n_ch/dta.py deleted file mode 100644 index a8ae96e080d..00000000000 --- a/addons/l10n_ch/dta.py +++ /dev/null @@ -1,85 +0,0 @@ -# -*- encoding: utf-8 -*- -############################################################################## -# -# Author: Nicolas Bessi. Copyright Camptocamp SA -# Donors: Hasa Sàrl, Open Net Sàrl and Prisme Solutions Informatique SA -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU Affero General Public License as -# published by the Free Software Foundation, either version 3 of the -# License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU Affero General Public License for more details. -# -# You should have received a copy of the GNU Affero General Public License -# along with this program. If not, see . -# -############################################################################## - -import time -from osv import osv, fields - -class account_dta(osv.osv): - """class that implements bank DTA File format, - used to transfert bulk batch payment instruction to a bank""" - _name = "account.dta" - _description = "DTA History" - _columns = { - ### name of the file - 'name': fields.binary('DTA file', readonly=True), - ### list of dta line linked to the dta order - 'dta_line_ids': fields.one2many('account.dta.line','dta_id','DTA lines', readonly=True), - ## textual notes - 'note': fields.text('Creation log', readonly=True, - help="Displays the problem during dta generation"), - ### bank how will execute DTA order - 'bank': fields.many2one('res.partner.bank','Bank', readonly=True,select=True, - help="Bank how will execute DTA order"), - ### date of DTA order generation - 'date': fields.date('Creation Date', readonly=True,select=True, - help="Date of DTA order generation"), - ### user how generate the DTA order - 'user_id': fields.many2one('res.users','User', readonly=True, select=True), - } -account_dta() - -class account_dta_line(osv.osv): - """Class that represent a DTA order line, - each line corressponds to a payment instruction""" - _name = "account.dta.line" - _description = "DTA line" - _columns = { - ### name of the line - 'name' : fields.many2one('account.invoice','Invoice', required=True, size=256), - ### partner how will receive payments - 'partner_id' : fields.many2one('res.partner','Partner', - help="Partenr to pay"), - ### due date of the payment - 'due_date' : fields.date('Due date'), - ### date of the supplier invoice to pay - 'invoice_date' : fields.date('Invoice date'), - ### cash discount date - 'cashdisc_date' : fields.date('Cash Discount date'), - ### amount effectively paied on this line - 'amount_to_pay' : fields.float('Amount to pay', - help="Amount effectively paid"), - ### amount that was on the supplier invoice - 'amount_invoice': fields.float('Invoiced Amount', - help="Amount to pay base on the supplier invoice"), - ### Cash discount amount - 'amount_cashdisc': fields.float('Cash Discount Amount'), - ### Linke to the main dta order - 'dta_id': fields.many2one('account.dta','Associated DTA', required=True, ondelete='cascade'), - ### state of the invoice Drat, Cancel, Done - 'state' : fields.selection([('draft','Draft'),('cancel','Error'),('done','Paid')],'State') - } - _defaults = { - 'state' : lambda *a :'draft', - } - -account_dta_line() - -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/l10n_ch/dta_data.xml b/addons/l10n_ch/dta_data.xml index 5ef689d551c..b11e5e172a9 100644 --- a/addons/l10n_ch/dta_data.xml +++ b/addons/l10n_ch/dta_data.xml @@ -1,6 +1,6 @@ - + - - iban - - - - - - - - - iban - - - - - - bank - - - - - - - - - bank - - - - - - post_number - - - - - - - - bank - - - - - - post_number - - - - - - - - bank - - - - - - post_number - - - - - - - - bank - - - - - - - acc_number - - - - - - \ No newline at end of file + diff --git a/addons/l10n_ch/dta_view.xml b/addons/l10n_ch/dta_view.xml deleted file mode 100644 index 869eacae6f1..00000000000 --- a/addons/l10n_ch/dta_view.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - partner - bank inherit - res.partner - form - - - - - - - - - - - - - partner - bank inherit - res.partner.bank - form - - - - - - - - - - - - - diff --git a/addons/l10n_ch/invoice.py b/addons/l10n_ch/invoice.py index 4896931b77b..0f5a403d64f 100644 --- a/addons/l10n_ch/invoice.py +++ b/addons/l10n_ch/invoice.py @@ -73,7 +73,7 @@ class account_invoice(osv.osv): help='The partner bank account to pay\nKeep empty to use the default' ), ### Amount to pay - 'amount_to_pay': fields.function(_amount_to_pay, + 'amount_to_pay': fields.function(_amount_to_pay, method=True, type='float', string='Amount to be paid', help='The amount which should be paid at the current date\n' \ 'minus the amount which is already in payment order'), @@ -120,7 +120,7 @@ class account_invoice(osv.osv): invoice.partner_bank_id.state in \ ('bvrbank', 'bvrpost') and \ invoice.reference_type != 'bvr': - return False + return False return True _constraints = [ @@ -143,16 +143,16 @@ class account_invoice(osv.osv): def onchange_partner_id(self, cr, uid, ids, type, partner_id, date_invoice=False, payment_term=False, partner_bank_id=False, company_id=False): """ Function that is call when the partner of the invoice is changed - it will retriev and set the good bank partner bank""" + it will retrieve and set the good bank partner bank""" res = super(account_invoice, self).onchange_partner_id( cr, - uid, - ids, - type, - partner_id, - date_invoice, - payment_term - ) + uid, + ids, + type, + partner_id, + date_invoice, + payment_term + ) bank_id = False if partner_id: p = self.pool.get('res.partner').browse(cr, uid, partner_id) diff --git a/addons/l10n_ch/journal_data.xml b/addons/l10n_ch/journal_data.xml index ac8c714fbca..7b4c777463f 100644 --- a/addons/l10n_ch/journal_data.xml +++ b/addons/l10n_ch/journal_data.xml @@ -1,5 +1,5 @@ - + Journal de frais @@ -15,7 +15,7 @@ Banque CHF BCHF - cash + bank @@ -26,7 +26,7 @@ Banque EUR BEUR - cash + bank diff --git a/addons/l10n_ch/partner.py b/addons/l10n_ch/partner.py index 35a4456b7fd..9301c564227 100644 --- a/addons/l10n_ch/partner.py +++ b/addons/l10n_ch/partner.py @@ -30,35 +30,4 @@ class res_partner(osv.osv): } res_partner() - -class res_partner_bank(osv.osv): - _inherit = "res.partner.bank" - _columns = { - 'name': fields.char('Description', size=128, required=True), - 'post_number': fields.char('Post number', size=64), - 'bvr_adherent_num': fields.char('BVR adherent number', size=11), - 'dta_code': fields.char('DTA code', size=5), - } - - def name_get(self, cr, uid, ids, context=None): - if not len(ids): - return [] - bank_type_obj = self.pool.get('res.partner.bank.type') - - type_ids = bank_type_obj.search(cr, uid, []) - bank_type_names = {} - for bank_type in bank_type_obj.browse(cr, uid, type_ids, - context=context): - bank_type_names[bank_type.code] = bank_type.name - res = [] - for r in self.read(cr, uid, ids, ['name','state'], context): - res.append((r['id'], r['name']+' : '+bank_type_names[r['state']])) - return res - - _sql_constraints = [ - ('bvr_adherent_uniq', 'unique (bvr_adherent_num)', 'The BVR adherent number must be unique !') - ] - -res_partner_bank() - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/l10n_ch/report/bvr.mako b/addons/l10n_ch/report/bvr.mako index 6ff8921a142..e4a2a2ea87d 100644 --- a/addons/l10n_ch/report/bvr.mako +++ b/addons/l10n_ch/report/bvr.mako @@ -7,6 +7,17 @@ font-weight: normal; src: url(${police_absolute_path('ocrbb.ttf')}) format("truetype"); } + .ocrbb{ + text-align:right; + font-family:bvrocrb; + font-size:${str(company.bvr_scan_line_font_size or '0.0').replace(',','.')}pt; + position:absolute;top:${str(company.bvr_scan_line_vert or '0.0').replace(',','.')}mm; + left:${str(company.bvr_scan_line_horz or '0.0').replace(',','.')}mm; + z-index:4; + letter-spacing:str(company.bvr_scan_line_letter_spacing or '0.0').replace(',','.') + } + ${css} + @@ -87,9 +98,41 @@ } - ${_check(objects)} %for inv in objects : <% setLang(inv.partner_id.lang) %> + + + + + + + %if inv.address_invoice_id.country_id : + + %endif + %if inv.address_invoice_id.phone : + + %endif + %if inv.address_invoice_id.fax : + + %endif + %if inv.address_invoice_id.email : + + %endif + %if inv.partner_id.vat : + + %endif +
${inv.partner_id.title.name or ''|entity} ${inv.partner_id.name |entity}
${inv.address_invoice_id.street or ''|entity}
${inv.address_invoice_id.street2 or ''|entity}
${inv.address_invoice_id.zip or ''|entity} ${inv.address_invoice_id.city or ''|entity}
${inv.address_invoice_id.country_id.name or ''|entity}
${_("Tel") |entity}: ${inv.address_invoice_id.phone|entity}
${_("Fax") |entity}: ${inv.address_invoice_id.fax|entity}
${_("E-mail") |entity}: ${inv.address_invoice_id.email|entity}
${_("VAT") |entity}: ${inv.partner_id.vat|entity}
+ +
+ ${_('Invoice')} - ${inv.number or ''|entity} +
+
+ ${_('Here is the BVR to allow you to pay the invoice %s - %s') % (inv.name or '', inv.number or '',)} +
+ ${_('Regards')} +
+ +
${mod10r('01'+str('%.2f' % inv.amount_total).replace('.','').rjust(10,'0'))}>${_get_ref(inv)}+${inv.partner_bank_id.post_number.split('-')[0]+(str(inv.partner_bank_id.post_number.split('-')[1])).rjust(6,'0')+inv.partner_bank_id.post_number.split('-')[2]}>
@@ -103,7 +146,7 @@
${_space(('%.2f' % inv.amount_total)[:-3], 1)}${ _space(('%.2f' % inv.amount_total)[-2:], 1)}
${_space(('%.2f' % inv.amount_total)[:-3], 1)}${ _space(('%.2f' % inv.amount_total)[-2:], 1)}
- ${mod10r('01'+str('%.2f' % inv.amount_total).replace('.','').rjust(10,'0'))}>${_get_ref(inv)}+${inv.partner_bank_id.post_number.split('-')[0]+(str(inv.partner_bank_id.post_number.split('-')[1])).rjust(6,'0')+inv.partner_bank_id.post_number.split('-')[2]}> + %endfor diff --git a/addons/l10n_ch/report/report_webkit_html.mako b/addons/l10n_ch/report/report_webkit_html.mako index d15bfda2898..099bbbf8816 100644 --- a/addons/l10n_ch/report/report_webkit_html.mako +++ b/addons/l10n_ch/report/report_webkit_html.mako @@ -9,7 +9,7 @@ <% setLang(inv.partner_id.lang) %>
- + diff --git a/addons/l10n_ch/report/report_webkit_html.py b/addons/l10n_ch/report/report_webkit_html.py index 619a152405c..b551845322f 100644 --- a/addons/l10n_ch/report/report_webkit_html.py +++ b/addons/l10n_ch/report/report_webkit_html.py @@ -33,7 +33,9 @@ import addons import pooler from tools.config import config from mako.template import Template +from mako import exceptions from tools.translate import _ +from osv.osv import except_osv class l10n_ch_report_webkit_html(report_sxw.rml_parse): @@ -41,16 +43,15 @@ class l10n_ch_report_webkit_html(report_sxw.rml_parse): super(l10n_ch_report_webkit_html, self).__init__(cr, uid, name, context=context) self.localcontext.update({ 'time': time, - 'cr':cr, + 'cr': cr, 'uid': uid, 'user':self.pool.get("res.users").browse(cr, uid, uid), 'mod10r': mod10r, '_space': self._space, '_get_ref': self._get_ref, 'comma_me': self.comma_me, - 'police_absolute_path' : self.police_absolute_path, - 'bvr_absolute_path':self.bvr_absolute_path, - '_check' : self._check, + 'police_absolute_path': self.police_absolute_path, + 'bvr_absolute_path': self.bvr_absolute_path, 'headheight': self.headheight }) @@ -58,15 +59,22 @@ class l10n_ch_report_webkit_html(report_sxw.rml_parse): _compile_comma_me = re.compile("^(-?\d+)(\d{3})") _compile_check_bvr = re.compile('[0-9][0-9]-[0-9]{3,6}-[0-9]') _compile_check_bvr_add_num = re.compile('[0-9]*$') - + + def set_context(self, objects, data, ids, report_type=None): + user = self.pool.get('res.users').browse(self.cr, self.uid, self.uid) + company = user.company_id + if not company.invoice_only: + self._check(ids) + return super(l10n_ch_report_webkit_html, self).set_context(objects, data, ids, report_type=report_type) + def police_absolute_path(self, inner_path) : """Will get the ocrb police absolute path""" - path = addons.get_module_resource(os.path.join('l10n_ch','report',inner_path)) + path = addons.get_module_resource(os.path.join('l10n_ch', 'report', inner_path)) return path def bvr_absolute_path(self) : """Will get the ocrb police absolute path""" - path = addons.get_module_resource(os.path.join('l10n_ch','report','bvr1.jpg')) + path = addons.get_module_resource(os.path.join('l10n_ch', 'report', 'bvr1.jpg')) return path def headheight(self): @@ -76,7 +84,7 @@ class l10n_ch_report_webkit_html(report_sxw.rml_parse): def comma_me(self, amount): """Fast swiss number formatting""" - if type(amount) is float : + if isinstance(amount, float): amount = str('%.2f'%amount) else : amount = str(amount) @@ -88,14 +96,15 @@ class l10n_ch_report_webkit_html(report_sxw.rml_parse): return self.comma_me(new) def _space(self, nbr, nbrspc=5): - """Spaces * 5""" - res = '' - for i in range(len(nbr)): - res = res + nbr[i] - if not (i-1) % nbrspc: - res = res + ' ' - return res + """Spaces * 5. + Example: + >>> self._space('123456789012345') + '12 34567 89012 345' + """ + return ''.join([' '[(i - 2) % nbrspc:] + c for i, c in enumerate(nbr)]) + + def _get_ref(self, inv): """Retrieve ESR/BVR reference form invoice in order to print it""" res = '' @@ -106,39 +115,77 @@ class l10n_ch_report_webkit_html(report_sxw.rml_parse): invoice_number = self._compile_get_ref.sub('', inv.number) return mod10r(res + invoice_number.rjust(26-len(res), '0')) - def _check(self, invoices): + def _check(self, invoice_ids): """Check if the invoice is ready to be printed""" + if not invoice_ids: + invoice_ids = [] cursor = self.cr pool = self.pool invoice_obj = pool.get('account.invoice') - ids = [x.id for x in invoices] + ids = invoice_ids for invoice in invoice_obj.browse(cursor, self.uid, ids): if not invoice.partner_bank_id: - raise wizard.except_wizard(_('UserError'), + raise except_osv(_('UserError'), _('No bank specified on invoice:\n' + \ invoice_obj.name_get(cursor, self.uid, [invoice.id], context={})[0][1])) if not self._compile_check_bvr.match( invoice.partner_bank_id.post_number or ''): - raise wizard.except_wizard(_('UserError'), - _("Your bank BVR number should be of the form 0X-XXX-X! " + - 'Please check your company ' + - 'information for the invoice:\n' + - invoice_obj.name_get(cursor, self.uid, [invoice.id], - context={})[0][1])) + raise except_osv(_('UserError'), + _('Your bank BVR number should be of the form 0X-XXX-X! ' + + 'Please check your company ' + + 'information for the invoice:\n' + + invoice_obj.name_get(cursor, self.uid, [invoice.id], + context={})[0][1])) if invoice.partner_bank_id.bvr_adherent_num \ and not self._compile_check_bvr_add_num.match( invoice.partner_bank_id.bvr_adherent_num): - raise wizard.except_wizard('UserError', - 'Your bank BVR adherent number must contain exactly seven' + - 'digits!\nPlease check your company ' + - 'information for the invoice:\n' + - invoice_obj.name_get(cursor, self.uid, [invoice.id], - context={})[0][1]) - return "" + raise except_osv(_('UserError'), + _('Your bank BVR adherent number must contain exactly seven' + + 'digits!\nPlease check your company ' + + 'information for the invoice:\n' + + invoice_obj.name_get(cursor, self.uid, [invoice.id], + context={})[0][1])) + return '' class BVRWebKitParser(webkit_report.WebKitParser): + def setLang(self, lang): + if not lang: + lang = 'en_US' + self.localcontext['lang'] = lang + + def formatLang(self, value, digits=None, date=False, date_time=False, grouping=True, monetary=False): + """format using the know cursor, language from localcontext""" + if digits is None: + digits = self.parser_instance.get_digits(value) + if isinstance(value, (str, unicode)) and not value: + return '' + pool_lang = self.pool.get('res.lang') + lang = self.localcontext['lang'] + + lang_ids = pool_lang.search(self.parser_instance.cr, self.parser_instance.uid, [('code','=',lang)])[0] + lang_obj = pool_lang.browse(self.parser_instance.cr, self.parser_instance.uid, lang_ids) + + if date or date_time: + if not str(value): + return '' + + date_format = lang_obj.date_format + parse_format = '%Y-%m-%d' + if date_time: + value=value.split('.')[0] + date_format = date_format + " " + lang_obj.time_format + parse_format = '%Y-%m-%d %H:%M:%S' + if not isinstance(value, time.struct_time): + return time.strftime(date_format, time.strptime(value, parse_format)) + + else: + date = datetime(*value.timetuple()[:6]) + return date.strftime(date_format) + + return lang_obj.format('%.' + str(digits) + 'f', value, grouping=grouping, monetary=monetary) + def create_single_pdf(self, cursor, uid, ids, data, report_xml, context=None): """generate the PDF""" self.parser_instance = self.parser( @@ -190,74 +237,81 @@ class BVRWebKitParser(webkit_report.WebKitParser): """ + self.parser_instance.localcontext.update({'setLang':self.setLang}) + self.parser_instance.localcontext.update({'formatLang':self.formatLang}) css = report_xml.webkit_header.css if not css : css = '' user = self.pool.get('res.users').browse(cursor, uid, uid) - company= user.company_id + company = user.company_id parse_template = template #default_filters=['unicode', 'entity'] can be used to set global filter - body_mako_tpl = Template(parse_template ,input_encoding='utf-8') + body_mako_tpl = Template(parse_template ,input_encoding='utf-8', output_encoding='utf-8') #BVR specific bvr_path = addons.get_module_resource(os.path.join('l10n_ch','report','bvr.mako')) - body_bvr_tpl = Template(file(bvr_path).read(), input_encoding='utf-8') + body_bvr_tpl = Template(file(bvr_path).read(), input_encoding='utf-8', output_encoding='utf-8') helper = report_helper.WebKitHelper(cursor, uid, report_xml.id, context) ##BVR Specific htmls = [] for obj in objs : - self.parser_instance.localcontext['objects'] = [obj] if not company.bvr_only: - html = body_mako_tpl.render( + try: + html = body_mako_tpl.render( + helper=helper, + css=css, + _=self.translate_call, + **self.parser_instance.localcontext + ) + except Exception, e: + raise Exception(exceptions.text_error_template().render()) + htmls.append(html) + if not company.invoice_only: + try: + bvr = body_bvr_tpl.render( + helper=helper, + css=css, + _=self.translate_call, + **self.parser_instance.localcontext + ) + except Exception, e: + raise Exception(exceptions.text_error_template().render()) + htmls.append(bvr) + head_mako_tpl = Template(header, input_encoding='utf-8', output_encoding='utf-8') + try: + head = head_mako_tpl.render( + helper=helper, + css=css, + _debug=False, + _=self.translate_call, + **self.parser_instance.localcontext + ) + except Exception, e: + raise Exception(exceptions.text_error_template().render()) + foot = False + if footer and company.invoice_only : + foot_mako_tpl = Template(footer, input_encoding='utf-8', output_encoding='utf-8') + try: + foot = foot_mako_tpl.render( helper=helper, - css=css, + css=css, _=self.translate_call, **self.parser_instance.localcontext ) - htmls.append(html) - if not company.invoice_only: - bvr = body_bvr_tpl.render( - helper=helper, - css=css, - _=self.translate_call, - **self.parser_instance.localcontext - ) - htmls.append(bvr) - head_mako_tpl = Template(header, input_encoding='utf-8') - head = head_mako_tpl.render( - company=company, - time=time, - helper=helper, - css=css, - formatLang=self.parser_instance.formatLang, - setLang=self.parser_instance.setLang, - _debug=False - ) - foot = False - if footer and company.invoice_only : - foot_mako_tpl = Template(footer ,input_encoding='utf-8') - foot = foot_mako_tpl.render( - company=company, - time=time, - helper=helper, - css=css, - formatLang=self.parser_instance.formatLang, - setLang=self.parser_instance.setLang, - _=self.translate_call, - - ) + except Exception, e: + raise Exception(exceptions.text_error_template().render()) if report_xml.webkit_debug : - deb = head_mako_tpl.render( - company=company, - time=time, - helper=helper, - css=css, - _debug=html, - formatLang=self.parser_instance.formatLang, - setLang=self.parser_instance.setLang, - _=self.translate_call, - ) + try: + deb = head_mako_tpl.render( + helper=helper, + css=css, + _debug=html, + _=self.translate_call, + **self.parser_instance.localcontext + ) + except Exception, e: + raise Exception(exceptions.text_error_template().render()) return (deb, 'html') bin = self.get_lib(cursor, uid, company.id) pdf = self.generate_pdf(bin, report_xml, head, foot, htmls) diff --git a/addons/l10n_ch/report/report_webkit_html_view.xml b/addons/l10n_ch/report/report_webkit_html_view.xml index c03db709162..c1638ff99db 100644 --- a/addons/l10n_ch/report/report_webkit_html_view.xml +++ b/addons/l10n_ch/report/report_webkit_html_view.xml @@ -5,55 +5,57 @@ PortraitA4 - - - - - -
${inv.partner_id.title or ''|entity} ${inv.partner_id.name |entity}
${inv.partner_id.title.name or ''|entity} ${inv.partner_id.name |entity}
${inv.address_invoice_id.street or ''|entity}
${inv.address_invoice_id.street2 or ''|entity}
${inv.address_invoice_id.zip or ''|entity} ${inv.address_invoice_id.city or ''|entity}
- - - - - - - - - - - - - - - - - - - - -
${helper.embed_logo_by_name('camptocamp_logo', width=64)} - - - - -
/

${company.partner_id.name |entity} -
${company.partner_id.address and company.partner_id.address[0].street or ''|entity} -
Phone: ${company.partner_id.address and company.partner_id.address[0].phone or ''|entity} -
Mail: ${company.partner_id.address and company.partner_id.address[0].email or ''|entity}
${_debug or ''}
- ]]> + + + + + + + + + + + +
${helper.embed_logo_by_name('camptocamp_logo', width=128)} + + + + + + + + + + + + + + + + + +
${company.partner_id.name |entity}
${company.partner_id.address and company.partner_id.address[0].street or ''|entity}${_("phone")}:${company.partner_id.address and company.partner_id.address[0].phone or ''|entity}
${company.partner_id.address and company.partner_id.address[0].street2 or ''|entity}${_('Fax')}:${company.partner_id.address and company.partner_id.address[0].fax or ''|entity}
${company.partner_id.address and company.partner_id.address[0].zip or ''|entity} ${company.partner_id.address and company.partner_id.address[0].city or ''|entity}${_('e-mail')}:${company.partner_id.address and company.partner_id.address[0].email or ''|entity}
${company.partner_id.address and company.partner_id.address[0].country_id.name or ''|entity} /
+
+
+ ${_debug or ''} +
+ +]]> diff --git a/addons/l10n_ch/sterchi_chart/account.xml b/addons/l10n_ch/sterchi_chart/account.xml index 8c907653b4a..f642b800493 100644 --- a/addons/l10n_ch/sterchi_chart/account.xml +++ b/addons/l10n_ch/sterchi_chart/account.xml @@ -1,40 +1,65 @@ - - Autre : Vue + + Autre : Vue + view + none + none + + + Autre: Vue Actifs view none + asset + + + Autre: Vue Passifs + view + none + liability + + + Autre: Vue Charges + view + none + expense + + + Autre: Vue Produits + view + none + income Bilan : Liquidites et titres cash balance - asset + none Bilan : Actif de regularisation adjusting_asset balance - asset + none Bilan : Capitaux propres equity balance - liability + none PP : Chiffre d'affaires income none - income + none Bilan : Passifs de regularisation adj_liability balance - liability + none Autre : Cloture @@ -45,123 +70,123 @@ PP : Amortissement depreciation none - expense + none PP : Resultat financier financial_result none - income + none Bilan : Immobilisations financieres financial_asset balance - asset + none Bilan : Immo corporelles immobilieres building_asset balance - asset + none Bilan : Actifs hors exploitation non_ope_asset balance - asset + none PP : Autres charges d'exploitation other_ope_expense none - expense + none Bilan : Dettes hors exploitation non_ope_debts balance - liability + none Bilan : Immo corporelles mobilieres fixed_asset balance - asset + none Bilan : Immo incorporelles intangible_asset balance - asset + none Bilan : Stocks inventory balance - asset + none Bilan : Dettes à LT lt_liability balance - liability + none PP : Resultat activites annexes non_oper_result none - income + none Bilan : Autres creanciers à CT other_payable balance - liability + none Bilan : Autres créances other_receivable balance - asset + none PP : Charge de personnel personnal_exp none - expense + none Bilan : Provisions et reserves provision_reserve balance - liability + none PP : Achat de marchandise purchase none - expense + none Bilan : Resultat reporte report_result balance - liability + none Bilan : Debiteurs receivable True unreconciled - asset + none Bilan : Fournisseurs payable True unreconciled - liability + none Autre : Consolidation @@ -184,7 +209,7 @@ view Bilan 1_2 - + @@ -192,7 +217,7 @@ view Actif 1 - + @@ -200,7 +225,7 @@ view Actifs circulants 10 - + @@ -208,7 +233,7 @@ view Liquidités et titres 100 - + @@ -216,7 +241,7 @@ view Caisse 100.0 - + @@ -272,7 +297,7 @@ view Poste (CCP) 101.0 - + @@ -296,7 +321,7 @@ view Banques 102.0 - + @@ -360,7 +385,7 @@ view Chèques, effets à recevoir 104.0 - + @@ -392,7 +417,7 @@ view Avoirs à court terme 105.0 - + @@ -432,7 +457,7 @@ view Titres réalisables à court terme 106.0 - + @@ -480,7 +505,7 @@ view Autres placements à court terme 107.0 - + @@ -520,7 +545,7 @@ view Compte d'attente en monnaie 109.0 - + @@ -536,16 +561,15 @@ view Créances 110 - + view - Créances résultant de vente et de prestations de services - (débiteurs-clients) + Créances résultant de vente et de prestations de services (débiteurs-clients) 110.0 - + @@ -553,7 +577,7 @@ view Créances résultant prestations envers des tiers 110.00 - + @@ -587,7 +611,7 @@ view Créances résultant prestations envers des sociétés du groupe 111.00 - + @@ -621,7 +645,7 @@ view Créances résultant prestations envers actionnaires 112.00 - + @@ -655,7 +679,7 @@ view Autres créances à court terme 114.0 - + @@ -663,7 +687,7 @@ view Autres créances à court terme envers des tiers 114.00 - + @@ -703,7 +727,7 @@ view Autres créances à court terme envers des sociétés du groupe 115.00 - + @@ -735,7 +759,7 @@ view Autres créances à court terme envers actionnaires 116.00 - + @@ -767,7 +791,7 @@ view Créances envers des institutions publiques 117.00 - + @@ -815,7 +839,7 @@ view Capital-actions non libéré 118.00 - + @@ -831,7 +855,7 @@ view Autres créances à court terme 119.00 - + @@ -887,7 +911,7 @@ view Stocks et travaux en cours 120 - + @@ -895,7 +919,7 @@ view Stocks de marchandises 120.0 - + @@ -935,7 +959,7 @@ view Stocks de matières premières 121.0 - + @@ -975,7 +999,7 @@ view Stocks d'autres approvisionnements 122.0 - + @@ -1015,7 +1039,7 @@ view Stocks de matières auxiliaires et de fournitures 123.0 - + @@ -1063,7 +1087,7 @@ view Stocks obligatoires 124.0 - + @@ -1095,7 +1119,7 @@ view Marchandises en consignation 125.0 - + @@ -1111,7 +1135,7 @@ view Stocks de produits finis 126.0 - + @@ -1135,7 +1159,7 @@ view Stocks de produits semi-ouvrés 127.0 - + @@ -1159,7 +1183,7 @@ view Stocks de produits en cours 128.0 - + @@ -1183,7 +1207,7 @@ view Actifs de régularisation 130 - + @@ -1191,7 +1215,7 @@ view Actifs de régularisation (Actifs transitoires) 130.0 - + @@ -1215,7 +1239,7 @@ view Actifs immobilisés 14 - + @@ -1223,7 +1247,7 @@ view Immobilisations financières 140 - + @@ -1231,7 +1255,7 @@ view Titres à long terme 140.0 - + @@ -1287,7 +1311,7 @@ view Autres placements à long terme 141.0 - + @@ -1319,7 +1343,7 @@ view Participations 142.0 - + @@ -1359,7 +1383,7 @@ view Créances à long terme envers des tiers 144.0 - + @@ -1391,7 +1415,7 @@ view Créances à long terme envers des sociétés du groupe 145.0 - + @@ -1423,7 +1447,7 @@ view Créances à long terme envers des actionnaires 146.0 - + @@ -1455,7 +1479,7 @@ view Actions propres 149.0 - + @@ -1479,7 +1503,7 @@ view Immobilisation corporelles meubles 150 - + @@ -1487,7 +1511,7 @@ view Machines et appareils destinés à la production 150.0 - + @@ -1527,7 +1551,7 @@ view Mobilier et installations 151.0 - + @@ -1583,7 +1607,7 @@ view Machines de bureau, informatiques, communication 152.0 - + @@ -1663,7 +1687,7 @@ view Véhicules 153.0 - + @@ -1719,7 +1743,7 @@ view Instruments et outillage 154.0 - + @@ -1751,7 +1775,7 @@ view Installations de stockage 155.0 - + @@ -1791,7 +1815,7 @@ view Equipements et installations 157.0 - + @@ -1863,7 +1887,7 @@ view Autres immobilisations corporelles meubles 159.0 - + @@ -1903,7 +1927,7 @@ view Immobilisation corporelles immeubles 160 - + @@ -1911,7 +1935,7 @@ view Bâtiments d'exploitation 160.0 - + @@ -1951,7 +1975,7 @@ view Usines 161.0 - + @@ -1991,7 +2015,7 @@ view Ateliers 162.0 - + @@ -2031,7 +2055,7 @@ view Entrepôts 163.0 - + @@ -2071,7 +2095,7 @@ view Bâtiments d'exposition et de vente 164.0 - + @@ -2119,7 +2143,7 @@ view Bâtiments administratifs 165.0 - + @@ -2167,7 +2191,7 @@ view Immeubles d'habitation 166.0 - + @@ -2215,7 +2239,7 @@ view Immobilisations incorporelles 170 - + @@ -2223,7 +2247,7 @@ view Brevets, know-how, recettes de fabrication 170.0 - + @@ -2263,7 +2287,7 @@ view Marques commerciales, échantillons, modèles, plans 171.0 - + @@ -2311,7 +2335,7 @@ view Droits de licences, concessions, etc. 172.0 - + @@ -2359,7 +2383,7 @@ view Droits de propriétés, d'édition, conventionnels 173.0 - + @@ -2399,7 +2423,7 @@ view Goodwill 177.0 - + @@ -2423,7 +2447,7 @@ view Autres immobilisations incorporelles 179.0 - + @@ -2463,7 +2487,7 @@ view Charges activées et comptes d'actif de corrections de valeur 18 - + @@ -2471,7 +2495,7 @@ view Charges activées et comptes d'actif de corrections de valeur 180 - + @@ -2479,7 +2503,7 @@ view Charges activées 180.0 - + @@ -2487,7 +2511,7 @@ view Frais de fondation, augmentation de capital 180.00 - + @@ -2527,7 +2551,7 @@ view Disagio s/emprunts et s/emprunts par obligations 181.00 - + @@ -2551,7 +2575,7 @@ view Frais de recherche et de développement 182.00 - + @@ -2583,7 +2607,7 @@ view Autres charges activées 184.00 - + @@ -2607,7 +2631,7 @@ view Comptes d'actif de corrections de valeur 185.0 - + @@ -2615,7 +2639,7 @@ view Capital-actions non libéré 185.00 - + @@ -2639,7 +2663,7 @@ view Actifs hors exploitation 19 - + @@ -2647,7 +2671,7 @@ view Actifs hors exploitation 190 - + @@ -2655,7 +2679,7 @@ view Liquidités et titres 190.0 - + @@ -2695,7 +2719,7 @@ view Créances à court terme 191.0 - + @@ -2719,7 +2743,7 @@ view Stocks et travaux en cours 192.0 - + @@ -2759,7 +2783,7 @@ view Actifs de régularisation 193.0 - + @@ -2775,7 +2799,7 @@ view Immobilisations financières 194.0 - + @@ -2807,7 +2831,7 @@ view Immobilisations corporelles meubles 195.0 - + @@ -2847,7 +2871,7 @@ view Immobilisations corporelles immeubles 196.0 - + @@ -2895,7 +2919,7 @@ view Immobilisations incorporelles 197.0 - + @@ -2943,7 +2967,7 @@ view Charges activées 198.0 - + @@ -2967,7 +2991,7 @@ view Passif 2 - + @@ -2975,7 +2999,7 @@ view Dettes à court terme 20 - + @@ -2983,16 +3007,15 @@ view Dettes à court terme résultant d'achats et prestations services 200 - + view - Dettes à court terme résultant d'achats et prestations services - envers des tiers (fournisseurs) + Dettes à court terme résultant d'achats et prestations services envers des tiers (fournisseurs) 200.0 - + @@ -3054,7 +3077,7 @@ view Acomptes de clients 203.0 - + @@ -3071,7 +3094,7 @@ view Dettes c/achats, prestations services stés groupe 205.0 - + @@ -3097,7 +3120,7 @@ view Dettes c/achats, prestations services actionnaires 206.0 - + @@ -3123,7 +3146,7 @@ view Dettes financières à court terme 210 - + @@ -3131,7 +3154,7 @@ view Dettes bancaires à court terme 210.0 - + @@ -3147,7 +3170,7 @@ view Dettes c/chèques postaux, sociétés de virement 211.0 - + @@ -3171,7 +3194,7 @@ view Effets à payer 212.0 - + @@ -3195,7 +3218,7 @@ view Autres dettes financières à court terme à tiers 214.0 - + @@ -3211,7 +3234,7 @@ view Dettes financières à court terme stés du groupe 215.0 - + @@ -3235,7 +3258,7 @@ view Dettes financières à court terme actionnaires 216.0 - + @@ -3259,7 +3282,7 @@ view Dettes financières à court terme fonds prévoyance 217.0 - + @@ -3275,7 +3298,7 @@ view Part à rembourser dettes financières à long terme 218.0 - + @@ -3299,7 +3322,7 @@ view Autres dettes à court terme 220 - + @@ -3307,7 +3330,7 @@ view Dettes envers des institutions publiques 220.0 - + @@ -3348,7 +3371,7 @@ view Autres dettes à court terme envers des tiers 221.0 - + @@ -3372,7 +3395,7 @@ view Dividendes et coupons d'obligations non encaissés 223.0 - + @@ -3404,7 +3427,7 @@ view Obligations à rembourser 224.0 - + @@ -3420,7 +3443,7 @@ view Autres dettes à court terme c/stés du groupe 225.0 - + @@ -3444,7 +3467,7 @@ view Autres dettes à court terme envers actionnaires 226.0 - + @@ -3468,7 +3491,7 @@ view Autres dettes à court terme c/fonds prévoyance 227.0 - + @@ -3484,7 +3507,7 @@ view Résultat à verser 229.0 - + @@ -3500,7 +3523,7 @@ view Passifs de régularisation, provisions court terme 230 - + @@ -3508,7 +3531,7 @@ view Passifs de régularisation 230.0 - + @@ -3532,7 +3555,7 @@ view Provisions à court terme c/ventes, services 233.0 - + @@ -3556,7 +3579,7 @@ view Provisions à court terme pour impôts 234.0 - + @@ -3580,7 +3603,7 @@ view Dettes à long terme 24 - + @@ -3588,7 +3611,7 @@ view Dettes financière à long terme 240 - + @@ -3596,7 +3619,7 @@ view Dettes bancaires à long terme 240.0 - + @@ -3612,7 +3635,7 @@ view Dettes résultant d'opérations de crédit-bail 242.0 - + @@ -3628,7 +3651,7 @@ view Dettes hypothécaires 244.0 - + @@ -3700,7 +3723,7 @@ view Emprunts par obligations 246.0 - + @@ -3716,7 +3739,7 @@ view Autres dettes à long terme 250 - + @@ -3724,7 +3747,7 @@ view Emprunts à long terme à des tiers 250.0 - + @@ -3740,7 +3763,7 @@ view Dettes à long terme envers des sociétés du groupe 255.0 - + @@ -3764,7 +3787,7 @@ view Dettes à long terme envers des actionnaires 256.0 - + @@ -3788,7 +3811,7 @@ view Dettes à long terme envers des institutions LPP 257.0 - + @@ -3812,7 +3835,7 @@ view Provisions à long terme 260 - + @@ -3820,7 +3843,7 @@ view Provisions réparation, assainissements, rénovation 260.0 - + @@ -3852,7 +3875,7 @@ view Provisions pour recherche et développement 261.0 - + @@ -3876,7 +3899,7 @@ view Provisions pour restructuration de l'entreprise 262.0 - + @@ -3892,7 +3915,7 @@ view Provisions résultant de ventes/prestations service 263.0 - + @@ -3908,7 +3931,7 @@ view Provisions pour impôts (long terme) 264.0 - + @@ -3924,7 +3947,7 @@ view Provisions pour la protection de l'environnement 265.0 - + @@ -3940,7 +3963,7 @@ view Provisions pour prestations en cas de vieillesse 267.0 - + @@ -3956,7 +3979,7 @@ view Autres provisions 269.0 - + @@ -3972,7 +3995,7 @@ view Dettes hors exploitation 27 - + @@ -3980,7 +4003,7 @@ view Dettes hors exploitation 270 - + @@ -3988,7 +4011,7 @@ view Dettes à court terme résultant prestations service 270.0 - + @@ -4004,7 +4027,7 @@ view Dettes financières à court terme 271.0 - + @@ -4036,7 +4059,7 @@ view Autres dettes à court terme 272.0 - + @@ -4052,7 +4075,7 @@ view Passifs de régularisation, provisions court terme 273.0 - + @@ -4076,7 +4099,7 @@ view Dettes financières à long terme 274.0 - + @@ -4100,7 +4123,7 @@ view Autres dettes à long terme 275.0 - + @@ -4132,7 +4155,7 @@ view Provisions 276.0 - + @@ -4148,7 +4171,7 @@ view Capitaux propres 28 - + @@ -4156,7 +4179,7 @@ view Capital/Privé 280 - + @@ -4164,7 +4187,7 @@ view Capital 280.0 - + @@ -4172,7 +4195,7 @@ view Capital propre des entreprises raison individuelle 280.00 - + @@ -4196,7 +4219,7 @@ view Capital propre des sociétés de personnes 281.00 - + @@ -4228,7 +4251,7 @@ view Capital social de la S.à.r.l 282.00 - + @@ -4244,7 +4267,7 @@ view Capital de la société coopérative 283.00 - + @@ -4260,7 +4283,7 @@ view Capital-actions et participation 284.00 - + @@ -4284,7 +4307,7 @@ view Privé 285.0 - + @@ -4292,7 +4315,7 @@ view Compte privé 285.00 - + @@ -4356,7 +4379,7 @@ view Comptes pour immeubles et biens-fonds privés 288.00 - + @@ -4380,7 +4403,7 @@ view Réserves, Bénéfice/Perte résultant du bilan 290 - + @@ -4388,7 +4411,7 @@ view Réserves 290.0 - + @@ -4396,7 +4419,7 @@ view Réserves légales 290.00 - + @@ -4436,7 +4459,7 @@ view Autres réserves 291.00 - + @@ -4492,7 +4515,7 @@ view Bénéfice/Perte résultant du bilan 299.0 - + @@ -4500,7 +4523,7 @@ view Bénéfice/Perte résultant du bilan 299.00 - + @@ -4524,7 +4547,7 @@ view Compte de résultat 3_9 - + @@ -4532,7 +4555,7 @@ view Chiffre d'affaires ventes, prestations services 3 - + @@ -4540,7 +4563,7 @@ view Chiffre d'affaires brut de la production vendue 30 - + @@ -4548,7 +4571,7 @@ view Caf brut de la production vendue secteur A 300 - + @@ -4596,7 +4619,7 @@ view Caf brut de la production vendue secteur B 301 - + @@ -4628,7 +4651,7 @@ view Caf brut de la production vendue secteur C 302 - + @@ -4676,7 +4699,7 @@ view Caf brut de la production livrée à des stés groupe 305 - + @@ -4692,7 +4715,7 @@ view Variations des stocks de produits en cours/finis 308 - + @@ -4708,7 +4731,7 @@ view Déductions sur le caf de la production vendue 309 - + @@ -4780,7 +4803,7 @@ view Ventes de marchandises 32 - + @@ -4788,7 +4811,7 @@ view Ventes brutes de marchandises secteur A 320 - + @@ -4820,7 +4843,7 @@ view Ventes brutes de marchandises secteur B 321 - + @@ -4852,7 +4875,7 @@ view Ventes brutes de marchandises secteur C 322 - + @@ -4900,7 +4923,7 @@ view Ventes brutes de marchandises stés groupe 325 - + @@ -4916,7 +4939,7 @@ view Déductions sur les ventes de marchandises 329 - + @@ -4988,7 +5011,7 @@ view Ventes de prestations de services 34 - + @@ -4996,7 +5019,7 @@ view Ventes brutes de prestations de service secteur A 340 - + @@ -5036,7 +5059,7 @@ view Ventes brutes de prestations de services secteur B 341 - + @@ -5060,7 +5083,7 @@ view Ventes brutes prestations de services du secteur C 342 - + @@ -5108,7 +5131,7 @@ view Ventes brutes prestations services à stés groupe 345 - + @@ -5124,7 +5147,7 @@ view Déductions s/ventes prestations de services 349 - + @@ -5196,7 +5219,7 @@ view Autres produits 36 - + @@ -5204,7 +5227,7 @@ view Autres produits c/ventes et prestations services 360 - + @@ -5260,7 +5283,7 @@ view Produits des licences, des brevets, etc. 361 - + @@ -5300,7 +5323,7 @@ view Autres produits prestations services stés groupe 365 - + @@ -5316,7 +5339,7 @@ view Produits c/mise à disposition du personnel 367 - + @@ -5332,7 +5355,7 @@ view Autres produits c/ventes et prestations services 368 - + @@ -5356,7 +5379,7 @@ view Déductions s/les autres produits 369 - + @@ -5380,7 +5403,7 @@ view Prestations propres et consommations propres 37 - + @@ -5388,7 +5411,7 @@ view Prestations propres 370 - + @@ -5428,7 +5451,7 @@ view Consommations propres pour propre production 371 - + @@ -5452,7 +5475,7 @@ view Consommations propres de marchandises 372 - + @@ -5476,7 +5499,7 @@ view Consommations propres de services 374 - + @@ -5500,7 +5523,7 @@ view Variations de stocks de produits et services 38 - + @@ -5508,7 +5531,7 @@ view Variations de stocks de produits et services 380 - + @@ -5532,7 +5555,7 @@ view Variations de stocks de services 384 - + @@ -5556,7 +5579,7 @@ view Déductions s/produits des ventes 39 - + @@ -5564,7 +5587,7 @@ view Déductions s/produits 390 - + @@ -5604,7 +5627,7 @@ view Charges de matières, marchandises et services 4 - + @@ -5612,7 +5635,7 @@ view Charges de matières 40 - + @@ -5620,7 +5643,7 @@ view Charges de matières du secteur A 400 - + @@ -5660,7 +5683,7 @@ view Charges de matières du secteur B 401 - + @@ -5716,7 +5739,7 @@ view Charges de matières du secteur C 402 - + @@ -5772,7 +5795,7 @@ view Travaux de tiers 406 - + @@ -5804,7 +5827,7 @@ view Charges directes d'achat 407 - + @@ -5836,7 +5859,7 @@ view Variations de stocks, pertes de matières 408 - + @@ -5892,7 +5915,7 @@ view Déductions obtenues s/achats de matières 409 - + @@ -5940,7 +5963,7 @@ view Charges de marchandises 42 - + @@ -5948,7 +5971,7 @@ view Charges de marchandises du secteur A 420 - + @@ -5988,7 +6011,7 @@ view Charges de marchandises du secteur B 421 - + @@ -6036,7 +6059,7 @@ view Charges directes d'achat s/marchandises 427 - + @@ -6068,7 +6091,7 @@ view Variations de stocks de marchandises, pertes 428 - + @@ -6124,7 +6147,7 @@ view Déductions obtenues s/achats liés aux marchandises 429 - + @@ -6172,7 +6195,7 @@ view Charges pour prestations de tiers (services) 44 - + @@ -6180,7 +6203,7 @@ view Charges pour prestations de services de tiers A 440 - + @@ -6220,7 +6243,7 @@ view Charges directes d'achat s/prestations de services 447 - + @@ -6252,7 +6275,7 @@ view Déductions obtenues s/achats de prestations tiers 449 - + @@ -6292,7 +6315,7 @@ view Charges d'énergie 45 - + @@ -6300,7 +6323,7 @@ view Electricité 450 - + @@ -6324,7 +6347,7 @@ view Gaz 451 - + @@ -6348,7 +6371,7 @@ view Combustibles 452 - + @@ -6372,7 +6395,7 @@ view Carburants 453 - + @@ -6404,7 +6427,7 @@ view Eau 454 - + @@ -6420,7 +6443,7 @@ view Autres charges 46 - + @@ -6428,7 +6451,7 @@ view Autres charges de matières pour la production 460 - + @@ -6444,7 +6467,7 @@ view Autres charges de marchandises 462 - + @@ -6460,7 +6483,7 @@ view Autres charges pour prestations de tiers 464 - + @@ -6476,7 +6499,7 @@ view Charges d'emballage 465 - + @@ -6492,7 +6515,7 @@ view Charges directes d'achat 47 - + @@ -6500,7 +6523,7 @@ view Charges directes d'achat 470 - + @@ -6532,7 +6555,7 @@ view Variations de stocks, pertes de matières et march. 48 - + @@ -6540,7 +6563,7 @@ view Variations de stocks des matières de production 480 - + @@ -6556,7 +6579,7 @@ view Variations de stocks de marchandises 482 - + @@ -6572,7 +6595,7 @@ view Pertes de matières et de marchandises 488 - + @@ -6596,7 +6619,7 @@ view Déductions obtenues s/charges 49 - + @@ -6604,7 +6627,7 @@ view Déductions s/charges 490 - + @@ -6652,7 +6675,7 @@ view Charges de personnel 5 - + @@ -6660,7 +6683,7 @@ view Charges de personnel de production 50 - + @@ -6668,7 +6691,7 @@ view Charges de personnel de production du secteur A 500 - + @@ -6748,7 +6771,7 @@ view Charges sociales de production 507 - + @@ -6804,7 +6827,7 @@ view Autres charges de personnel de production 508 - + @@ -6852,7 +6875,7 @@ view Prestations de travail de tiers dans la production 509 - + @@ -6876,7 +6899,7 @@ view Charges de personnel pour le commerce des march. 52 - + @@ -6884,7 +6907,7 @@ view Charges de personnel pour le commerce A 520 - + @@ -6964,7 +6987,7 @@ view Charges sociales pour le commerce des marchandises 527 - + @@ -7020,7 +7043,7 @@ view Autres charges de personnel pour le commerce march 528 - + @@ -7068,7 +7091,7 @@ view Prestations de travail de tiers dans le commerce 529 - + @@ -7084,7 +7107,7 @@ view Charges de personnel pour la fourniture 54 - + @@ -7092,7 +7115,7 @@ view Salaires pour la fourniture des prestations serv. 540 - + @@ -7172,7 +7195,7 @@ view Charges sociales pour les prestations de services 547 - + @@ -7228,7 +7251,7 @@ view Autres charges de personnel pour les prestations 548 - + @@ -7276,7 +7299,7 @@ view Prestations de tiers pour les prestations service 549 - + @@ -7292,7 +7315,7 @@ view Charges de personnel dans l'administration 56 - + @@ -7300,7 +7323,7 @@ view Salaires pour l'administration 560 - + @@ -7388,7 +7411,7 @@ view Charges sociales pour l'administration 567 - + @@ -7444,7 +7467,7 @@ view Autres charges de personnel pour l'administration 568 - + @@ -7492,7 +7515,7 @@ view Prestations de travail de tiers c/l'administration 569 - + @@ -7508,7 +7531,7 @@ view Charges sociales 57 - + @@ -7516,7 +7539,7 @@ view AVS, AI, APG, assurance-chômage 570 - + @@ -7532,7 +7555,7 @@ view Caisse de compensation familiale 571 - + @@ -7548,7 +7571,7 @@ view Prévoyance professionnelle 572 - + @@ -7564,7 +7587,7 @@ view Assurance-accidents 573 - + @@ -7580,7 +7603,7 @@ view Assurance indemnités journalières en cas maladie 574 - + @@ -7596,7 +7619,7 @@ view Impôts à la source 579 - + @@ -7612,7 +7635,7 @@ view Autres charges de personnel 58 - + @@ -7620,7 +7643,7 @@ view Recherche de personnel 580 - + @@ -7644,7 +7667,7 @@ view Formation et formation continue 581 - + @@ -7668,7 +7691,7 @@ view Indemnités effectives 582 - + @@ -7700,7 +7723,7 @@ view Indemnités forfaitaires 583 - + @@ -7732,7 +7755,7 @@ view Restaurant du personnel 584 - + @@ -7772,7 +7795,7 @@ view Autres charges de personnel 588 - + @@ -7796,7 +7819,7 @@ view Charges de personnel comme prélèvements privés 589 - + @@ -7812,7 +7835,7 @@ view Prestations de travail de tiers 59 - + @@ -7820,7 +7843,7 @@ view Prestations de travail de tiers 590 - + @@ -7844,7 +7867,7 @@ view Autres charges d'exploitation 6 - + @@ -7852,7 +7875,7 @@ view Charges de locaux 60 - + @@ -7860,7 +7883,7 @@ view Loyers pour locaux de tiers 600 - + @@ -7924,7 +7947,7 @@ view Loyers pour locaux propres 601 - + @@ -7988,7 +8011,7 @@ view Charges accessoires 603 - + @@ -8076,7 +8099,7 @@ view Charges de nettoyage 604 - + @@ -8156,7 +8179,7 @@ view Charges d'entretien des locaux 605 - + @@ -8244,7 +8267,7 @@ view Charges pour immobilisations en crédit-bail 606 - + @@ -8308,7 +8331,7 @@ view Charges de locaux comme prélèvements privés 609 - + @@ -8324,7 +8347,7 @@ view Entretien, réparations, remplacements (ERR) 61 - + @@ -8332,7 +8355,7 @@ view Entretien, réparations, remplacements (ERR) 610 - + @@ -8340,7 +8363,7 @@ view ERR d'installations de production 610.0 - + @@ -8372,7 +8395,7 @@ view ERR d'installations pour le commerce des march. 611.0 - + @@ -8396,7 +8419,7 @@ view ERR d'installations d'entreposage 612.0 - + @@ -8420,7 +8443,7 @@ view ERR d'installations de bureau 613.0 - + @@ -8444,7 +8467,7 @@ view ERR d'installations pour le personnel 614.0 - + @@ -8468,7 +8491,7 @@ view Charges c/immobi. corporelles meubles crédit-bail 616 - + @@ -8476,7 +8499,7 @@ view Charges c/immobi. corporelles meubles crédit-bail 616.0 - + @@ -8524,7 +8547,7 @@ view Charges de véhicules et de transport 62 - + @@ -8532,7 +8555,7 @@ view Charges de véhicules 620 - + @@ -8540,7 +8563,7 @@ view Réparation, service et nettoyage des véhicules 620.0 - + @@ -8604,7 +8627,7 @@ view Carburants 621.0 - + @@ -8668,7 +8691,7 @@ view Assurances 622.0 - + @@ -8732,7 +8755,7 @@ view Droits de circulation, cotisations, taxes 623.0 - + @@ -8788,7 +8811,7 @@ view Charges de location pour véhicules en crédit-bail 626.0 - + @@ -8836,7 +8859,7 @@ view Charges de véhicules comme prélèvements privés 627.0 - + @@ -8852,7 +8875,7 @@ view Charges de transport 628 - + @@ -8860,7 +8883,7 @@ view Frets, frais de transport, cargo domicile 628.0 - + @@ -8908,7 +8931,7 @@ view Assurances-choses, droits, taxes, autorisations 63 - + @@ -8916,7 +8939,7 @@ view Assurances-choses 630 - + @@ -8924,7 +8947,7 @@ view Primes d'assurance c/dommages, bris de glace, vols 630.0 - + @@ -8956,7 +8979,7 @@ view Primes d'assurance responsabilité civile /garantie 631.0 - + @@ -8988,7 +9011,7 @@ view Primes d'assurance pour arrêts d'exploitation 632.0 - + @@ -9004,7 +9027,7 @@ view Primes pour assurances liées aux crédits 633.0 - + @@ -9028,7 +9051,7 @@ view Droits, taxes, autorisations, patentes 636 - + @@ -9036,7 +9059,7 @@ view Droits et taxes 636.0 - + @@ -9060,7 +9083,7 @@ view Autorisations et patentes 637.0 - + @@ -9084,7 +9107,7 @@ view Charges d'énergie et évacuation des déchets 64 - + @@ -9092,7 +9115,7 @@ view Charges d'énergie 640 - + @@ -9100,7 +9123,7 @@ view Electricité 640.0 - + @@ -9132,7 +9155,7 @@ view Gaz 641.0 - + @@ -9156,7 +9179,7 @@ view Combustibles et matériaux de chauffage 642.0 - + @@ -9180,7 +9203,7 @@ view Eau 643.0 - + @@ -9196,7 +9219,7 @@ view Evacuation de déchets 646 - + @@ -9204,7 +9227,7 @@ view Evacuation de déchets 646.0 - + @@ -9236,7 +9259,7 @@ view Charges d'administration et d'informatique 65 - + @@ -9244,7 +9267,7 @@ view Charges d'administration 650 - + @@ -9252,7 +9275,7 @@ view Matériel de bureau, imprimés, photocopies 650.0 - + @@ -9292,7 +9315,7 @@ view Téléphone, téléfax, Internet, frais de port 651.0 - + @@ -9332,7 +9355,7 @@ view Cotisations, dons, cadeaux et pourboires 652.0 - + @@ -9364,7 +9387,7 @@ view Honoraires pour fiduciaire et conseil 653.0 - + @@ -9396,7 +9419,7 @@ view Conseil d'administration, AG, OR 654.0 - + @@ -9428,7 +9451,7 @@ view Charges d'administration comme prélèvements privés 655.0 - + @@ -9444,7 +9467,7 @@ view Informatique 656 - + @@ -9452,7 +9475,7 @@ view Locations en crédit-bail et locations de hard/soft 656.0 - + @@ -9484,7 +9507,7 @@ view Licences et entretien 657.0 - + @@ -9540,7 +9563,7 @@ view Conseils et développements 658.0 - + @@ -9588,7 +9611,7 @@ view Publicité 66 - + @@ -9596,7 +9619,7 @@ view Publicité, médias électroniques 660 - + @@ -9684,7 +9707,7 @@ view Imprimés, matériel, articles de publicité 661 - + @@ -9708,7 +9731,7 @@ view Vitrines, décoration, foires, expositions 662 - + @@ -9732,7 +9755,7 @@ view Frais de voyage, conseils à la clientèle 664 - + @@ -9764,7 +9787,7 @@ view Publicité, sponsoring 666 - + @@ -9788,7 +9811,7 @@ view Relations publiques 667 - + @@ -9820,7 +9843,7 @@ view Conseils en publicité, études de marché 668 - + @@ -9844,7 +9867,7 @@ view Autres charges d'exploitation 67 - + @@ -9852,7 +9875,7 @@ view Informations économiques, poursuites 670 - + @@ -9876,7 +9899,7 @@ view Sécurité et surveillance 671 - + @@ -9900,7 +9923,7 @@ view Recherche et développement 672 - + @@ -9924,7 +9947,7 @@ view Résultat financier 68 - + @@ -9932,7 +9955,7 @@ view Charges financières 680 - + @@ -9940,7 +9963,7 @@ view Charges financières pour financement par des tiers 680.0 - + @@ -9988,7 +10011,7 @@ view Charges financières pour financement par des stés 681.0 - + @@ -10012,7 +10035,7 @@ view Charges financières pour financement actionnaires 682.0 - + @@ -10036,7 +10059,7 @@ view Charges financières pour financement LPP 683.0 - + @@ -10052,7 +10075,7 @@ view Autres charges financières 684.0 - + @@ -10108,7 +10131,7 @@ view Produits financiers 685 - + @@ -10116,7 +10139,7 @@ view Produits financiers des liquidités et des titres 685.0 - + @@ -10164,7 +10187,7 @@ view Produits financiers c/immobilisations financières 686.0 - + @@ -10212,7 +10235,7 @@ view Produits financiers de placement auprès des stés 687.0 - + @@ -10236,7 +10259,7 @@ view Produits financiers placement auprès actionnaires 688.0 - + @@ -10260,7 +10283,7 @@ view Autres produits financiers 689.0 - + @@ -10316,7 +10339,7 @@ view Amortissement 69 - + @@ -10324,7 +10347,7 @@ view Dépréciations s/immobilisations financières 690 - + @@ -10348,7 +10371,7 @@ view Dépréciations s/participations à des stés groupe 691 - + @@ -10372,7 +10395,7 @@ view Amortissements s/immobilisations corporelles 692 - + @@ -10412,7 +10435,7 @@ view Amortissements s/immobilisations corporelles imm. 693 - + @@ -10436,7 +10459,7 @@ view Amortissements s/immobilisations incorporelles 694 - + @@ -10468,7 +10491,7 @@ view Amortissements s/charges activées 695 - + @@ -10492,7 +10515,7 @@ view Résultat des activités annexes d'exploitation 7 - + @@ -10500,7 +10523,7 @@ view Résultat des activités annexes 70 - + @@ -10508,7 +10531,7 @@ view Résultat de l'activité annexe 1 700 - + @@ -10516,7 +10539,7 @@ view Produits de l'activité annexe 1 700.0 - + @@ -10540,7 +10563,7 @@ view Charges de l'activité annexe 1 701.0 - + @@ -10628,7 +10651,7 @@ view Résultat de l'activité annexe 2 700 - + @@ -10636,7 +10659,7 @@ view Résultat de l'activité annexe 2 702.0 - + @@ -10660,7 +10683,7 @@ view Charges de l'activité annexe 2 703.0 - + @@ -10748,7 +10771,7 @@ view Résultat des placements financiers 74 - + @@ -10756,7 +10779,7 @@ view Produits de placements financiers 740.0 - + @@ -10796,7 +10819,7 @@ view Charges s/placements financiers 741.0 - + @@ -10836,7 +10859,7 @@ view Résultat d'immeuble 75 - + @@ -10844,7 +10867,7 @@ view Résultat de l'immeuble d'exploitation 1 750 - + @@ -10852,7 +10875,7 @@ view Produits de l'immeuble d'exploitation 1 750.0 - + @@ -10900,7 +10923,7 @@ view Charges de l'immeuble d'exploitation 1 751.0 - + @@ -10964,7 +10987,7 @@ view Bénéfices provenant de l'aliénation d'actifs immob 79 - + @@ -10972,7 +10995,7 @@ view Bénéfices s/immobilisations financières 790 - + @@ -11004,7 +11027,7 @@ view Bénéfices s/immobilisations corporelles meubles 791 - + @@ -11020,7 +11043,7 @@ view Bénéfice s/immobilisations corporelles immeubles 792 - + @@ -11036,7 +11059,7 @@ view Bénéfices s/immobilisations incorporelles 793 - + @@ -11052,7 +11075,7 @@ view Résultats exceptionnel et hors exploitation impôts 8 - + @@ -11060,7 +11083,7 @@ view Résultat exceptionnel 80 - + @@ -11068,7 +11091,7 @@ view Produits exceptionnels 800 - + @@ -11132,7 +11155,7 @@ view Charges exceptionnelles 801 - + @@ -11212,7 +11235,7 @@ view Résultat hors exploitation 82 - + @@ -11220,7 +11243,7 @@ view Résultat de l'activité hors exploitation 820 - + @@ -11228,7 +11251,7 @@ view Résultat de l'activité hors exploitation 1 820.0 - + @@ -11236,7 +11259,7 @@ view Produits de l'activité hors exploitation 1 820.00 - + @@ -11260,7 +11283,7 @@ view Charges de l'activité hors exploitation 1 821.00 - + @@ -11348,7 +11371,7 @@ view Résultat des placements financiers hors exploitation 840 - + @@ -11356,7 +11379,7 @@ view Produits financiers s/placements financiers hors exploitation 840.0 - + @@ -11380,7 +11403,7 @@ view Charges financières s/placements financiers hors exploitation 841.0 - + @@ -11420,7 +11443,7 @@ view Résultat de l'immeuble hors exploitation 850 - + @@ -11428,7 +11451,7 @@ view Résultat de l'immeuble hors exploitation 1 850.0 - + @@ -11436,7 +11459,7 @@ view Produits de l'immeuble hors exploitation 1 850.00 - + @@ -11476,7 +11499,7 @@ view Charges de l'immeuble hors exploitation 1 851.00 - + @@ -11540,7 +11563,7 @@ view Autres résultats hors exploitation 870 - + @@ -11548,7 +11571,7 @@ view Autres produits hors exploitation 870.0 - + @@ -11572,7 +11595,7 @@ view Autres charges hors exploitation 871.0 - + @@ -11588,7 +11611,7 @@ view Charges d'impôt 89 - + @@ -11596,7 +11619,7 @@ view Impôts directs de l'entreprise 890 - + @@ -11628,7 +11651,7 @@ view Clôture 9 - + @@ -11636,7 +11659,7 @@ view Compte de résultat 90 - + @@ -11644,7 +11667,7 @@ view Compte de résultat 900 - + @@ -11660,7 +11683,7 @@ view Bilan 91 - + @@ -11668,7 +11691,7 @@ view Bilan 910 - + @@ -11692,7 +11715,7 @@ view Utilisation du bénéfice 92 - + @@ -11700,7 +11723,7 @@ view Utilisation du bénéfice 920 - + @@ -11724,7 +11747,7 @@ view Ecriture de regroupements et de corrections 99 - + @@ -11732,7 +11755,7 @@ view Ecritures de regroupements 990 - + @@ -11756,7 +11779,7 @@ view Ecritures de corrections 991 - + @@ -11773,10 +11796,10 @@ - Swiss PCG + Plan comptable STERCHI - + diff --git a/addons/l10n_ch/sterchi_chart/fiscal_position.xml b/addons/l10n_ch/sterchi_chart/fiscal_position.xml index e6b95fb7e68..d8a70325ba5 100644 --- a/addons/l10n_ch/sterchi_chart/fiscal_position.xml +++ b/addons/l10n_ch/sterchi_chart/fiscal_position.xml @@ -1,5 +1,5 @@ - + @@ -115,4 +115,4 @@ - \ No newline at end of file + diff --git a/addons/l10n_ch/test/l10n_ch_dta.yml b/addons/l10n_ch/test/l10n_ch_dta.yml new file mode 100644 index 00000000000..8ae9e205fcc --- /dev/null +++ b/addons/l10n_ch/test/l10n_ch_dta.yml @@ -0,0 +1,221 @@ +- + In order to test DTA generation I make an invoice and create the DTA from it. +- + I create an invoice on 1st January for 7000 EUR + ########################### + # Creating 1 invoice # +########################### +- + !record {model: account.invoice, id: dta_account_invoice}: + company_id: base.main_company + journal_id: account.bank_journal + currency_id: base.EUR + account_id: account.a_pay + type : in_invoice + partner_id: base.res_partner_agrolait + address_contact_id: base.res_partner_address_8 + address_invoice_id: base.res_partner_address_8 + reference_type: bvr + reference: 111111111111111111111111111111 + date_invoice: !eval "'%s-01-01' %(datetime.now().year)" + period_id: account.period_1 + #invoice_line: + partner_bank_id: main_partner_bank + check_total : 7000 +- + I add an invoice line +- + !record {model: account.invoice.line, id: dta_invoice_line}: + account_id: account.a_expense + name: '[PC1] Basic PC' + price_unit: 700.0 + quantity: 10.0 + product_id: product.product_product_pc1 + uos_id: product.product_uom_unit + invoice_id: dta_account_invoice + + +- + I Validate invoice by clicking on Validate button +- + !workflow {model: account.invoice, action: invoice_open, ref: dta_account_invoice} + +- + I create my payment order to pay my invoice + ########################### + # Doing payment order # +########################### +- + !record {model: payment.order, id: dta_payment_order}: + #date_created + #date_done + date_prefered: due + #date_scheduled + #line_ids: + mode: l10n_ch.payment_mode_dta + #reference + state: draft + total: 7000 + #user_id +- + I add a payment line to my payment order +- + !record {model: payment.line, id: dta_pay_line}: + amount: 7000 + amount_currency: 7000 + bank_id: l10n_ch.agro_bank + #bank_statement_line_id + communication: "111111111111111111111111111111" + #communication2 + company_currency: base.EUR + #create_date + currency: base.EUR + #date + #info_owner + #info_partner + #ml_date_created + #ml_inv_ref + #ml_maturity_date + move_line_id: !ref {model: account.move.line, search: "[('ref','=','111111111111111111111111111111')]"} + #name (reference) + order_id: dta_payment_order + partner_id: base.res_partner_agrolait + state: normal + +- + I generate a DTA file by using the wizard "Create DTA" for my payment order +- + !python {model: create.dta.wizard}: | + import base64 + wiz_id = self.create(cr,uid,[]) + wiz = self.browse(cr, uid, wiz_id) + pay_order_id = ref("dta_payment_order") + #set the payment order as the active id + context['active_ids'] = [pay_order_id] + context['active_id'] = pay_order_id + result = wiz.create_dta(context=context) + assert result, "No result returned" + + data = wiz.read(['dta_file']) + dta_file = base64.decodestring(data[0]['dta_file'] or '') + assert dta_file, "File is empty" + + #check that file starts with 1st segment characters "01" + assert dta_file[:2] == "01", "File is not a DTA file" + + payment_obj = self.pool.get('payment.order') + payment_obj.set_done(cr, uid, [ref('dta_payment_order')], context) + #force state in open state (confirmed) + payment_obj.write(cr, uid, [ref('dta_payment_order')], {'state': 'open'}) + +- + I check the execution date is today +- + !assert {model: payment.order, id: dta_payment_order}: + - date_done == datetime.now().date().strftime('%Y-%m-%d') + +- + I check my payment order state is Confirmed +- + !assert {model: payment.order, id: dta_payment_order, string: state is done}: + - state == 'open' + +- + I create a Bank Statment in order to confirm the payment line +- + !record {model: account.bank.statement, id: dta_bank_statement}: + #account_id: + #balance_end: + #balance_end_cash: + #balance_end_real: + #balance_start: + #closing_date: + #company_id: + #currency: + date: !eval "'%s-01-01' %(datetime.now().year)" + #ending_details_ids: + journal_id: account.bank_journal + #line_ids: + #move_line_ids + name: "/" + period_id: account.period_1 + #starting_details_ids + state: draft + #total_entry_encoding + #user_id + +- + I import the payment line +- + !python {model: account.payment.populate.statement}: | + wiz_id = self.create(cr,uid,[]) + wiz = self.browse(cr, uid, wiz_id) + + line_obj = self.pool.get('payment.line') + pay_line_ids = line_obj.search(cr, uid, [('communication','=','111111111111111111111111111111'),('amount','=','7000')]) + + data = { 'lines': [(6, 0, [pay_line_ids[0]])],} + wiz.write(data) + + context['active_id'] = ref('dta_bank_statement') + context['active_ids'] = [ref('dta_bank_statement')] + + self.populate_statement(cr, uid, [wiz_id], context=context) + + +- + I check the statement line is created +- + !assert {model: account.bank.statement, id: dta_bank_statement, string: statement_line_ids is not empty}: + - line_ids + +- + I check the voucher line is created +- + !python {model: account.bank.statement}: | + statement = self.browse(cr, uid, ref('dta_bank_statement')) + + assert statement.line_ids[0].voucher_id.line_ids, "Voucher line is missing" + assert len(statement.line_ids[0].voucher_id.line_ids) == 1, "There are too many voucher lines" + +- + In order to confirm my bank statement, I enter the closing balance and press on compute button +- + !python {model: account.bank.statement}: | + statement = self.browse(cr, uid, ref('dta_bank_statement')) + statement.write({'balance_end_real': -7000.0}) + self.button_dummy(cr, uid, [ref('dta_bank_statement')], context=context) + statement = self.browse(cr, uid, ref('dta_bank_statement')) + +- + I confirm my bank statement +- + !python {model: account.bank.statement}: | + self.button_confirm_bank(cr, uid, [ref('dta_bank_statement')], context=context) + + +- + I check the move lines have been defined +- + !assert {model: account.bank.statement, id: dta_bank_statement, string: move_line_ids is not empty}: + - move_line_ids + + +- + I check bank statement is Closed and balance is -7000 +- + !assert {model: account.bank.statement, id: dta_bank_statement, string: state is Closed and balance is -7000}: + - state == 'confirm' + - balance_end == -7000.0 + +- + I check the residual amount of invoice, should be 0 in residual currency and 0 in amount_residual and paid +- + !python {model: account.invoice}: | + invoice_id = self.browse(cr, uid, ref("dta_account_invoice")) + move_line_obj = self.pool.get('account.move.line') + move_lines = move_line_obj.search(cr, uid, [('move_id', '=', invoice_id.move_id.id), ('invoice', '=', invoice_id.id), ('account_id', '=', invoice_id.account_id.id)]) + move_line = move_line_obj.browse(cr, uid, move_lines[0]) + assert move_line.amount_residual_currency == 0.0, "Residual amount currency is not correct : %.2f" % move_line.amount_residual_currency + assert move_line.amount_residual == 0.0 , "Residual amount of invoice is not correct : %.2f" % move_line.amount_residual + assert invoice_id.state == 'paid', "Invoice state is not Paid" \ No newline at end of file diff --git a/addons/l10n_ch/test/l10n_ch_report.yml b/addons/l10n_ch/test/l10n_ch_report.yml index a730bdc82bd..e5b570fe58f 100644 --- a/addons/l10n_ch/test/l10n_ch_report.yml +++ b/addons/l10n_ch/test/l10n_ch_report.yml @@ -1,5 +1,5 @@ - - In order to test BVR printing. I create Partner data. + In order to test BVR printing. I create Partner data . - !record {model: res.partner.category, id: res_partner_category_bvr}: name: Customers @@ -57,4 +57,4 @@ !python {model: account.invoice}: | from tools.test_reports import try_report company = self.pool.get('res.users').browse(cr, uid, uid).company_id - company.lib_path and try_report(cr, uid, 'report.invoice_web_bvr', [ref('l10n_ch_invoice')]) or 'Webkit lib not set' + company.lib_path and try_report(cr, uid, 'report.invoice_web_bvr', [ref('l10n_ch_invoice')]) or 'Webkit lib not set' \ No newline at end of file diff --git a/addons/l10n_ch/test/l10n_ch_v11.yml b/addons/l10n_ch/test/l10n_ch_v11.yml new file mode 100644 index 00000000000..f5fd0dddabb --- /dev/null +++ b/addons/l10n_ch/test/l10n_ch_v11.yml @@ -0,0 +1,161 @@ +- + In order to test the V11 import, + I will create an invoice with a specified reference that I will reconcile with the moves imported from a V11 +- + I create an invoice ref 1234567 +- + !record {model: account.invoice, id: v11_test_invoice}: + name: V11 YAML invoice + number: 1234567 + company_id: base.main_company + journal_id: account.bank_journal + currency_id: base.EUR + account_id: account.a_recv + type : out_invoice + partner_id: base.res_partner_agrolait + address_contact_id: base.res_partner_address_8 + address_invoice_id: base.res_partner_address_8 + reference_type: bvr + reference: 12345676 + date_invoice: !eval "'%s-01-01' %(datetime.now().year)" + period_id: account.period_1 + #invoice_line: + partner_bank_id: main_partner_bank + check_total : 888.00 + +- + I create an invoice line +- + !record {model: account.invoice.line, id: v11_test_invoice_line}: + account_id: account.a_expense + name: '[PC1] Basic PC' + price_unit: 888.00 + quantity: 1.0 + product_id: product.product_product_pc1 + uos_id: product.product_uom_unit + invoice_id: v11_test_invoice + +- + I Validate invoice by clicking on Validate button +- + !workflow {model: account.invoice, action: invoice_open, ref: v11_test_invoice} + +- + I specify the invoice number to fit with my v11 +- + !python {model: account.invoice}: | + invoice = self.browse(cr, uid, ref('v11_test_invoice')) + invoice.write({'number': 1234567}) + + +- + I create a bank statement +- + !record {model: account.bank.statement, id: v11_test_bank_statement}: + #account_id: + #balance_end: + #balance_end_cash: + #balance_end_real: + #balance_start: + #closing_date: + #company_id: + #currency: + date: !eval "'%s-01-01' %(datetime.now().year)" + #ending_details_ids: + journal_id: account.bank_journal + #line_ids: + #move_line_ids + name: "/" + period_id: account.period_1 + #starting_details_ids + state: draft + #total_entry_encoding + #user_id + +- + I import the V11 +- + !python {model: bvr.import.wizard}: | + import base64 + import addons + import os + + # create our wizard + wiz_id = self.create(cr,uid,[]) + wiz = self.browse(cr, uid, wiz_id) + + test_file_path = addons.get_module_resource(os.path.join('l10n_ch', 'test', 'test.v11')) + + # get our test file to test it + f_v11 = open(test_file_path) + + str64_v11 = base64.encodestring(f_v11.read()) + + wiz.write({'file': str64_v11}) + + # set the file in the wizard field + bank_statement_id = ref('v11_test_bank_statement') + + context['active_id'] = bank_statement_id + context['active_ids'] = [bank_statement_id] + # launch the import + self.import_bvr(cr, uid, [wiz_id], context=context) + + +- + I check my bank statement got a statement line +- + !assert {model: account.bank.statement, id: v11_test_bank_statement, string: statement has 1 and only 1 statement line id}: + - len(line_ids) == 1 + +- + I check the voucher linked to the statement line contains a line with an amount of 888.00 +- + !python {model: account.bank.statement}: | + statement = self.browse(cr, uid, ref('v11_test_bank_statement')) + + voucher_line_ids = statement.line_ids[0].voucher_id.line_ids + + assert voucher_line_ids, "No voucher line found" + + voucher_line_amount = voucher_line_ids[0].amount + assert voucher_line_amount == 888.00, "Amount isn't correct : %d" %(voucher_line_amount) + +- + I check amount of account voucher is equal to the bank statement line amount +- + !python {model: account.bank.statement}: | + statement = self.browse(cr, uid, ref('v11_test_bank_statement')) + + statement_line_amount = statement.line_ids[0].amount + voucher_amount = statement.line_ids[0].voucher_id.amount + + assert statement_line_amount == voucher_amount, "Mismatch of amounts" + +- + I enter the closing balance and press on compute button +- + !python {model: account.bank.statement}: | + statement = self.browse(cr, uid, ref('v11_test_bank_statement')) + statement.write({'balance_end_real': 888.00}) + self.button_dummy(cr, uid, [ref('v11_test_bank_statement')], context=context) + +- + I check that the statement Balance is 888.00 +- + !assert {model: account.bank.statement, id: v11_test_bank_statement, string: balance is 888.0}: + - balance_end == 888.0 + +- + I confirm my bank statement +- + !python {model: account.bank.statement}: | + self.button_confirm_bank(cr, uid, [ref('v11_test_bank_statement')], context=context) + +- + I check my invoice is paid, reconciled and has no residual +- + !assert {model: account.invoice, id: v11_test_invoice, string: 'invoice is paid, reconciled and has no residual'}: + - state == "paid" + - reconciled + - residual == 0.0 \ No newline at end of file diff --git a/addons/l10n_ch/test/l10n_ch_v11_part.yml b/addons/l10n_ch/test/l10n_ch_v11_part.yml new file mode 100644 index 00000000000..81f0b17f7ba --- /dev/null +++ b/addons/l10n_ch/test/l10n_ch_v11_part.yml @@ -0,0 +1,292 @@ +- + In order to test the V11 import, + I will create an invoice with a specified reference that I will partialy reconcile with a 1st V11 + And then I will complete the reconcile with a second V11 +- + I create an invoice ref 2000999 of EUR 250.00 +- + !record {model: account.invoice, id: v11_part_test_invoice}: + name: V11 YAML invoice + number: 2000999 + company_id: base.main_company + journal_id: account.bank_journal + currency_id: base.EUR + account_id: account.a_recv + type : out_invoice + partner_id: base.res_partner_agrolait + address_contact_id: base.res_partner_address_8 + address_invoice_id: base.res_partner_address_8 + reference_type: bvr + reference: 20009997 + date_invoice: !eval "'%s-01-01' %(datetime.now().year)" + period_id: account.period_1 + #invoice_line: + partner_bank_id: main_partner_bank + check_total : 250.00 + +- + I create an invoice line +- + !record {model: account.invoice.line, id: v11_part_test_invoice_line}: + account_id: account.a_expense + name: '[PC1] Basic PC' + price_unit: 250.00 + quantity: 1.0 + product_id: product.product_product_pc1 + uos_id: product.product_uom_unit + invoice_id: v11_part_test_invoice + +- + I Validate invoice by clicking on Validate button +- + !workflow {model: account.invoice, action: invoice_open, ref: v11_part_test_invoice} + +- + I specify the invoice number to fit with my v11 +- + !python {model: account.invoice}: | + invoice = self.browse(cr, uid, ref('v11_part_test_invoice')) + invoice.write({'number': 2000999}) + + +- + I create a 1st bank statement + ######################################### + # Creating 1st bank statement # +######################################### +- + !record {model: account.bank.statement, id: v11_part_test_bank_statement_1}: + #account_id: + #balance_end: + #balance_end_cash: + #balance_end_real: + #balance_start: + #closing_date: + #company_id: + #currency: + date: !eval "'%s-01-01' %(datetime.now().year)" + #ending_details_ids: + journal_id: account.bank_journal + #line_ids: + #move_line_ids + name: "/" + period_id: account.period_1 + #starting_details_ids + state: draft + #total_entry_encoding + #user_id + +- + I import the 1st V11 +- + !python {model: bvr.import.wizard}: | + import base64 + import addons + import os + + # create our wizard + wiz_id = self.create(cr,uid,[]) + wiz = self.browse(cr, uid, wiz_id) + + test_file_path = addons.get_module_resource(os.path.join('l10n_ch', 'test', 'test_part_1.v11')) + + # get our test file to test it + f_v11 = open(test_file_path) + + str64_v11 = base64.encodestring(f_v11.read()) + + wiz.write({'file': str64_v11}) + + # set the file in the wizard field + bank_statement_id = ref('v11_part_test_bank_statement_1') + + context['active_id'] = bank_statement_id + context['active_ids'] = [bank_statement_id] + # launch the import + self.import_bvr(cr, uid, [wiz_id], context=context) + + +- + I check my bank statement got a statement line +- + !assert {model: account.bank.statement, id: v11_part_test_bank_statement_1, string: statement has 1 and only 1 statement line id}: + - len(line_ids) == 1 + +- + I check the voucher linked to the statement line contains a line with an amount of EUR 150.00 +- + !python {model: account.bank.statement}: | + statement = self.browse(cr, uid, ref('v11_part_test_bank_statement_1')) + + voucher_line_ids = statement.line_ids[0].voucher_id.line_ids + + assert voucher_line_ids, "No voucher line found" + + voucher_line_amount = voucher_line_ids[0].amount + assert voucher_line_amount == 150.00, "Amount isn't correct : %d" %(voucher_line_amount) + +- + I check amount of account voucher is equal to the bank statement line amount +- + !python {model: account.bank.statement}: | + statement = self.browse(cr, uid, ref('v11_part_test_bank_statement_1')) + + statement_line_amount = statement.line_ids[0].amount + voucher_amount = statement.line_ids[0].voucher_id.amount + + assert statement_line_amount == voucher_amount, "Mismatch of amounts" + +- + I enter the closing balance and press on compute button +- + !python {model: account.bank.statement}: | + statement = self.browse(cr, uid, ref('v11_part_test_bank_statement_1')) + statement.write({'balance_end_real': 150.00}) + self.button_dummy(cr, uid, [ref('v11_part_test_bank_statement_1')], context=context) + +- + I check that the statement Balance is EUR 150.00 +- + !assert {model: account.bank.statement, id: v11_part_test_bank_statement_1, string: balance is 150.0}: + - balance_end == 150.0 + +- + I confirm my 1st bank statement +- + !python {model: account.bank.statement}: | + self.button_confirm_bank(cr, uid, [ref('v11_part_test_bank_statement_1')], context=context) + + +- + I check that my invoice is partially paid in open state, not reconciled, with a residual amount of EUR 100.0 + ######################################### + # Checking partial result # +######################################### +- + !assert {model: account.invoice, id: v11_part_test_invoice, string: 'invoice is open, reconciled and has no residual'}: + - state == "open" + - not reconciled + - residual == 100.0 + + + +- + I create a 2nd bank statement + ######################################### + # Creating 2nd bank statement # +######################################### +- + !record {model: account.bank.statement, id: v11_part_test_bank_statement_2}: + #account_id: + #balance_end: + #balance_end_cash: + #balance_end_real: + #balance_start: + #closing_date: + #company_id: + #currency: + date: !eval "'%s-01-01' %(datetime.now().year)" + #ending_details_ids: + journal_id: account.bank_journal + #line_ids: + #move_line_ids + name: "/" + period_id: account.period_1 + #starting_details_ids + state: draft + #total_entry_encoding + #user_id + +- + I import the 2nd V11 +- + !python {model: bvr.import.wizard}: | + import base64 + import addons + import os + + # create our wizard + wiz_id = self.create(cr,uid,[]) + wiz = self.browse(cr, uid, wiz_id) + + test_file_path = addons.get_module_resource(os.path.join('l10n_ch', 'test', 'test_part_2.v11')) + + # get our test file to test it + f_v11 = open(test_file_path) + + str64_v11 = base64.encodestring(f_v11.read()) + + wiz.write({'file': str64_v11}) + + # set the file in the wizard field + bank_statement_id = ref('v11_part_test_bank_statement_2') + + context['active_id'] = bank_statement_id + context['active_ids'] = [bank_statement_id] + # launch the import + self.import_bvr(cr, uid, [wiz_id], context=context) + + +- + I check my bank statement got a statement line +- + !assert {model: account.bank.statement, id: v11_part_test_bank_statement_2, string: statement has 1 and only 1 statement line id}: + - len(line_ids) == 1 + +- + I check the voucher linked to the statement line contains a line with an amount of EUR 100.00 +- + !python {model: account.bank.statement}: | + statement = self.browse(cr, uid, ref('v11_part_test_bank_statement_2')) + + voucher_line_ids = statement.line_ids[0].voucher_id.line_ids + + assert voucher_line_ids, "No voucher line found" + + voucher_line_amount = voucher_line_ids[0].amount + assert voucher_line_amount == 100.00, "Amount isn't correct : %d" %(voucher_line_amount) + +- + I check amount of account voucher is equal to the bank statement line amount +- + !python {model: account.bank.statement}: | + statement = self.browse(cr, uid, ref('v11_part_test_bank_statement_2')) + + statement_line_amount = statement.line_ids[0].amount + voucher_amount = statement.line_ids[0].voucher_id.amount + + assert statement_line_amount == voucher_amount, "Mismatch of amounts" + + +- + I enter the closing balance and press on compute button +- + !python {model: account.bank.statement}: | + statement = self.browse(cr, uid, ref('v11_part_test_bank_statement_2')) + statement.write({'balance_end_real': 100.00}) + self.button_dummy(cr, uid, [ref('v11_part_test_bank_statement_2')], context=context) + +- + I check that the statement Balance is EUR 100.00 +- + !assert {model: account.bank.statement, id: v11_part_test_bank_statement_2, string: balance is 100.0}: + - balance_end == 100.0 + +- + I confirm my 2nd bank statement +- + !python {model: account.bank.statement}: | + self.button_confirm_bank(cr, uid, [ref('v11_part_test_bank_statement_2')], context=context) + + + +- + I check my invoice is paid, reconciled and has no residual + ######################################### + # Checking finale state # +######################################### +- + !assert {model: account.invoice, id: v11_part_test_invoice, string: 'invoice is paid, reconciled and has no residual'}: + - state == "paid" + - reconciled + - residual == 0.0 \ No newline at end of file diff --git a/addons/l10n_ch/test/test.v11 b/addons/l10n_ch/test/test.v11 new file mode 100755 index 00000000000..74f3e3217e7 --- /dev/null +++ b/addons/l10n_ch/test/test.v11 @@ -0,0 +1,2 @@ +00201012162700000000000000000001234567600000888000001 000111010111010111010100000000010000000000000 +999010121627999999999999999999999999999000000088800000000000001110102000000000000000000 diff --git a/addons/l10n_ch/test/test_part_1.v11 b/addons/l10n_ch/test/test_part_1.v11 new file mode 100755 index 00000000000..0d20a3e631a --- /dev/null +++ b/addons/l10n_ch/test/test_part_1.v11 @@ -0,0 +1,2 @@ +00201012162700000000000000000002000999700000150000001 000111010111010111010100000000010000000000000 +999010121627999999999999999999999999999000000015000000000000001110102000000000000000000 diff --git a/addons/l10n_ch/test/test_part_2.v11 b/addons/l10n_ch/test/test_part_2.v11 new file mode 100755 index 00000000000..6a336dbd91e --- /dev/null +++ b/addons/l10n_ch/test/test_part_2.v11 @@ -0,0 +1,2 @@ +00201012162700000000000000000002000999700000100000001 000111010511010511010500000000010000000000000 +999010121627999999999999999999999999999000000010000000000000001110106000000000000000000 diff --git a/addons/l10n_ch/wizard.xml b/addons/l10n_ch/wizard.xml index 531202cc05d..084159aa36d 100644 --- a/addons/l10n_ch/wizard.xml +++ b/addons/l10n_ch/wizard.xml @@ -7,7 +7,6 @@ Accounts/Generate Chart of Accounts from a Chart Template. 4 - automatic diff --git a/addons/l10n_ch/wizard/__init__.py b/addons/l10n_ch/wizard/__init__.py index b8530855159..aa1d22666b6 100644 --- a/addons/l10n_ch/wizard/__init__.py +++ b/addons/l10n_ch/wizard/__init__.py @@ -19,7 +19,8 @@ # ############################################################################## -import create_dta -import bvr_import +from . import create_dta +from . import bvr_import +from . import unicode2ascii # 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 5fb7bda2a12..85ae375060d 100644 --- a/addons/l10n_ch/wizard/bvr_import.py +++ b/addons/l10n_ch/wizard/bvr_import.py @@ -36,7 +36,9 @@ def _reconstruct_invoice_ref(cursor, user, reference, context=None): user_current=user_obj.browse(cursor, user, user) ## - cursor.execute("SELECT inv.id,inv.number from account_invoice AS inv where inv.company_id = %s" ,(user_current.company_id.id,)) + cursor.execute("SELECT inv.id,inv.number from account_invoice " + "AS inv where inv.company_id = %s and type='out_invoice'", + (user_current.company_id.id,)) result_invoice = cursor.fetchall() REF = re.compile('[^0-9]') for inv_id,inv_name in result_invoice: @@ -60,7 +62,6 @@ def _reconstruct_invoice_ref(cursor, user, reference, context=None): def _import(self, cursor, user, data, context=None): statement_line_obj = self.pool.get('account.bank.statement.line') -# statement_reconcile_obj = pool.get('account.bank.statement.reconcile') voucher_obj = self.pool.get('account.voucher') voucher_line_obj = self.pool.get('account.voucher.line') move_line_obj = self.pool.get('account.move.line') @@ -167,7 +168,7 @@ def _import(self, cursor, user, data, context=None): # line2reconcile = line.id account_id = line.account_id.id break - result = voucher_obj.onchange_partner_id(cursor, user, [], partner_id, journal_id=statement.journal_id.id, price=abs(record['amount']), currency_id= statement.currency.id, ttype='receipt', date=statement.date ,context=context) + result = voucher_obj.onchange_partner_id(cursor, user, [], partner_id, journal_id=statement.journal_id.id, price=abs(record['amount']), voucher_currency_id= statement.currency.id, ttype='receipt', date=statement.date ,context=context) voucher_res = { 'type': 'receipt' , 'name': values['name'], @@ -191,8 +192,8 @@ def _import(self, cursor, user, data, context=None): voucher_line_dict = line_dict if voucher_line_dict: voucher_line_dict.update({'voucher_id':voucher_id}) - voucher_line_obj.create(cursor, user, voucher_line_dict, context=context) - + voucher_line_obj.create(cursor, user, voucher_line_dict, context=context) + if not account_id: if record['amount'] >= 0: account_id = account_receivable @@ -204,10 +205,10 @@ def _import(self, cursor, user, data, context=None): if record['amount'] < 0: name = "property_account_payable" prop = property_obj.search( - cursor, + cursor, user, [ - ('name','=','property_account_receivable'), + ('name','=',name), ('company_id','=',statement.company_id.id), ('res_id', '=', False) ] @@ -226,9 +227,9 @@ def _import(self, cursor, user, data, context=None): values['partner_id'] = partner_id statement_line_obj.create(cursor, user, values, context=context) attachment_obj.create(cursor, user, { - 'name': 'BVR', + 'name': 'BVR %s'%time.strftime("%Y-%m-%d_%H:%M:%S", time.gmtime()), 'datas': file, - 'datas_fname': 'BVR.txt', + 'datas_fname': 'BVR %s.txt'%time.strftime("%Y-%m-%d_%H:%M:%S", time.gmtime()), 'res_model': 'account.bank.statement', 'res_id': statement_id, }, context=context) diff --git a/addons/l10n_ch/wizard/create_dta.py b/addons/l10n_ch/wizard/create_dta.py index add32f26e01..7abb1d7ca7c 100644 --- a/addons/l10n_ch/wizard/create_dta.py +++ b/addons/l10n_ch/wizard/create_dta.py @@ -26,6 +26,7 @@ import base64 from osv import osv, fields import pooler from tools.translate import _ +import unicode2ascii TRANS=[ (u'é','e'), @@ -38,6 +39,24 @@ TRANS=[ (u'ä','a'), ] +def _u2a(text) : + """Tries to convert unicode charactere to asci equivalence""" + if not text : return "" + txt = "" + for c in text: + if ord(c) < 128 : + txt += c + elif c in unicode2ascii.EXTRA_LATIN_NAMES : + txt += unicode2ascii.EXTRA_LATIN_NAMES[c] + elif c in unicode2ascii.UNI2ASCII_CONVERSIONS : + txt += unicode2ascii.UNI2ASCII_CONVERSIONS[c] + elif c in unicode2ascii.EXTRA_CHARACTERS : + txt += unicode2ascii.EXTRA_CHARACTERS[c] + elif c in unicode2ascii.FG_HACKS : + txt += unicode2ascii.FG_HACKS[c] + else : txt+= "_" + return txt + def tr(string_in): try: string_in= string_in.decode('utf-8') @@ -339,7 +358,9 @@ def _create_dta(obj, cr, uid, data, context=None): if context is None: context = {} payment = payment_obj.browse(cr, uid, data['id'], context=context) - + # if payment.state != 'done': + # raise osv.except_osv(_('Order not confirmed'), + # _('Please confirm it')) if not payment.mode: raise osv.except_osv(_('Error'), _('No payment mode')) @@ -365,11 +386,13 @@ def _create_dta(obj, cr, uid, data, context=None): v['comp_name'] = co_addr.name v['comp_dta'] = bank.dta_code or '' #XXX not mandatory in pratice - v['comp_bank_number'] = bank.acc_number or '' - if bank.iban: - v['comp_bank_iban'] = bank.iban.replace(' ','') or '' - else: - v['comp_bank_iban'] = '' + # iban and account number are the same field and depends only on the type of account + v['comp_bank_iban'] = v['comp_bank_number'] = bank.acc_number or '' + + #if bank.iban: + # v['comp_bank_iban'] = bank.iban.replace(' ','') or '' + #else: + # v['comp_bank_iban'] = '' if not v['comp_bank_iban']: raise osv.except_osv(_('Error'), _('No IBAN for the company bank account.')) @@ -403,7 +426,7 @@ def _create_dta(obj, cr, uid, data, context=None): 'on the partner: %s\n' \ 'on line: %s') % (pline.bank_id.state, pline.partner_id.name, pline.name)) - v['partner_bank_iban'] = pline.bank_id.iban or False + v['partner_bank_iban'] = pline.bank_id.acc_number or False v['partner_bank_number'] = pline.bank_id.acc_number \ and pline.bank_id.acc_number.replace('.','').replace('-','') \ or False @@ -468,7 +491,7 @@ def _create_dta(obj, cr, uid, data, context=None): # si payment structure -> bvr (826) # si non -> (827) - if elec_pay == 'dta_iban': + if elec_pay == 'iban': # If iban => country=country code for space reason v['comp_country'] = co_addr.country_id and co_addr.country_id.code+'-' or '' record_type = record_gt836 @@ -512,13 +535,10 @@ def _create_dta(obj, cr, uid, data, context=None): elif elec_pay == 'bvbank': if not v['partner_bank_number'] : - if v['partner_bank_iban'] : - v['partner_bank_number']= v['partner_bank_iban'] - else: - raise osv.except_osv(_('Error'), _('You must provide ' \ - 'a bank number \n' \ - 'for the partner bank: %s\n' \ - 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] , pline.name)) + raise osv.except_osv(_('Error'), _('You must provide ' \ + 'a bank number \n' \ + 'for the partner bank: %s\n' \ + 'on line: %s') % (res_partner_bank_obj.name_get(cr, uid, [pline.bank_id.id], context)[0][1] , pline.name)) if not v['partner_bank_clearing']: raise osv.except_osv(_('Error'), _('You must provide ' \ 'a Clearing Number\n' \ @@ -551,17 +571,17 @@ def _create_dta(obj, cr, uid, data, context=None): v['sequence'] = str(seq).rjust(5).replace(' ','0') if dta : dta = dta + record_gt890(v).generate() - + dta_data = _u2a(dta) dta_data = base64.encodestring(dta) payment_obj.set_done(cr, uid, [data['id']], context) attachment_obj.create(cr, uid, { - 'name': 'DTA', + 'name': 'DTA%s'%time.strftime("%Y-%m-%d_%H:%M:%S", time.gmtime()), 'datas': dta_data, - 'datas_fname': 'DTA.txt', + 'datas_fname': 'DTA%s.txt'%time.strftime("%Y-%m-%d_%H:%M:%S", time.gmtime()), 'res_model': 'payment.order', 'res_id': data['id'], }, context=context) - return {'dta': dta_data} + return dta_data class create_dta_wizard(osv.osv_memory): _name="create.dta.wizard" @@ -572,6 +592,11 @@ class create_dta_wizard(osv.osv_memory): def create_dta(self, cr, uid, ids, context=None): if not context: context = {} + if isinstance(ids, list): + req_id = ids[0] + else: + req_id = ids + current = self.browse(cr, uid, req_id, context) data = {} active_ids = context.get('active_ids', []) active_id = context.get('active_id', []) @@ -579,26 +604,9 @@ class create_dta_wizard(osv.osv_memory): data['ids'] = active_ids data['id'] = active_id dta_file = _create_dta(self, cr, uid, data, context) - context.update({'dta_file':dta_file}) - return self.save_dta(cr, uid, ids, context) - - def save_dta(self, cr, uid, ids, context=None): - obj_model = self.pool.get('ir.model.data') - if context is None: - context = {} - model_data_ids = obj_model.search(cr,uid,[('model','=','ir.ui.view'), ('name','=','dta_save_view')]) - resource_id = obj_model.read(cr, uid, model_data_ids, fields=['res_id'])[0]['res_id'] - return { - 'view_type': 'form', - 'view_mode': 'form', - 'res_model': 'create.dta.wizard', - 'views': [(resource_id, 'form')], - 'type': 'ir.actions.act_window', - 'target': 'new', - 'context': context, - } - + current.write({'dta_file': dta_file}) + return True create_dta_wizard() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_ch/wizard/create_dta_view.xml b/addons/l10n_ch/wizard/create_dta_view.xml index 6a0732c56e9..3f466f1da7a 100644 --- a/addons/l10n_ch/wizard/create_dta_view.xml +++ b/addons/l10n_ch/wizard/create_dta_view.xml @@ -10,6 +10,7 @@
+