#5399 (Automatically run invoicing plans as background tasks)
by Luc Saffre · in Developers · assigned to Luc Saffre
Résumé
Concepts sous-jacents
Commentaires
- 2 ans, 6 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : I am now a bit blocked here because of #5552
- 2 ans, 6 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : I restarted to work on this. Actually we must define one invoicing action per task also per partner and per order.
- 2 ans, 7 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : TODO: When the invoiceable date range on the plan is empty, Lino should set the period to (date2 of last report +1 day) until (date of report -1 day).
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : Maybe even more fundamental changes. For example, at least in Noi, get_generators_for_plan() should group the sessions by SLA and not by partner.
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : OK, I could now make a quick upgrade to Jane and manually print out the pending service reports, but at least one thing is still missing: Lino is still not able to do it automatically. The ticket is only *almost done*.
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : I am slowly advancing. My next goal is to print out the currently pending service reports (btz, pdg, inin, ...). Today I am satisfied with the content for the first time. But some translations and styling (recipient) need to be done before I can send really the reports to the customers.
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : I plan to upgrade Jane now soon, in order to try my latest changes on the field.
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : I am thinking about how to handle free services. WE want to report them in the service reports, but that's all. Currently Lino collects them as negative provisions that will always grow because there is no filler for them...
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : In a first step I don't yet drop it but turn it into a PointingChoice that points to the tariff (i.e. the invoiceable product).
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : I wonder whether we should drop the ReportingType choicelist and replace it by a simple FK to Product (labelled "Tariff").
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : @8lurry I'd like to talk with you about PriceRule and PriceFactors usage in Pronto.
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : Multiple sales prices per produce would be another ticket. But for Jane we need a way to differentiate between regular and free sessions in a service report. The product to return by get_ruled_price() doesn't depend only on the partner but alo on the session's reporting type.
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : I wonder whether I should redesign PriceRule and TradeType.price_field_name. There are situations where we want multiple sales prices for a same product.
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : Seems that there is something conceptually wrong in Product.get_ruled_price(). Why does it have an explicit argument "partner"?
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) (1 reply) : And there is some bug somehwere because the provision before should be 11:00, not 85:00. And 85:00 - 35:10 is 49:50, not 50:00.
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : The service report now prints a table with the provisions of each mentioned product for this partner, before and after the report. But the quantities before and after are not formatted hh:mm, they are formatted 999,99. I guess I need to extend DeliveryUnits to fix this.
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : Next thing to do: Implement Product.get_provision(journal, partner, date)
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : Another thing to do: servie report should show the provisions before and after the covered period.
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : Jane generated a first series of valid service reports using the new system. Great! But there is more to do: e.g. the default date range must start the day after the end date of the last report for that customer.
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : I renamed SRV to SRV-O and created a new journal SRV.
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : The debug messages helped me to understand why the invoicing plan remains empty: the existing journal SRV has voucher_type sales.VatProductInvoice but working.Session.target_voucher_model is "storage.DeliveryNote". If I don't want to lose existing service reports, I must make a new journal.
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : Strange: On Jane, when I click the fill_plan button, no service report gets generated. Now I would like to set the logging level to debug and watch the lino.log file.. I did this in /etc/supervisor/conf.d/jane-asgi.conf but it seems to have no effect.
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : On Jane, after the upgrade, I now manually created a first Invoicing task "Make Service reports (SRV)".
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : I started the second phase: make the invoicing tasks being actually scheduled.
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : I considered moving the demo.py fixture from lino_xl.lib.invoicing to lino_cosi lib cosi. Right now this fixture causes us to always have an invoicing plan "SLS" with a follow-up rule for sales.InvoiceItem. But after poking around for some time I think that the current solutiion is okay.
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : Uff! First phase is done! I pushed my work in half a dozen repositories.
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : The applications now define their own follow-up rules and invoicing tasks, but not in the minimal_ledger fixture as I thought in the beginning but in the demo fixture.
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) (1 reply) : OMG, it seems that Django loads fixtures having a same label using an arbitraary ordering, not the one defined by INSTALLED_APPS.
- 2 ans, 8 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : The first step it is almost done, but I need to find a way for every application to define her own follow-up rules in a minimal_ledger fixture...
- 2 ans, 9 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : In noi1e, the SRV and SUB get generated again after my changes. But the SLS not yet.
- 2 ans, 9 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : I am still fidgeting with this. It's complex because I am redefining the vocabulary of the rules for deciding which invoice generator generates invoices of which type...
- 2 ans, 9 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : Quite a few changes: New model invoicing.Task replaces InvoicingAreas. Class attribute InvoiceGenerator.target_invoicing_area replaced by target_voucher_model.
- 2 ans, 9 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) (1 reply) : Idea: Rather a single daily background procedure "run_invoicing_plans", and replace the choicelist InvoicingAreas by a model InvoicingJob, which inherits from RecurrenceSet.
- 2 ans, 9 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : The current logic in the invoicing demo_bookings fixture is to loop over InvoicingAreas every month. This will be replaced by (1) defining a background procedure for each invoicing area (2) a fixture that "runs" these procedures every week or month.
- 2 ans, 9 mois ago by Luc Saffre about #5399 (Automatically run invoicing plans as background tasks) : Created new Ticket #5399 (Automatically run invoicing plans as background tasks).