Amit Dodiya (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/5.0-opw-381491-VatIntra-ado into
lp:openobject-addons/5.0.
Requested reviews:
nel (nel-tinyerp)
Naresh(OpenERP) (nch-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/5.0-opw-381491-VatIntra-ado/+merge/91031
Hello,
Hello,
Improve the Vat_List.xml file creation from wizard as per the new VAT format.
Thanks,
Amit
--
https://code.launchpad.net/~openerp-dev/openobject-addons/5.0-opw-381491-VatIntra-ado/+merge/91031
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/5.0-opw-381491-VatIntra-ado.
=== modified file 'l10n_be/wizard/wizard_vat_intra.py'
--- l10n_be/wizard/wizard_vat_intra.py 2010-08-23 13:42:24 +0000
+++ l10n_be/wizard/wizard_vat_intra.py 2012-02-01 09:30:57 +0000
@@ -33,22 +33,34 @@
from tools.translate import _
form_intra = """<?xml version="1.0"?>
-<form string="Partner VAT Intra">
- <notebook>
- <page string="General Information">
- <label string="This wizard will create an XML file for Vat Intra" colspan="4"/>
- <newline/>
- <field name="period_code"/>
- <newline/>
- <field name="period_ids"/>
- <newline/>
- <field name="mand_id" help="This identifies the representative of the sending company. This is a string of 14 characters"/>
- <newline/>
- </page>
- <page string="European Countries">
- <field name="country_ids" colspan="4" nolabel="1" />
- </page>
- </notebook>
+<form string="Partner VAT intra">
+ <group width="450">
+ <separator string="Create an XML file for Vat Intra" colspan="4"/>
+ <notebook colspan="4">
+ <page string="General Information">
+ <newline/>
+ <group>
+ <field name="period_code" colspan="4"/>
+ <newline/>
+ <field name="mand_id" colspan="4"/>
+ <newline/>
+ <field name="identification_type"/>
+ <newline/>
+ <field name="other" attrs="{'invisible':[('identification_type','!=','other')], 'required':[('identification_type','=','other')]}"/>
+ <newline/>
+ <field name="tax_code_id" string="Company" colspan="4"/>
+ </group>
+ <separator string="Periods" colspan="4"/>
+ <field name="period_ids" nolabel="1" colspan="4"/>
+ </page>
+ <page string="Comments">
+ <field name="comments" nolabel="1"/>
+ </page>
+ <page string="European Countries">
+ <field name="country_ids" colspan="4" nolabel="1"/>
+ </page>
+ </notebook>
+ </group>
</form>"""
fields_intra = {
'period_code': {'string':'Period Code','type':'char','size':'6','required': True, 'help': '''This is where you have to set the period code for the intracom declaration using the format: ppyyyy
@@ -69,6 +81,15 @@
'relation': 'res.country',
'required': False
},
+ 'identification_type':{'string': 'Identification Type' ,'type':'selection','selection':[('tin','TIN'), ('nvat','NVAT'), ('other','Other')]},
+ 'other': {'string': 'QLF', 'type': 'text', 'size': 64},
+ 'tax_code_id': {
+ 'string': 'Company',
+ 'type': 'many2one',
+ 'relation': 'account.tax.code',
+ 'required': True,
+ 'domain': [('parent_id','=',False)]},
+ 'comments': {'string': 'Comments', 'type': 'text', 'size' : 64},
}
msg_form = """<?xml version="1.0"?>
@@ -103,12 +124,18 @@
dnum = cref + seq_declarantnum[-5:]
if len(data['form']['period_code']) != 6:
raise wizard.except_wizard(_('Wrong Period Code'), _('The period code you entered is not valid.'))
-
- street = zip_city = country = ''
+ issued_by = company_vat[:2]
+ month_quarter = data['form']['period_code'][:2]
+ year = data['form']['period_code'][2:]
+ email = phone = street = zip_city = country = ''
addr = pool.get('res.partner').address_get(cr, uid, [data_cmpny.partner_id.id], ['invoice'])
+ type = data['form']['identification_type'] or ''
+ other = data['form']['other'] or ''
+ comments = data['form']['comments'] or ''
if addr.get('invoice',False):
ads = pool.get('res.partner.address').browse(cr,uid,[addr['invoice']])[0]
zip_city = (ads.city or '') + ' ' + (ads.zip or '')
+ post_code = (ads.zip or '')
if zip_city== ' ':
zip_city = ''
if ads.street:
@@ -118,18 +145,54 @@
street += ads.street2
if ads.country_id:
country = ads.country_id.code
+ email = ads.email or ''
+ phone = ads.phone or ''
+
+ xml_data = { 'company_name': data_cmpny.name,
+ 'company_vat': company_vat,
+ 'vatnum': company_vat[2:],
+ 'controlref': seq_controlref,
+ 'cref': cref,
+ 'mand_id': data['form']['mand_id'],
+ 'sender_date': str(time.strftime('%Y-%m-%d')),
+ 'street': street,
+ 'city': zip_city,
+ 'post_code': post_code,
+ 'country': country,
+ 'email': email,
+ 'phone': phone,
+ 'period': data['form']['period_code'],
+ 'clientlist': [],
+ 'comments': comments,
+ 'type': type,
+ 'other': other,
+ 'issued_by': issued_by,
+ }
sender_date = time.strftime('%Y-%m-%d')
comp_name = data_cmpny.name
- data_file = '<?xml version="1.0"?>\n<VatIntra xmlns="http://www.minfin.fgov.be/VatIntra" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" RecipientId="VAT-ADMIN" SenderId="' + str(company_vat) + '"'
- data_file +=' ControlRef="' + cref + '" MandataireId="' + data['form']['mand_id'] + '" SenderDate="'+ str(sender_date)+ '"'
- data_file += ' VersionTech="1.3">'
- data_file +='\n\t<AgentRepr DecNumber="1">\n\t\t<CompanyInfo>\n\t\t\t<VATNum>' + str(company_vat)+'</VATNum>\n\t\t\t<Name>'+ comp_name +'</Name>\n\t\t\t<Street>'+ street +'</Street>\n\t\t\t<CityAndZipCode>'+ zip_city +'</CityAndZipCode>'
- data_file +='\n\t\t\t<Country>' + country +'</Country>\n\t\t</CompanyInfo>\n\t</AgentRepr>'
-
- data_comp ='\n\t\t<CompanyInfo>\n\t\t\t<VATNum>'+str(company_vat[2:])+'</VATNum>\n\t\t\t<Name>'+ comp_name +'</Name>\n\t\t\t<Street>'+ street +'</Street>\n\t\t\t<CityAndZipCode>'+ zip_city +'</CityAndZipCode>\n\t\t\t<Country>'+ country +'</Country>\n\t\t</CompanyInfo>'
- data_period = '\n\t\t<Period>'+ data['form']['period_code'] +'</Period>' #trimester
-
+ data_head ="""<?xml version="1.0"?><IntraConsignment xmlns="http://www.minfin.fgov.be/IntraConsignment" IntraListingsNbr="1">
+ <Representative>
+ <RepresentativeID identificationType="%(type)s" issuedBy="%(issued_by)s" otherQlf="%(other)s">%(company_vat)s
+ </RepresentativeID>
+ <Name>%(company_name)s</Name>
+ <Street>%(street)s</Street>
+ <PostCode>%(post_code)s</PostCode>
+ <City>%(city)s</City>
+ <CountryCode>%(country)s</CountryCode>
+ <EmailAddress>%(email)s</EmailAddress>
+ <Phone>%(phone)s</Phone>
+ </Representative>
+ <RepresentativeReference>%(mand_id)s</RepresentativeReference>""" % (xml_data)
+ data_comp_period = '\n\t\t<ReplacedIntraListing></ReplacedIntraListing>\n\t\t<Declarant>\n\t\t\t<VATNumber xmlns="http://www.minfin.fgov.be/InputCommon">%(vatnum)s</VATNumber>\n\t\t\t<Name>%(company_name)s</Name>\n\t\t\t<Street>%(street)s</Street>\n\t\t\t<PostCode>%(post_code)s</PostCode>\n\t\t\t<City>%(city)s</City>\n\t\t\t<CountryCode>%(country)s</CountryCode>\n\t\t\t<EmailAddress>%(email)s</EmailAddress>\n\t\t\t<Phone>%(phone)s</Phone>\n\t\t</Declarant>' % (xml_data)
+
+ if month_quarter.startswith('3'):
+ data_comp_period += '\n\t\t<Period>\n\t\t\t<Quarter>'+month_quarter+'</Quarter> \n\t\t\t<Year>'+year+'</Year>\n\t\t</Period>'
+ elif month_quarter.startswith('0') and month_quarter.endswith('0'):
+ data_comp_period+= '\n\t\t<Period>%(period)s</Period>' % (xml_data)
+ else:
+ data_comp_period += '\n\t\t<Period>\n\t\t\t<Month>'+month_quarter+'</Month> \n\t\t\t<Year>'+year+'</Year>\n\t\t</Period>'
+
error_message = []
seq = 0
amount_sum = 0
@@ -149,11 +212,13 @@
amt = int(amt * 100)
amount_sum += amt
intra_code = row['intra_code'] == '88' and 'L' or (row['intra_code'] == '44b' and 'T' or (row['intra_code'] == '44a' and 'S' or ''))
- data_clientinfo +='\n\t\t<ClientList SequenceNum="'+str(seq)+'">\n\t\t\t<CompanyInfo>\n\t\t\t\t<VATNum>'+row['vat'][2:] +'</VATNum>\n\t\t\t\t<Country>'+row['vat'][:2] +'</Country>\n\t\t\t</CompanyInfo>\n\t\t\t<Amount>'+str(amt) +'</Amount>\n\t\t\t<Code>'+str(intra_code) +'</Code>\n\t\t</ClientList>'
+ data_clientinfo +='\n\t\t<IntraClient SequenceNumber="%(seq)s">\n\t\t\t<CompanyVATNumber issuedBy="%(country)s">%(vatnum)s</CompanyVATNumber>\n\t\t\t<Code>%(code)s</Code>\n\t\t\t<Amount>%(amount)s</Amount>\n\t\t\t<CorrectingPeriod>\n\t\t\t\t<Month></Month> \n\t\t\t\t<Year></Year>\n\t\t\t</CorrectingPeriod>\n\t\t</IntraClient>' % (client)
+ data_file = ''
amount_sum = int(amount_sum)
- data_decl = '\n\t<DeclarantList SequenceNum="1" DeclarantNum="'+ dnum + '" ClientNbr="'+ str(seq) +'" AmountSum="'+ str(amount_sum) +'" >'
- data_file += data_decl + data_comp + str(data_period) + data_clientinfo + '\n\t</DeclarantList>\n</VatIntra>'
+ xml_data.update({'dnum': dnum, 'clientnbr': str(seq), 'amountsum': amount_sum})
+ data_decl = '\n\t<IntraListing SequenceNumber="1" ClientsNbr="%(clientnbr)s" DeclarantReference="%(dnum)s" AmountSum="%(amountsum)s">' % (xml_data)
+ data_file += data_head + data_decl + data_comp_period + data_clientinfo + '\n\t\t<FileAttachment></FileAttachment> \n\t\t<Comment>%(comments)s</Comment>\n\t</IntraListing>\n</IntraConsignment>' % (xml_data)
data['form']['msg'] = 'Save the File with '".xml"' extension.'
data['form']['file_save'] = base64.encodestring(data_file.encode('utf8'))
return data['form']
_______________________________________________
Mailing list: https://launchpad.net/~openerp-dev-gtk
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openerp-dev-gtk
More help : https://help.launchpad.net/ListHelp