[IMP] l10n_be: merged the enhancements for vat declaration made by Noviat
bzr revid: qdp-launchpad@openerp.com-20110505120003-apzwajpwlol7gmy1
This commit is contained in:
parent
15850af75e
commit
ca5a45a313
|
@ -3,6 +3,11 @@
|
|||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
# 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<ClientListingNihil>'+ (data['client_nihil'] and 'YES' or 'NO') +'</ClientListingNihil>'
|
||||
data_of_file +='\n\t\t<DATA>\n\t\t\t<DATA_ELEM>'
|
||||
|
||||
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<D'+str(int(item['code'])) +'>' + str(abs(int(round(item['sum_period']*100)))) + '</D'+str(int(item['code'])) +'>'
|
||||
cases_list.append(item)
|
||||
cases_list.sort()
|
||||
for item in cases_list:
|
||||
data_of_file +='\n\t\t\t\t<D'+str(int(item['code'])) +'>' + str(abs(int(round(item['sum_period']*100)))) + '</D'+str(int(item['code'])) +'>'
|
||||
|
||||
data_of_file += '\n\t\t\t</DATA_ELEM>\n\t\t</DATA>\n\t</VATRECORD>\n</VATSENDING>'
|
||||
model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_vat_save')], context=context)
|
||||
|
|
Loading…
Reference in New Issue