From 4d4491902601af645d81022c5537a7515c37ccf1 Mon Sep 17 00:00:00 2001 From: "PAP(OpenERP)" <> Date: Sat, 14 Aug 2010 16:00:45 +0530 Subject: [PATCH] [IMP] Account correct entries analysis, other misc changes bzr revid: mra@mra-laptop-20100814103045-m7tkki6fjl843ft1 --- addons/account/account.py | 90 +++++++++---------- addons/account/account_move_line.py | 4 +- addons/account/account_view.xml | 20 ++--- addons/account/project/project_view.xml | 2 +- .../report/account_account_report_view.xml | 2 +- .../report/account_analytic_report_view.xml | 2 +- .../account/report/account_entries_report.py | 3 + .../report/account_entries_report_view.xml | 29 +++--- addons/account/wizard/account_move_journal.py | 2 +- .../wizard/account_move_journal_view.xml | 6 +- .../wizard/account_subscription_generate.py | 14 ++- .../account_subscription_generate_view.xml | 4 +- 12 files changed, 93 insertions(+), 85 deletions(-) diff --git a/addons/account/account.py b/addons/account/account.py index 855cd42cd25..8e1dc4a403e 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -647,7 +647,7 @@ class account_journal(osv.osv): 'user_id': lambda self,cr,uid,context: uid, 'company_id': lambda self,cr,uid,c: self.pool.get('res.users').browse(cr, uid, uid, c).company_id.id, } - + def write(self, cr, uid, ids, vals, context=None): obj=[] if 'company_id' in vals: @@ -673,21 +673,21 @@ class account_journal(osv.osv): 'purchase_refund':'seq_out_refund', 'sale_refund':'seq_in_refund' } - + seq_pool = self.pool.get('ir.sequence') seq_typ_pool = self.pool.get('ir.sequence.type') date_pool = self.pool.get('ir.model.data') - + result = True - + journal = self.browse(cr, uid, ids[0], context) - code = journal.code.lower() + code = journal.code.lower() types = { 'name':journal.name, 'code':code } type_id = seq_typ_pool.create(cr, uid, types) - + seq = { 'name':journal.name, 'code':code, @@ -697,7 +697,7 @@ class account_journal(osv.osv): 'number_increment':1 } seq_id = seq_pool.create(cr, uid, seq) - + res = {} if not journal.sequence_id: res.update({ @@ -711,11 +711,11 @@ class account_journal(osv.osv): res.update({ 'invoice_sequence_id':inv_seq_id }) - + result = self.write(cr, uid, [journal.id], res) - + return result - + def create(self, cr, uid, vals, context={}): journal_id = super(account_journal, self).create(cr, uid, vals, context) self.create_sequence(cr, uid, [journal_id], context) @@ -738,7 +738,7 @@ class account_journal(osv.osv): if context.get('journal_type', False): args += [('type','=',context.get('journal_type'))] - + if name: ids = self.search(cr, user, [('code','ilike',name)]+ args, limit=limit, context=context) if not ids: @@ -749,7 +749,7 @@ class account_journal(osv.osv): def onchange_type(self, cr, uid, ids, type, currency): data_pool = self.pool.get('ir.model.data') user_pool = self.pool.get('res.users') - + type_map = { 'sale':'account_sp_journal_view', 'sale_refund':'account_sp_refund_journal_view', @@ -761,23 +761,23 @@ class account_journal(osv.osv): 'general':'account_journal_view', 'situation':'account_journal_view' } - + res = {} - + view_id = type_map.get(type, 'general') - + user = user_pool.browse(cr, uid, uid) if type in ('cash', 'bank') and currency and user.company_id.currency_id.id != currency: view_id = 'account_journal_bank_view_multi' - + data_id = data_pool.search(cr, uid, [('model','=','account.journal.view'), ('name','=',view_id)]) data = data_pool.browse(cr, uid, data_id[0]) - + res.update({ 'centralisation':type == 'situation', 'view_id':data.res_id, }) - + return { 'value':res } @@ -1035,31 +1035,31 @@ class account_move(osv.osv): """ Returns a list of tupples containing id, name, as internally it is called {def name_get} result format : {[(id, name), (id, name), ...]} - + @param cr: A database cursor @param user: ID of the user currently logged in - @param name: name to search + @param name: name to search @param args: other arguments @param operator: default operator is 'ilike', it can be changed @param context: context arguments, like lang, time zone @param limit: Returns first 'n' ids of complete result, default is 80. - + @return: Returns a list of tupples containing id and name """ - + if not args: args=[] if not context: context={} ids = [] - + if name: ids += self.search(cr, user, [('name','=',name)], limit=limit) if not ids: ids += self.search(cr, user, [('id','=',name)], limit=limit) - + return self.name_get(cr, user, ids, context=context) - + def name_get(self, cursor, user, ids, context=None): if not len(ids): return [] @@ -1159,7 +1159,7 @@ class account_move(osv.osv): 'You cannot create entries on different periods/journals in the same move', ['line_id']), ] - + def post(self, cr, uid, ids, context=None): if self.validate(cr, uid, ids, context) and len(ids): for move in self.browse(cr, uid, ids): @@ -1218,7 +1218,7 @@ class account_move(osv.osv): 'balance':False, 'account_tax_id':False, }) - + if 'journal_id' in vals and vals.get('journal_id', False): for l in vals['line_id']: if not l[0]: @@ -1667,15 +1667,15 @@ class account_tax(osv.osv): """ Returns a list of tupples containing id, name, as internally it is called {def name_get} result format : {[(id, name), (id, name), ...]} - + @param cr: A database cursor @param user: ID of the user currently logged in - @param name: name to search + @param name: name to search @param args: other arguments @param operator: default operator is 'ilike', it can be changed @param context: context arguments, like lang, time zone @param limit: Returns first 'n' ids of complete result, default is 80. - + @return: Returns a list of tupples containing id and name """ if not args: @@ -1685,10 +1685,10 @@ class account_tax(osv.osv): ids = [] ids = self.search(cr, user, args, limit=limit, context=context) return self.name_get(cr, user, ids, context=context) - + def search(self, cr, uid, args, offset=0, limit=None, order=None, context=None, count=False): journal_pool = self.pool.get('account.journal') - + if context and context.has_key('type'): if context.get('type') in ('out_invoice','out_refund'): args += [('type_tax_use','in',['sale','all'])] @@ -1699,7 +1699,7 @@ class account_tax(osv.osv): journal = journal_pool.browse(cr, uid, context.get('journal_id')) if journal.type in ('sale', 'purchase'): args += [('type_tax_use','in',[journal.type,'all'])] - + return super(account_tax, self).search(cr, uid, args, offset, limit, order, context, count) def name_get(self, cr, uid, ids, context={}): @@ -1716,7 +1716,7 @@ class account_tax(osv.osv): if user.company_id: return user.company_id.id return self.pool.get('res.company').search(cr, uid, [('parent_id', '=', False)])[0] - + _defaults = { 'python_compute': lambda *a: '''# price_unit\n# address : res.partner.address object or False\n# product : product.product object or None\n# partner : res.partner object or None\n\nresult = price_unit * 0.10''', 'python_compute_inv': lambda *a: '''# price_unit\n# address : res.partner.address object or False\n# product : product.product object or False\n\nresult = price_unit * 0.10''', @@ -1836,11 +1836,11 @@ class account_tax(osv.osv): tin = self.compute_inv(cr, uid, tin, price_unit, quantity, address_id=address_id, product=product, partner=partner) for r in tin: totalex -= r['amount'] - totlex_qty=0.0 + totlex_qty=0.0 try: totlex_qty=totalex/quantity except: - pass + pass tex = self._compute(cr, uid, tex, totlex_qty, quantity, address_id=address_id, product=product, partner=partner) for r in tex: totalin += r['amount'] @@ -2146,11 +2146,10 @@ class account_subscription_line(osv.osv): 'date': fields.date('Date', required=True), 'move_id': fields.many2one('account.move', 'Entry'), } - _defaults = { - } - def move_create(self, cr, uid, ids, context={}): + + def move_create(self, cr, uid, ids, context=None): tocheck = {} - for line in self.browse(cr, uid, ids, context): + for line in self.browse(cr, uid, ids, context=context): datas = { 'date': line.date, } @@ -2159,7 +2158,8 @@ class account_subscription_line(osv.osv): self.write(cr, uid, [line.id], {'move_id':ids[0]}) if tocheck: self.pool.get('account.subscription').check(cr, uid, tocheck.keys(), context) - return True + return ids + _rec_name = 'date' account_subscription_line() @@ -2623,7 +2623,7 @@ class wizard_multi_charts_accounts(osv.osv_memory): data_id = data_pool.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_sp_journal_view')]) data = data_pool.browse(cr, uid, data_id[0]) view_id = data.res_id - + seq_id = obj_sequence.search(cr, uid, [('name','=','Account Journal')])[0] if obj_multi.seq_journal: @@ -2664,7 +2664,7 @@ class wizard_multi_charts_accounts(osv.osv_memory): data_id = data_pool.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_journal_bank_view')]) data = data_pool.browse(cr, uid, data_id[0]) view_id_cash = data.res_id - + data_id = data_pool.search(cr, uid, [('model','=','account.journal.view'), ('name','=','account_journal_bank_view_multi')]) data = data_pool.browse(cr, uid, data_id[0]) ref_acc_bank = data.res_id @@ -2739,7 +2739,7 @@ class wizard_multi_charts_accounts(osv.osv_memory): 'fields_id': field[0], 'value': account and 'account.account,'+str(acc_template_ref[account.id]) or False, } - + if r: #the property exist: modify it property_obj.write(cr, uid, r, vals) @@ -2776,7 +2776,7 @@ class wizard_multi_charts_accounts(osv.osv_memory): 'position_id' : new_fp, } obj_ac_fp.create(cr, uid, vals_acc) - + #fially inactive the demo chart of accounts data_id = data_pool.search(cr, uid, [('model','=','account.account'), ('name','=','chart0')]) if data_id: diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 5b612d187d3..30e40f56a7c 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -855,8 +855,8 @@ class account_move_line(osv.osv): journal_list = journal_pool.name_search(cr, uid, '', [], context=context) result['fields']['journal_id']['selection'] = journal_list return result - - if not context.get('view_mode', False): + + if context.get('view_mode', False): return result fld = [] diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index e848de5cfd5..4eba06cb173 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -898,9 +898,9 @@ - - + + @@ -1094,7 +1094,6 @@ account.move.line form tree,form - @@ -1518,15 +1517,16 @@ - - + + + + /> tree You can look up individual account entries by searching for useful information. To search for account entries, open a journal, then select a record line. - + - + account.analytic.line.form diff --git a/addons/account/report/account_account_report_view.xml b/addons/account/report/account_account_report_view.xml index bd9101a3382..521fe37ff4b 100644 --- a/addons/account/report/account_account_report_view.xml +++ b/addons/account/report/account_account_report_view.xml @@ -88,7 +88,7 @@ - + diff --git a/addons/account/report/account_analytic_report_view.xml b/addons/account/report/account_analytic_report_view.xml index 070b3a8c10a..cb7318fe3e4 100644 --- a/addons/account/report/account_analytic_report_view.xml +++ b/addons/account/report/account_analytic_report_view.xml @@ -122,7 +122,7 @@ {'search_default_This Month':1,'search_default_User':1,'group_by_no_leaf':1,'group_by':[]} - + diff --git a/addons/account/report/account_entries_report.py b/addons/account/report/account_entries_report.py index a40705fd83f..0aebe500c6f 100644 --- a/addons/account/report/account_entries_report.py +++ b/addons/account/report/account_entries_report.py @@ -51,6 +51,7 @@ class account_entries_report(osv.osv): help='When new account move is created the state will be \'Draft\'. When all the payments are done it will be in \'Posted\' state.'), 'state_2': fields.selection([('draft','Draft'), ('valid','Valid')], 'State of Move Line', readonly=True, help='When new move line is created the state will be \'Draft\'.\n* When all the payments are done it will be in \'Valid\' state.'), + 'reconcile_id': fields.many2one('account.move.reconcile', readonly=True), 'partner_id': fields.many2one('res.partner','Partner', readonly=True), 'analytic_account_id' : fields.many2one('account.analytic.account', 'Analytic Account', readonly=True), 'quantity': fields.float('Products Quantity', digits=(16,2), readonly=True), @@ -81,6 +82,7 @@ class account_entries_report(osv.osv): am.ref as ref, am.state as state, l.state as state_2, + l.reconcile_id as reconcile_id, to_char(am.date, 'YYYY') as year, to_char(am.date, 'MM') as month, to_char(am.date, 'YYYY-MM-DD') as day, @@ -104,6 +106,7 @@ class account_entries_report(osv.osv): left join account_account a on (l.account_id = a.id) left join account_move am on (am.id=l.move_id) left join account_period p on (am.period_id=p.id) + where l.state != 'draft' ) """) account_entries_report() diff --git a/addons/account/report/account_entries_report_view.xml b/addons/account/report/account_entries_report_view.xml index 6db0d9ce8d7..6259466bd2a 100644 --- a/addons/account/report/account_entries_report_view.xml +++ b/addons/account/report/account_entries_report_view.xml @@ -17,7 +17,6 @@ - @@ -26,7 +25,6 @@ - @@ -54,23 +52,24 @@ - - + - + help="Entries created in this period"/> + + + + + @@ -89,9 +88,6 @@ - - - @@ -103,7 +99,6 @@ - @@ -122,7 +117,7 @@ account.entries.report form tree,graph - {'search_default_profit': 1,'search_default_group_account':1,'search_default_group_month': 1, 'group_by_no_leaf':1,'group_by':[]} + {'search_default_profit': 1,'search_default_group_account':1,'search_default_group_journal':1,'search_default_group_month': 1, 'group_by_no_leaf':1,'group_by':[], 'search_default_year':1, 'search_default_period':1} A tool search lets you know statistics on your different financial accounts that match your needs. diff --git a/addons/account/wizard/account_move_journal.py b/addons/account/wizard/account_move_journal.py index 84b152f95ec..79f41ec2d46 100644 --- a/addons/account/wizard/account_move_journal.py +++ b/addons/account/wizard/account_move_journal.py @@ -87,7 +87,7 @@ class account_move_journal(osv.osv_memory): view = """
- +