diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 030af7cfc54..eafc2c3f605 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -559,12 +559,12 @@ class account_move_line(osv.osv): GROUP BY account_id,reconcile_id') r = cr.fetchall() #TODO: move this check to a constraint in the account_move_reconcile object - if (len(r) != 1) and context.get('same_account', True): + if (len(r) != 1) and not context.get('fy_closing', False): raise osv.except_osv(_('Error'), _('Entries are not of the same account or already reconciled ! ')) if not unrec_lines: raise osv.except_osv(_('Error'), _('Entry is already reconciled')) account = self.pool.get('account.account').browse(cr, uid, account_id, context=context) - if not account.reconcile: + if not context.get('fy_closing', False) and not account.reconcile: raise osv.except_osv(_('Error'), _('The account is not defined to be reconcile !')) if r[0][1] != None: raise osv.except_osv(_('Error'), _('Some entries are already reconciled !')) diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index ab8678439fb..cdc0786c6eb 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1309,7 +1309,7 @@ - + Entry Lines account.move.line form tree,form diff --git a/addons/account/invoice.py b/addons/account/invoice.py index bd2a8de5d6a..a79bf281723 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -427,6 +427,8 @@ class account_invoice(osv.osv): return ok def button_reset_taxes(self, cr, uid, ids, context=None): + if not context: + context = {} ait_obj = self.pool.get('account.invoice.tax') for id in ids: cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s", (id,)) diff --git a/addons/account/wizard/wizard_fiscalyear_close.py b/addons/account/wizard/wizard_fiscalyear_close.py index 3dd8c8f799f..feba99a4ccb 100644 --- a/addons/account/wizard/wizard_fiscalyear_close.py +++ b/addons/account/wizard/wizard_fiscalyear_close.py @@ -56,13 +56,13 @@ def _data_save(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) fy_id = data['form']['fy_id'] - new_fyear = pool.get('account.fiscalyear').browse(cr, uid, data['form']['fy2_id']) + period_ids = pool.get('account.period').search(cr, uid, [('fiscalyear_id', '=', fy_id)]) + fy_period_set = ','.join(map(str, period_ids)) + periods_fy2 = pool.get('account.period').search(cr, uid, [('fiscalyear_id', '=', data['form']['fy2_id'])]) + fy2_period_set = ','.join(map(str, periods_fy2)) - periods_fy2 = new_fyear.period_ids - if not periods_fy2: - raise wizard.except_wizard(_('UserError'), - _('There are no periods defined on New Fiscal Year.')) - period=periods_fy2[0] + period = pool.get('account.period').browse(cr, uid, data['form']['period_id'], context=context) + new_fyear = pool.get('account.fiscalyear').browse(cr, uid, data['form']['fy2_id'], context=context) new_journal = data['form']['journal_id'] new_journal = pool.get('account.journal').browse(cr, uid, new_journal, context=context) @@ -87,6 +87,7 @@ def _data_save(self, cr, uid, data, context): ids = map(lambda x: x[0], cr.fetchall()) for account in pool.get('account.account').browse(cr, uid, ids, context={'fiscalyear': fy_id}): + accnt_type_data = account.user_type if not accnt_type_data: continue @@ -120,7 +121,40 @@ def _data_save(self, cr, uid, data, context): if not result: break for move in result: - parent_id = move['id'] + move.pop('id') + move.update({ + 'date': period.date_start, + 'journal_id': new_journal.id, + 'period_id': period.id, + }) + pool.get('account.move.line').create(cr, uid, move, { + 'journal_id': new_journal.id, + 'period_id': period.id, + }) + offset += limit + + #We have also to consider all move_lines that were reconciled + #on another fiscal year, and report them too + offset = 0 + limit = 100 + while True: + #TODO: this query could be improved in order to work if there is more than 2 open FY + # a.period_id IN ('+fy2_period_set+') is the problematic clause + cr.execute('SELECT b.id, b.name, b.quantity, b.debit, b.credit, b.account_id, b.ref, ' \ + 'b.amount_currency, b.currency_id, b.blocked, b.partner_id, ' \ + 'b.date_maturity, b.date_created ' \ + 'FROM account_move_line a, account_move_line b ' \ + 'WHERE b.account_id = %s ' \ + 'AND b.reconcile_id is NOT NULL ' \ + 'AND a.reconcile_id = b.reconcile_id ' \ + 'AND b.period_id IN ('+fy_period_set+') ' \ + 'AND a.period_id IN ('+fy2_period_set+') ' \ + 'ORDER BY id ' \ + 'LIMIT %s OFFSET %s', (account.id, limit, offset)) + result = cr.dictfetchall() + if not result: + break + for move in result: move.pop('id') move.update({ 'date': period.date_start, @@ -148,7 +182,6 @@ def _data_save(self, cr, uid, data, context): if not result: break for move in result: - parent_id = move['id'] move.pop('id') move.update({ 'date': period.date_start, @@ -160,10 +193,8 @@ def _data_save(self, cr, uid, data, context): ids = pool.get('account.move.line').search(cr, uid, [('journal_id','=',new_journal.id), ('period_id.fiscalyear_id','=',new_fyear.id)]) - - context['same_account'] = False + context['fy_closing'] = True pool.get('account.move.line').reconcile(cr, uid, ids, context=context) - new_period = data['form']['period_id'] ids = pool.get('account.journal.period').search(cr, uid, [('journal_id','=',new_journal.id),('period_id','=',new_period)]) if ids: diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index 787faf6bfdf..a943ea61706 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -451,6 +451,7 @@ class account_analytic_account_summary_user(osv.osv): 'user' : fields.many2one('res.users', 'User'), } def init(self, cr): + tools.sql.drop_view_if_exists(cr, 'account_analytic_analysis_summary_user') cr.execute('CREATE OR REPLACE VIEW account_analytic_analysis_summary_user AS (' \ 'SELECT ' \ '(u.account_id * u.max_user) + u."user" AS id, ' \ diff --git a/addons/account_followup/followup_view.xml b/addons/account_followup/followup_view.xml index 5b0bbb7dd34..1b2d40a7cd9 100644 --- a/addons/account_followup/followup_view.xml +++ b/addons/account_followup/followup_view.xml @@ -31,13 +31,9 @@ @@ -134,11 +130,11 @@ - + - + diff --git a/addons/account_followup/report/report_followup_print.py b/addons/account_followup/report/report_followup_print.py index f77c6ff7239..b6c89b074b8 100644 --- a/addons/account_followup/report/report_followup_print.py +++ b/addons/account_followup/report/report_followup_print.py @@ -61,7 +61,7 @@ class report_rappel(report_sxw.rml_parse): movelines = moveline_obj.read(self.cr, self.uid, movelines) return movelines - def _get_text(self, partner, followup_id): + def _get_text(self, partner, followup_id, context={}): fp_obj = pooler.get_pool(self.cr.dbname).get('account_followup.followup') fp_line = fp_obj.browse(self.cr, self.uid, followup_id).followup_line li_delay = [] @@ -82,7 +82,12 @@ class report_rappel(report_sxw.rml_parse): partner_delay.append(delay) text = partner_delay and a[max(partner_delay)] or '' if text: - text = text % {'partner_name':partner.name} + text = text % { + 'partner_name': partner.name, + 'date': time.strftime('%Y-%m-%d'), + 'company_name': fp_obj.browse(self.cr, self.uid, followup_id).company_id.name, + 'user_signature': pooler.get_pool(self.cr.dbname).get('res.users').browse(self.cr, self.uid, self.uid, context).signature, + } return text diff --git a/addons/account_followup/wizard/wizard_followup_print.py b/addons/account_followup/wizard/wizard_followup_print.py index 8344914fbd6..e271d1dbd27 100644 --- a/addons/account_followup/wizard/wizard_followup_print.py +++ b/addons/account_followup/wizard/wizard_followup_print.py @@ -204,7 +204,7 @@ class followup_all_print(wizard.interface): summary = msg_unsent + line + msg_sent return {'summary' : summary} else: - return {'summary' : '\n\n\nMain not sent to any partner if you want to sent it please tick send email confirmation on wizard'} + return {'summary' : '\n\n\nMail not sent to any partner if you want to sent it please tick send email confirmation on wizard'} def _get_partners(self, cr, uid, data, context): pool = pooler.get_pool(cr.dbname) diff --git a/addons/account_report/__terp__.py b/addons/account_report/__terp__.py index 61646eeff53..ab9a04435b7 100644 --- a/addons/account_report/__terp__.py +++ b/addons/account_report/__terp__.py @@ -23,7 +23,7 @@ { 'name': 'Reporting for accounting', - 'version': '1.0', + 'version': '1.1', 'category': 'Generic Modules/Accounting', 'description': """Financial and accounting reporting Fiscal statements diff --git a/addons/account_tax_include/invoice_tax_incl.py b/addons/account_tax_include/invoice_tax_incl.py index 62f88205bf1..7d66a87fc0f 100644 --- a/addons/account_tax_include/invoice_tax_incl.py +++ b/addons/account_tax_include/invoice_tax_incl.py @@ -1,7 +1,7 @@ # -*- encoding: utf-8 -*- ############################################################################## # -# OpenERP, Open Source Management Solution +# OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (). All Rights Reserved # $Id$ # @@ -140,12 +140,12 @@ class account_invoice_line(osv.osv): else: return super(account_invoice_line, self).product_id_change_unit_price_inv(cr, uid, tax_id, price_unit, qty, address_invoice_id, product, partner_id, context=context) - def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition=False, price_unit=False, address_invoice_id=False, price_type='tax_excluded', context=None): - # note: will call product_id_change_unit_price_inv with context... + def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, fposition_id=False, price_unit=False, address_invoice_id=False, price_type='tax_excluded', context=None): + # note: will call product_id_change_unit_price_inv with context... if context is None: context = {} context.update({'price_type': price_type}) - return super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition, price_unit, address_invoice_id, context=context) + return super(account_invoice_line, self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, fposition_id, price_unit, address_invoice_id, context=context) account_invoice_line() class account_invoice_tax(osv.osv): diff --git a/addons/base_contact/base_contact_demo.xml b/addons/base_contact/base_contact_demo.xml index fe6266e6bba..c92d6294ab5 100644 --- a/addons/base_contact/base_contact_demo.xml +++ b/addons/base_contact/base_contact_demo.xml @@ -4,7 +4,7 @@ - + PA diff --git a/addons/base_iban/__terp__.py b/addons/base_iban/__terp__.py index 2d0329746b9..8969e7de62a 100644 --- a/addons/base_iban/__terp__.py +++ b/addons/base_iban/__terp__.py @@ -30,7 +30,7 @@ This module install the base for IBAN bank accounts. """, 'author': 'Tiny', - 'depends': ['base'], + 'depends': ['base', 'account'], 'init_xml': ['base_iban_data.xml'], 'update_xml': ['base_iban_view.xml'], 'installable': True, diff --git a/addons/base_iban/base_iban.py b/addons/base_iban/base_iban.py index aebaa940a9a..2d91e1d5b4c 100644 --- a/addons/base_iban/base_iban.py +++ b/addons/base_iban/base_iban.py @@ -38,13 +38,13 @@ class res_partner_bank(osv.osv): def create(self, cr, uid, vals, context={}): #overwrite to format the iban number correctly - if vals.has_key('iban'): + if 'iban' in vals and vals['iban']: vals['iban'] = _format_iban(vals['iban']) return super(res_partner_bank, self).create(cr, uid, vals, context) def write(self, cr, uid, ids, vals, context={}): #overwrite to format the iban number correctly - if vals.has_key('iban'): + if 'iban' in vals and vals['iban']: vals['iban'] = _format_iban(vals['iban']) return super(res_partner_bank, self).write(cr, uid, ids, vals, context) diff --git a/addons/base_module_publish/wizard/wizard_module_export.py b/addons/base_module_publish/wizard/wizard_module_export.py index 58cda426d5e..0b40d57ddac 100644 --- a/addons/base_module_publish/wizard/wizard_module_export.py +++ b/addons/base_module_publish/wizard/wizard_module_export.py @@ -40,7 +40,7 @@ init_fields = { finish_form = '''
- + ''' diff --git a/addons/base_module_record/base_module_record.py b/addons/base_module_record/base_module_record.py index fa9c8a6b51f..9cfa5058031 100644 --- a/addons/base_module_record/base_module_record.py +++ b/addons/base_module_record/base_module_record.py @@ -182,7 +182,7 @@ class base_module_record(osv.osv): val = str(val) val = val and ('"""%s"""' % val.replace('\\', '\\\\').replace('"', '\"')) or 'False' - field.setAttribute(u"eval", val) + field.setAttribute(u"eval", val.decode('utf-8')) record.appendChild(field) return record_list, noupdate @@ -324,8 +324,8 @@ class base_module_record(osv.osv): data.appendChild(res) elif rec[0]=='assert': pass - res = doc.toprettyxml(indent="\t") - return doc.toprettyxml(indent="\t").encode('utf8') + + return doc.toprettyxml(indent="\t").encode('utf-8') base_module_record() # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/base_report_designer/wizard/tiny_sxw2rml/normalized_odt2rml.xsl b/addons/base_report_designer/wizard/tiny_sxw2rml/normalized_odt2rml.xsl index b935de03a3b..09d81860896 100644 --- a/addons/base_report_designer/wizard/tiny_sxw2rml/normalized_odt2rml.xsl +++ b/addons/base_report_designer/wizard/tiny_sxw2rml/normalized_odt2rml.xsl @@ -498,6 +498,7 @@ + @@ -670,6 +671,17 @@ + + + + + + + + + + +