From 4b61fc1a7dc8292709e4c2a8d9c248d4404a9ad3 Mon Sep 17 00:00:00 2001 From: "mra (Open ERP)" Date: Fri, 2 Apr 2010 17:14:59 +0530 Subject: [PATCH] [IMP] l10n_BE: Improve and clean bzr revid: mra@tinyerp.com-20100402114459-48rcp0jz7grm05rv --- addons/l10n_be/__init__.py | 6 ++-- addons/l10n_be/__terp__.py | 17 +++++------ addons/l10n_be/wizard/__init__.py | 1 - .../wizard/l10_be_partner_vat_listing.py | 29 +++++++++---------- .../wizard/l10n_be_account_vat_declaration.py | 12 ++++---- .../l10n_be_account_vat_declaration_view.xml | 12 ++++---- .../wizard/l10n_be_partner_vat_listing.xml | 16 +++++----- addons/l10n_be/wizard/l10n_be_vat_intra.py | 5 ++-- .../l10n_be/wizard/l10n_be_vat_intra_view.xml | 19 ++++++------ 9 files changed, 55 insertions(+), 62 deletions(-) diff --git a/addons/l10n_be/__init__.py b/addons/l10n_be/__init__.py index 444b6e3c625..1b2677d295e 100644 --- a/addons/l10n_be/__init__.py +++ b/addons/l10n_be/__init__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,11 +15,11 @@ # 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 . +# along with this program. If not, see . # ############################################################################## import company import wizard -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/l10n_be/__terp__.py b/addons/l10n_be/__terp__.py index d8f2c22b78a..6c13990fc45 100644 --- a/addons/l10n_be/__terp__.py +++ b/addons/l10n_be/__terp__.py @@ -18,10 +18,7 @@ # along with this program. If not, see . # ############################################################################## - - -{ - 'name': 'Belgium - Plan Comptable Minimum Normalise', +{ 'name': 'Belgium - Plan Comptable Minimum Normalise', 'version': '1.1', 'category': 'Localisation/Account Charts', 'description': """ @@ -34,8 +31,12 @@ * This is the same wizard that runs from Financial Management/Configuration/Financial Accounting/Financial Accounts/Generate Chart of Accounts from a Chart Template. Wizards provided by this module: - * Enlist the partners with their related VAT and invoiced amounts.Prepares an XML file format.Path to access : Financial Management/Reporting/Listing of VAT Customers. - * Prepares an XML file for Vat Declaration of the Main company of the User currently Logged in.Path to access : Financial Management/Reporting/Listing of VAT Customers. + * Partner VAT Intra: Enlist the partners with their related VAT and invoiced amounts.Prepares an XML file format. + Path to access : Financial Management/Reporting//Legal Statements/Belgium Statements/Partner VAT Listing + * Periodical VAT Declaration: Prepares an XML file for Vat Declaration of the Main company of the User currently Logged in. + Path to access : Financial Management/Reporting/Legal Statements/Belgium Statements/Periodical VAT Declaration + * Annual Listing Of VAT-Subjected Customers: Prepares an XML file for Vat Declaration of the Main company of the User currently Logged in.Based on Fiscal year + Path to access : Financial Management/Reporting/Legal Statements/Belgium Statements/Annual Listing Of VAT-Subjected Customers """, 'author': 'Tiny', @@ -57,9 +58,7 @@ 'fiscal_templates.xml', 'security/ir.model.access.csv' ], - 'demo_xml': [ - 'account.report.report.csv' - ], + 'demo_xml': ['account.report.report.csv'], 'installable': True, 'certificate': '0031977724637', } diff --git a/addons/l10n_be/wizard/__init__.py b/addons/l10n_be/wizard/__init__.py index 9db9b1ec853..2e09bbb17db 100644 --- a/addons/l10n_be/wizard/__init__.py +++ b/addons/l10n_be/wizard/__init__.py @@ -23,5 +23,4 @@ import l10_be_partner_vat_listing import l10n_be_vat_intra import l10n_be_account_vat_declaration - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_be/wizard/l10_be_partner_vat_listing.py b/addons/l10n_be/wizard/l10_be_partner_vat_listing.py index ecec9369ede..049a625830b 100644 --- a/addons/l10n_be/wizard/l10_be_partner_vat_listing.py +++ b/addons/l10n_be/wizard/l10_be_partner_vat_listing.py @@ -21,9 +21,7 @@ # along with this program. If not, see . # ############################################################################## - import time -import datetime import base64 from tools.translate import _ @@ -38,7 +36,7 @@ class vat_listing_clients(osv.osv_memory): 'country': fields.char('Country', size=64), 'amount': fields.float('Amount'), 'turnover': fields.float('Turnover'), - } + } vat_listing_clients() @@ -53,9 +51,9 @@ class partner_vat(osv.osv_memory): obj_model_data = self.pool.get('ir.model.data') data = self.read(cursor, user, ids)[0] period = obj_period.search(cursor, user, [('fiscalyear_id', '=', data['fyear'])], context=context) - p_id_list = obj_partner.search(cursor, user, [('vat_subjected','!=',False)], context=context) + p_id_list = obj_partner.search(cursor, user, [('vat_subjected', '!=', False)], context=context) if not p_id_list: - raise osv.except_osv(_('Data Insufficient!'),_('No partner has a VAT Number asociated with him.')) + raise osv.except_osv(_('Data Insufficient!'), _('No partner has a VAT Number asociated with him.')) partners = [] records = [] for obj_partner in obj_partner.browse(cursor, user, p_id_list, context=context): @@ -99,7 +97,7 @@ class partner_vat(osv.osv_memory): record['turnover'] = 0 record['name'] = obj_partner.name for item in line_info: - if item[0]=='produit': + if item[0] == 'produit': record['turnover'] += item[1] else: record['amount'] += item[1] @@ -140,9 +138,13 @@ class partner_vat_list(osv.osv_memory): 'file_save' : fields.binary('Save File', readonly=True), } - def get_partners(self, cursor, user, context={}): + def _get_partners(self, cursor, user, context={}): return context.get('partner_ids', []) + _defaults={ + 'partner_ids': _get_partners + } + def create_xml(self, cursor, user, ids, context={}): datas=[] obj_sequence = self.pool.get('ir.sequence') @@ -197,10 +199,10 @@ class partner_vat_list(osv.osv_memory): else: client_data = obj_vat_lclient.read(cursor, user, partner, context=context) datas.append(client_data) - seq=0 - data_clientinfo='' - sum_tax=0.00 - sum_turnover=0.00 + seq = 0 + data_clientinfo = '' + sum_tax = 0.00 + sum_turnover = 0.00 if len(error_message): msg ='Exception : \n' +'-'*50+'\n'+ '\n'.join(error_message) return msg @@ -218,14 +220,9 @@ class partner_vat_list(osv.osv_memory): data_file += tools.ustr(data_decl) + tools.ustr(data_comp) + tools.ustr(data_period) + tools.ustr(data_clientinfo) + '\n' msg = 'Save the File with '".xml"' extension.' file_save = base64.encodestring(data_file.encode('utf8')) - self.write(cursor, user, ids, {'file_save':file_save, 'msg':msg, 'name':'vat_list.xml'}, context=context) return True - _defaults={ - 'partner_ids': get_partners - } - partner_vat_list() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py b/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py index 87bfbf525c5..9dd5ea5b269 100644 --- a/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py +++ b/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py @@ -18,15 +18,13 @@ # along with this program. If not, see . # ############################################################################## -import time -import datetime import base64 from osv import osv, fields from tools.translate import _ class l10n_be_vat_declaration(osv.osv_memory): - """ Vat Declaration """ + """ Periodical VAT Declaration """ _name = "l1on_be.vat.declaration" _description = "Vat Declaration" @@ -38,7 +36,7 @@ class l10n_be_vat_declaration(osv.osv_memory): _defaults = { 'msg': lambda *a:'''Save the File with '".xml"' extension.''', - } + } def create_xml(self, cr, uid, ids, context={}): obj_fyear = self.pool.get('account.fiscalyear') @@ -87,9 +85,9 @@ class l10n_be_vat_declaration(osv.osv_memory): #starting month and ending month of selected period are not the same #it means that the accounting isn't based on periods of 1 month but on quarters quarter = str(((int(starting_month) - 1) / 3) + 1) - data_of_file += ''+quarter+'\n\t\t\t' + data_of_file += '' + quarter + '\n\t\t\t' else: - data_of_file += ''+starting_month+'\n\t\t\t' + data_of_file += '' + starting_month + '\n\t\t\t' data_of_file += '' + str(account_period.date_stop[:4]) + '\n\t\t\n\t\t' data_of_file +='\n\t\t\n\t\t\t' @@ -98,7 +96,7 @@ class l10n_be_vat_declaration(osv.osv_memory): if item['code'] == '71-72': item['code'] = '71' if item['code'] in list_of_tags: - data_of_file +='\n\t\t\t\t' + str(int(item['sum_period']*100)) + '' + data_of_file +='\n\t\t\t\t' + str(int(item['sum_period']*100)) + '' data_of_file +='\n\t\t\t\n\t\t\n\t\n' data['file_save'] = base64.encodestring(data_of_file) diff --git a/addons/l10n_be/wizard/l10n_be_account_vat_declaration_view.xml b/addons/l10n_be/wizard/l10n_be_account_vat_declaration_view.xml index 1c3ae12ca06..56f8b6477f9 100644 --- a/addons/l10n_be/wizard/l10n_be_account_vat_declaration_view.xml +++ b/addons/l10n_be/wizard/l10n_be_account_vat_declaration_view.xml @@ -3,9 +3,9 @@ + id="menu_finance_belgian_statement" + name="Belgium Statements" + parent="account.menu_finance_legal_statement"/> Select Period @@ -13,9 +13,9 @@ form
- - -