From d77656fb7494dab18172672acab656c9be4e2dfd Mon Sep 17 00:00:00 2001 From: hmo-tinyerp <> Date: Wed, 23 Jul 2008 12:22:55 +0530 Subject: [PATCH 1/6] created fiscal year's methods periods on configuration fiscal year wizard bzr revid: hmo-tinyerp-20080723065255-l2o7kkpscqxh9kb9 --- addons/account/account.py | 1 + 1 file changed, 1 insertion(+) diff --git a/addons/account/account.py b/addons/account/account.py index 2e35a30c2ec..1b4a0c4122d 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -1555,6 +1555,7 @@ class account_config_fiscalyear(osv.osv_memory): 'date_stop':end_date, } new_id=res_obj.create(cr, uid, vals, context=context) + res_obj.create_period(cr,uid,[new_id]) return { 'view_type': 'form', "view_mode": 'form', From 413ff31a80372dc1af341995e4bf8caa0a7ddda5 Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 23 Jul 2008 15:57:46 +0530 Subject: [PATCH 2/6] add wizard and sequence files for vat listing and declaration bzr revid: mra@tinyerp.com-20080723102746-frh924rqb9utv8p9 --- addons/l10n_be/__init__.py | 2 ++ addons/l10n_be/__terp__.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/l10n_be/__init__.py b/addons/l10n_be/__init__.py index 00fd7b7c4a1..bb4b26b4a13 100644 --- a/addons/l10n_be/__init__.py +++ b/addons/l10n_be/__init__.py @@ -27,3 +27,5 @@ # ############################################################################## +import wizard + diff --git a/addons/l10n_be/__terp__.py b/addons/l10n_be/__terp__.py index 8255419545d..18a2ba78585 100644 --- a/addons/l10n_be/__terp__.py +++ b/addons/l10n_be/__terp__.py @@ -34,6 +34,6 @@ "account_chart"], "init_xml" : [], "demo_xml" : ["account_demo.xml","account.report.report.csv"], - "update_xml" : ["../account_chart/account_chart.xml", "account_pcmn_belgium.xml"], + "update_xml" : ["../account_chart/account_chart.xml", "account_pcmn_belgium.xml", "l10n_be_wizard.xml", "l10n_be_sequence.xml"], "installable": True } From 4adced1f1b96c13fc534f9a67e710cce5252508f Mon Sep 17 00:00:00 2001 From: Mustufa Rangwala Date: Wed, 23 Jul 2008 15:59:42 +0530 Subject: [PATCH 3/6] added wizard on l10n_be for vat listing and declation bzr revid: mra@tinyerp.com-20080723102942-eztv9fg66w3x1248 --- addons/l10n_be/l10n_be_sequence.xml | 32 ++++ addons/l10n_be/l10n_be_wizard.xml | 28 ++++ addons/l10n_be/wizard/__init__.py | 2 + .../l10n_be/wizard/account_vat_declaration.py | 101 ++++++++++++ addons/l10n_be/wizard/partner_vat_listing.py | 147 ++++++++++++++++++ 5 files changed, 310 insertions(+) create mode 100644 addons/l10n_be/l10n_be_sequence.xml create mode 100644 addons/l10n_be/l10n_be_wizard.xml create mode 100644 addons/l10n_be/wizard/__init__.py create mode 100644 addons/l10n_be/wizard/account_vat_declaration.py create mode 100644 addons/l10n_be/wizard/partner_vat_listing.py diff --git a/addons/l10n_be/l10n_be_sequence.xml b/addons/l10n_be/l10n_be_sequence.xml new file mode 100644 index 00000000000..6e2ea26cbe6 --- /dev/null +++ b/addons/l10n_be/l10n_be_sequence.xml @@ -0,0 +1,32 @@ + + + + + # + # Sequences for controlref will be used in wizard for "Listing of VAT Customers"..in creating xml file + # + + Controlref + controlref + + + Controlref + controlref + 4 + + + # + # Sequences for declarantnum will be used in wizard for "Listing of VAT Customers"..in creating xml file + # + + Declarantnum + declarantnum + + + Declarantnum + declarantnum + 5 + + + + diff --git a/addons/l10n_be/l10n_be_wizard.xml b/addons/l10n_be/l10n_be_wizard.xml new file mode 100644 index 00000000000..63596d36ddd --- /dev/null +++ b/addons/l10n_be/l10n_be_wizard.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + diff --git a/addons/l10n_be/wizard/__init__.py b/addons/l10n_be/wizard/__init__.py new file mode 100644 index 00000000000..4bdc9b28276 --- /dev/null +++ b/addons/l10n_be/wizard/__init__.py @@ -0,0 +1,2 @@ +import account_vat_declaration +import partner_vat_listing \ No newline at end of file diff --git a/addons/l10n_be/wizard/account_vat_declaration.py b/addons/l10n_be/wizard/account_vat_declaration.py new file mode 100644 index 00000000000..8e2fd143b27 --- /dev/null +++ b/addons/l10n_be/wizard/account_vat_declaration.py @@ -0,0 +1,101 @@ +import wizard +import time +import datetime +import pooler +import base64 + +form_fyear = """ +
+ +""" + +fields_fyear = { + 'period': {'string': 'Period', 'type': 'many2one', 'relation': 'account.period', 'required': True,}, +} + +form = """ +
+ + + +""" + +fields = { + 'msg': {'string':'File created', 'type':'text', 'size':'100','readonly':True}, + 'file_save':{'string': 'Save File', + 'type': 'binary', + 'readonly': True,}, +} + +class wizard_vat_declaration(wizard.interface): + + def _create_xml(self, cr, uid, data, context): + list_of_tags=['00','01','02','03','45','46','47','48','49','54','55','56','57','59','61','62','63','64','71','81','82','83','84','85','86','87','91'] + pool_obj = pooler.get_pool(cr.dbname) + #obj_company = pool_obj.get('res.company').browse(cr,uid,1) + obj_company = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid).company_id + 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!') + + tax_ids = pool_obj.get('account.tax.code').search(cr,uid,[]) + ctx = context.copy() + ctx['period_id'] = data['form']['period'] #added context here + tax_info = pool_obj.get('account.tax.code').read(cr,uid,tax_ids,['code','sum_period'],context=ctx) + + address=post_code=city='' + 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 + + 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='\n' + data_of_file +='\n\t\n\t\t'+str(vat_no)+'\n\t\t'+str(obj_company.name)+'\n\t\t
'+str(address)+'
' + data_of_file +='\n\t\t'+str(post_code)+'\n\t\t'+str(city)+'\n\t\t'+send_ref+'\n\t
' + data_of_file +='\n\t\n\t\t1\n\t\t'+str(vat_no)+'\n\t\t\n\t\t\t'+str(month)+'\n\t\t\t'+str(current_year[-4:])+'\n\t\t\n\t\t' + data_of_file +='\n\t\t\n\t\t\t' + + for item in tax_info: + if item['code']: + if item['code'] == '71-72': + item['code']='71' + if item['code'] in list_of_tags: + data_of_file +='\n\t\t\t\t' + str(int(item['sum_period']*100)) + '' + + data_of_file +='\n\t\t\t\n\t\t\n\t\n
' + data['form']['msg']='Save the File with '".xml"' extension.' + data['form']['file_save']=base64.encodestring(data_of_file) + return data['form'] + + + states = { + 'init': { + 'actions': [], + 'result': {'type':'form', 'arch':form_fyear, 'fields':fields_fyear, 'state':[('end','Cancel'),('go','Create XML')]}, + }, + 'go': { + 'actions': [_create_xml], + 'result': {'type':'form', 'arch':form, 'fields':fields, 'state':[('end','Ok')]}, + } + } + +wizard_vat_declaration('wizard.account.vat.declaration') \ No newline at end of file diff --git a/addons/l10n_be/wizard/partner_vat_listing.py b/addons/l10n_be/wizard/partner_vat_listing.py new file mode 100644 index 00000000000..05bf58e0da9 --- /dev/null +++ b/addons/l10n_be/wizard/partner_vat_listing.py @@ -0,0 +1,147 @@ +import wizard +import time +import datetime +import pooler +import base64 + +form = """ +
+