<commit_before># -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, api


class AccountInvoice(models.Model):

    _inherit = "account.invoice"

    @api.multi
    @api.returns('self')
    def refund(self, date_invoice=None,
               date=None, description=None, journal_id=None):
        """
        En las facturas rectificativas no se calculan bien los impuestos (por)
        ej. el campo base. Esto arregla eso
        """
        new_invoices = super(AccountInvoice, self).refund(
            date_invoice=date_invoice, date=date,
            description=description, journal_id=journal_id)
        new_invoices.compute_taxes()
        return new_invoices
<commit_msg>9.0-add to onchange_jorunal to keep the currency when change the journal (#67)<commit_after># -*- coding: utf-8 -*-
##############################################################################
# For copyright and license notices, see __openerp__.py file in module root
# directory
##############################################################################
from openerp import models, api


class AccountInvoice(models.Model):

    _inherit = "account.invoice"

    @api.multi
    @api.returns('self')
    def refund(self, date_invoice=None,
               date=None, description=None, journal_id=None):
        """
        En las facturas rectificativas no se calculan bien los impuestos (por)
        ej. el campo base. Esto arregla eso
        """
        new_invoices = super(AccountInvoice, self).refund(
            date_invoice=date_invoice, date=date,
            description=description, journal_id=journal_id)
        new_invoices.compute_taxes()
        return new_invoices

    # TODO borrar porque al fianl estamos desactivando cambio de moneda
    # sin importar si viene o no la clave en el contexto
    # We do this for a bug when creating an invoice from
    # the PO that does not get the correct currency from the PO, by default
    # bring the currency of the newspaper.
    # we also add this so that in a multic environment if you change company
    # currency is not changed
    @api.onchange('journal_id')
    def _onchange_journal_id(self):
        """
        desactivamos cambio de moneda ya que el cambio de moneda no actualiza
        precios y en realidad en la mayoria de los csaos no quermeos que
        cambiar diario cambie moneda.
        """
        currency = self.currency_id
        super(AccountInvoice, self)._onchange_journal_id()
        self.currency_id = currency
        # if self._context.get('default_currency_id', False):
        #     self.currency_id = self._context.get('default_currency_id')
        # else:
        #     super(AccountInvoice, self)._onchange_journal_id()

{'fraction_non_alphanumeric': 0.17619208657423063, 'fraction_numerical': 0.002029083530605343, 'mean_word_length': 3.2439024390243905, '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': '654943', 'n_tokens_mistral': 817, 'n_tokens_neox': 787, 'n_words': 247}