'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)
-
- # 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)
-
- # 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,
- # }
-
- # 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"))
-
- # elif field == 'credit':
- # f.set('sum', _("Total credit"))
-
- # 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_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 == '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 == '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
-
- # 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 ('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)
-
- # 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
if context is None: