<commit_before># Copyright 2021 <NAME> - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models


class SaleOrder(models.Model):
    _inherit = "sale.order"

    def _create_invoices(
        self, grouped=False, final=False, date=None, start_date=None, end_date=None
    ):
        moves = super(SaleOrder, self)._create_invoices(
            grouped=grouped, final=final, date=date
        )
        if start_date or end_date:
            vals = {
                "start_date_period": start_date or "",
                "end_date_period": end_date or "",
            }
            moves.write(vals)
        return moves<commit_msg>[IMP] account_invoice_with_start_end_date: Coger fecha inicio y fin, sin vienen en el contexto.<commit_after># Copyright 2021 <NAME> - AvanzOSC
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import models


class SaleOrder(models.Model):
    _inherit = "sale.order"

    def _create_invoices(
        self, grouped=False, final=False, date=None, start_date=None, end_date=None
    ):
        moves = super(SaleOrder, self)._create_invoices(
            grouped=grouped, final=final, date=date
        )
        if start_date or end_date:
            vals = {
                "start_date_period": start_date or "",
                "end_date_period": end_date or "",
            }
            moves.write(vals)
        else:
            vals = {}
            if ("timesheet_start_date" in self.env.context and
                    self.env.context.get("timesheet_start_date", False)):
                vals["start_date_period"] = (
                    self.env.context.get("timesheet_start_date"))
            if ("timesheet_end_date" in self.env.context and
                    self.env.context.get("timesheet_end_date", False)):
                vals["end_date_period"] = (
                    self.env.context.get("timesheet_end_date"))
            if vals:
                moves.write(vals)
        return moves
{'fraction_non_alphanumeric': 0.10726643598615918, 'fraction_numerical': 0.005931784478497282, 'mean_word_length': 2.0900763358778627, 'pattern_counts': {'":': 4, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '1087126', 'n_tokens_mistral': 638, 'n_tokens_neox': 611, 'n_words': 125}