<commit_before># -*- coding: utf-8 -*-
# © 2015 <NAME> (Camptocamp)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp import models, fields, api
from openerp import tools


class FinancialReportLine(models.Model):
    _inherit = 'financial.report.line'
    _name = 'general.ledger.line'
    _description = "General Ledger report"

    _auto = False
    _order = 'account_id, date'

    @api.depends('invoice_number', 'name')
    def _get_label(self):
        for rec in self:
            invoice_number = ''
            if rec.invoice_number:
                invoice_number = ' (rec.invoice_number)'
            rec.label = u'%(line_name)s%(invoice_number)s' % {
                'line_name': rec.name,
                'invoice_number': invoice_number}

    label = fields.Char(compute='_get_label', readonly=True, store=False)

    def init(self, cr):
        report_name = self._name.replace('.', '_')
        tools.drop_view_if_exists(cr, report_name)
        query = """
CREATE OR REPLACE VIEW %(report_name)s AS (
  SELECT
    acc.id AS account_id,
    acc.code AS account_code,
    acc.centralized,
    ml.id,
    ml.name,
    ml.ref,
    ml.date,
    date_part('year', ml.date) || '-' || date_part('month', ml.date)
        AS month,
    part.ref AS partner_ref,
    part.name AS partner_name,
    ml.journal_id,
    ml.currency_id,
    cur.name AS currency_code,
    ml.debit,<commit_msg>fix get_label<commit_after># -*- coding: utf-8 -*-
# © 2015 <NAME> (Camptocamp)
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).

from openerp import models, fields, api
from openerp import tools


class FinancialReportLine(models.Model):
    _inherit = 'financial.report.line'
    _name = 'general.ledger.line'
    _description = "General Ledger report"

    _auto = False
    _order = 'account_id, date'

    @api.depends('invoice_number', 'name')
    def _get_label(self):
        for rec in self:
            label = rec.name
            if rec.invoice_number:
                label += u' ({})'.format(rec.invoice_number)
            rec.label = label

    label = fields.Char(compute='_get_label', readonly=True, store=False)

    def init(self, cr):
        report_name = self._name.replace('.', '_')
        tools.drop_view_if_exists(cr, report_name)
        query = """
CREATE OR REPLACE VIEW %(report_name)s AS (
  SELECT
    acc.id AS account_id,
    acc.code AS account_code,
    acc.centralized,
    ml.id,
    ml.name,
    ml.ref,
    ml.date,
    date_part('year', ml.date) || '-' || date_part('month', ml.date)
        AS month,
    part.ref AS partner_ref,
    part.name AS partner_name,
    ml.journal_id,
    ml.currency_id,
    cur.name AS currency_code,
    ml.debit,
{'fraction_non_alphanumeric': 0.13016453382084095, 'fraction_numerical': 0.005118829981718464, 'mean_word_length': 2.5858453473132372, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7316551', 'n_tokens_mistral': 954, 'n_tokens_neox': 918, 'n_words': 206}