[FIX] bgufixed the 2 wizards of l10n_be
-vat_subjected wasn't take in considearation in vat_linting -wrong value was filled for <MONTH> tag in vat_declaration + [IMP] improved the vat_declaration wizard in oorder to: -work for quarter based accountings -have a generic solution for zip_id that is added in cci_partner bzr revid: qdp@tinyerp.com-20090203140311-74erq47phor2l5q3
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import company
|
||||
import wizard
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
# -*- encoding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). 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 <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
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:
|
||||
@@ -25,6 +25,8 @@ import datetime
|
||||
import pooler
|
||||
import base64
|
||||
|
||||
from tools.translate import _
|
||||
|
||||
form_fyear = """<?xml version="1.0"?>
|
||||
<form string="Select Period">
|
||||
<field name="period" />
|
||||
@@ -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='<?xml version="1.0"?>\n<VATSENDING xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MultiDeclarationTVA-NoSignature-14.xml">'
|
||||
data_of_file +='\n\t<DECLARER>\n\t\t<VATNUMBER>'+str(vat_no)+'</VATNUMBER>\n\t\t<NAME>'+str(obj_company.name)+'</NAME>\n\t\t<ADDRESS>'+str(address)+'</ADDRESS>'
|
||||
data_of_file +='\n\t\t<POSTCODE>'+str(post_code)+'</POSTCODE>\n\t\t<CITY>'+str(city)+'</CITY>\n\t\t<SENDINGREFERENCE>'+send_ref+'</SENDINGREFERENCE>\n\t</DECLARER>'
|
||||
data_of_file +='\n\t<VATRECORD>\n\t\t<RECNUM>1</RECNUM>\n\t\t<VATNUMBER>'+str(vat_no)+'</VATNUMBER>\n\t\t<DPERIODE>\n\t\t\t<MONTH>'+str(month)+'</MONTH>\n\t\t\t<YEAR>'+str(current_year[-4:])+'</YEAR>\n\t\t</DPERIODE>\n\t\t<ASK RESTITUTION="NO" PAYMENT="NO"/>'
|
||||
data_of_file +='\n\t<DECLARER>\n\t\t<VATNUMBER>'+str(vat_no)+'</VATNUMBER>\n\t\t<NAME>'+str(obj_company.name)+'</NAME>\n\t\t<ADDRESS>'+address+'</ADDRESS>'
|
||||
data_of_file +='\n\t\t<POSTCODE>'+post_code+'</POSTCODE>\n\t\t<CITY>'+city+'</CITY>\n\t\t<SENDINGREFERENCE>'+send_ref+'</SENDINGREFERENCE>\n\t</DECLARER>'
|
||||
data_of_file +='\n\t<VATRECORD>\n\t\t<RECNUM>1</RECNUM>\n\t\t<VATNUMBER>'+str(vat_no)+'</VATNUMBER>\n\t\t<DPERIODE>\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>'+quarter+'</QUARTER>\n\t\t\t'
|
||||
else:
|
||||
data_of_file += '<MONTH>'+starting_month+'</MONTH>\n\t\t\t'
|
||||
data_of_file += '<YEAR>'+str(current_year[-4:])+'</YEAR>\n\t\t</DPERIODE>\n\t\t<ASK RESTITUTION="NO" PAYMENT="NO"/>'
|
||||
data_of_file +='\n\t\t<DATA>\n\t\t\t<DATA_ELEM>'
|
||||
|
||||
for item in tax_info:
|
||||
|
||||
@@ -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.')
|
||||
|
||||
Reference in New Issue
Block a user