diff --git a/addons/account/account.py b/addons/account/account.py index 625bcd1a6a8..28fff33a4bc 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -686,6 +686,27 @@ class account_journal(osv.osv): vals.update({'sequence_id' : self.create_sequence(cr, uid, vals, context)}) return super(account_journal, self).create(cr, uid, vals, context) + def name_get(self, cr, user, ids, context={}): + """ + 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 + 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 = [] @@ -2659,6 +2680,7 @@ class wizard_multi_charts_accounts(osv.osv_memory): vals_journal['type'] = 'sale' vals_journal['code'] = _('SAJ') vals_journal['sequence_id'] = seq_id_sale + vals_journal['company_id'] = company_id if obj_multi.chart_template_id.property_account_receivable: vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_income_categ.id] @@ -2672,6 +2694,7 @@ class wizard_multi_charts_accounts(osv.osv_memory): vals_journal['code'] = _('EXJ') vals_journal['sequence_id'] = seq_id_purchase vals_journal['view_id'] = view_id + vals_journal['company_id'] = company_id if obj_multi.chart_template_id.property_account_payable: vals_journal['default_credit_account_id'] = acc_template_ref[obj_multi.chart_template_id.property_account_expense_categ.id] @@ -2723,6 +2746,8 @@ class wizard_multi_charts_accounts(osv.osv_memory): vals_journal['code']= _('BNK') + str(current_num) 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_analytic_line.py b/addons/account/account_analytic_line.py index 5a8ee0d4e8c..be1e5ec65e6 100644 --- a/addons/account/account_analytic_line.py +++ b/addons/account/account_analytic_line.py @@ -51,7 +51,6 @@ class account_analytic_line(osv.osv): def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): if context is None: context = {} - if context.get('from_date',False): args.append(['date', '>=',context['from_date']]) diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 53c08525a6a..e2dafa57ef8 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -214,22 +214,121 @@ class account_bank_statement(osv.osv): self.write(cr, uid, ids, {}, context) return True - def button_confirm_bank(self, cr, uid, ids, context=None): - done = [] + + def create_move_from_st_line(self, cr, uid, st_line, company_currency_id, next_number, context=None): res_currency_obj = self.pool.get('res.currency') res_users_obj = self.pool.get('res.users') account_move_obj = self.pool.get('account.move') account_move_line_obj = self.pool.get('account.move.line') account_analytic_line_obj = self.pool.get('account.analytic.line') account_bank_statement_line_obj = self.pool.get('account.bank.statement.line') + + st = st_line.statement_id + + context.update({'date': st_line.date}) + move_id = account_move_obj.create(cr, uid, { + 'journal_id': st.journal_id.id, + 'period_id': st.period_id.id, + 'date': st_line.date, + }, context=context) + account_bank_statement_line_obj.write(cr, uid, [st_line.id], { + 'move_ids': [(4, move_id, False)] + }) + + torec = [] + if st_line.amount >= 0: + account_id = st.journal_id.default_credit_account_id.id + else: + account_id = st.journal_id.default_debit_account_id.id + acc_cur = ((st_line.amount<=0) and st.journal_id.default_debit_account_id) or st_line.account_id + amount = res_currency_obj.compute(cr, uid, st.currency.id, + company_currency_id, st_line.amount, context=context, + account=acc_cur) + + val = { + 'name': st_line.name, + 'date': st_line.date, + 'ref': st_line.ref, + 'move_id': move_id, + 'partner_id': ((st_line.partner_id) and st_line.partner_id.id) or False, + 'account_id': (st_line.account_id) and st_line.account_id.id, + 'credit': ((amount>0) and amount) or 0.0, + 'debit': ((amount<0) and -amount) or 0.0, + 'statement_id': st.id, + 'journal_id': st.journal_id.id, + 'period_id': st.period_id.id, + 'currency_id': st.currency.id, + 'analytic_account_id': st_line.analytic_account_id and st_line.analytic_account_id.id or False + } + + amount = res_currency_obj.compute(cr, uid, st.currency.id, + company_currency_id, st_line.amount, context=context, + account=acc_cur) + if st.currency.id <> company_currency_id: + amount_cur = res_currency_obj.compute(cr, uid, company_currency_id, + st.currency.id, amount, context=context, + account=acc_cur) + val['amount_currency'] = -amount_cur + + if st_line.account_id and st_line.account_id.currency_id and st_line.account_id.currency_id.id <> company_currency_id: + val['currency_id'] = st_line.account_id.currency_id.id + if company_currency_id==st_line.account_id.currency_id.id: + amount_cur = st_line.amount + else: + amount_cur = res_currency_obj.compute(cr, uid, company_currency_id, + st_line.account_id.currency_id.id, amount, context=context, + account=acc_cur) + val['amount_currency'] = amount_cur + + move_line_id = account_move_line_obj.create(cr, uid, val , context=context) + torec.append(move_line_id) + + # Fill the secondary amount/currency + # if currency is not the same than the company + amount_currency = False + currency_id = False + if st.currency.id <> company_currency_id: + amount_currency = st_line.amount + currency_id = st.currency.id + account_move_line_obj.create(cr, uid, { + 'name': st_line.name, + 'date': st_line.date, + 'ref': st_line.ref, + 'move_id': move_id, + 'partner_id': ((st_line.partner_id) and st_line.partner_id.id) or False, + 'account_id': account_id, + 'credit': ((amount < 0) and -amount) or 0.0, + 'debit': ((amount > 0) and amount) or 0.0, + 'statement_id': st.id, + 'journal_id': st.journal_id.id, + 'period_id': st.period_id.id, + 'amount_currency': amount_currency, + 'currency_id': currency_id, + }, context=context) + + for line in account_move_line_obj.browse(cr, uid, [x.id for x in + account_move_obj.browse(cr, uid, move_id, + context=context).line_id], + context=context): + if line.state <> 'valid': + raise osv.except_osv(_('Error !'), + _('Journal Item "%s" is not valid') % line.name) + + move_name = next_number + ' - ' + str(st_line.sequence) + account_move_obj.write(cr, uid, [move_id], {'name': move_name}) + # Bank statements will not consider boolean on journal entry_posted + account_move_obj.post(cr, uid, [move_id], context=context) + return move_id + + def button_confirm_bank(self, cr, uid, ids, context=None): + done = [] obj_seq = self.pool.get('ir.sequence') if context is None: context = {} - company_currency_id = res_users_obj.browse(cr, uid, uid, - context=context).company_id.currency_id.id for st in self.browse(cr, uid, ids, context): + company_currency_id = st.journal_id.company_id.currency_id.id if not st.state=='draft': continue @@ -245,181 +344,24 @@ class account_bank_statement(osv.osv): if not st.name == '/': next_number = st.name else: - next_number = obj_seq.get(cr, uid, 'account.bank.statement') + if st.journal_id.sequence_id: + c = {'fiscalyear_id': st.period_id.fiscalyear_id.id} + next_number = obj_seq.get_id(cr, uid, st.journal_id.sequence_id.id, context=c) + else: + next_number = obj_seq.get(cr, uid, 'account.bank.statement') for line in st.move_line_ids: if line.state <> 'valid': raise osv.except_osv(_('Error !'), _('The account entries lines are not in valid state.')) - # for bank.statement.lines - # In line we get reconcile_id on bank.ste.rec. - # in bank stat.rec we get line_new_ids on bank.stat.rec.line - for move in st.line_ids: - if move.analytic_account_id: + for st_line in st.line_ids: + if st_line.analytic_account_id: if not st.journal_id.analytic_journal_id: raise osv.except_osv(_('No Analytic Journal !'),_("You have to define an analytic journal on the '%s' journal!") % (st.journal_id.name,)) - - context.update({'date': move.date}) - move_id = account_move_obj.create(cr, uid, { - 'journal_id': st.journal_id.id, - 'period_id': st.period_id.id, - 'date': move.date, - }, context=context) - account_bank_statement_line_obj.write(cr, uid, [move.id], { - 'move_ids': [(4, move_id, False)] - }) - if not move.amount: + if not st_line.amount: continue - torec = [] - if move.amount >= 0: - account_id = st.journal_id.default_credit_account_id.id - else: - account_id = st.journal_id.default_debit_account_id.id - acc_cur = ((move.amount<=0) and st.journal_id.default_debit_account_id) or move.account_id - amount = res_currency_obj.compute(cr, uid, st.currency.id, - company_currency_id, move.amount, context=context, - account=acc_cur) - if move.reconcile_id and move.reconcile_id.line_new_ids: - for newline in move.reconcile_id.line_new_ids: - amount += newline.amount - - val = { - 'name': move.name, - 'date': move.date, - 'ref': move.ref, - 'move_id': move_id, - 'partner_id': ((move.partner_id) and move.partner_id.id) or False, - 'account_id': (move.account_id) and move.account_id.id, - 'credit': ((amount>0) and amount) or 0.0, - 'debit': ((amount<0) and -amount) or 0.0, - 'statement_id': st.id, - 'journal_id': st.journal_id.id, - 'period_id': st.period_id.id, - 'currency_id': st.currency.id, - 'analytic_account_id': move.analytic_account_id and move.analytic_account_id.id or False - } - - amount = res_currency_obj.compute(cr, uid, st.currency.id, - company_currency_id, move.amount, context=context, - account=acc_cur) - if st.currency.id <> company_currency_id: - amount_cur = res_currency_obj.compute(cr, uid, company_currency_id, - st.currency.id, amount, context=context, - account=acc_cur) - val['amount_currency'] = -amount_cur - - if move.account_id and move.account_id.currency_id and move.account_id.currency_id.id <> company_currency_id: - val['currency_id'] = move.account_id.currency_id.id - if company_currency_id==move.account_id.currency_id.id: - amount_cur = move.amount - else: - amount_cur = res_currency_obj.compute(cr, uid, company_currency_id, - move.account_id.currency_id.id, amount, context=context, - account=acc_cur) - val['amount_currency'] = amount_cur - - move_line_id = account_move_line_obj.create(cr, uid, val , context=context) - torec.append(move_line_id) - - if move.analytic_account_id: - anal_val = {} - amt = (val['credit'] or 0.0) - (val['debit'] or 0.0) - anal_val = { - 'name': val['name'], - 'ref': val['ref'], - 'date': val['date'], - 'amount': amt, - 'account_id': val['analytic_account_id'], - 'currency_id': val['currency_id'], - 'general_account_id': val['account_id'], - 'journal_id': st.journal_id.analytic_journal_id.id, - 'period_id': val['period_id'], - 'user_id': uid, - 'move_id': move_line_id - } - if val.get('amount_currency', False): - anal_val['amount_currency'] = val['amount_currency'] - account_analytic_line_obj.create(cr, uid, anal_val, context=context) - - if move.reconcile_id and move.reconcile_id.line_new_ids: - for newline in move.reconcile_id.line_new_ids: - account_move_line_obj.create(cr, uid, { - 'name': newline.name or move.name, - 'date': move.date, - 'ref': move.ref, - 'move_id': move_id, - 'partner_id': ((move.partner_id) and move.partner_id.id) or False, - 'account_id': (newline.account_id) and newline.account_id.id, - 'debit': newline.amount>0 and newline.amount or 0.0, - 'credit': newline.amount<0 and -newline.amount or 0.0, - 'statement_id': st.id, - 'journal_id': st.journal_id.id, - 'period_id': st.period_id.id, - 'analytic_account_id':newline.analytic_id and newline.analytic_id.id or False, - - }, context=context) - - # Fill the secondary amount/currency - # if currency is not the same than the company - amount_currency = False - currency_id = False - if st.currency.id <> company_currency_id: - amount_currency = move.amount - currency_id = st.currency.id - account_move_line_obj.create(cr, uid, { - 'name': move.name, - 'date': move.date, - 'ref': move.ref, - 'move_id': move_id, - 'partner_id': ((move.partner_id) and move.partner_id.id) or False, - 'account_id': account_id, - 'credit': ((amount < 0) and -amount) or 0.0, - 'debit': ((amount > 0) and amount) or 0.0, - 'statement_id': st.id, - 'journal_id': st.journal_id.id, - 'period_id': st.period_id.id, - 'amount_currency': amount_currency, - 'currency_id': currency_id, - }, context=context) - - for line in account_move_line_obj.browse(cr, uid, [x.id for x in - account_move_obj.browse(cr, uid, move_id, - context=context).line_id], - context=context): - if line.state <> 'valid': - raise osv.except_osv(_('Error !'), - _('Journal Item "%s" is not valid') % line.name) - - if move.reconcile_id and move.reconcile_id.line_ids: - ## Search if move has already a partial reconciliation - previous_partial = False - for line_reconcile_move in move.reconcile_id.line_ids: - if line_reconcile_move.reconcile_partial_id: - previous_partial = True - break - ## - torec += map(lambda x: x.id, move.reconcile_id.line_ids) - #try: - if abs(move.reconcile_amount-move.amount)<0.0001: - - writeoff_acc_id = False - #There should only be one write-off account! - for entry in move.reconcile_id.line_new_ids: - writeoff_acc_id = entry.account_id.id - break - ## If we have already a partial reconciliation - ## We need to make a partial reconciliation - ## To add this amount to previous paid amount - if previous_partial: - account_move_line_obj.reconcile_partial(cr, uid, torec, 'statement', context) - ## If it's the first reconciliation, we do a full reconciliation as regular - else: - account_move_line_obj.reconcile(cr, uid, torec, 'statement', writeoff_acc_id=writeoff_acc_id, writeoff_period_id=st.period_id.id, writeoff_journal_id=st.journal_id.id, context=context) - else: - account_move_line_obj.reconcile_partial(cr, uid, torec, 'statement', context) - move_name = next_number + ' - ' + str(move.sequence) - account_move_obj.write(cr, uid, [move_id], {'name': move_name, 'state': 'posted'}) # Bank statements will not consider boolean on journal entry_posted + self.create_move_from_st_line(cr, uid, st_line, company_currency_id, next_number, context) self.log(cr, uid, st.id, 'Statement %s is confirmed and entries are created.' % st.name) done.append(st.id) @@ -474,175 +416,6 @@ class account_bank_statement(osv.osv): account_bank_statement() -class account_bank_statement_reconcile(osv.osv): - _name = "account.bank.statement.reconcile" - _description = "Statement Reconcile" - - def _total_entry(self, cursor, user, ids, name, attr, context=None): - result = {} - for o in self.browse(cursor, user, ids, context=context): - result[o.id] = 0.0 - for line in o.line_ids: - result[o.id] += line.debit - line.credit - return result - - def _total_new(self, cursor, user, ids, name, attr, context=None): - result = {} - for o in self.browse(cursor, user, ids, context=context): - result[o.id] = 0.0 - for line in o.line_new_ids: - result[o.id] += line.amount - return result - - def _total_balance(self, cursor, user, ids, name, attr, context=None): - result = {} - for o in self.browse(cursor, user, ids, context=context): - result[o.id] = o.total_new - o.total_entry + o.total_amount - return result - - def _total_amount(self, cursor, user, ids, name, attr, context=None): - res = {} - res_currency_obj = self.pool.get('res.currency') - res_users_obj = self.pool.get('res.users') - - company_currency_id = res_users_obj.browse(cursor, user, user, - context=context).company_id.currency_id.id - currency_id = context.get('currency_id', company_currency_id) - - acc_cur = None - if context.get('journal_id', False) and context.get('account_id',False): - st =self.pool.get('account.journal').browse(cursor, user, context['journal_id']) - acc = self.pool.get('account.account').browse(cursor, user, context['account_id']) - acc_cur = (( context.get('amount',0.0)<=0) and st.default_debit_account_id) or acc - - for reconcile_id in ids: - res[reconcile_id] = res_currency_obj.compute(cursor, user, - currency_id, company_currency_id, - context.get('amount', 0.0), context=context, account=acc_cur) - return res - - def _default_amount(self, cursor, user, context=None): - if context is None: - context = {} - res_currency_obj = self.pool.get('res.currency') - res_users_obj = self.pool.get('res.users') - - company_currency_id = res_users_obj.browse(cursor, user, user, - context=context).company_id.currency_id.id - currency_id = context.get('currency_id', company_currency_id) - - acc_cur = None - if context.get('journal_id', False) and context.get('account_id',False): - st =self.pool.get('account.journal').browse(cursor, user, context['journal_id']) - acc = self.pool.get('account.account').browse(cursor, user, context['account_id']) - acc_cur = (( context.get('amount',0.0)<=0) and st.default_debit_account_id) or acc - - return res_currency_obj.compute(cursor, user, - currency_id, company_currency_id, - context.get('amount', 0.0), context=context, account=acc_cur) - - def _total_currency(self, cursor, user, ids, name, attrs, context=None): - res = {} - res_users_obj = self.pool.get('res.users') - - company_currency_id = res_users_obj.browse(cursor, user, user, - context=context).company_id.currency_id.id - - for reconcile_id in ids: - res[reconcile_id] = company_currency_id - return res - - def _default_currency(self, cursor, user, context=None): - res_users_obj = self.pool.get('res.users') - - return res_users_obj.browse(cursor, user, user, - context=context).company_id.currency_id.id - - - def _total_second_amount(self, cursor, user, ids, name, attr, - context=None): - res = {} - for reconcile_id in ids: - res[reconcile_id] = context.get('amount', 0.0) - return res - - def _total_second_currency(self, cursor, user, ids, name, attr, context=None): - res = {} - for reconcile_id in ids: - res[reconcile_id] = context.get('currency_id', False) - return res - - def name_get(self, cursor, user, ids, context=None): - res= [] - for o in self.browse(cursor, user, ids, context=context): - result = 0.0 - res_currency = '' - for line in o.line_ids: - if line.amount_currency and line.currency_id: - result += line.amount_currency - res_currency = line.currency_id.code - else: - result += line.debit - line.credit - if res_currency: - res_currency = ' ' + res_currency - res.append((o.id, '[%.2f'% (result - o.total_new,) + res_currency + ']' )) - return res - - _columns = { - 'name': fields.char('Date', size=64, required=True), - 'partner_id': fields.many2one('res.partner', 'Partner', readonly=True), - 'line_new_ids': fields.one2many('account.bank.statement.reconcile.line', - 'line_id', 'Write-Off'), - 'total_entry': fields.function(_total_entry, method=True, - string='Total entries'), - 'total_new': fields.function(_total_new, method=True, - string='Total write-off'), - 'total_second_amount': fields.function(_total_second_amount, - method=True, string='Payment amount', - help='The amount in the currency of the journal'), - 'total_second_currency': fields.function(_total_second_currency, method=True, - string='Currency', type='many2one', relation='res.currency', - help='The currency of the journal'), - 'total_amount': fields.function(_total_amount, method=True, - string='Payment amount'), - 'total_currency': fields.function(_total_currency, method=True, - string='Currency', type='many2one', relation='res.currency'), - 'total_balance': fields.function(_total_balance, method=True, - string='Balance'), - #line_ids define in account.py - 'statement_line': fields.one2many('account.bank.statement.line', - 'reconcile_id', 'Bank Statement Line'), - } - _defaults = { - 'name': lambda *a: time.strftime('%Y-%m-%d'), - 'partner_id': lambda obj, cursor, user, context=None: \ - context.get('partner', False), - 'total_amount': _default_amount, - 'total_currency': _default_currency, - 'total_second_amount': lambda obj, cursor, user, context=None: \ - context.get('amount', 0.0), - 'total_second_currency': lambda obj, cursor, user, context=None: \ - context.get('currency_id', False), - 'total_balance': _default_amount, - } -account_bank_statement_reconcile() - -class account_bank_statement_reconcile_line(osv.osv): - _name = "account.bank.statement.reconcile.line" - _description = "Statement reconcile line" - _columns = { - 'name': fields.char('Description', size=64, required=True), - 'account_id': fields.many2one('account.account', 'Account', required=True), - 'line_id': fields.many2one('account.bank.statement.reconcile', 'Reconcile'), - 'amount': fields.float('Amount', required=True), - 'analytic_id': fields.many2one('account.analytic.account',"Analytic Account", domain=[('parent_id', '!=', False)]) - } - _defaults = { - 'name': 'Write-Off', - } -account_bank_statement_reconcile_line() - - class account_bank_statement_line(osv.osv): def onchange_partner_id(self, cursor, user, line_id, partner_id, type, currency_id, context=None): @@ -683,25 +456,6 @@ class account_bank_statement_line(osv.osv): res['value']['amount'] = balance return res - def _reconcile_amount(self, cursor, user, ids, name, args, context=None): - if not ids: - return {} - res_currency_obj = self.pool.get('res.currency') - res_users_obj = self.pool.get('res.users') - - res = {} - company_currency_id = res_users_obj.browse(cursor, user, user, - context=context).company_id.currency_id.id - - for line in self.browse(cursor, user, ids, context=context): - if line.reconcile_id: - res[line.id] = res_currency_obj.compute(cursor, user, - company_currency_id, line.statement_id.currency.id, - line.reconcile_id.total_entry, context=context) - else: - res[line.id] = 0.0 - return res - _order = "statement_id desc, sequence" _name = "account.bank.statement.line" _description = "Bank Statement Line" @@ -719,16 +473,12 @@ class account_bank_statement_line(osv.osv): required=True), 'statement_id': fields.many2one('account.bank.statement', 'Statement', select=True, required=True, ondelete='cascade'), - 'reconcile_id': fields.many2one('account.bank.statement.reconcile', - 'Reconcile'), 'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account'), 'move_ids': fields.many2many('account.move', 'account_bank_statement_line_move_rel', 'move_id','statement_id', 'Moves'), 'ref': fields.char('Reference', size=32), 'note': fields.text('Notes'), - 'reconcile_amount': fields.function(_reconcile_amount, - string='Amount reconciled', method=True, type='float'), 'sequence': fields.integer('Sequence', help="Gives the sequence order when displaying a list of bank statement lines."), 'company_id': fields.related('statement_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True), } diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index 8cdb20aa225..2fd80348404 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -270,7 +270,7 @@ class account_cash_statement(osv.osv): super(account_cash_statement, self).write(cr, uid, [rs], res.get(rs)) return True - def onchange_journal_id(self, cr, uid, statement_id, journal_id, context={}): + def onchange_journal_id(self, cr, uid, statement_id, journal_id, context=None): """ Changes balance start and starting details if journal_id changes" @param statement_id: Changed statement_id @param journal_id: Changed journal_id @@ -288,7 +288,7 @@ class account_cash_statement(osv.osv): 'balance_start': balance_start }) return res - res = super(account_cash_statement, self).onchange_journal_id(cr, uid, statement_id, journal_id, context) + res = super(account_cash_statement, self).onchange_journal_id(cr, uid, statement_id, journal_id, context=context) return res def _equal_balance(self, cr, uid, ids, statement, context={}): @@ -454,25 +454,25 @@ class account_cash_statement(osv.osv): move_line_id = account_move_line_obj.create(cr, uid, val , context=context) torec.append(move_line_id) - if move.analytic_account_id: - anal_val = {} - amt = (val['credit'] or 0.0) - (val['debit'] or 0.0) - anal_val = { - 'name': val['name'], - 'ref': val['ref'], - 'date': val['date'], - 'amount': amt, - 'account_id': val['analytic_account_id'], - 'currency_id': val['currency_id'], - 'general_account_id': val['account_id'], - 'journal_id': st.journal_id.analytic_journal_id.id, - 'period_id': val['period_id'], - 'user_id': uid, - 'move_id': move_line_id - } - if val.get('amount_currency', False): - anal_val['amount_currency'] = val['amount_currency'] - account_analytic_line_obj.create(cr, uid, anal_val, context=context) +# if move.analytic_account_id: +# anal_val = {} +# amt = (val['credit'] or 0.0) - (val['debit'] or 0.0) +# anal_val = { +# 'name': val['name'], +# 'ref': val['ref'], +# 'date': val['date'], +# 'amount': amt, +# 'account_id': val['analytic_account_id'], +# 'currency_id': val['currency_id'], +# 'general_account_id': val['account_id'], +# 'journal_id': st.journal_id.analytic_journal_id.id, +# 'period_id': val['period_id'], +# 'user_id': uid, +# 'move_id': move_line_id +# } +# if val.get('amount_currency', False): +# anal_val['amount_currency'] = val['amount_currency'] +# account_analytic_line_obj.create(cr, uid, anal_val, context=context) if move.reconcile_id and move.reconcile_id.line_new_ids: for newline in move.reconcile_id.line_new_ids: 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_invoice_view.xml b/addons/account/account_invoice_view.xml index 81391e796b9..aeb9a7112ec 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -150,7 +150,7 @@
- + @@ -161,14 +161,14 @@ - + - + @@ -221,7 +221,6 @@ - @@ -260,7 +259,7 @@ - + @@ -271,14 +270,14 @@ - + - + @@ -316,7 +315,7 @@ - + diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 990dd277d65..bb208e4e231 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -131,7 +131,8 @@ class account_move_line(osv.osv): 'general_account_id': obj_line.account_id.id, 'journal_id': obj_line.journal_id.analytic_journal_id.id, 'ref': obj_line.ref, - 'move_id':obj_line.id + 'move_id':obj_line.id, + 'user_id': uid } new_id = self.pool.get('account.analytic.line').create(cr,uid,vals_lines) return True @@ -1181,6 +1182,7 @@ class account_move_line(osv.osv): 'general_account_id': vals.get('account_id', False), 'journal_id': journal.analytic_journal_id.id, 'ref': vals.get('ref', False), + 'user_id': uid })] result = super(osv.osv, self).create(cr, uid, vals, context) @@ -1257,13 +1259,5 @@ class account_move_line(osv.osv): return result account_move_line() - -class account_bank_statement_reconcile(osv.osv): - _inherit = "account.bank.statement.reconcile" - _columns = { - 'line_ids': fields.many2many('account.move.line', 'account_bank_statement_line_rel', 'statement_id', 'line_id', 'Entries'), - } -account_bank_statement_reconcile() - # vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index bcd5d8b233b..40f8fd277a8 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -521,7 +521,7 @@ attrs="{'invisible':[('state','=','confirm')]}"/> - + @@ -533,8 +533,6 @@ - - @@ -544,7 +542,6 @@ - @@ -552,7 +549,7 @@ - + @@ -657,38 +654,6 @@
- - account.bank.statement.reconcile.form - account.bank.statement.reconcile - form - -
- - - - - - - - - - - - - - - - - - - - - -