diff --git a/addons/l10n_be/__init__.py b/addons/l10n_be/__init__.py index f5dd0969f16..c652b702c26 100644 --- a/addons/l10n_be/__init__.py +++ b/addons/l10n_be/__init__.py @@ -20,6 +20,7 @@ # ############################################################################## +import company import wizard # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_be/company.py b/addons/l10n_be/company.py new file mode 100644 index 00000000000..3538f6e0dfd --- /dev/null +++ b/addons/l10n_be/company.py @@ -0,0 +1,43 @@ +# -*- encoding: utf-8 -*- +############################################################################## +# +# OpenERP, Open Source Management Solution +# Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved +# $Id$ +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +############################################################################## + +from osv import osv + +class res_company(osv.osv): + _inherit = "res.company" + _description = 'res.company' + + + def _get_default_ad(self, addresses): + city = post_code = address = "" + for ads in addresses: + if ads.type == 'default': + city = ads.city + post_code = ads.zip + if ads.street: + address = ads.street + if ads.street2: + address += " " + ads.street2 + return city, post_code, address +res_company() + +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_be/wizard/account_vat_declaration.py b/addons/l10n_be/wizard/account_vat_declaration.py index 1dfd85aa52f..a6123d7c5c7 100644 --- a/addons/l10n_be/wizard/account_vat_declaration.py +++ b/addons/l10n_be/wizard/account_vat_declaration.py @@ -25,6 +25,8 @@ import datetime import pooler import base64 +from tools.translate import _ + form_fyear = """
@@ -48,6 +50,7 @@ fields = { 'readonly': True,}, } + class wizard_vat_declaration(wizard.interface): def _create_xml(self, cr, uid, data, context): @@ -58,7 +61,7 @@ class wizard_vat_declaration(wizard.interface): user_cmpny = obj_company.name vat_no=obj_company.partner_id.vat if not vat_no: - raise wizard.except_wizard('Data Insufficient','No VAT Number Associated with Main Company!') + raise wizard.except_wizard(_('Data Insufficient'),_('No VAT Number Associated with Main Company!')) tax_ids = pool_obj.get('account.tax.code').search(cr,uid,[]) ctx = context.copy() @@ -69,30 +72,33 @@ class wizard_vat_declaration(wizard.interface): if not obj_company.partner_id.address: address=post_code=city='' - for ads in obj_company.partner_id.address: - if ads.type=='default': - if ads.zip_id: - city=ads.zip_id.city - post_code=ads.zip_id.name - if ads.street: - address=ads.street - if ads.street2: - address +=ads.street2 + city, post_code, address = pooler.get_pool(cr.dbname).get('res.company')._get_default_ad(obj_company.partner_id.address) obj_fyear = pool_obj.get('account.fiscalyear') year_id = obj_fyear.find(cr, uid) current_year = obj_fyear.browse(cr,uid,year_id).name - month=time.strftime('%m') period_code = pool_obj.get('account.period').browse(cr, uid, data['form']['period']).code + send_ref = user_cmpny if period_code: send_ref = send_ref + period_code data_of_file='\n' - data_of_file +='\n\t\n\t\t'+str(vat_no)+'\n\t\t'+str(obj_company.name)+'\n\t\t
'+str(address)+'
' - data_of_file +='\n\t\t'+str(post_code)+'\n\t\t'+str(city)+'\n\t\t'+send_ref+'\n\t
' - data_of_file +='\n\t\n\t\t1\n\t\t'+str(vat_no)+'\n\t\t\n\t\t\t'+str(month)+'\n\t\t\t'+str(current_year[-4:])+'\n\t\t\n\t\t' + data_of_file +='\n\t\n\t\t'+str(vat_no)+'\n\t\t'+str(obj_company.name)+'\n\t\t
'+address+'
' + data_of_file +='\n\t\t'+post_code+'\n\t\t'+city+'\n\t\t'+send_ref+'\n\t
' + data_of_file +='\n\t\n\t\t1\n\t\t'+str(vat_no)+'\n\t\t\n\t\t\t' + + starting_month = pool_obj.get('account.period').browse(cr, uid, data['form']['period']).date_start[5:7] + ending_month = pool_obj.get('account.period').browse(cr, uid, data['form']['period']).date_stop[5:7] + if starting_month != ending_month: + #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' + else: + data_of_file += ''+starting_month+'\n\t\t\t' + data_of_file += ''+str(current_year[-4:])+'\n\t\t\n\t\t' data_of_file +='\n\t\t\n\t\t\t' for item in tax_info: diff --git a/addons/l10n_be/wizard/partner_vat_listing.py b/addons/l10n_be/wizard/partner_vat_listing.py index cac723612ae..e259d194608 100644 --- a/addons/l10n_be/wizard/partner_vat_listing.py +++ b/addons/l10n_be/wizard/partner_vat_listing.py @@ -76,8 +76,7 @@ class wizard_vat(wizard.interface): # obj_company=pooler.get_pool(cr.dbname).get('res.company').browse(cr,uid,1) # vat_company=obj_company.partner_id.vat -#TODO: can be improved if we replace this test => add a new field on res_partner for cases when a partner has a number and is not subjected to the VAT... have to see if this situation could happen - p_id_list=pooler.get_pool(cr.dbname).get('res.partner').search(cr,uid,[('vat','!=',False)]) + p_id_list=pooler.get_pool(cr.dbname).get('res.partner').search(cr,uid,[('vat_subjected','!=',False)]) if not p_id_list: raise wizard.except_wizard('Data Insufficient!','No partner has a VAT Number asociated with him.')