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 03fff730bb4..38a711f995b 100644 --- a/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py +++ b/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py @@ -3,6 +3,11 @@ # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). +# +# Adapted by Noviat to +# - enforce correct vat number +# - support negative balance +# - support Noviat tax code scheme # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public License as @@ -58,13 +63,13 @@ class l10n_be_vat_declaration(osv.osv_memory): if context is None: context = {} - list_of_tags = ['00','01','02','03','44','45','46','47','48','49','54','55','56','57','59','61','62','63','64','71','81','82','83','84','85','86','87','88','91'] + list_of_tags = ['00','01','02','03','44','45','46','47','48','49','54','55','56','57','59','61','62','63','64','71','72','81','82','83','84','85','86','87','88','91'] data_tax = self.browse(cr, uid, ids[0]) if data_tax.tax_code_id: obj_company = data_tax.tax_code_id.company_id else: obj_company = obj_user.browse(cr, uid, uid, context=context).company_id - vat_no = obj_company.partner_id.vat + vat_no = obj_company.partner_id.vat.replace(' ','').upper() if not vat_no: raise osv.except_osv(_('Data Insufficient'), _('No VAT Number Associated with Main Company!')) @@ -98,15 +103,22 @@ class l10n_be_vat_declaration(osv.osv_memory): data_of_file += '\n\t\t'+ (data['client_nihil'] and 'YES' or 'NO') +'' data_of_file +='\n\t\t\n\t\t\t' + cases_list = [] for item in tax_info: if item['code'] == '91' and ending_month != 12: #the tax code 91 can only be send for the declaration of December continue if item['code']: - if item['code'] == '71-72': - item['code']='71' + if item['code'] == 'VI': + if item['sum_period'] >= 0: + item['code'] = '71' + else: + item['code'] = '72' if item['code'] in list_of_tags: - data_of_file +='\n\t\t\t\t' + str(abs(int(round(item['sum_period']*100)))) + '' + cases_list.append(item) + cases_list.sort() + for item in cases_list: + data_of_file +='\n\t\t\t\t' + str(abs(int(round(item['sum_period']*100)))) + '' data_of_file += '\n\t\t\t\n\t\t\n\t\n' model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_vat_save')], context=context)