addons14/contract/models/contract.py
def _get_lines_to_invoice(self, date_ref):
        """
        This method fetches and returns the lines to invoice on the contract
        (self), based on the given date.
        :param date_ref: date used as reference date to find lines to invoice
        :return: contract lines (contract.line recordset)
        """
        self.ensure_one()

        def can_be_invoiced(contract_line):
            return (
                not contract_line.is_canceled
                and contract_line.recurring_next_date
                and contract_line.recurring_next_date <= date_ref
            )

        lines2invoice = previous = self.env["contract.line"]
        current_section = current_note = False
        for line in self.contract_line_ids:
            if line.display_type == "line_section":
                current_section = line
            elif line.display_type == "line_note" and not line.is_recurring_note:
                if line.note_invoicing_mode == "with_previous_line":
                    if previous in lines2invoice:
                        lines2invoice |= line
                    current_note = False
                elif line.note_invoicing_mode == "with_next_line":
                    current_note = line
            elif line.is_recurring_note or not line.display_type:
                if can_be_invoiced(line):
                    if current_section:
                        lines2invoice |= current_section
                        current_section = False
                    if current_note:
                        lines2invoice |= current_note
                    lines2invoice |= line
                    current_note = False
            previous = line
        return lines2invoice.sorted()

        This method fetches and returns the lines to invoice on the contract
        (self), based on the given date.
        :param date_ref: date used as reference date to find lines to invoice
        :return: contract lines (contract.line recordset)
        
This method fetches and returns the lines to invoice on the contract
(self), based on the given date.
This method fetches and returns the lines to invoice on the contract ( self ) based on the given date .
def _get_lines_to_invoice(self, date_ref):
        self.ensure_one()
        def can_be_invoiced(contract_line):
            return (
                not contract_line.is_canceled
                and contract_line.recurring_next_date
                and contract_line.recurring_next_date <= date_ref
            )
        lines2invoice = previous = self.env["contract.line"]
        current_section = current_note = False
        for line in self.contract_line_ids:
            if line.display_type == "line_section":
                current_section = line
            elif line.display_type == "line_note" and not line.is_recurring_note:
                if line.note_invoicing_mode == "with_previous_line":
                    if previous in lines2invoice:
                        lines2invoice |= line
                    current_note = False
                elif line.note_invoicing_mode == "with_next_line":
                    current_note = line
            elif line.is_recurring_note or not line.display_type:
                if can_be_invoiced(line):
                    if current_section:
                        lines2invoice |= current_section
                        current_section = False
                    if current_note:
                        lines2invoice |= current_note
                    lines2invoice |= line
                    current_note = False
            previous = line
        return lines2invoice.sorted()
def _get_lines_to_invoice ( self , date_ref ) : self . ensure_one ( ) def can_be_invoiced ( contract_line ) : return ( not contract_line . is_canceled and contract_line . recurring_next_date and contract_line . recurring_next_date <= date_ref ) lines2invoice = previous = self . env [ "contract.line" ] current_section = current_note = False for line in self . contract_line_ids : if line . display_type == "line_section" : current_section = line elif line . display_type == "line_note" and not line . is_recurring_note : if line . note_invoicing_mode == "with_previous_line" : if previous in lines2invoice : lines2invoice |= line current_note = False elif line . note_invoicing_mode == "with_next_line" : current_note = line elif line . is_recurring_note or not line . display_type : if can_be_invoiced ( line ) : if current_section : lines2invoice |= current_section current_section = False if current_note : lines2invoice |= current_note lines2invoice |= line current_note = False previous = line return lines2invoice . sorted ( )
This method fetches and returns the lines to invoice on the contract
(self), based on the given date.
This method fetches and returns the lines to invoice on the contract ( self ) based on the given date .
"""
        This method fetches and returns the lines to invoice on the contract
        (self), based on the given date.
        :param date_ref: date used as reference date to find lines to invoice
        :return: contract lines (contract.line recordset)
        """
contract lines (contract.line recordset)
contract lines ( contract . line recordset )
self
date_ref
date used as reference date to find lines to invoice
date used as reference date to find lines to invoice