summaryrefslogtreecommitdiff
path: root/addons/account_check_printing
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/account_check_printing
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/account_check_printing')
-rw-r--r--addons/account_check_printing/models/account_payment.py2
-rw-r--r--addons/account_check_printing/tests/test_print_check.py4
2 files changed, 3 insertions, 3 deletions
diff --git a/addons/account_check_printing/models/account_payment.py b/addons/account_check_printing/models/account_payment.py
index 4a1fe600315..673ed281950 100644
--- a/addons/account_check_printing/models/account_payment.py
+++ b/addons/account_check_printing/models/account_payment.py
@@ -88,7 +88,7 @@ class AccountPayment(models.Model):
}
}
else:
- self.filtered(lambda r: r.state == 'draft').post()
+ self.filtered(lambda r: r.state == 'draft').action_post()
return self.do_print_checks()
def action_unmark_sent(self):
diff --git a/addons/account_check_printing/tests/test_print_check.py b/addons/account_check_printing/tests/test_print_check.py
index 30d88d054b2..82222daea88 100644
--- a/addons/account_check_printing/tests/test_print_check.py
+++ b/addons/account_check_printing/tests/test_print_check.py
@@ -39,7 +39,7 @@ class TestPrintCheck(AccountTestInvoicingCommon):
'invoice_date': '2017-01-01',
'invoice_line_ids': [(0, 0, {'product_id': self.product_a.id, 'price_unit': 100.0})]
} for i in range(nb_invoices_to_test)])
- out_invoices.post()
+ out_invoices.action_post()
# Create a single payment.
payment = self.env['account.payment.register'].with_context(active_model='account.move', active_ids=out_invoices.ids).create({
@@ -80,7 +80,7 @@ class TestPrintCheck(AccountTestInvoicingCommon):
'invoice_date': '2017-01-01',
'invoice_line_ids': [(0, 0, {'product_id': self.product_a.id, 'price_unit': 100.0})]
} for i in range(nb_invoices_to_test)])
- out_refunds.post()
+ out_refunds.action_post()
# Create a single payment.
payment = self.env['account.payment.register'].with_context(active_model='account.move', active_ids=out_refunds.ids).create({