summaryrefslogtreecommitdiff
path: root/addons/l10n_it_edi
diff options
context:
space:
mode:
authorwilliam <wan@odoo.com>2020-03-30 11:46:27 +0000
committerwilliam <wan@odoo.com>2020-08-05 11:57:10 +0000
commit82dc0cb7b91ae59beae7e1c865b670afc5958b31 (patch)
tree949b949b249cdac265310798d5abb82675a1741b /addons/l10n_it_edi
parent276ba8e90c87f8294286f915508766761a58d1e2 (diff)
[IMP] account: soft post entries in the future
Add an easy way to not post the entries in the future when calling post() on it, but rather set it to be auto-posted at accounting date. This is useful when we are creating a lot of entries in batch and some might be in the future, some in the past, and we don't want to separate that in two batch every time. (asset, accrual, transfer,... )
Diffstat (limited to 'addons/l10n_it_edi')
-rw-r--r--addons/l10n_it_edi/models/account_invoice.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/addons/l10n_it_edi/models/account_invoice.py b/addons/l10n_it_edi/models/account_invoice.py
index fc5ca66fa83..6ad986994a9 100644
--- a/addons/l10n_it_edi/models/account_invoice.py
+++ b/addons/l10n_it_edi/models/account_invoice.py
@@ -55,12 +55,12 @@ class AccountMove(models.Model):
invoice.l10n_it_einvoice_id = einvoice
invoice.l10n_it_einvoice_name = einvoice.name
- def post(self):
+ def _post(self, soft=True):
# OVERRIDE
- super(AccountMove, self).post()
+ posted = super()._post(soft)
# Retrieve invoices to generate the xml.
- invoices_to_export = self.filtered(lambda move:
+ invoices_to_export = posted.filtered(lambda move:
move.company_id.country_id == self.env.ref('base.it') and
move.is_sale_document() and
move.l10n_it_send_state not in ['sent', 'delivered', 'delivered_accepted'])
@@ -84,6 +84,7 @@ class AccountMove(models.Model):
for invoice in invoices_to_send:
invoice.send_pec_mail()
+ return posted
def _check_before_xml_exporting(self):
seller = self.company_id