account-closing icon indicating copy to clipboard operation
account-closing copied to clipboard

[16.0][ADD] account cutoff accrual on order

Open jbaudoux opened this issue 1 year ago • 8 comments

Port and refactor https://github.com/OCA/account-closing/pull/73

Generate cutoff accruals by analyzing order lines invoiced & delivered quantity (or ordered quantity for sales with invoice policy on order).

Several modules are provided:

  • account_cutoff_accrual_order_base: Base module to analyze any type of order lines
  • account_cutoff_accrual_order_stock_base: Base module to analyze order lines delivered by stock moves
  • account_cutoff_accrual_sale: analyze sales order lines to accrue what must be invoiced. Generates accrued revenue, i.e. invoice to establish
  • account_cutoff_accrual_purchase: analyze purchase order lines to accrue what must be invoiced. Generates accrued expense, i.e. invoice to receive
  • account_cutoff_accrual_sale_stock: analyze sales order lines to accrue what must be delivered. Generates accrued prepaid revenue, i.e. goods to deliver
  • account_cutoff_accrual_purchase_stock: analyze purchase order lines to accrue what must be received. Generates accrued prepaid expense, i.e. goods to receive

The modules allow to process a large amount of data in a reasonable amount of time. To decrease the amount of stock moves & invoices to analyze a cron pre-generates the cutoff entries at the end of the period. Nevertheless, it is always possible to regenerate entries at any time (but the more stock moves & invoices to analyze are, the more time it will take). Any invoice posted after the cutoff is generated will alter the corresponding cut-off entries. Once the cut-off is posted is accounting, you cannot anymore alter the entries.

Note: Those modules covers the feature provided by stock_cutoff_picking but in a more generic and efficient way. Instead of analyzing all pickings & invoices inside a given interval, only pickings and invoices generated after the cutoff date are analyzed, The limit in time in the past is then now disabled.

Accrual on order flagged as force_invoiced is disabled.

Road-map: The generic approach of the modules allows to extend the features to generate accrual on service SO / PO with project tasks

cc @alexis-via @florian-dacosta @rousseldenis

jbaudoux avatar Oct 25 '23 09:10 jbaudoux

Hi @alexis-via, some modules you are maintaining are being modified, check this out!

OCA-git-bot avatar Oct 25 '23 09:10 OCA-git-bot

@alexis-via Added dependencies on sale/purchase_force_invoiced to handle exclusion. I dropped my boolean in favor of that force_invoiced

jbaudoux avatar Nov 08 '23 08:11 jbaudoux

@alexis-via Everything we discussed as been done (that I remember as you forgot to post your review). Can you redo a final review?

jbaudoux avatar Nov 14 '23 11:11 jbaudoux

Fixed cron job method

jbaudoux avatar Nov 17 '23 10:11 jbaudoux

@alexis-via This deserves a little review. Thanks

rousseldenis avatar Feb 19 '24 09:02 rousseldenis

I fixed the case of sale delivery line (service) added after SO confirmation and after cutoff date.

jbaudoux avatar May 08 '24 16:05 jbaudoux

I added the use case where a SO having only the delivery line (shipping cost) to invoice among the SO lines is not considered as invoiceable.

jbaudoux avatar Aug 27 '24 11:08 jbaudoux

@alexis-via Have you had the chance to test this PR in comparison to your previous implementation ? Can it get merged ?

jbaudoux avatar Aug 27 '24 11:08 jbaudoux

/ocabot merge nobump

adrienpeiffer avatar Oct 10 '24 15:10 adrienpeiffer

On my way to merge this fine PR! Prepared branch 16.0-ocabot-merge-pr-271-by-adrienpeiffer-bump-nobump, awaiting test results.

OCA-git-bot avatar Oct 10 '24 15:10 OCA-git-bot

This PR has the approved label and has been created more than 5 days ago. It should therefore be ready to merge by a maintainer (or a PSC member if the concerned addon has no declared maintainer). 🤖

OCA-git-bot avatar Oct 10 '24 15:10 OCA-git-bot

@adrienpeiffer The merge process could not be finalized, because command twine check odoo_addon_account_cutoff_accrual_purchase_stock-16.0.1.0.0.10-py3-none-any.whl failed with output:

Checking 
odoo_addon_account_cutoff_accrual_purchase_stock-16.0.1.0.0.10-py3-none-any.whl:[31mFAILED[0m
[31mERROR   [0m `long_description` has syntax errors in markup and would not be        
         rendered on PyPI.                                                      
         No content rendered from RST source.                                   
[33mWARNING [0m `long_description_content_type` missing. defaulting to `text/x-rst`.   

OCA-git-bot avatar Oct 10 '24 15:10 OCA-git-bot

@adrienpeiffer I added the missing readmes and squashed the fix commits

jbaudoux avatar Oct 10 '24 15:10 jbaudoux