<commit_before># -*- coding: utf-8 -*-
from __future__ import division
from osv import osv, fields
from tools.translate import _
from datetime import datetime, timedelta
from calendar import isleap
import netsvc


class WizardInvestmentAmortization(osv.osv_memory):
    """Assistent per amortitzar la inversió.
    """
    _name = 'wizard.generationkwh.investment.amortization'
    _columns = {
        'date_end': fields.date(
            'Data final',
            required=True
        ),
        'err': fields.text(
            'Missatges d\'error',
            readonly=True,
        ),
        'output': fields.text(
            'Missatges d\'error',
            readonly=True,
        ),
        'state': fields.char(
            'Estat',
            50
        ),
    }

    _defaults = {
        'state': lambda *a: 'init',
        'date_end': lambda *a: str(datetime.today()+timedelta(days=6)),
    }

    def preview(self, cursor, uid, ids, context=None):
        wiz = self.browse(cursor, uid, ids[0], context)
        context.update(pre_calc=True)

        print wiz.date_end
        wiz.write(dict(
            output=
                '- Amortitzacions pendents: {pending}\n\n'
                '- Import total: {pending_amount} €\n'
                .format(
                    pending = 15,
                    pending_amount = 3033.23,

                ),
            state='pre_calc',
            err='soc un error'
            ))

    def generate(self, cursor, uid, ids, context=None):
        wiz = self.browse(cursor, uid, ids[0], context)
        invoice_ids = []
        return {
            'domain': "[('id','in', %s)]" % str(invoice_ids),<commit_msg>Add invocies amortization to list<commit_after># -*- coding: utf-8 -*-
from __future__ import division
from osv import osv, fields
from tools.translate import _
from datetime import datetime, timedelta
from calendar import isleap
import netsvc


class WizardInvestmentAmortization(osv.osv_memory):
    """Assistent per amortitzar la inversió.
    """
    _name = 'wizard.generationkwh.investment.amortization'
    _columns = {
        'date_end': fields.date(
            'Data final',
            required=True
        ),
        'err': fields.text(
            'Missatges d\'error',
            readonly=True,
        ),
        'output': fields.text(
            'Missatges d\'error',
            readonly=True,
        ),
        'state': fields.char(
            'Estat',
            50
        ),
    }

    _defaults = {
        'state': lambda *a: 'init',
        'date_end': lambda *a: str(datetime.today()+timedelta(days=6)),
    }

    def preview(self, cursor, uid, ids, context=None):
        wiz = self.browse(cursor, uid, ids[0], context)
        context.update(pre_calc=True)

        print wiz.date_end
        wiz.write(dict(
            output=
                '- Amortitzacions pendents: {pending}\n\n'
                '- Import total: {pending_amount} €\n'
                .format(
                    pending = 150,
                    pending_amount = 3033.23,

                ),
            state='pre_calc',
            err='soc un error'
            ))

    def generate(self, cursor, uid, ids, context=None):
        wiz = self.browse(cursor, uid, ids[0], context)
        Invoice = self.pool.get('account.invoice')
        invoice_ids = Invoice.search(cursor,uid,[
                ('name','like', "%AMOR%"),
                ])

        return {
            'domain': "[('id','in', %s)]" % str(invoice_ids),
{'fraction_non_alphanumeric': 0.12763532763532764, 'fraction_numerical': 0.008262108262108263, 'mean_word_length': 1.7602201257861636, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '1369538', 'n_tokens_mistral': 1092, 'n_tokens_neox': 1036, 'n_words': 234}