Meera Trambadia (OpenERP) has proposed merging
lp:~openerp-dev/openobject-addons/6.0-opw-50926-vat_declaration-mtr into
lp:openobject-addons/6.0.
Requested reviews:
Naresh(OpenERP) (nch-openerp)
For more details, see:
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-50926-vat_declaration-mtr/+merge/91239
l10n_be:-Improved the 'Peridical VAT declaration' wizard as per the new VAT
format
--
https://code.launchpad.net/~openerp-dev/openobject-addons/6.0-opw-50926-vat_declaration-mtr/+merge/91239
Your team OpenERP R&D Team is subscribed to branch
lp:~openerp-dev/openobject-addons/6.0-opw-50926-vat_declaration-mtr.
=== modified file 'l10n_be/company.py'
--- l10n_be/company.py 2011-01-14 00:11:01 +0000
+++ l10n_be/company.py 2012-02-02 11:13:23 +0000
@@ -25,7 +25,7 @@
_description = 'Company'
def _get_default_ad(self, addresses):
- city = post_code = address = country_code = ""
+ name = email = phone = city = post_code = address = country_code = ""
for ads in addresses:
if ads.type == 'default':
city = ads.city or ""
@@ -36,7 +36,10 @@
address += " " + ads.street2
if ads.country_id:
country_code = ads.country_id and ads.country_id.code or ""
- return city, post_code, address, country_code
+ name = ads.name or ""
+ email = ads.email or ""
+ phone = ads.phone or ""
+ return name, email, phone, city, post_code, address, country_code
res_company()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== modified file 'l10n_be/wizard/l10n_be_account_vat_declaration.py'
--- l10n_be/wizard/l10n_be_account_vat_declaration.py 2011-01-14 00:11:01 +0000
+++ l10n_be/wizard/l10n_be_account_vat_declaration.py 2012-02-02 11:13:23 +0000
@@ -36,17 +36,24 @@
_columns = {
'name': fields.char('File Name', size=32),
'period_id': fields.many2one('account.period','Period', required=True),
- 'tax_code_id': fields.many2one('account.tax.code', 'Tax Code', domain=[('parent_id', '=', False)]),
+ 'tax_code_id': fields.many2one('account.tax.code', 'Tax Code', domain=[('parent_id', '=', False)], help="Keep empty to use the user's company"),
'msg': fields.text('File created', size=64, readonly=True),
'file_save': fields.binary('Save File'),
- 'ask_resitution': fields.boolean('Ask Restitution',help='It indicates whether a resitution is to made or not?'),
+ 'ask_restitution': fields.boolean('Ask Restitution',help='It indicates whether a resitution is to made or not?'),
'ask_payment': fields.boolean('Ask Payment',help='It indicates whether a payment is to made or not?'),
'client_nihil': fields.boolean('Last Declaration of Enterprise',help='Tick this case only if it concerns only the last statement on the civil or cessation of activity'),
+ 'vat_declarations_nbr': fields.integer('VAT Declaration Number', help="Number of periodic VAT returns in the shipment"),
+ 'comments': fields.text('Comments'),
+ 'identification_type': fields.selection([('tin','TIN'), ('nvat','NVAT'), ('other','Other')], 'Identification Type', required=True),
+ 'other': fields.char('Other Qlf', size=16, help="Description of a Identification Type"),
+
}
_defaults = {
'msg': 'Save the File with '".xml"' extension.',
'file_save': _get_xml_data,
'name': 'vat_declaration.xml',
+ 'identification_type': 'tin',
+ 'vat_declarations_nbr': 0,
}
def create_xml(self, cr, uid, ids, context=None):
@@ -67,6 +74,8 @@
vat_no = obj_company.partner_id.vat
if not vat_no:
raise osv.except_osv(_('Data Insufficient'), _('No VAT Number Associated with Main Company!'))
+ vat_no = vat_no.replace(' ','').upper()
+ vat = vat_no[2:]
tax_code_ids = obj_tax_code.search(cr, uid, [], context=context)
ctx = context.copy()
@@ -74,41 +83,107 @@
ctx['period_id'] = data['period_id'] #added context here
tax_info = obj_tax_code.read(cr, uid, tax_code_ids, ['code','sum_period'], context=ctx)
- address = post_code = city = country_code = ''
- city, post_code, address, country_code = self.pool.get('res.company')._get_default_ad(obj_company.partner_id.address)
+ name = email = phone = address = post_code = city = country_code = ''
+ name, email, phone, city, post_code, address, country_code = self.pool.get('res.company')._get_default_ad(obj_company.partner_id.address)
account_period = obj_acc_period.browse(cr, uid, data['period_id'], context=context)
+ issued_by = vat_no[:2]
+ comments = data['comments'] or ''
+ type = data['identification_type'] or ''
+ other = data['other'] or ''
send_ref = str(obj_company.partner_id.id) + str(account_period.date_start[5:7]) + str(account_period.date_stop[:4])
- data_of_file = '<?xml version="1.0"?>\n<VATSENDING xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="MultiDeclarationTVA-NoSignature-16.xml">'
- data_of_file +='\n\t<DECLARER>\n\t\t<VATNUMBER>'+str(vat_no)+'</VATNUMBER>\n\t\t<NAME>'+ 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<COUNTRY>'+country_code+'</COUNTRY>\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>'+((vat_no and str(vat_no[2:])) or '')+'</VATNUMBER>\n\t\t<DPERIODE>\n\t\t\t'
starting_month = account_period.date_start[5:7]
ending_month = account_period.date_stop[5:7]
+ quarter = str(((int(starting_month) - 1) / 3) + 1)
+
+ file_data = {
+ 'vat_declarations_nbr': str(data['vat_declarations_nbr']),
+ 'type': type.upper(),
+ 'issued_by': issued_by,
+ 'other': other,
+ 'vat_no': vat_no,
+ 'only_vat': vat_no[2:],
+ 'cmpny_name': obj_company.name,
+ 'address': address,
+ 'post_code': post_code,
+ 'city': city,
+ 'country_code': country_code,
+ 'email': email,
+ 'phone': phone,
+ 'send_ref': send_ref,
+ 'quarter': quarter,
+ 'month': starting_month,
+ 'year': str(account_period.date_stop[:4]),
+ 'client_nihil': (data['client_nihil'] and 'YES' or 'NO'),
+ 'ask_restitution': (data['ask_restitution'] and 'YES' or 'NO'),
+ 'ask_payment': (data['ask_payment'] and 'YES' or 'NO'),
+ 'comments': comments,
+ }
+ data_of_file = """<?xml version="1.0"?>
+<VATConsignment xmlns="http://www.minfin.fgov.be/VATConsignment" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" VATDeclarationsNbr="%(vat_declarations_nbr)s">
+ <Representative>
+ <RepresentativeID identificationType="%(type)s" issuedBy="%(issued_by)s" otherQlf="%(other)s">%(vat_no)s</RepresentativeID>
+ <Name>%(cmpny_name)s</Name>
+ <Street>%(address)s</Street>
+ <PostCode>%(post_code)s</PostCode>
+ <City>%(city)s</City>
+ <CountryCode>%(country_code)s</CountryCode>
+ <EmailAddress>%(email)s</EmailAddress>
+ <Phone>%(phone)s</Phone>
+ </Representative>
+ <RepresentativeReference></RepresentativeReference>
+ <VATDeclaration SequenceNumber="1" DeclarantReference="%(send_ref)s">
+ <ReplacedVATDeclaration></ReplacedVATDeclaration>
+ <Declarant>
+ <VATNUMBER xmlns="http://www.minfin.fgov.be/InputCommon">%(only_vat)s</VATNUMBER>
+ <Name>%(cmpny_name)s</Name>
+ <Street>%(address)s</Street>
+ <PostCode>%(post_code)s</PostCode>
+ <City>%(city)s</City>
+ <CountryCode>%(country_code)s</CountryCode>
+ <EmailAddress>%(email)s</EmailAddress>
+ <Phone>%(phone)s</Phone>
+ </Declarant>
+ <Period>
+ """ % (file_data)
+
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'
+ data_of_file += '\t\t<Quarter>%(quarter)s</Quarter>\n\t\t' % (file_data)
else:
- data_of_file += '<MONTH>'+starting_month+'</MONTH>\n\t\t\t'
- data_of_file += '<YEAR>' + str(account_period.date_stop[:4]) + '</YEAR>\n\t\t</DPERIODE>\n\t\t<ASK RESTITUTION="NO" PAYMENT="NO"/>'
- 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>'
-
+ data_of_file += '\t\t<Month>%(month)s</Month>\n\t\t' % (file_data)
+ data_of_file += '\t<Year>%(year)s</Year>' % (file_data)
+ data_of_file += '\n\t\t</Period>\n'
+ data_of_file += '\t\t<Data>\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<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>'
+ cases_list.append(item)
+ cases_list.sort()
+ for item in cases_list:
+ grid_amount_data = {
+ 'code': str(int(item['code'])),
+ 'amount': str(abs(int(round(item['sum_period']*100)))),
+ }
+ data_of_file += '\n\t\t\t<Amount GridNumber="%(code)s">%(amount)s</Amount''>' % (grid_amount_data)
+ data_of_file += '\n\t\t</Data>'
+ data_of_file += '\n\t\t<ClientListingNihil>%(client_nihil)s</ClientListingNihil>' % (file_data)
+ data_of_file += '\n\t\t<Ask Restitution="%(ask_restitution)s" Payment="%(ask_payment)s"/>' % (file_data)
+ data_of_file += '\n\t\t<FileAttachment>''</FileAttachment>'
+ data_of_file += '\n\t\t<Comment>%(comments)s</Comment>' % (file_data)
+ data_of_file += '\n\t</VATDeclaration> \n</VATConsignment>'
model_data_ids = mod_obj.search(cr, uid,[('model','=','ir.ui.view'),('name','=','view_vat_save')], context=context)
resource_id = mod_obj.read(cr, uid, model_data_ids, fields=['res_id'], context=context)[0]['res_id']
context['file_save'] = data_of_file
=== modified file 'l10n_be/wizard/l10n_be_account_vat_declaration_view.xml'
--- l10n_be/wizard/l10n_be_account_vat_declaration_view.xml 2011-01-14 00:11:01 +0000
+++ l10n_be/wizard/l10n_be_account_vat_declaration_view.xml 2012-02-02 11:13:23 +0000
@@ -2,55 +2,62 @@
<openerp>
<data>
- <menuitem
- id="menu_finance_belgian_statement"
- name="Belgium Statements"
- parent="account.menu_finance_legal_statement" groups="account.group_account_manager"/>
+ <menuitem
+ id="menu_finance_belgian_statement"
+ name="Belgium Statements"
+ parent="account.menu_finance_legal_statement" groups="account.group_account_manager"/>
- <record id="view_vat_declaration" model="ir.ui.view">
- <field name="name">Vat Declaraion</field>
- <field name="model">l1on_be.vat.declaration</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Periodical VAT Declaration" >
- <group>
- <group colspan="4">
- <separator string="Declare Periodical VAT" colspan="4"/><newline/>
- <field name="period_id" widget="selection"/>
+ <record id="view_vat_declaration" model="ir.ui.view">
+ <field name="name">Vat Declaraion</field>
+ <field name="model">l1on_be.vat.declaration</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Periodical VAT Declaration" >
+ <group>
+ <group colspan="4">
+ <separator string="Declare Periodical VAT" colspan="4"/><newline/>
+ <field name="vat_declarations_nbr"/>
+ <field name="period_id" widget="selection"/>
+ <field name="identification_type"/>
+ <field name="other" attrs="{'invisible':[('identification_type','!=','other')], 'required':[('identification_type','=','other')]}"/>
<field name="tax_code_id" string="Company" widget="selection" groups="base.group_multi_company"/>
<newline/>
</group>
<group>
- <field name="ask_resitution" colspan="1"/>
+ <field name="ask_restitution" colspan="1"/>
<field name="ask_payment" colspan="1"/>
<field name="client_nihil" string="Is Last Declaration" colspan="1" /><label/>
- </group>
- <newline/>
- <group>
- <separator colspan="4"/>
- <newline/>
- <button special="cancel" string="Close" icon="gtk-cancel"/>
- <button icon="gtk-execute" name="create_xml" string="Create XML" type="object" default_focus="1" />
- </group>
- </group>
- </form>
- </field>
- </record>
+ </group>
+ <newline/>
+ <group colspan="4">
+ <separator string="Comments" colspan="4"/>
+ <field colspan="4" name="comments" nolabel="1"/>
+ </group>
+ <group>
+ <separator colspan="4"/>
+ <newline/>
+ <button special="cancel" string="Close" icon="gtk-cancel"/>
+ <button icon="gtk-execute" name="create_xml" string="Create XML" type="object" default_focus="1" />
+ </group>
+ </group>
+ </form>
+ </field>
+ </record>
<record id="view_vat_save" model="ir.ui.view">
- <field name="name">Save XML</field>
- <field name="model">l1on_be.vat.declaration</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
+ <field name="name">Save XML</field>
+ <field name="model">l1on_be.vat.declaration</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
<form string="Save xml">
<group colspan="3">
<label string="Save the File with '.xml' extension." colspan="2" align="0.0"/><newline/>
- <field name="name"/><newline/>
- <field name="file_save" readonly="True"/>
- <newline/>
- <separator colspan="4"/><label/>
- <button special="cancel" string="Ok" icon="gtk-ok"/>
- </group>
+ <field name="name"/><newline/>
+ <field name="file_save" readonly="True"/>
+ <newline/>
+ <separator colspan="4"/><label/>
+ <button special="cancel" string="Ok" icon="gtk-ok"/>
+ </group>
</form>
</field>
</record>
_______________________________________________
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