Currently, tryton does not set any accounting date and the user must set it manually.
But following this requirement we may set the accounting date based on the account_invoice_stock relation. As each invoice is realted to shipments, we can deduce the max effective date (in case of grouping several shipments) and set it on the invoice.
My idea is to set the accounting date when posting invoice if the accouting date is empty, so the user does not need to care about setting the accounting date manually as the system will set from him and in case the date is not valid (the period is already posted) the user can always modify it. Does it make sense? Any better ideas?
I will also like if this is usefull for other countires so we can make it generic feature for tryton.
Also if you think that will cause any issue in some countries, please raise your voice.
It is the accounting date of the invoice, that is used for the move and for tax reports. This is already implemented in Tryton so we just need to set the accounting date on the invoice and the proper tax report will be produced.
This has been already explained in the linked topic:
The fact is that the company delivers some goods at 30/12/2021 but we do not issue the invoice until 15/01/2021. So the user needs to set the accounting date to 30/12/2021 as the Spanish law requires that the taxes should be declared when the goods are set (which is before the invoices is posted), so the move should be booked at this date.
So my proposal is about setting the accounting date automatically as tryton already knows when the goods are sent instead of forcing the user to set them manually.
the requirement is about tax declaration period and not the accounting date
Indeed the requirements is much more similar to account_tax_cash module but based on the shipping date (which should be converted into accounting period).
Also I suspect that the rule is not symmetric between customer and supplier invoice.
No, rule is only for customer shipments/invoices. I forgot to mention that, sorry.
Yes but I do not see any issue as far as we do not group invoices with diferent accounting periods . We may take that in account by adding the period on the invoice grouping fields.
Maybe but in this case we now at the moment of posting the effective date but in account_tax_cash the period when the invoice should be paid is unknown. Note that this is just applied when invoice is created based on sent shipments.