diff --git a/addons/account/__openerp__.py b/addons/account/__openerp__.py index 39e40555f39..04f55566d40 100644 --- a/addons/account/__openerp__.py +++ b/addons/account/__openerp__.py @@ -18,8 +18,6 @@ # along with this program. If not, see . # ############################################################################## - - { "name" : "Accounting and Financial Management", "version" : "1.1", @@ -119,6 +117,8 @@ module named account_vouchers 'report/account_account_report_view.xml', 'report/account_analytic_entries_report_view.xml', 'board_account_view.xml', + "wizard/account_pl_report_view.xml", + "wizard/account_bs_report_view.xml" ], 'demo_xml': [ #'demo/price_accuracy00.yml', @@ -145,4 +145,4 @@ module named account_vouchers 'active': False, 'certificate': '0080331923549', } -# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: \ No newline at end of file +# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: diff --git a/addons/account/account.py b/addons/account/account.py index 06060f59e28..0abdd2af7e0 100644 --- a/addons/account/account.py +++ b/addons/account/account.py @@ -584,6 +584,9 @@ class account_journal_column(osv.osv): result = [] cols = self.pool.get('account.move.line')._columns for col in cols: + if col in ('period_id', 'journal_id'): + continue + result.append( (col, cols[col].string) ) result.sort() return result @@ -657,11 +660,9 @@ class account_journal(osv.osv): # }) return journal_id - def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=100): + def name_search(self, cr, user, name, args=None, operator='ilike', context={}, limit=100): if not args: args = [] - if context is None: - context = {} ids = [] if name: ids = self.search(cr, user, [('code','ilike',name)]+ args, limit=limit, context=context) @@ -832,7 +833,7 @@ class account_period(osv.osv): cr.execute('update account_period set state=%s where id=%s', (mode, id)) return True - def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80): + def name_search(self, cr, user, name, args=None, operator='ilike', context={}, limit=80): if args is None: args = [] if context is None: @@ -844,7 +845,7 @@ class account_period(osv.osv): ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit) return self.name_get(cr, user, ids, context=context) - def write(self, cr, uid, ids, vals, context=None): + def write(self, cr, uid, ids, vals, context={}): obj=[] if 'company_id' in vals: move_lines = self.pool.get('account.move.line').search(cr, uid, [('period_id', 'in', ids)]) @@ -1143,6 +1144,7 @@ class account_move(osv.osv): return amount def _centralise(self, cr, uid, move, mode, context=None): + assert(mode in ('debit', 'credit'), 'Invalid Mode') #to prevent sql injection if context is None: context = {} @@ -1190,10 +1192,7 @@ class account_move(osv.osv): else: line_id2 = 0 - cr.execute('SELECT SUM(%s) '\ - 'FROM account_move_line '\ - 'WHERE move_id=%s AND id<>%s', - (mode, move.id, line_id2)) + cr.execute('SELECT SUM(%s) FROM account_move_line WHERE move_id=%%s AND id!=%%s' % (mode,), (move.id, line_id2)) result = cr.fetchone()[0] or 0.0 cr.execute('update account_move_line set '+mode2+'=%s where id=%s', (result, line_id)) return True diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py index 6de3dabaa28..0e46944a436 100644 --- a/addons/account/account_bank_statement.py +++ b/addons/account/account_bank_statement.py @@ -45,7 +45,7 @@ class account_bank_statement(osv.osv): 'type': 'ir.actions.act_window', 'target': 'new', 'nodestroy': True - } + } def _default_journal_id(self, cr, uid, context={}): if context.get('journal_id', False): @@ -556,9 +556,9 @@ 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={}): + def onchange_partner_id(self, cursor, user, line_id, partner_id, type, currency_id, context={}): res = {'value': {}} + if not partner_id: return res line = self.browse(cursor, user, line_id) @@ -591,6 +591,10 @@ class account_bank_statement_line(osv.osv): balance = res_currency_obj.compute(cursor, user, company_currency_id, currency_id, balance, context=context) res['value']['amount'] = balance + + if context.get('amount', 0) > 0: + res['value']['amount'] = context.get('amount') + return res def _reconcile_amount(self, cursor, user, ids, name, args, context=None): diff --git a/addons/account/account_invoice_view.xml b/addons/account/account_invoice_view.xml index bceb1b3c857..fc10c58cc8f 100644 --- a/addons/account/account_invoice_view.xml +++ b/addons/account/account_invoice_view.xml @@ -349,11 +349,15 @@ + + - + + + @@ -363,7 +367,7 @@ - + diff --git a/addons/account/account_menuitem.xml b/addons/account/account_menuitem.xml index dd577f98458..48e0e27e59a 100644 --- a/addons/account/account_menuitem.xml +++ b/addons/account/account_menuitem.xml @@ -3,9 +3,9 @@ - - - + + + @@ -13,7 +13,7 @@ - + @@ -36,7 +36,7 @@ - diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index b8719f26242..272933018ad 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -788,57 +788,81 @@ class account_move_line(osv.osv): def fields_view_get(self, cr, uid, view_id=None, view_type='form', context={}, toolbar=False, submenu=False): result = super(osv.osv, self).fields_view_get(cr, uid, view_id,view_type,context,toolbar=toolbar, submenu=submenu) - if view_type=='tree' and 'journal_id' in context: - title = self.view_header_get(cr, uid, view_id, view_type, context) - journal = self.pool.get('account.journal').browse(cr, uid, context['journal_id']) + if view_type != 'tree': + return result - # if the journal view has a state field, color lines depending on - # its value - state = '' + fld = [] + fields = {} + flds = [] + title = self.view_header_get(cr, uid, view_id, view_type, context) + xml = '''\n\n\t''' % (title) + journal_pool = self.pool.get('account.journal') + + ids = journal_pool.search(cr, uid, []) + journals = journal_pool.browse(cr, uid, ids) + all_journal = [None] + for journal in journals: + all_journal.append(journal.id) for field in journal.view_id.columns_id: - if field.field=='state': - state = ' colors="red:state==\'draft\'"' - - #xml = '''\n\n\t''' % (title, state) - xml = '''\n\n\t''' % (title, state) - fields = [] - - widths = { - 'ref': 50, - 'statement_id': 50, - 'state': 60, - 'tax_code_id': 50, - 'move_id': 40, - } - for field in journal.view_id.columns_id: - fields.append(field.field) - attrs = [] - if field.field=='debit': - attrs.append('sum="Total debit"') - elif field.field=='credit': - attrs.append('sum="Total credit"') - elif field.field=='account_tax_id': - attrs.append('domain="[(\'parent_id\',\'=\',False)]"') - elif field.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)"') - elif field.field == 'partner_id': - attrs.append('on_change="onchange_partner_id(move_id,partner_id,account_id,debit,credit,date,((\'journal_id\' in context) and context[\'journal_id\']) or {})"') - if field.readonly: - attrs.append('readonly="1"') - if field.required: - attrs.append('required="1"') + if not field.field in fields: + fields[field.field] = [None, journal.id] + fld.append((field.field, field.sequence)) + flds.append(field.field) else: - attrs.append('required="0"') - if field.field in ('amount_currency','currency_id'): - attrs.append('on_change="onchange_currency(account_id,amount_currency,currency_id,date,((\'journal_id\' in context) and context[\'journal_id\']) or {})"') + fields.get(field.field).append(journal.id) + + fld.append(('period_id', 3)) + fld.append(('journal_id', 10)) + flds.append('period_id') + flds.append('journal_id') + fields['period_id'] = all_journal + fields['journal_id'] = all_journal + + from operator import itemgetter + fld = sorted(fld, key=itemgetter(1)) - if field.field in widths: - attrs.append('width="'+str(widths[field.field])+'"') - xml += '''\n''' % (field.field,' '.join(attrs)) + widths = { + 'ref': 50, + 'statement_id': 50, + 'state': 60, + 'tax_code_id': 50, + 'move_id': 40, + } - xml += '''''' - result['arch'] = xml - result['fields'] = self.fields_get(cr, uid, fields, context) + for field_it in fld: + field = field_it[0] + if field=='state': + state = 'colors="red:state==\'draft\'"' + + 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)]"') + 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)"') + elif field == 'partner_id': + attrs.append('on_change="onchange_partner_id(move_id, partner_id, account_id, debit, credit, date, journal_id)"') +# if field.readonly: +# attrs.append('readonly="1"') +# if field.required: +# attrs.append('required="1"') +# else: +# attrs.append('required="0"') + 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])+'"') + + attrs.append("invisible=\"context.get('visible_id') not in %s\"" % (fields.get(field))) + xml += '''\n''' % (field,' '.join(attrs)) + + xml += '''''' + result['arch'] = xml + result['fields'] = self.fields_get(cr, uid, flds, context) return result def _check_moves(self, cr, uid, context): diff --git a/addons/account/account_report.xml b/addons/account/account_report.xml index 6480178d1ae..fc622d8f0c0 100644 --- a/addons/account/account_report.xml +++ b/addons/account/account_report.xml @@ -34,7 +34,7 @@ string="Taxes Report"/>
- + - + @@ -292,28 +292,31 @@ - - - - + + + + + - + + + + + + - - - - - - - - - + + + + + + @@ -333,7 +336,25 @@ tree,form - + + + account.bank.statement.select + account.bank.statement + search + + + + + + + + + + + + + + account.bank.statement.tree account.bank.statement @@ -358,19 +379,20 @@ form - - - - - - - - -