endi.plugins.sap.models.services package

Submodules

endi.plugins.sap.models.services.attestation module

exception endi.plugins.sap.models.services.attestation.RejectInvoice(msg: str, invoice: Invoice)

Bases : Exception

A rejected/ignored invoice with the reject reason as a text message.

class endi.plugins.sap.models.services.attestation.SAPAttestationLineService

Bases : object

Handles mainly the transformation of Invoices into SAPAttestationLines

Unsupported : - multi-TVA invoices (hard to implement reliably with partial payments) - Invoices cancelled by partial cancelinvoices

Partly supported : - invoices having prestation lines over different years with partial

payment (may lead to inconsistencies on attestation regeneration if only one of the attestations is regenerated)

get_rejects() List[RejectInvoice]

Get the rejects after a query() call

query(year: int, companies_ids: Set[int] = None, customers_ids: Set[int] = None) Iterable[SAPAttestationLine]
static sort_for_grouping(lines: List[SAPAttestationLine]) None

Sort (inplace) the list for further grouping within attestation

class endi.plugins.sap.models.services.attestation.SAPAttestationService

Bases : object

classmethod generate_bulk(attestation_cls, companies_ids, customers_ids, regenerate_existing, year, request: Request) Tuple[List[Tuple[SAPAttestation, bool]], List[RejectInvoice]]

Returns a list of the generated SAPAttestation and the list of rejected invoices.

classmethod get_cesu_sum(attestation: SAPAttestation) int

Compute the sum of payments by CESU for that attestation

classmethod get_or_create(attestation_cls, customer_id, year) Tuple[SAPAttestation, bool]

endi.plugins.sap.models.services.nova module

class endi.plugins.sap.models.services.nova.NovaStatsService

Bases : object

Stats pour le service nova

https://www.servicesalapersonne.gouv.fr/files_sap/files/professionnels/nova/tutoriel_nova.pdf

classmethod query()
classmethod query_for_monthly_summary(year)
classmethod query_for_product(year, product_id)
classmethod query_for_year(year)
classmethod query_for_yearly_summary(year)
endi.plugins.sap.models.services.nova.zero_or_null(field)

Avoids using a .in_((v1, v2…)) which do not support NULL values sqla helper

endi.plugins.sap.models.services.subqueries module

class endi.plugins.sap.models.services.subqueries.InvoiceSubQueries

Bases : object

Group subqueries for lazy loading

They cannot be defined before sqla mappings are configured.

We use @reify / @lru_cache to ensure same instance is returned

cancelinvoices_summary
discount_ratio
payments_summary(year)

Module contents