<commit_before>odoo.define('tko_coexiste_br_account.reconciliationa', function (require) {
"use strict";
    var core = require('web.core');
    var _t = core._t;
    var reconciliation = require('account.reconciliation');
    var FieldMany2One = core.form_widget_registry.get('many2one');

    reconciliation.abstractReconciliation.include({
        init: function(parent, context) {
            this._super(parent, context);
            var self = this;
            this.create_form_fields['expense_type_id']= {
                id: "expense_type_id",
                index: 25,
                corresponding_property: "expense_type_id",
                label: _t("Expense Type"),
                required: false,
                group:"analytic.group_analytic_accounting",
                constructor: FieldMany2One,
                field_properties: {
                    relation: "account.expense.type",
                    string: _t("Expense Type"),
                    type: "many2one",
                },
            }


        },
    });
});<commit_msg>Store expense_type_id in move_lines<commit_after>odoo.define('tko_coexiste_br_account.reconciliationa', function (require) {
"use strict";
    var core = require('web.core');
    var _t = core._t;
    var reconciliation = require('account.reconciliation');
    var FieldMany2One = core.form_widget_registry.get('many2one');

    reconciliation.abstractReconciliation.include({
        init: function(parent, context) {
            this._super(parent, context);
            this.create_form_fields['expense_type_id']= {
                id: "expense_type_id",
                index: 25,
                corresponding_property: "expense_type_id",
                label: _t("Expense Type"),
                required: false,
                group:"analytic.group_analytic_accounting",
                constructor: FieldMany2One,
                field_properties: {
                    relation: "account.expense.type",
                    string: _t("Expense Type"),
                    type: "many2one",
                },
            }


        },

        fetchPresets: function() {
        var self = this;
        var deferred_last_update = self.model_presets.query(['write_date']).order_by('-write_date').first().then(function (data) {
            self.presets_last_write_date = (data ? data.write_date : undefined);
        });
        var deferred_presets = self.model_presets.query().order_by('-sequence', '-id').all().then(function (data) {
            self.presets = {};
            _(data).each(function(datum){
                var preset = {
                    id: datum.id,
                    name: datum.name,
                    sequence: datum.sequence,
                    lines: [{
                        account_id: datum.account_id,
                        journal_id: datum.journal_id,
                        label: datum.label,
                        amount_type: datum.amount_type,
                        amount: datum.amount,
                        tax_id: datum.tax_id,
                        analytic_account_id: datum.analytic_account_id,
                        expense_type_id: datum.expense_type_id
                    }]
                };
                if (datum.has_second_line) {
                    preset.lines.push({
                        account_id: datum.second_account_id,
                        journal_id: datum.second_journal_id,
                        label: datum.second_label,
                        amount_type: datum.second_amount_type,
                        amount: datum.second_amount,
                        tax_id: datum.second_tax_id,
                        analytic_account_id: datum.second_analytic_account_id,
                        expense_type_id: datum.second_expense_type_id
                    });
                }
                self.presets[datum.id] = preset;
            });
        });
        return $.when(deferred_last_update, deferred_presets);
    },
    });

    /* write expense_type_id to database */

    reconciliation.abstractReconciliation.include({
        // Returns an object that can be passed to process_reconciliation()
        prepareCreatedMoveLinesForPersisting: function(lines) {
            lines = _.filter(lines, function(line) { return !line.is_tax_line });
            return _.collect(lines, function(line) {
                var dict = {
                    account_id: line.account_id,
                    name: line.label
                };
                // Use amount_before_tax since the amount of the newly created line is adjusted to
                // reflect tax included in price in account_move_line.create()
                var amount = line.tax_id ? line.amount_before_tax: line.amount;
                dict['credit'] = (amount > 0 ? amount : 0);
                dict['debit'] = (amount < 0 ? -1 * amount : 0);
                if (line.tax_id) dict['tax_ids'] = [[4, line.tax_id, null]];
                if (line.analytic_account_id) dict['analytic_account_id'] = line.analytic_account_id;
                if (line.expense_type_id) dict['expense_type_id'] = line.expense_type_id;
                return dict;
            });
        },
    });
});
{'fraction_non_alphanumeric': 0.10099274532264223, 'fraction_numerical': 0.003436426116838488, 'mean_word_length': 1.611665004985045, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, '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': '7322577', 'n_tokens_mistral': 1470, 'n_tokens_neox': 1364, 'n_words': 249}