diff --git a/addons/account/account.py b/addons/account/account.py index 28fff33a4bc..df6a0492ff9 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -157,8 +157,6 @@ class account_account_type(osv.osv): ('asset','Balance Sheet (Assets Accounts)'), ('liability','Balance Sheet (Liability Accounts)') ],'Type Heads', select=True, readonly=False, help="According value related accounts will be display on respective reports (Balance Sheet Profit & Loss Account)"), - 'parent_id':fields.many2one('account.account.type', 'Parent Type', required=False), - 'child_ids':fields.one2many('account.account.type', 'parent_id', 'Child Types', required=False), 'note': fields.text('Description'), } _defaults = { @@ -167,14 +165,6 @@ class account_account_type(osv.osv): } _order = "code" - def _check_recursion(self, cr, uid, ids): - #TODO: Need to check for recusrion - return True - - _constraints = [ - (_check_recursion, 'Error ! You can not create recursive types.', ['parent_id']) - ] - account_account_type() def _code_get(self, cr, uid, context={}): @@ -690,23 +680,23 @@ class account_journal(osv.osv): """ Returns a list of tupples containing id, name. result format : {[(id, name), (id, name), ...]} - + @param cr: A database cursor @param user: ID of the user currently logged in @param ids: list of ids for which name should be read @param context: context arguments, like lang, time zone - + @return: Returns a list of tupples containing id, name """ result = self.browse(cr, user, ids, context) res = [] for rs in result: - name = rs.name + name = rs.name if rs.currency: name = "%s (%s)" % (rs.name, rs.currency.name) res += [(rs.id, name)] return res - + def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100): if not args: args = [] @@ -2747,7 +2737,7 @@ class wizard_multi_charts_accounts(osv.osv_memory): vals_journal['sequence_id'] = seq_id vals_journal['type'] = 'cash' vals_journal['company_id'] = company_id - + if line.currency_id: vals_journal['view_id'] = view_id_cur vals_journal['currency'] = line.currency_id.id diff --git a/addons/account/account_installer.xml b/addons/account/account_installer.xml index a262dc5eb7f..a9de51c3afb 100644 --- a/addons/account/account_installer.xml +++ b/addons/account/account_installer.xml @@ -8,13 +8,13 @@
- Accounting Modules Configuration + Accounting Application Configuration
- Configure Your Accounting System + Configure Your Accounting Chart - Configure your accounting system. By default, Chart of Account is matching to your country. If there are not chart of account certified for your county, you can install the generic chart of account. + The default Chart of Accounts is matching your country selection. If no certified Chart of Accounts exists for your specified country, a generic one can be installed and will be selected by default. Configure @@ -66,13 +66,17 @@
- Accounting Modules Configuration + Accounting Application Configuration
- Extra Accounting Modules + Configure Your Accounting Application + - From this screen, you can install extra accounting modules in your accounting system. Select the modules to directly install them. If you do not think you need any of these right now, you can easily install them later. + Add extra Accounting Addons to the ones already installed. Remember you can always install them at a later stage. + + + Configure @@ -100,7 +104,7 @@ - Accounting Modules Installation + Accounting Application Configuration ir.actions.act_window account.installer.modules diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index bb208e4e231..322c38875ec 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -160,10 +160,10 @@ class account_move_line(osv.osv): return context def _default_get(self, cr, uid, fields, context={}): - + if not context.get('journal_id', False) and context.get('search_default_journal_id', False): context['journal_id'] = context.get('search_default_journal_id') - + period_obj = self.pool.get('account.period') context = self.convert_to_period(cr, uid, context) @@ -946,6 +946,7 @@ class account_move_line(osv.osv): if field in ('amount_currency', 'currency_id'): attrs.append('on_change="onchange_currency(account_id, amount_currency,currency_id, date, journal_id)"') + attrs.append("attrs='{'readonly':[('state','=','valid')]}'") if field in widths: attrs.append('width="'+str(widths[field])+'"') diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index 3b54653e80c..b56b3100a5b 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -668,6 +668,7 @@ + account.account.type.form account.account.type @@ -677,7 +678,6 @@ - @@ -942,8 +942,8 @@ - - + + @@ -998,7 +998,7 @@ - + @@ -2340,11 +2340,11 @@
- Generate Chart of Accounts from a Chart Template + Accounting Application Configuration
Generate Chart of Accounts from a Chart Template + >Generate Your Accounting Chart from a Chart Template This will automatically configure your chart of accounts, bank accounts, taxes and journals according to the selected template @@ -2508,8 +2508,6 @@ - -
@@ -2519,7 +2517,6 @@ - diff --git a/addons/account/i18n/hr.po b/addons/account/i18n/hr.po index 329ae8fa080..1fbbfcbd0ab 100644 --- a/addons/account/i18n/hr.po +++ b/addons/account/i18n/hr.po @@ -2668,10 +2668,10 @@ msgid "" "partners accounts (for debit/credit computations), closed for deprecated " "accounts." msgstr "" -"Pogled: Sintetički zbrojni konto, ne sadrži knjiženja\r\n" -"Konsolidacija: Zbrojni konto za više poduzeća i paralelne kontne planove\r\n" -"Obveze: Salda konta partnera - dobavljači\r\n" -"Potraživanja: Salda konta partnera - kupci\r\n" +"Pogled: Sintetički zbrojni konto, ne sadrži knjiženja\n" +"Konsolidacija: Zbrojni konto za više poduzeća i paralelne kontne planove\n" +"Obveze: Salda konta partnera - dobavljači\n" +"Potraživanja: Salda konta partnera - kupci\n" "Zatvoren: Za konta koja se više ne koriste" #. module: account diff --git a/addons/account/installer.py b/addons/account/installer.py index deb47f98346..1d96120b4b0 100644 --- a/addons/account/installer.py +++ b/addons/account/installer.py @@ -73,6 +73,21 @@ class account_installer(osv.osv_memory): return user.company_id.id return False + def _get_default_charts(self, cr, uid, context={}): + module_name = False + company_id = self._default_company(cr, uid, context=context) + company = self.pool.get('res.company').browse(cr, uid, company_id) + address_id = self.pool.get('res.partner').address_get(cr, uid, [company.partner_id.id]) + if address_id['default']: + address = self.pool.get('res.partner.address').browse(cr, uid, address_id['default']) + code = address.country_id.code + module_name = (code and 'l10n_' + code.lower()) or False + if module_name: + module_id = self.pool.get('ir.module.module').search(cr, uid, [('name', '=', module_name)]) + if module_id: + return module_name + return 'configurable' + _defaults = { 'date_start': lambda *a: time.strftime('%Y-01-01'), 'date_stop': lambda *a: time.strftime('%Y-12-31'), @@ -80,7 +95,8 @@ class account_installer(osv.osv_memory): 'sale_tax':lambda *a:0.0, 'purchase_tax':lambda *a:0.0, 'company_id': _default_company, - 'bank_accounts_id':_get_default_accounts + 'bank_accounts_id':_get_default_accounts, + 'charts': _get_default_charts } def on_change_tax(self, cr, uid, id, tax): diff --git a/addons/account/invoice.py b/addons/account/invoice.py index 14081cb6a45..42e4bee12b6 100644 --- a/addons/account/invoice.py +++ b/addons/account/invoice.py @@ -138,16 +138,17 @@ class account_invoice(osv.osv): return res + # Give Journal Items related to the payment reconciled to this invoice + # Return ids of partial and total payments related to the selected invoices def _get_lines(self, cr, uid, ids, name, arg, context=None): res = {} - for id in ids: - move_lines = self.move_line_id_payment_get(cr, uid, [id]) - if not move_lines: - res[id] = [] - continue + for invoice in self.browse(cr, uid, ids, context=context): + id = invoice.id res[id] = [] - data_lines = self.pool.get('account.move.line').browse(cr, uid, move_lines) - partial_ids = []# Keeps the track of ids where partial payments are done with payment terms + if not invoice.move_id: + continue + data_lines = invoice.move_id.line_id + partial_ids = [] for line in data_lines: ids_line = [] if line.reconcile_id: @@ -174,17 +175,17 @@ class account_invoice(osv.osv): def _compute_lines(self, cr, uid, ids, name, args, context=None): result = {} for invoice in self.browse(cr, uid, ids, context): - moves = self.move_line_id_payment_get(cr, uid, [invoice.id]) src = [] lines = [] - for m in self.pool.get('account.move.line').browse(cr, uid, moves, context): - temp_lines = []#Added temp list to avoid duplicate records - if m.reconcile_id: - temp_lines = map(lambda x: x.id, m.reconcile_id.line_id) - elif m.reconcile_partial_id: - temp_lines = map(lambda x: x.id, m.reconcile_partial_id.line_partial_ids) - lines += [x for x in temp_lines if x not in lines] - src.append(m.id) + if invoice.move_id: + for m in invoice.move_id.line_id: + temp_lines = [] + if m.reconcile_id: + temp_lines = map(lambda x: x.id, m.reconcile_id.line_id) + elif m.reconcile_partial_id: + temp_lines = map(lambda x: x.id, m.reconcile_partial_id.line_partial_ids) + lines += [x for x in temp_lines if x not in lines] + src.append(m.id) lines = filter(lambda x: x not in src, lines) result[invoice.id] = lines @@ -594,15 +595,22 @@ class account_invoice(osv.osv): # return the ids of the move lines which has the same account than the invoice # whose id is in ids def move_line_id_payment_get(self, cr, uid, ids, *args): - res = [] + if not ids: return [] + result = self.move_line_id_payment_gets(cr, uid, ids, *args) + return result.get(ids[0], []) + + def move_line_id_payment_gets(self, cr, uid, ids, *args): + res = {} if not ids: return res - cr.execute('SELECT l.id '\ + cr.execute('SELECT i.id, l.id '\ 'FROM account_move_line l '\ 'LEFT JOIN account_invoice i ON (i.move_id=l.move_id) '\ 'WHERE i.id IN %s '\ 'AND l.account_id=i.account_id', (tuple(ids),)) - res = map(itemgetter(0), cr.fetchall()) + for r in cr.fetchall(): + res.setdefault(r[0], []) + res[r[0]].append( r[1] ) return res def copy(self, cr, uid, id, default={}, context=None): diff --git a/addons/account/report/account_balance_sheet.py b/addons/account/report/account_balance_sheet.py index 9b816b2ab5a..9f6b924f4e0 100644 --- a/addons/account/report/account_balance_sheet.py +++ b/addons/account/report/account_balance_sheet.py @@ -81,7 +81,6 @@ class report_balancesheet_horizontal(rml_parse.rml_parse, common_report_header): result_pl = self.obj_pl.get_data(data) self.res_bl = self.obj_pl.final_result() - type_pool = db_pool.get('account.account.type') account_pool = db_pool.get('account.account') year_pool = db_pool.get('account.fiscalyear') diff --git a/addons/account/report/account_profit_loss.py b/addons/account/report/account_profit_loss.py index 28b5cb52aaf..6a6e0f3c2cc 100644 --- a/addons/account/report/account_profit_loss.py +++ b/addons/account/report/account_profit_loss.py @@ -74,7 +74,6 @@ class report_pl_account_horizontal(rml_parse.rml_parse, common_report_header): cr, uid = self.cr, self.uid db_pool = pooler.get_pool(self.cr.dbname) - type_pool = db_pool.get('account.account.type') account_pool = db_pool.get('account.account') year_pool = db_pool.get('account.fiscalyear') diff --git a/addons/account/report/account_tax_code.rml b/addons/account/report/account_tax_code.rml index 35205440993..9c495dd4834 100644 --- a/addons/account/report/account_tax_code.rml +++ b/addons/account/report/account_tax_code.rml @@ -1,32 +1,8 @@ -