summaryrefslogtreecommitdiff
path: root/addons/l10n_in
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_in
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_in')
-rw-r--r--addons/l10n_in/models/account_invoice.py8
1 files changed, 4 insertions, 4 deletions
diff --git a/addons/l10n_in/models/account_invoice.py b/addons/l10n_in/models/account_invoice.py
index 316f461c488..691e661bbbd 100644
--- a/addons/l10n_in/models/account_invoice.py
+++ b/addons/l10n_in/models/account_invoice.py
@@ -87,12 +87,12 @@ class AccountMove(models.Model):
"""Overwrite in sale"""
return shipping_partner.vat
- def post(self):
+ def _post(self, soft=True):
"""Use journal type to define document type because not miss state in any entry including POS entry"""
- res = super().post()
+ posted = super()._post(soft)
gst_treatment_name_mapping = {k: v for k, v in
self._fields['l10n_in_gst_treatment']._description_selection(self.env)}
- for move in self.filtered(lambda m: m.l10n_in_company_country_code == 'IN'):
+ for move in posted.filtered(lambda m: m.l10n_in_company_country_code == 'IN'):
"""Check state is set in company/sub-unit"""
company_unit_partner = move.journal_id.l10n_in_gstin_partner_id or move.journal_id.company_id
if not company_unit_partner.state_id:
@@ -120,4 +120,4 @@ class AccountMove(models.Model):
#still state is not set then assumed that transaction is local like PoS so set state of company unit
if not move.l10n_in_state_id:
move.l10n_in_state_id = company_unit_partner.state_id
- return res
+ return posted