[IMP] l10n_BE: Improve and clean
bzr revid: mra@tinyerp.com-20100402114459-48rcp0jz7grm05rv
This commit is contained in:
parent
43caafbd4a
commit
4b61fc1a7d
|
@ -1,6 +1,6 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
##############################################################################
|
||||
#
|
||||
#
|
||||
# OpenERP, Open Source Management Solution
|
||||
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
|
||||
#
|
||||
|
@ -15,11 +15,11 @@
|
|||
# GNU Affero General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import company
|
||||
import wizard
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -18,10 +18,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
|
||||
{
|
||||
'name': 'Belgium - Plan Comptable Minimum Normalise',
|
||||
{ 'name': 'Belgium - Plan Comptable Minimum Normalise',
|
||||
'version': '1.1',
|
||||
'category': 'Localisation/Account Charts',
|
||||
'description': """
|
||||
|
@ -34,8 +31,12 @@
|
|||
* This is the same wizard that runs from Financial Management/Configuration/Financial Accounting/Financial Accounts/Generate Chart of Accounts from a Chart Template.
|
||||
|
||||
Wizards provided by this module:
|
||||
* Enlist the partners with their related VAT and invoiced amounts.Prepares an XML file format.Path to access : Financial Management/Reporting/Listing of VAT Customers.
|
||||
* Prepares an XML file for Vat Declaration of the Main company of the User currently Logged in.Path to access : Financial Management/Reporting/Listing of VAT Customers.
|
||||
* Partner VAT Intra: Enlist the partners with their related VAT and invoiced amounts.Prepares an XML file format.
|
||||
Path to access : Financial Management/Reporting//Legal Statements/Belgium Statements/Partner VAT Listing
|
||||
* Periodical VAT Declaration: Prepares an XML file for Vat Declaration of the Main company of the User currently Logged in.
|
||||
Path to access : Financial Management/Reporting/Legal Statements/Belgium Statements/Periodical VAT Declaration
|
||||
* Annual Listing Of VAT-Subjected Customers: Prepares an XML file for Vat Declaration of the Main company of the User currently Logged in.Based on Fiscal year
|
||||
Path to access : Financial Management/Reporting/Legal Statements/Belgium Statements/Annual Listing Of VAT-Subjected Customers
|
||||
|
||||
""",
|
||||
'author': 'Tiny',
|
||||
|
@ -57,9 +58,7 @@
|
|||
'fiscal_templates.xml',
|
||||
'security/ir.model.access.csv'
|
||||
],
|
||||
'demo_xml': [
|
||||
'account.report.report.csv'
|
||||
],
|
||||
'demo_xml': ['account.report.report.csv'],
|
||||
'installable': True,
|
||||
'certificate': '0031977724637',
|
||||
}
|
||||
|
|
|
@ -23,5 +23,4 @@ import l10_be_partner_vat_listing
|
|||
import l10n_be_vat_intra
|
||||
import l10n_be_account_vat_declaration
|
||||
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
|
|
|
@ -21,9 +21,7 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
|
||||
import time
|
||||
import datetime
|
||||
import base64
|
||||
|
||||
from tools.translate import _
|
||||
|
@ -38,7 +36,7 @@ class vat_listing_clients(osv.osv_memory):
|
|||
'country': fields.char('Country', size=64),
|
||||
'amount': fields.float('Amount'),
|
||||
'turnover': fields.float('Turnover'),
|
||||
}
|
||||
}
|
||||
|
||||
vat_listing_clients()
|
||||
|
||||
|
@ -53,9 +51,9 @@ class partner_vat(osv.osv_memory):
|
|||
obj_model_data = self.pool.get('ir.model.data')
|
||||
data = self.read(cursor, user, ids)[0]
|
||||
period = obj_period.search(cursor, user, [('fiscalyear_id', '=', data['fyear'])], context=context)
|
||||
p_id_list = obj_partner.search(cursor, user, [('vat_subjected','!=',False)], context=context)
|
||||
p_id_list = obj_partner.search(cursor, user, [('vat_subjected', '!=', False)], context=context)
|
||||
if not p_id_list:
|
||||
raise osv.except_osv(_('Data Insufficient!'),_('No partner has a VAT Number asociated with him.'))
|
||||
raise osv.except_osv(_('Data Insufficient!'), _('No partner has a VAT Number asociated with him.'))
|
||||
partners = []
|
||||
records = []
|
||||
for obj_partner in obj_partner.browse(cursor, user, p_id_list, context=context):
|
||||
|
@ -99,7 +97,7 @@ class partner_vat(osv.osv_memory):
|
|||
record['turnover'] = 0
|
||||
record['name'] = obj_partner.name
|
||||
for item in line_info:
|
||||
if item[0]=='produit':
|
||||
if item[0] == 'produit':
|
||||
record['turnover'] += item[1]
|
||||
else:
|
||||
record['amount'] += item[1]
|
||||
|
@ -140,9 +138,13 @@ class partner_vat_list(osv.osv_memory):
|
|||
'file_save' : fields.binary('Save File', readonly=True),
|
||||
}
|
||||
|
||||
def get_partners(self, cursor, user, context={}):
|
||||
def _get_partners(self, cursor, user, context={}):
|
||||
return context.get('partner_ids', [])
|
||||
|
||||
_defaults={
|
||||
'partner_ids': _get_partners
|
||||
}
|
||||
|
||||
def create_xml(self, cursor, user, ids, context={}):
|
||||
datas=[]
|
||||
obj_sequence = self.pool.get('ir.sequence')
|
||||
|
@ -197,10 +199,10 @@ class partner_vat_list(osv.osv_memory):
|
|||
else:
|
||||
client_data = obj_vat_lclient.read(cursor, user, partner, context=context)
|
||||
datas.append(client_data)
|
||||
seq=0
|
||||
data_clientinfo=''
|
||||
sum_tax=0.00
|
||||
sum_turnover=0.00
|
||||
seq = 0
|
||||
data_clientinfo = ''
|
||||
sum_tax = 0.00
|
||||
sum_turnover = 0.00
|
||||
if len(error_message):
|
||||
msg ='Exception : \n' +'-'*50+'\n'+ '\n'.join(error_message)
|
||||
return msg
|
||||
|
@ -218,14 +220,9 @@ class partner_vat_list(osv.osv_memory):
|
|||
data_file += tools.ustr(data_decl) + tools.ustr(data_comp) + tools.ustr(data_period) + tools.ustr(data_clientinfo) + '\n</VatList>'
|
||||
msg = 'Save the File with '".xml"' extension.'
|
||||
file_save = base64.encodestring(data_file.encode('utf8'))
|
||||
|
||||
self.write(cursor, user, ids, {'file_save':file_save, 'msg':msg, 'name':'vat_list.xml'}, context=context)
|
||||
return True
|
||||
|
||||
_defaults={
|
||||
'partner_ids': get_partners
|
||||
}
|
||||
|
||||
partner_vat_list()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
|
@ -18,15 +18,13 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
##############################################################################
|
||||
import time
|
||||
import datetime
|
||||
import base64
|
||||
|
||||
from osv import osv, fields
|
||||
from tools.translate import _
|
||||
|
||||
class l10n_be_vat_declaration(osv.osv_memory):
|
||||
""" Vat Declaration """
|
||||
""" Periodical VAT Declaration """
|
||||
_name = "l1on_be.vat.declaration"
|
||||
_description = "Vat Declaration"
|
||||
|
||||
|
@ -38,7 +36,7 @@ class l10n_be_vat_declaration(osv.osv_memory):
|
|||
|
||||
_defaults = {
|
||||
'msg': lambda *a:'''Save the File with '".xml"' extension.''',
|
||||
}
|
||||
}
|
||||
|
||||
def create_xml(self, cr, uid, ids, context={}):
|
||||
obj_fyear = self.pool.get('account.fiscalyear')
|
||||
|
@ -87,9 +85,9 @@ class l10n_be_vat_declaration(osv.osv_memory):
|
|||
#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 += '<QUARTER>' + quarter + '</QUARTER>\n\t\t\t'
|
||||
else:
|
||||
data_of_file += '<MONTH>'+starting_month+'</MONTH>\n\t\t\t'
|
||||
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<DATA>\n\t\t\t<DATA_ELEM>'
|
||||
|
||||
|
@ -98,7 +96,7 @@ class l10n_be_vat_declaration(osv.osv_memory):
|
|||
if item['code'] == '71-72':
|
||||
item['code'] = '71'
|
||||
if item['code'] in list_of_tags:
|
||||
data_of_file +='\n\t\t\t\t<D'+str(int(item['code'])) +'>' + str(int(item['sum_period']*100)) + '</D'+str(int(item['code'])) +'>'
|
||||
data_of_file +='\n\t\t\t\t<D' + str(int(item['code'])) +'>' + str(int(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>'
|
||||
data['file_save'] = base64.encodestring(data_of_file)
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
<data>
|
||||
|
||||
<menuitem
|
||||
id="menu_finance_belgian_statement"
|
||||
name="Belgium Statements"
|
||||
parent="account.menu_finance_legal_statement"/>
|
||||
id="menu_finance_belgian_statement"
|
||||
name="Belgium Statements"
|
||||
parent="account.menu_finance_legal_statement"/>
|
||||
|
||||
<record id="view_vat_declaration" model="ir.ui.view">
|
||||
<field name="name">Select Period</field>
|
||||
|
@ -13,9 +13,9 @@
|
|||
<field name="type">form</field>
|
||||
<field name="arch" type="xml">
|
||||
<form string="Select Period">
|
||||
<group colspan="4" >
|
||||
<field name="period_id" select="1"/>
|
||||
<button colspan="1" name="create_xml" string="Create XML" type="object" default_focus="1" icon="gtk-execute"/>
|
||||
<group colspan="4" >
|
||||
<field name="period_id" select="1" default_focus="1"/>
|
||||
<button colspan="1" name="create_xml" string="Create XML" type="object" icon="gtk-execute"/>
|
||||
</group>
|
||||
<separator string="XML Flie has been Created." colspan="4"/>
|
||||
<group colspan="4" >
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
<data>
|
||||
|
||||
<menuitem
|
||||
id="menu_finance_belgian_statement"
|
||||
name="Belgium Statements"
|
||||
parent="account.menu_finance_legal_statement"/>
|
||||
id="menu_finance_belgian_statement"
|
||||
name="Belgium Statements"
|
||||
parent="account.menu_finance_legal_statement"/>
|
||||
|
||||
<record id="view_partner_vat_listing" model="ir.ui.view">
|
||||
<field name="name">Partner VAT Listing</field>
|
||||
|
@ -15,7 +15,7 @@
|
|||
<form string="Select Fiscal Year">
|
||||
<label string="This wizard will create an XML file for Vat details and total invoiced amounts per partner." colspan="4"/>
|
||||
<newline/>
|
||||
<field name="fyear" />
|
||||
<field name="fyear" default_focus="1"/>
|
||||
<newline/>
|
||||
<field name="mand_id"/>
|
||||
<newline/>
|
||||
|
@ -25,7 +25,7 @@
|
|||
<separator colspan="4"/>
|
||||
<group colspan="4" >
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
<button colspan="1" name="get_partner" string="View Client" type="object" default_focus="1" icon="terp-partner"/>
|
||||
<button colspan="1" name="get_partner" string="View Client" type="object" icon="terp-partner"/>
|
||||
</group>
|
||||
</form>
|
||||
</field>
|
||||
|
@ -42,7 +42,7 @@
|
|||
</record>
|
||||
|
||||
<menuitem
|
||||
name="Annual Listing of VAT-Subjected Customers"
|
||||
name="Annual Listing Of VAT-Subjected Customers"
|
||||
parent="menu_finance_belgian_statement"
|
||||
action="action_partner_vat_listing"
|
||||
id="partner_vat_listing"/>
|
||||
|
@ -55,10 +55,10 @@
|
|||
<form string="Select Fiscal Year" >
|
||||
<label string="You can remove clients/partners which you do not want in exported xml file" colspan="4"/>
|
||||
<separator string="Clients" colspan="4"/>
|
||||
<field name="partner_ids" colspan="4" nolabel="1"/>
|
||||
<field name="partner_ids" colspan="4" nolabel="1" default_focus="1"/>
|
||||
<separator colspan="4"/>
|
||||
<group colspan="4" >
|
||||
<button colspan="1" name="create_xml" string="Create XML" type="object" default_focus="1" icon="gtk-execute"/>
|
||||
<button colspan="1" name="create_xml" string="Create XML" type="object" icon="gtk-execute"/>
|
||||
</group>
|
||||
<separator string="XML File has been Created." colspan="4"/>
|
||||
<field name="msg" colspan="4" nolabel="1"/>
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#
|
||||
##############################################################################
|
||||
import time
|
||||
import datetime
|
||||
import base64
|
||||
|
||||
from osv import osv, fields
|
||||
|
@ -42,7 +41,7 @@ class partner_vat_intra(osv.osv_memory):
|
|||
'Trimester Number', required=True, help="It will be the first digit of period"),
|
||||
'test_xml': fields.boolean('Test XML file', help="Sets the XML output as test file"),
|
||||
'mand_id' : fields.char('MandataireId', size=14, required=True, help="This identifies the representative of the sending company. This is a string of 14 characters"),
|
||||
'fyear': fields.many2one('account.fiscalyear','Fiscal Year', required=True),
|
||||
'fyear': fields.many2one('account.fiscalyear', 'Fiscal Year', required=True),
|
||||
'msg': fields.text('File created', size=64, readonly=True),
|
||||
'file_save' : fields.binary('Save File', readonly=True),
|
||||
'country_ids': fields.many2many('res.country', 'vat_country_rel', 'vat_id', 'country_id', 'European Countries'),
|
||||
|
@ -50,7 +49,7 @@ class partner_vat_intra(osv.osv_memory):
|
|||
|
||||
_defaults = {
|
||||
'country_ids': _get_europe_country,
|
||||
}
|
||||
}
|
||||
|
||||
def create_xml(self, cursor, user, ids, context={}):
|
||||
obj_user = self.pool.get('res.users')
|
||||
|
|
|
@ -17,26 +17,27 @@
|
|||
<page string="General Information">
|
||||
<label string="This wizard will create an XML file for Vat Intra" colspan="4"/>
|
||||
<newline/>
|
||||
<field name="fyear" />
|
||||
<field name="fyear" default_focus="1" />
|
||||
<newline/>
|
||||
<field name="mand_id"/>
|
||||
<newline/>
|
||||
<field name="trimester"/>
|
||||
<newline/>
|
||||
<field name="test_xml"/>
|
||||
<newline/>
|
||||
<button colspan="4" name="create_xml" string="Create XML" type="object" icon="gtk-execute"/>
|
||||
<separator colspan="4"/>
|
||||
<group colspan="4" >
|
||||
<field name="msg" nolabel="1" colspan="4"/>
|
||||
<field name="file_save" readonly="True"/>
|
||||
</group>
|
||||
<button special="cancel" colspan="4" string="Cancel" icon="gtk-cancel"/>
|
||||
</page>
|
||||
<page string="European Countries">
|
||||
<field name="country_ids" colspan="4" nolabel="1" />
|
||||
</page>
|
||||
</notebook>
|
||||
<newline/>
|
||||
<button colspan="1" name="create_xml" string="Create XML" type="object" default_focus="1" icon="gtk-execute"/>
|
||||
<separator colspan="4"/>
|
||||
<group colspan="4" >
|
||||
<field name="msg" nolabel="1" colspan="4"/>
|
||||
<field name="file_save" readonly="True"/>
|
||||
</group>
|
||||
<button special="cancel" string="Cancel" icon="gtk-cancel"/>
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
@ -52,7 +53,7 @@
|
|||
</record>
|
||||
|
||||
<menuitem
|
||||
name="Partner VAT intra"
|
||||
name="Partner VAT Intra"
|
||||
parent="menu_finance_belgian_statement"
|
||||
action="action_vat_intra"
|
||||
id="l10_be_vat_intra"/>
|
||||
|
|
Loading…
Reference in New Issue