[IMP] l10n_BE: Small code improvement for wizard

bzr revid: mra@tinyerp.com-20100504115431-2q3llzper8kwquyq
This commit is contained in:
mra (Open ERP)
2010-05-04 17:24:31 +05:30
parent 5976307470
commit 41d5d23230
3 changed files with 6 additions and 12 deletions
@@ -56,9 +56,7 @@ class l10n_be_vat_declaration(osv.osv_memory):
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!'))
osv.except_osv(_('Data Insufficient'), _('No VAT Number Associated with Main Company!'))
tax_code_ids = obj_tax_code.search(cr, uid, [], context=context)
ctx = context.copy()
@@ -68,8 +66,6 @@ class l10n_be_vat_declaration(osv.osv_memory):
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)
year_id = obj_fyear.find(cr, uid)
account_period = obj_acc_period.browse(cr, uid, data['period_id'], context=context)
@@ -80,7 +76,7 @@ class l10n_be_vat_declaration(osv.osv_memory):
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<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]
if starting_month != ending_month:
@@ -105,7 +101,6 @@ class l10n_be_vat_declaration(osv.osv_memory):
data['file_save'] = base64.encodestring(data_of_file)
self.write(cr, uid, ids, {'file_save':data['file_save']}, context=context)
l10n_be_vat_declaration()
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
@@ -18,7 +18,7 @@
<field name="ask_resitution"/>
<field name="ask_payment"/>
<field name="client_nihil"/>
<button colspan="1" name="create_xml" string="Create XML" type="object" default_focus="1"/>
<button colspan="1" name="create_xml" string="Create XML" type="object"/>
</group>
<separator string="XML Flie has been Created." colspan="4"/>
<group colspan="4" >
+3 -4
View File
@@ -31,9 +31,8 @@ class partner_vat_intra(osv.osv_memory):
_name = "partner.vat.intra"
_description = 'Partner VAT Intra'
def _get_europe_country(self, cursor, user, context={}):
obj_country = self.pool.get('res.country')
return obj_country.search(cursor, user, [('code', 'in', ['AT', 'BG', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'GB'])])
def _get_europe_country(self, cursor, user, context=None):
return self.pool.get('res.country').search(cursor, user, [('code', 'in', ['AT', 'BG', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'GB'])])
_columns = {
'name': fields.char('File Name', size=32),
@@ -69,9 +68,9 @@ class partner_vat_intra(osv.osv_memory):
street = zip_city = country = p_list = data_clientinfo = ''
error_message = list_partner = []
seq = amount_sum = 0
if context is None:
context = {}
data_cmpny = obj_user.browse(cursor, user, user).company_id
data = self.read(cursor, user, ids)[0]
company_vat = data_cmpny.partner_id.vat