diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index 5ba019b5621..f06123487e2 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -114,8 +114,6 @@ module named account_voucher. 'report/account_invoice_report_view.xml', 'report/account_entries_report_view.xml', 'report/account_report_view.xml', - 'report/account_analytic_report_view.xml', - 'report/account_account_report_view.xml', 'report/account_analytic_entries_report_view.xml', 'board_account_view.xml', "wizard/account_report_profit_loss_view.xml", diff --git a/addons/account/account.py b/addons/account/account.py index 17237211581..0dc079e2891 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -631,7 +631,7 @@ class account_journal(osv.osv): 'default_debit_account_id': fields.many2one('account.account', 'Default Debit Account', domain="[('type','!=','view')]", help="It acts as a default account for debit amount"), 'centralisation': fields.boolean('Centralised counterpart', help="Check this box to determine that each entry of this journal won't create a new counterpart but will share the same counterpart. This is used in fiscal year closing."), 'update_posted': fields.boolean('Allow Cancelling Entries', help="Check this box if you want to allow the cancellation the entries related to this journal or of the invoice related to this journal"), - 'group_invoice_lines': fields.boolean('Group invoice lines', help="If this box is checked, the system will try to group the accounting lines when generating them from invoices."), + 'group_invoice_lines': fields.boolean('Group Invoice Lines', help="If this box is checked, the system will try to group the accounting lines when generating them from invoices."), 'sequence_id': fields.many2one('ir.sequence', 'Entry Sequence', help="The sequence gives the display order for a list of journals", required=False), 'user_id': fields.many2one('res.users', 'User', help="The user responsible for this journal"), 'groups_id': fields.many2many('res.groups', 'account_journal_group_rel', 'journal_id', 'group_id', 'Groups'), diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 8a8f5556aff..6ddea9645b4 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -131,7 +131,7 @@ class account_bank_statement(osv.osv): _name = "account.bank.statement" _description = "Bank Statement" _columns = { - 'name': fields.char('Name', size=64, required=True, states={'confirm': [('readonly', True)]}), + 'name': fields.char('Name', size=64, required=True, help='if you give the Name other then /, its created Accounting Entries Move will be with same name as statement name. This allows the statement entries to have the same references than the statement itself', states={'confirm': [('readonly', True)]}), 'date': fields.date('Date', required=True, states={'confirm': [('readonly', True)]}), 'journal_id': fields.many2one('account.journal', 'Journal', required=True, states={'confirm': [('readonly', True)]}, domain=[('type', '=', 'bank')]), @@ -195,15 +195,17 @@ class account_bank_statement(osv.osv): self.write(cr, uid, ids, {}, context) return True - def button_confirm_bank(self, cr, uid, ids, context={}): + def button_confirm_bank(self, cr, uid, ids, context=None): done = [] 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_bank_statement_line_obj = \ - self.pool.get('account.bank.statement.line') + account_bank_statement_line_obj = self.pool.get('account.bank.statement.line') + 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 @@ -369,13 +371,16 @@ class account_bank_statement(osv.osv): # raise osv.except_osv(_('Error !'), _('Unable to reconcile entry "%s": %.2f') % (move.name, move.amount)) if st.journal_id.entry_posted: - account_move_obj.write(cr, uid, [move_id], {'state':'posted'}) + account_move_obj.write(cr, uid, [move_id], {'state': 'posted'}) self.log(cr, uid, st.id, 'Statement %s is confirmed and entries are created.' % st.name) done.append(st.id) - next_number = self.pool.get('ir.sequence').get(cr, uid, 'account.bank.statement') - self.write(cr, uid, [st.id], {'name':next_number}, context) + next_number = obj_seq.get(cr, uid, 'account.bank.statement') + if not st.name == '/': + next_number = st.name + '/' + next_number[-1:] + account_move_obj.write(cr, uid, [move_id], {'state': 'posted', 'name': next_number}) + self.write(cr, uid, [st.id], {'name': next_number}, context=context) self.write(cr, uid, done, {'state':'confirm'}, context=context) return True @@ -647,7 +652,7 @@ class account_bank_statement_line(osv.osv): res[line.id] = 0.0 return res - _order = "date,name desc" + _order = "statement_id desc, sequence" _name = "account.bank.statement.line" _description = "Bank Statement Line" _columns = { diff --git a/addons/account/account_cash_statement.py b/addons/account/account_cash_statement.py index 572144ccf6c..f08f9de2f8f 100644 --- a/addons/account/account_cash_statement.py +++ b/addons/account/account_cash_statement.py @@ -210,7 +210,7 @@ class account_cash_statement(osv.osv): 'balance_end_cash': fields.function(_balance_end_cash, method=True, store=True, string='Balance', help="Closing balance based on cashBox"), 'starting_details_ids': fields.one2many('account.cashbox.line', 'starting_id', string='Opening Cashbox'), 'ending_details_ids': fields.one2many('account.cashbox.line', 'ending_id', string='Closing Cashbox'), - 'name': fields.char('Name', size=64, required=True, readonly=True), + 'name': fields.char('Name', size=64, required=True, readonly=False, help='if you give the Name other then / , its created Accounting Entries Move will be with same name as statement name. This allows the statement entries to have the same references than the statement itself'), 'user_id':fields.many2one('res.users', 'Responsible', required=False), } _defaults = { diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index 99575c08375..5bcd3b36815 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -507,7 +507,20 @@ - + + + diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 30e40f56a7c..b7bc7cb426f 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -146,7 +146,7 @@ class account_move_line(osv.osv): def convert_to_period(self, cr, uid, context={}): period_obj = self.pool.get('account.period') - + #check if the period_id changed in the context from client side if context.get('period_id', False): period_id = context.get('period_id') @@ -157,13 +157,13 @@ class account_move_line(osv.osv): }) return context - + def _default_get(self, cr, uid, fields, context={}): - + period_obj = self.pool.get('account.period') context = self.convert_to_period(cr, uid, context) - + # Compute simple values data = super(account_move_line, self).default_get(cr, uid, fields, context) # Starts: Manual entry from account.move form @@ -337,7 +337,7 @@ class account_move_line(osv.osv): invoice_id = res[line_id] res[line_id] = (invoice_id, invoice_names[invoice_id]) return res - + def name_get(self, cr, uid, ids, context={}): if not len(ids): return [] @@ -572,18 +572,18 @@ class account_move_line(osv.osv): if journal: jt = self.pool.get('account.journal').browse(cr, uid, journal).type #FIXME: Bank and cash journal are such a journal we can not assume a account based on this 2 journals - # Bank and cash journal can have a payment or receipt transection, and in both type partner account + # Bank and cash journal can have a payment or receipt transection, and in both type partner account # will not be same id payment then payable, and if receipt then receivable #if jt in ('sale', 'purchase_refund', 'bank', 'cash'): if jt in ('sale', 'purchase_refund'): val['account_id'] = self.pool.get('account.fiscal.position').map_account(cr, uid, part and part.property_account_position or False, id2) elif jt in ('purchase', 'sale_refund', 'expense', 'bank', 'cash'): val['account_id'] = self.pool.get('account.fiscal.position').map_account(cr, uid, part and part.property_account_position or False, id1) - + if val.get('account_id', False): d = self.onchange_account_id(cr, uid, ids, val['account_id']) val.update(d['value']) - + return {'value':val} def onchange_account_id(self, cr, uid, ids, account_id=False, partner_id=False): @@ -843,22 +843,23 @@ class account_move_line(osv.osv): def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): journal_pool = self.pool.get('account.journal') - + result = super(osv.osv, self).fields_view_get(cr, uid, view_id, view_type, context, toolbar=toolbar, submenu=submenu) if view_type != 'tree': #Remove the toolbar from the form view if view_type == 'form': - result['toolbar']['action'] = [] + if result.get('toolbar', False): + result['toolbar']['action'] = [] #Restrict the list of journal view in search view if view_type == 'search': journal_list = journal_pool.name_search(cr, uid, '', [], context=context) result['fields']['journal_id']['selection'] = journal_list return result - + if context.get('view_mode', False): return result - + fld = [] fields = {} flds = [] @@ -912,14 +913,14 @@ class account_move_line(osv.osv): attrs = [] if field == 'debit': attrs.append('sum="Total debit"') - + elif field == 'credit': attrs.append('sum="Total credit"') - + elif field == 'account_tax_id': attrs.append('domain="[(\'parent_id\',\'=\',False)]"') attrs.append("context=\"{'journal_id':journal_id}\"") - + elif field == 'account_id' and journal.id: attrs.append('domain="[(\'journal_id\', \'=\', '+str(journal.id)+'),(\'type\',\'<>\',\'view\'), (\'type\',\'<>\',\'closed\')]" on_change="onchange_account_id(account_id, partner_id)"') @@ -937,7 +938,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)"') - + 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 67576d406da..12ac88cfa62 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -605,11 +605,11 @@ - + -