diff --git a/addons/board_project/board_project_view.xml b/addons/board_project/board_project_view.xml index 19cdb3a6a1b..fc79b0f9304 100644 --- a/addons/board_project/board_project_view.xml +++ b/addons/board_project/board_project_view.xml @@ -93,10 +93,10 @@ - + - + diff --git a/addons/document/document.py b/addons/document/document.py index f3ffd2f6f6c..af2517c7cbb 100644 --- a/addons/document/document.py +++ b/addons/document/document.py @@ -165,7 +165,7 @@ class document_file(osv.osv): vals['res_model'] = context.get('default_res_model', False) if vals.get('res_id', False) and vals.get('res_model', False): obj_model = self.pool.get(vals['res_model']) - result = obj_model.read(cr, uid, [vals['res_id']], context=context) + result = obj_model.read(cr, uid, [vals['res_id']], ['name', 'partner_id', 'address_id'], context=context) if len(result): obj = result[0] if obj.get('name', False): diff --git a/addons/l10n_be/__terp__.py b/addons/l10n_be/__terp__.py index 43d5a189247..618367dfef7 100644 --- a/addons/l10n_be/__terp__.py +++ b/addons/l10n_be/__terp__.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,7 +15,7 @@ # 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 . +# along with this program. If not, see . # ############################################################################## @@ -39,20 +39,21 @@ """, 'author': 'Tiny', - 'depends': [ - 'account', - 'account_report', - 'base_vat', - 'base_iban', - 'account_chart' + 'depends': [ + 'account', + 'account_report', + 'base_vat', + 'base_iban', + 'account_chart' ], 'init_xml': [], 'update_xml': [ - 'account_pcmn_belgium.xml', - 'l10n_be_wizard.xml', - 'l10n_be_sequence.xml', - 'fiscal_templates.xml', - 'security/ir.model.access.csv' + 'account_pcmn_belgium.xml', + 'l10n_be_wizard.xml', + 'wizard/l10n_be_account_vat_declaration_view.xml', + 'l10n_be_sequence.xml', + 'fiscal_templates.xml', + 'security/ir.model.access.csv' ], 'demo_xml': [ 'account.report.report.csv' diff --git a/addons/l10n_be/company.py b/addons/l10n_be/company.py index 8d6633b0d88..4395f13380e 100644 --- a/addons/l10n_be/company.py +++ b/addons/l10n_be/company.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,17 +15,15 @@ # 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 . +# along with this program. If not, see . # ############################################################################## - from osv import osv class res_company(osv.osv): _inherit = "res.company" _description = 'res.company' - def _get_default_ad(self, addresses): city = post_code = address = "" for ads in addresses: @@ -39,4 +37,4 @@ class res_company(osv.osv): return city, post_code, address res_company() -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/l10n_be/l10n_be_wizard.xml b/addons/l10n_be/l10n_be_wizard.xml index c20f1c62420..86c4d828b70 100644 --- a/addons/l10n_be/l10n_be_wizard.xml +++ b/addons/l10n_be/l10n_be_wizard.xml @@ -21,7 +21,7 @@ type="wizard" id="partner_wizard_vat_menu"/> - + id="account_wizard_vat_declaration"/> --> ). # @@ -15,13 +15,14 @@ # 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 . +# along with this program. If not, see . # ############################################################################## import account_vat_declaration import partner_vat_listing import wizard_vat_intra +import l10n_be_account_vat_declaration # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/l10n_be/wizard/account_vat_declaration.py b/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py similarity index 62% rename from addons/l10n_be/wizard/account_vat_declaration.py rename to addons/l10n_be/wizard/l10n_be_account_vat_declaration.py index 6533493ce23..490709b15ec 100644 --- a/addons/l10n_be/wizard/account_vat_declaration.py +++ b/addons/l10n_be/wizard/l10n_be_account_vat_declaration.py @@ -1,6 +1,6 @@ # -*- coding: utf-8 -*- ############################################################################## -# +# # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (). # @@ -15,69 +15,62 @@ # 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 . +# along with this program. If not, see . # ############################################################################## -import wizard import time import datetime -import pooler import base64 - +from osv import osv, fields from tools.translate import _ -form_fyear = """ -
- -""" +class l10n_be_vat_declaration(osv.osv_memory): + """ Vat Declaration """ + _name = "l1on_be.vat.declaration" + _description = "Vat Declaration" -fields_fyear = { - 'period': {'string': 'Period', 'type': 'many2one', 'relation': 'account.period', 'required': True,}, -} + _columns = { + 'period_id': fields.many2one('account.period','Period', required=True), + 'msg': fields.text('File created', size=64, readonly=True), + 'file_save' : fields.binary('Save File'), + } -form = """ -
- - - -""" + _defaults = { + 'msg': lambda *a:'''Save the File with '".xml"' extension.''', + } -fields = { - 'msg': {'string':'File created', 'type':'text', 'size':'100','readonly':True}, - 'file_save':{'string': 'Save File', - 'type': 'binary', - 'readonly': True,}, -} + def create_xml(self, cr, uid, ids, context={}): + obj_fyear = self.pool.get('account.fiscalyear') + obj_tax_code = self.pool.get('account.tax.code') + obj_acc_period = self.pool.get('account.period') + obj_user = self.pool.get('res.users') + obj_comp = self.pool.get('res.company') + obj_data = self.pool.get('ir.model.data') - -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 + obj_company = obj_user.browse(cr, uid, uid, context=context).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,[]) + tax_code_ids = obj_tax_code.search(cr, uid, [], context=context) 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) + data = self.read(cr, uid, ids)[0] + 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='' + address = post_code = city = '' if not obj_company.partner_id.address: - address=post_code=city='' + address = post_code = city = '' + + city, post_code, address = obj_comp._get_default_ad(obj_company.partner_id.address) - city, post_code, address = pooler.get_pool(cr.dbname).get('res.company')._get_default_ad(obj_company.partner_id.address) - obj_fyear = pool_obj.get('account.fiscalyear') year_id = obj_fyear.find(cr, uid) - - account_period=pool_obj.get('account.period').browse(cr, uid, data['form']['period']) + + account_period = obj_acc_period.browse(cr, uid, data['period_id'], context=context) current_year = account_period.fiscalyear_id.name period_code = account_period.code @@ -93,7 +86,7 @@ class wizard_vat_declaration(wizard.interface): starting_month = account_period.date_start[5:7] ending_month = account_period.date_stop[5:7] if starting_month != ending_month: - #starting month and ending month of selected period are not the same + #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+'\n\t\t\t' @@ -110,21 +103,10 @@ class wizard_vat_declaration(wizard.interface): 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'] + data['file_save'] = base64.encodestring(data_of_file) + self.write(cr, uid, ids, {'file_save':data['file_save']}, context=context) - 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')]}, - } - } +l10n_be_vat_declaration() -wizard_vat_declaration('wizard.account.xml.vat.declaration') -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file diff --git a/addons/l10n_be/wizard/l10n_be_account_vat_declaration_view.xml b/addons/l10n_be/wizard/l10n_be_account_vat_declaration_view.xml new file mode 100644 index 00000000000..f0c19198bf3 --- /dev/null +++ b/addons/l10n_be/wizard/l10n_be_account_vat_declaration_view.xml @@ -0,0 +1,47 @@ + + + + + + + + Select Period + l1on_be.vat.declaration + form + +
+ + +