diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py index 302a74c27af..98521eb41a8 100644 --- a/addons/account/account_move_line.py +++ b/addons/account/account_move_line.py @@ -970,126 +970,126 @@ class account_move_line(osv.osv): 'context':context, } - def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): - journal_pool = self.pool.get('account.journal') - if context is None: - context = {} - result = super(account_move_line, self).fields_view_get(cr, uid, view_id, view_type, context=context, toolbar=toolbar, submenu=submenu) - if (view_type != 'tree') or view_id: - #Remove the toolbar from the form view - if view_type == 'form': - if result.get('toolbar', False): - result['toolbar']['action'] = [] - #Restrict the list of journal view in search view - if view_type == 'search' and result['fields'].get('journal_id', False): - result['fields']['journal_id']['selection'] = journal_pool.name_search(cr, uid, '', [], context=context) - ctx = context.copy() - #we add the refunds journal in the selection field of journal - if context.get('journal_type', False) == 'sale': - ctx.update({'journal_type': 'sale_refund'}) - result['fields']['journal_id']['selection'] += journal_pool.name_search(cr, uid, '', [], context=ctx) - elif context.get('journal_type', False) == 'purchase': - ctx.update({'journal_type': 'purchase_refund'}) - result['fields']['journal_id']['selection'] += journal_pool.name_search(cr, uid, '', [], context=ctx) - return result - if context.get('view_mode', False): - return result - fld = [] - flds = [] - title = _("Accounting Entries") # self.view_header_get(cr, uid, view_id, view_type, context) + # def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False): + # journal_pool = self.pool.get('account.journal') + # if context is None: + # context = {} + # result = super(account_move_line, self).fields_view_get(cr, uid, view_id, view_type, context=context, toolbar=toolbar, submenu=submenu) + # if (view_type != 'tree') or view_id: + # #Remove the toolbar from the form view + # if view_type == 'form': + # if result.get('toolbar', False): + # result['toolbar']['action'] = [] + # #Restrict the list of journal view in search view + # if view_type == 'search' and result['fields'].get('journal_id', False): + # result['fields']['journal_id']['selection'] = journal_pool.name_search(cr, uid, '', [], context=context) + # ctx = context.copy() + # #we add the refunds journal in the selection field of journal + # if context.get('journal_type', False) == 'sale': + # ctx.update({'journal_type': 'sale_refund'}) + # result['fields']['journal_id']['selection'] += journal_pool.name_search(cr, uid, '', [], context=ctx) + # elif context.get('journal_type', False) == 'purchase': + # ctx.update({'journal_type': 'purchase_refund'}) + # result['fields']['journal_id']['selection'] += journal_pool.name_search(cr, uid, '', [], context=ctx) + # return result + # if context.get('view_mode', False): + # return result + # fld = [] + # flds = [] + # title = _("Accounting Entries") # self.view_header_get(cr, uid, view_id, view_type, context) - ids = journal_pool.search(cr, uid, [], context=context) - journals = journal_pool.browse(cr, uid, ids, context=context) - for journal in journals: - for field in journal.view_id.columns_id: - # sometimes, it's possible that a defined column is not loaded (the module containing - # this field is not loaded) when we make an update. - if field.field not in self._columns: - continue + # ids = journal_pool.search(cr, uid, [], context=context) + # journals = journal_pool.browse(cr, uid, ids, context=context) + # for journal in journals: + # for field in journal.view_id.columns_id: + # # sometimes, it's possible that a defined column is not loaded (the module containing + # # this field is not loaded) when we make an update. + # if field.field not in self._columns: + # continue - if not field.field in flds: - fld.append((field.field, field.sequence)) - flds.append(field.field) + # if not field.field in flds: + # fld.append((field.field, field.sequence)) + # flds.append(field.field) - default_columns = { - 'period_id': 3, - 'journal_id': 10, - 'state': sys.maxint, - } - for d in default_columns: - if d not in flds: - fld.append((d, default_columns[d])) - flds.append(d) + # default_columns = { + # 'period_id': 3, + # 'journal_id': 10, + # 'state': sys.maxint, + # } + # for d in default_columns: + # if d not in flds: + # fld.append((d, default_columns[d])) + # flds.append(d) - fld = sorted(fld, key=itemgetter(1)) - widths = { - 'statement_id': 50, - 'state': 60, - 'tax_code_id': 50, - 'move_id': 40, - } + # fld = sorted(fld, key=itemgetter(1)) + # widths = { + # 'statement_id': 50, + # 'state': 60, + # 'tax_code_id': 50, + # 'move_id': 40, + # } - document = etree.Element('tree', string=title, editable="top", - on_write="on_create_write", - colors="red:state=='draft';black:state=='valid'") - fields_get = self.fields_get(cr, uid, flds, context) - for field, _seq in fld: - # TODO add string to element - f = etree.SubElement(document, 'field', name=field) + # document = etree.Element('tree', string=title, editable="top", + # on_write="on_create_write", + # colors="red:state=='draft';black:state=='valid'") + # fields_get = self.fields_get(cr, uid, flds, context) + # for field, _seq in fld: + # # TODO add string to element + # f = etree.SubElement(document, 'field', name=field) - if field == 'debit': - f.set('sum', _("Total debit")) + # if field == 'debit': + # f.set('sum', _("Total debit")) - elif field == 'credit': - f.set('sum', _("Total credit")) + # elif field == 'credit': + # f.set('sum', _("Total credit")) - elif field == 'move_id': - f.set('required', 'False') + # elif field == 'move_id': + # f.set('required', 'False') - elif field == 'account_tax_id': - f.set('domain', "[('parent_id', '=' ,False)]") - f.set('context', "{'journal_id': journal_id}") + # elif field == 'account_tax_id': + # f.set('domain', "[('parent_id', '=' ,False)]") + # f.set('context', "{'journal_id': journal_id}") - elif field == 'account_id' and journal.id: - f.set('domain', "[('journal_id', '=', journal_id),('type','!=','view'), ('type','!=','closed')]") - f.set('on_change', 'onchange_account_id(account_id, partner_id)') + # elif field == 'account_id' and journal.id: + # f.set('domain', "[('journal_id', '=', journal_id),('type','!=','view'), ('type','!=','closed')]") + # f.set('on_change', 'onchange_account_id(account_id, partner_id)') - elif field == 'partner_id': - f.set('on_change', 'onchange_partner_id(move_id, partner_id, account_id, debit, credit, date, journal_id)') + # elif field == 'partner_id': + # f.set('on_change', 'onchange_partner_id(move_id, partner_id, account_id, debit, credit, date, journal_id)') - elif field == 'journal_id': - f.set('context', "{'journal_id': journal_id}") + # elif field == 'journal_id': + # f.set('context', "{'journal_id': journal_id}") - elif field == 'statement_id': - f.set('domain', "[('state', '!=', 'confirm'),('journal_id.type', '=', 'bank')]") - f.set('invisible', 'True') + # elif field == 'statement_id': + # f.set('domain', "[('state', '!=', 'confirm'),('journal_id.type', '=', 'bank')]") + # f.set('invisible', 'True') - elif field == 'date': - f.set('on_change', 'onchange_date(date)') + # elif field == 'date': + # f.set('on_change', 'onchange_date(date)') - elif field == 'analytic_account_id': - # Currently it is not working due to being executed by superclass's fields_view_get - # f.set('groups', 'analytic.group_analytic_accounting') - pass + # elif field == 'analytic_account_id': + # # Currently it is not working due to being executed by superclass's fields_view_get + # # f.set('groups', 'analytic.group_analytic_accounting') + # pass - if field in ('amount_currency', 'currency_id'): - f.set('on_change', 'onchange_currency(account_id, amount_currency, currency_id, date, journal_id)') - f.set('attrs', "{'readonly': [('state', '=', 'valid')]}") + # if field in ('amount_currency', 'currency_id'): + # f.set('on_change', 'onchange_currency(account_id, amount_currency, currency_id, date, journal_id)') + # f.set('attrs', "{'readonly': [('state', '=', 'valid')]}") - if field in widths: - f.set('width', str(widths[field])) + # if field in widths: + # f.set('width', str(widths[field])) - if field in ('journal_id',): - f.set("invisible", "context.get('journal_id', False)") - elif field in ('period_id',): - f.set("invisible", "context.get('period_id', False)") + # if field in ('journal_id',): + # f.set("invisible", "context.get('journal_id', False)") + # elif field in ('period_id',): + # f.set("invisible", "context.get('period_id', False)") - orm.setup_modifiers(f, fields_get[field], context=context, - in_tree_view=True) + # orm.setup_modifiers(f, fields_get[field], context=context, + # in_tree_view=True) - result['arch'] = etree.tostring(document, pretty_print=True) - result['fields'] = fields_get - return result + # result['arch'] = etree.tostring(document, pretty_print=True) + # result['fields'] = fields_get + # return result def _check_moves(self, cr, uid, context=None): # use the first move ever created for this journal and period diff --git a/addons/account/account_view.xml b/addons/account/account_view.xml index f7d64f43405..fe40121eaeb 100644 --- a/addons/account/account_view.xml +++ b/addons/account/account_view.xml @@ -1063,31 +1063,78 @@ + account.move.line.tree account.move.line - - - - + + - + + - - - - + + + - + + + + + @@ -1280,6 +1327,39 @@ groups="group_account_user" /> + + Journal Items + account.move.journal + form + {'journal_type':'sale'} + This view is used by accountants in order to record entries massively in OpenERP. If you want to record a customer invoice, select the journal and the period in the search toolbar. Then, start by recording the entry line of the income account. OpenERP will propose to you automatically the Tax related to this account and the counter-part "Account receivable". + + + + + Journal Items + account.move.journal + form + {'journal_type':'purchase'} + This view is used by accountants in order to record entries massively in OpenERP. If you want to record a supplier invoice, start by recording the line of the expense account, OpenERP will propose to you automatically the Tax related to this account and the counter-part "Account Payable". + + + + + Journal Items + account.move.journal + form + {'journal_type':'bank'} + This view is used by accountants in order to record entries massively in OpenERP. Journal items are created by OpenERP if you use Bank Statements, Cash Registers, or Customer/Supplier payments. + + + Lines to reconcile account.move.line