mirror of
https://github.com/OCA/account-reconcile.git
synced 2025-01-20 12:27:39 +02:00
[FIX] account_reconciliation_widget: in case of manual operation with analytic account/tags, create the analytic entry(ies) if the move is posted
This commit is contained in:
@@ -234,8 +234,12 @@ class AccountBankStatementLine(models.Model):
|
||||
self._prepare_move_line_for_currency(aml_dict, date)
|
||||
|
||||
# Create write-offs
|
||||
wo_aml = self.env["account.move.line"]
|
||||
for aml_dict in new_aml_dicts:
|
||||
aml_obj.with_context(check_move_validity=False).create(aml_dict)
|
||||
wo_aml |= aml_obj.with_context(check_move_validity=False).create(aml_dict)
|
||||
analytic_wo_aml = wo_aml.filtered(
|
||||
lambda l: l.analytic_account_id or l.analytic_tag_ids
|
||||
)
|
||||
|
||||
# Create counterpart move lines and reconcile them
|
||||
aml_to_reconcile = []
|
||||
@@ -259,6 +263,9 @@ class AccountBankStatementLine(models.Model):
|
||||
self.move_id.with_context(
|
||||
skip_account_move_synchronization=True
|
||||
).action_post()
|
||||
elif analytic_wo_aml:
|
||||
# if already posted the analytic entry has to be created
|
||||
analytic_wo_aml.create_analytic_lines()
|
||||
|
||||
# Reconcile new lines with counterpart
|
||||
for new_aml, counterpart_move_line in aml_to_reconcile:
|
||||
|
||||
Reference in New Issue
Block a user