Skip to content

Commit 4fd426e

Browse files
committed
[MIG] sale_automatic_workflow: port PR to 14.0
* The fix is originally in `[MIG] sale_automatic_workflow_payment_mode: Migration to 14.0`. * Migrated to 14.0: OCA@d549fca#diff-644e82d43704d0eaa176dc9665558b4fc83117394397847ea859a524b432e6beR72 * When porting `[IMP] sale_automatic_workflow`, the ported commit does not have that fix * 13.0: OCA@4e43590#diff-87a59a699d3d1a4901d848f8116ccd51627cc0b64621732d4a348fc1a27e31f6R175 * Ported to 14.0: OCA@1c40132#diff-87a59a699d3d1a4901d848f8116ccd51627cc0b64621732d4a348fc1a27e31f6R167
1 parent e8e3b7f commit 4fd426e

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

sale_automatic_workflow/models/automatic_workflow_job.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,9 +161,9 @@ def _prepare_dict_account_payment(self, invoice):
161161
return {
162162
"reconciled_invoice_ids": [(6, 0, invoice.ids)],
163163
"amount": invoice.amount_residual,
164+
"date": fields.Date.context_today(self),
164165
"partner_id": invoice.partner_id.id,
165166
"partner_type": partner_type,
166-
"date": fields.Date.context_today(self),
167167
}
168168

169169
@api.model
@@ -182,6 +182,17 @@ def _register_payment_invoice(self, invoice):
182182
)
183183
payment.action_post()
184184

185+
domain = [
186+
("account_internal_type", "in", ("receivable", "payable")),
187+
("reconciled", "=", False),
188+
]
189+
payment_lines = payment.line_ids.filtered_domain(domain)
190+
lines = invoice.line_ids
191+
for account in payment_lines.account_id:
192+
(payment_lines + lines).filtered_domain(
193+
[("account_id", "=", account.id), ("reconciled", "=", False)]
194+
).reconcile()
195+
185196
@api.model
186197
def run_with_workflow(self, sale_workflow):
187198
workflow_domain = [("workflow_process_id", "=", sale_workflow.id)]

0 commit comments

Comments
 (0)