odoo-addon-account-reconcile-oca 16.0.1.4.1.11__py3-none-any.whl → 16.0.2.0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- odoo/addons/account_reconcile_oca/README.rst +1 -1
- odoo/addons/account_reconcile_oca/__manifest__.py +1 -1
- odoo/addons/account_reconcile_oca/i18n/account_reconcile_oca.pot +21 -0
- odoo/addons/account_reconcile_oca/i18n/ca.po +21 -0
- odoo/addons/account_reconcile_oca/i18n/es.po +21 -0
- odoo/addons/account_reconcile_oca/i18n/fr.po +21 -0
- odoo/addons/account_reconcile_oca/i18n/hr.po +21 -0
- odoo/addons/account_reconcile_oca/i18n/it.po +21 -0
- odoo/addons/account_reconcile_oca/i18n/nl.po +21 -0
- odoo/addons/account_reconcile_oca/i18n/pt.po +21 -0
- odoo/addons/account_reconcile_oca/i18n/pt_BR.po +21 -0
- odoo/addons/account_reconcile_oca/i18n/sv.po +21 -0
- odoo/addons/account_reconcile_oca/i18n/tr.po +21 -0
- odoo/addons/account_reconcile_oca/models/account_account_reconcile.py +3 -3
- odoo/addons/account_reconcile_oca/models/account_bank_statement_line.py +219 -91
- odoo/addons/account_reconcile_oca/models/account_reconcile_abstract.py +19 -22
- odoo/addons/account_reconcile_oca/static/description/index.html +1 -1
- odoo/addons/account_reconcile_oca/static/src/js/widgets/reconcile_data_widget.esm.js +2 -0
- odoo/addons/account_reconcile_oca/tests/test_bank_account_reconcile.py +110 -0
- odoo/addons/account_reconcile_oca/views/account_bank_statement_line.xml +15 -4
- {odoo_addon_account_reconcile_oca-16.0.1.4.1.11.dist-info → odoo_addon_account_reconcile_oca-16.0.2.0.0.1.dist-info}/METADATA +2 -2
- {odoo_addon_account_reconcile_oca-16.0.1.4.1.11.dist-info → odoo_addon_account_reconcile_oca-16.0.2.0.0.1.dist-info}/RECORD +24 -24
- {odoo_addon_account_reconcile_oca-16.0.1.4.1.11.dist-info → odoo_addon_account_reconcile_oca-16.0.2.0.0.1.dist-info}/WHEEL +0 -0
- {odoo_addon_account_reconcile_oca-16.0.1.4.1.11.dist-info → odoo_addon_account_reconcile_oca-16.0.2.0.0.1.dist-info}/top_level.txt +0 -0
@@ -60,6 +60,19 @@ class AccountBankStatementLine(models.Model):
|
|
60
60
|
"Percentage Analytic"
|
61
61
|
),
|
62
62
|
)
|
63
|
+
manual_in_currency = fields.Boolean(readonly=True, store=False, prefetch=False)
|
64
|
+
manual_in_currency_id = fields.Many2one(
|
65
|
+
"res.currency", readonly=True, store=False, prefetch=False
|
66
|
+
)
|
67
|
+
manual_amount_in_currency = fields.Monetary(
|
68
|
+
store=False,
|
69
|
+
default=False,
|
70
|
+
prefetch=False,
|
71
|
+
currency_field="manual_in_currency_id",
|
72
|
+
)
|
73
|
+
manual_exchange_counterpart = fields.Boolean(
|
74
|
+
store=False,
|
75
|
+
)
|
63
76
|
manual_model_id = fields.Many2one(
|
64
77
|
"account.reconcile.model",
|
65
78
|
check_company=True,
|
@@ -163,7 +176,7 @@ class AccountBankStatementLine(models.Model):
|
|
163
176
|
self.manual_model_id,
|
164
177
|
self.reconcile_data_info["reconcile_auxiliary_id"],
|
165
178
|
),
|
166
|
-
self.manual_reference
|
179
|
+
self.manual_reference,
|
167
180
|
)
|
168
181
|
else:
|
169
182
|
# Refreshing data
|
@@ -189,26 +202,19 @@ class AccountBankStatementLine(models.Model):
|
|
189
202
|
else:
|
190
203
|
new_data.append(line)
|
191
204
|
if is_new_line:
|
192
|
-
|
193
|
-
self.
|
194
|
-
self.add_account_move_line_id, "other", True, pending_amount
|
195
|
-
)
|
205
|
+
reconcile_auxiliary_id, lines = self._get_reconcile_line(
|
206
|
+
self.add_account_move_line_id, "other", True, pending_amount
|
196
207
|
)
|
208
|
+
new_data += lines
|
197
209
|
self.reconcile_data_info = self._recompute_suspense_line(
|
198
210
|
new_data,
|
199
211
|
self.reconcile_data_info["reconcile_auxiliary_id"],
|
200
212
|
self.manual_reference,
|
201
|
-
exchange_recompute=True,
|
202
213
|
)
|
203
214
|
self.can_reconcile = self.reconcile_data_info.get("can_reconcile", False)
|
204
215
|
self.add_account_move_line_id = False
|
205
216
|
|
206
|
-
def _recompute_suspense_line(
|
207
|
-
self, data, reconcile_auxiliary_id, manual_reference, exchange_recompute=False
|
208
|
-
):
|
209
|
-
reconcile_auxiliary_id = self._compute_exchange_rate(
|
210
|
-
data, reconcile_auxiliary_id, exchange_recompute=exchange_recompute
|
211
|
-
)
|
217
|
+
def _recompute_suspense_line(self, data, reconcile_auxiliary_id, manual_reference):
|
212
218
|
can_reconcile = True
|
213
219
|
total_amount = 0
|
214
220
|
new_data = []
|
@@ -286,15 +292,29 @@ class AccountBankStatementLine(models.Model):
|
|
286
292
|
self.ensure_one()
|
287
293
|
data = self.reconcile_data_info.get("data", [])
|
288
294
|
new_data = []
|
295
|
+
related_move_line_id = False
|
289
296
|
for line in data:
|
297
|
+
if line.get("reference") == self.manual_reference:
|
298
|
+
related_move_line_id = line.get("id")
|
299
|
+
break
|
300
|
+
for line in data:
|
301
|
+
if (
|
302
|
+
self.manual_delete
|
303
|
+
and related_move_line_id
|
304
|
+
and line.get("original_exchange_line_id") == related_move_line_id
|
305
|
+
):
|
306
|
+
# We should remove the related exchange rate line
|
307
|
+
continue
|
290
308
|
if line["reference"] == self.manual_reference:
|
291
309
|
if self.manual_delete:
|
292
310
|
self.update(
|
293
311
|
{
|
294
|
-
"manual_delete": False,
|
295
312
|
"manual_reference": False,
|
296
313
|
"manual_account_id": False,
|
297
314
|
"manual_amount": False,
|
315
|
+
"manual_exchange_counterpart": False,
|
316
|
+
"manual_in_currency_id": False,
|
317
|
+
"manual_in_currency": False,
|
298
318
|
"manual_name": False,
|
299
319
|
"manual_partner_id": False,
|
300
320
|
"manual_line_id": False,
|
@@ -304,6 +324,7 @@ class AccountBankStatementLine(models.Model):
|
|
304
324
|
"manual_original_amount": False,
|
305
325
|
"manual_currency_id": False,
|
306
326
|
"analytic_distribution": False,
|
327
|
+
"manual_amount_in_currency": False,
|
307
328
|
}
|
308
329
|
)
|
309
330
|
continue
|
@@ -311,11 +332,22 @@ class AccountBankStatementLine(models.Model):
|
|
311
332
|
self.manual_account_id = line["account_id"][0]
|
312
333
|
self.manual_amount = line["amount"]
|
313
334
|
self.manual_currency_id = line["currency_id"]
|
335
|
+
self.manual_in_currency_id = line.get("line_currency_id")
|
336
|
+
self.manual_in_currency = line.get("line_currency_id") and line[
|
337
|
+
"currency_id"
|
338
|
+
] != line.get("line_currency_id")
|
339
|
+
self.manual_amount_in_currency = line.get("currency_amount")
|
314
340
|
self.manual_name = line["name"]
|
341
|
+
self.manual_exchange_counterpart = line.get(
|
342
|
+
"is_exchange_counterpart", False
|
343
|
+
)
|
315
344
|
self.manual_partner_id = (
|
316
345
|
line.get("partner_id") and line["partner_id"][0]
|
317
346
|
)
|
318
|
-
|
347
|
+
manual_line = (
|
348
|
+
self.env["account.move.line"].browse(line["id"]).exists()
|
349
|
+
)
|
350
|
+
self.manual_line_id = manual_line
|
319
351
|
self.analytic_distribution = line.get("analytic_distribution", {})
|
320
352
|
if self.manual_line_id:
|
321
353
|
self.manual_move_id = self.manual_line_id.move_id
|
@@ -323,6 +355,7 @@ class AccountBankStatementLine(models.Model):
|
|
323
355
|
self.manual_kind = line["kind"]
|
324
356
|
self.manual_original_amount = line.get("original_amount", 0.0)
|
325
357
|
new_data.append(line)
|
358
|
+
self.update({"manual_delete": False})
|
326
359
|
self.reconcile_data_info = self._recompute_suspense_line(
|
327
360
|
new_data,
|
328
361
|
self.reconcile_data_info["reconcile_auxiliary_id"],
|
@@ -330,6 +363,17 @@ class AccountBankStatementLine(models.Model):
|
|
330
363
|
)
|
331
364
|
self.can_reconcile = self.reconcile_data_info.get("can_reconcile", False)
|
332
365
|
|
366
|
+
@api.onchange("manual_amount_in_currency")
|
367
|
+
def _onchange_manual_amount_in_currency(self):
|
368
|
+
if self.manual_line_id.exists() and self.manual_line_id:
|
369
|
+
self.manual_amount = self.manual_in_currency_id._convert(
|
370
|
+
self.manual_amount_in_currency,
|
371
|
+
self.company_id.currency_id,
|
372
|
+
self.company_id,
|
373
|
+
self.manual_line_id.date,
|
374
|
+
)
|
375
|
+
self._onchange_manual_reconcile_vals()
|
376
|
+
|
333
377
|
@api.onchange(
|
334
378
|
"manual_account_id",
|
335
379
|
"manual_partner_id",
|
@@ -368,6 +412,23 @@ class AccountBankStatementLine(models.Model):
|
|
368
412
|
)
|
369
413
|
if line["kind"] == "liquidity":
|
370
414
|
self._update_move_partner()
|
415
|
+
if self.manual_line_id and self.manual_line_id.id == line.get(
|
416
|
+
"original_exchange_line_id"
|
417
|
+
):
|
418
|
+
# Now, we should edit the amount of the exchange rate
|
419
|
+
amount = self._get_exchange_rate_amount(
|
420
|
+
self.manual_amount,
|
421
|
+
self.manual_amount_in_currency,
|
422
|
+
self.manual_line_id.currency_id,
|
423
|
+
self.manual_line_id,
|
424
|
+
)
|
425
|
+
line.update(
|
426
|
+
{
|
427
|
+
"amount": amount,
|
428
|
+
"credit": -amount if amount < 0 else 0.0,
|
429
|
+
"debit": amount if amount > 0 else 0.0,
|
430
|
+
}
|
431
|
+
)
|
371
432
|
new_data.append(line)
|
372
433
|
self.reconcile_data_info = self._recompute_suspense_line(
|
373
434
|
new_data,
|
@@ -451,49 +512,15 @@ class AccountBankStatementLine(models.Model):
|
|
451
512
|
new_data.append(new_line)
|
452
513
|
return new_data, reconcile_auxiliary_id
|
453
514
|
|
454
|
-
def _compute_exchange_rate(
|
455
|
-
self, data, reconcile_auxiliary_id, exchange_recompute=False
|
456
|
-
):
|
457
|
-
if not exchange_recompute:
|
458
|
-
return reconcile_auxiliary_id
|
459
|
-
foreign_currency = (
|
460
|
-
self.currency_id != self.company_id.currency_id
|
461
|
-
or self.foreign_currency_id
|
462
|
-
or any(line["currency_id"] != line["line_currency_id"] for line in data)
|
463
|
-
)
|
464
|
-
if not foreign_currency or self.is_reconciled:
|
465
|
-
return reconcile_auxiliary_id
|
466
|
-
currency = self.journal_id.currency_id or self.company_id.currency_id
|
467
|
-
amount = sum(d.get("net_amount", 0) for d in data)
|
468
|
-
if not currency.is_zero(amount):
|
469
|
-
account = self.company_id.expense_currency_exchange_account_id
|
470
|
-
if amount > 0:
|
471
|
-
account = self.company_id.income_currency_exchange_account_id
|
472
|
-
data.append(
|
473
|
-
{
|
474
|
-
"reference": "reconcile_auxiliary;%s" % reconcile_auxiliary_id,
|
475
|
-
"id": False,
|
476
|
-
"account_id": account.name_get()[0],
|
477
|
-
"partner_id": False,
|
478
|
-
"date": fields.Date.to_string(self.date),
|
479
|
-
"name": self.payment_ref or self.name,
|
480
|
-
"amount": -amount,
|
481
|
-
"net_amount": -amount,
|
482
|
-
"credit": amount if amount > 0 else 0.0,
|
483
|
-
"debit": -amount if amount < 0 else 0.0,
|
484
|
-
"kind": "other",
|
485
|
-
"currency_id": self.currency_id.id,
|
486
|
-
"line_currency_id": self.currency_id.id,
|
487
|
-
"currency_amount": -amount,
|
488
|
-
}
|
489
|
-
)
|
490
|
-
reconcile_auxiliary_id += 1
|
491
|
-
return reconcile_auxiliary_id
|
492
|
-
|
493
515
|
def _default_reconcile_data(self, from_unreconcile=False):
|
494
516
|
liquidity_lines, suspense_lines, other_lines = self._seek_for_lines()
|
495
|
-
data = [
|
517
|
+
data = []
|
496
518
|
reconcile_auxiliary_id = 1
|
519
|
+
for line in liquidity_lines:
|
520
|
+
reconcile_auxiliary_id, lines = self._get_reconcile_line(
|
521
|
+
line, "liquidity", reconcile_auxiliary_id=reconcile_auxiliary_id
|
522
|
+
)
|
523
|
+
data += lines
|
497
524
|
if not from_unreconcile:
|
498
525
|
res = (
|
499
526
|
self.env["account.reconcile.model"]
|
@@ -508,30 +535,36 @@ class AccountBankStatementLine(models.Model):
|
|
508
535
|
data, res["model"], reconcile_auxiliary_id
|
509
536
|
),
|
510
537
|
self.manual_reference,
|
511
|
-
exchange_recompute=True
|
512
538
|
)
|
513
539
|
elif res and res.get("amls"):
|
514
540
|
amount = self.amount_total_signed
|
515
541
|
for line in res.get("amls", []):
|
516
|
-
line_data = self._get_reconcile_line(
|
517
|
-
line,
|
542
|
+
reconcile_auxiliary_id, line_data = self._get_reconcile_line(
|
543
|
+
line,
|
544
|
+
"other",
|
545
|
+
is_counterpart=True,
|
546
|
+
max_amount=amount,
|
547
|
+
reconcile_auxiliary_id=reconcile_auxiliary_id,
|
518
548
|
)
|
519
|
-
amount -=
|
520
|
-
data
|
549
|
+
amount -= sum(line.get("amount") for line in line_data)
|
550
|
+
data += line_data
|
521
551
|
return self._recompute_suspense_line(
|
522
552
|
data,
|
523
553
|
reconcile_auxiliary_id,
|
524
554
|
self.manual_reference,
|
525
|
-
exchange_recompute=True,
|
526
555
|
)
|
556
|
+
else:
|
557
|
+
other_lines = (
|
558
|
+
other_lines.matched_credit_ids.credit_move_id
|
559
|
+
| other_lines.matched_debit_ids.debit_move_id
|
560
|
+
)
|
561
|
+
for line in other_lines:
|
562
|
+
reconcile_auxiliary_id, lines = self._get_reconcile_line(
|
563
|
+
line, "other", from_unreconcile=from_unreconcile
|
564
|
+
)
|
565
|
+
data += lines
|
527
566
|
return self._recompute_suspense_line(
|
528
|
-
data
|
529
|
-
+ [
|
530
|
-
self._get_reconcile_line(
|
531
|
-
line, "other", from_unreconcile=from_unreconcile
|
532
|
-
)
|
533
|
-
for line in other_lines
|
534
|
-
],
|
567
|
+
data,
|
535
568
|
reconcile_auxiliary_id,
|
536
569
|
self.manual_reference,
|
537
570
|
)
|
@@ -544,7 +577,7 @@ class AccountBankStatementLine(models.Model):
|
|
544
577
|
self.ensure_one()
|
545
578
|
self.reconcile_mode = self.journal_id.reconcile_mode
|
546
579
|
result = getattr(self, "_reconcile_bank_line_%s" % self.reconcile_mode)(
|
547
|
-
self.reconcile_data_info["data"]
|
580
|
+
self._prepare_reconcile_line_data(self.reconcile_data_info["data"])
|
548
581
|
)
|
549
582
|
self.reconcile_data_info = False
|
550
583
|
return result
|
@@ -718,10 +751,12 @@ class AccountBankStatementLine(models.Model):
|
|
718
751
|
if not res:
|
719
752
|
continue
|
720
753
|
liquidity_lines, suspense_lines, other_lines = record._seek_for_lines()
|
721
|
-
data = [
|
722
|
-
|
723
|
-
|
724
|
-
|
754
|
+
data = []
|
755
|
+
for line in liquidity_lines:
|
756
|
+
reconcile_auxiliary_id, lines = record._get_reconcile_line(
|
757
|
+
line, "liquidity"
|
758
|
+
)
|
759
|
+
data += lines
|
725
760
|
reconcile_auxiliary_id = 1
|
726
761
|
if res.get("status", "") == "write_off":
|
727
762
|
data = record._recompute_suspense_line(
|
@@ -729,29 +764,55 @@ class AccountBankStatementLine(models.Model):
|
|
729
764
|
data, res["model"], reconcile_auxiliary_id
|
730
765
|
),
|
731
766
|
self.manual_reference,
|
732
|
-
exchange_recompute=True
|
733
767
|
)
|
734
768
|
elif res.get("amls"):
|
735
769
|
amount = self.amount
|
736
770
|
for line in res.get("amls", []):
|
737
|
-
|
771
|
+
reconcile_auxiliary_id, line_datas = record._get_reconcile_line(
|
738
772
|
line, "other", is_counterpart=True, max_amount=amount
|
739
773
|
)
|
740
|
-
amount -= line_data.get("amount")
|
741
|
-
data
|
774
|
+
amount -= sum(line_data.get("amount") for line_data in line_datas)
|
775
|
+
data += line_datas
|
742
776
|
data = record._recompute_suspense_line(
|
743
777
|
data,
|
744
778
|
reconcile_auxiliary_id,
|
745
779
|
self.manual_reference,
|
746
|
-
exchange_recompute=True,
|
747
780
|
)
|
748
781
|
if not data.get("can_reconcile"):
|
749
782
|
continue
|
750
783
|
getattr(
|
751
784
|
record, "_reconcile_bank_line_%s" % record.journal_id.reconcile_mode
|
752
|
-
)(data["data"])
|
785
|
+
)(self._prepare_reconcile_line_data(data["data"]))
|
753
786
|
return result
|
754
787
|
|
788
|
+
def _prepare_reconcile_line_data(self, lines):
|
789
|
+
new_lines = []
|
790
|
+
reverse_lines = {}
|
791
|
+
for line in lines:
|
792
|
+
if not line.get("id") and not line.get("original_exchange_line_id"):
|
793
|
+
new_lines.append(line)
|
794
|
+
elif not line.get("original_exchange_line_id"):
|
795
|
+
reverse_lines[line["id"]] = line
|
796
|
+
for line in lines:
|
797
|
+
if line.get("original_exchange_line_id"):
|
798
|
+
reverse_lines[line["original_exchange_line_id"]].update(
|
799
|
+
{
|
800
|
+
"amount": reverse_lines[line["original_exchange_line_id"]][
|
801
|
+
"amount"
|
802
|
+
]
|
803
|
+
+ line["amount"],
|
804
|
+
"credit": reverse_lines[line["original_exchange_line_id"]][
|
805
|
+
"credit"
|
806
|
+
]
|
807
|
+
+ line["credit"],
|
808
|
+
"debit": reverse_lines[line["original_exchange_line_id"]][
|
809
|
+
"debit"
|
810
|
+
]
|
811
|
+
+ line["debit"],
|
812
|
+
}
|
813
|
+
)
|
814
|
+
return new_lines + list(reverse_lines.values())
|
815
|
+
|
755
816
|
def button_manual_reference_full_paid(self):
|
756
817
|
self.ensure_one()
|
757
818
|
if not self.reconcile_data_info["manual_reference"]:
|
@@ -764,14 +825,14 @@ class AccountBankStatementLine(models.Model):
|
|
764
825
|
if line["reference"] == manual_reference and line.get("id"):
|
765
826
|
total_amount = -line["amount"] + line["original_amount_unsigned"]
|
766
827
|
original_amount = line["original_amount_unsigned"]
|
767
|
-
|
768
|
-
self.
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
)
|
828
|
+
reconcile_auxiliary_id, lines = self._get_reconcile_line(
|
829
|
+
self.env["account.move.line"].browse(line["id"]),
|
830
|
+
"other",
|
831
|
+
is_counterpart=True,
|
832
|
+
reconcile_auxiliary_id=reconcile_auxiliary_id,
|
833
|
+
max_amount=original_amount,
|
774
834
|
)
|
835
|
+
new_data += lines
|
775
836
|
new_data.append(
|
776
837
|
{
|
777
838
|
"reference": "reconcile_auxiliary;%s" % reconcile_auxiliary_id,
|
@@ -796,7 +857,6 @@ class AccountBankStatementLine(models.Model):
|
|
796
857
|
new_data,
|
797
858
|
reconcile_auxiliary_id,
|
798
859
|
self.manual_reference,
|
799
|
-
exchange_recompute=True,
|
800
860
|
)
|
801
861
|
self.can_reconcile = self.reconcile_data_info.get("can_reconcile", False)
|
802
862
|
|
@@ -811,18 +871,86 @@ class AccountBankStatementLine(models.Model):
|
|
811
871
|
self.move_id.to_check = False
|
812
872
|
|
813
873
|
def _get_reconcile_line(
|
814
|
-
self,
|
874
|
+
self,
|
875
|
+
line,
|
876
|
+
kind,
|
877
|
+
is_counterpart=False,
|
878
|
+
max_amount=False,
|
879
|
+
from_unreconcile=False,
|
880
|
+
reconcile_auxiliary_id=False,
|
815
881
|
):
|
816
|
-
|
882
|
+
new_vals = super()._get_reconcile_line(
|
817
883
|
line,
|
818
884
|
kind,
|
819
885
|
is_counterpart=is_counterpart,
|
820
886
|
max_amount=max_amount,
|
821
887
|
from_unreconcile=from_unreconcile,
|
822
888
|
)
|
823
|
-
|
824
|
-
|
825
|
-
|
889
|
+
rates = []
|
890
|
+
for vals in new_vals:
|
891
|
+
if vals["partner_id"] is False:
|
892
|
+
vals["partner_id"] = (False, self.partner_name)
|
893
|
+
reconcile_auxiliary_id, rate = self._compute_exchange_rate(
|
894
|
+
vals, line, reconcile_auxiliary_id
|
895
|
+
)
|
896
|
+
if rate:
|
897
|
+
rates.append(rate)
|
898
|
+
new_vals += rates
|
899
|
+
return reconcile_auxiliary_id, new_vals
|
900
|
+
|
901
|
+
def _get_exchange_rate_amount(self, amount, currency_amount, currency, line):
|
902
|
+
return (
|
903
|
+
currency._convert(
|
904
|
+
currency_amount,
|
905
|
+
self.company_id.currency_id,
|
906
|
+
self.company_id,
|
907
|
+
self.date,
|
908
|
+
)
|
909
|
+
- amount
|
910
|
+
)
|
911
|
+
|
912
|
+
def _compute_exchange_rate(
|
913
|
+
self,
|
914
|
+
vals,
|
915
|
+
line,
|
916
|
+
reconcile_auxiliary_id,
|
917
|
+
):
|
918
|
+
foreign_currency = (
|
919
|
+
self.currency_id != self.company_id.currency_id
|
920
|
+
or self.foreign_currency_id
|
921
|
+
or vals["currency_id"] != vals["line_currency_id"]
|
922
|
+
)
|
923
|
+
if not foreign_currency or self.is_reconciled:
|
924
|
+
return reconcile_auxiliary_id, False
|
925
|
+
currency = self.env["res.currency"].browse(vals["line_currency_id"])
|
926
|
+
amount = self._get_exchange_rate_amount(
|
927
|
+
vals.get("amount", 0), vals.get("currency_amount", 0), currency, line
|
928
|
+
)
|
929
|
+
if currency.is_zero(amount):
|
930
|
+
return reconcile_auxiliary_id, False
|
931
|
+
account = self.company_id.expense_currency_exchange_account_id
|
932
|
+
if amount < 0:
|
933
|
+
account = self.company_id.income_currency_exchange_account_id
|
934
|
+
data = {
|
935
|
+
"is_exchange_counterpart": True,
|
936
|
+
"original_exchange_line_id": line.id,
|
937
|
+
"reference": "reconcile_auxiliary;%s" % reconcile_auxiliary_id,
|
938
|
+
"id": False,
|
939
|
+
"account_id": account.name_get()[0],
|
940
|
+
"partner_id": False,
|
941
|
+
"date": fields.Date.to_string(self.date),
|
942
|
+
"name": self.payment_ref or self.name,
|
943
|
+
"amount": amount,
|
944
|
+
"net_amount": amount,
|
945
|
+
"credit": -amount if amount < 0 else 0.0,
|
946
|
+
"debit": amount if amount > 0 else 0.0,
|
947
|
+
"kind": "other",
|
948
|
+
"currency_id": self.company_id.currency_id.id,
|
949
|
+
"line_currency_id": self.company_id.currency_id.id,
|
950
|
+
"currency_amount": amount,
|
951
|
+
}
|
952
|
+
reconcile_auxiliary_id += 1
|
953
|
+
return reconcile_auxiliary_id, data
|
826
954
|
|
827
955
|
def add_statement(self):
|
828
956
|
self.ensure_one()
|
@@ -38,33 +38,30 @@ class AccountReconcileAbstract(models.AbstractModel):
|
|
38
38
|
):
|
39
39
|
date = self.date if "date" in self._fields else line.date
|
40
40
|
original_amount = amount = net_amount = line.debit - line.credit
|
41
|
-
amount_currency = self.company_id.currency_id
|
42
41
|
if is_counterpart:
|
43
|
-
|
44
|
-
|
45
|
-
|
42
|
+
currency_amount = -line.amount_residual_currency or line.amount_residual
|
43
|
+
amount = -line.amount_residual
|
44
|
+
currency = line.currency_id or self.company_id.currency_id
|
45
|
+
original_amount = net_amount = -line.amount_residual
|
46
46
|
if max_amount:
|
47
47
|
currency_max_amount = self.company_id.currency_id._convert(
|
48
|
-
max_amount,
|
48
|
+
max_amount, currency, self.company_id, date
|
49
49
|
)
|
50
|
-
if
|
50
|
+
if (
|
51
|
+
-currency_amount > currency_max_amount > 0
|
52
|
+
or -currency_amount < currency_max_amount < 0
|
53
|
+
):
|
51
54
|
amount = currency_max_amount
|
52
|
-
net_amount = max_amount
|
53
|
-
|
54
|
-
amount =
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
55
|
+
net_amount = -max_amount
|
56
|
+
currency_amount = -amount
|
57
|
+
amount = currency._convert(
|
58
|
+
currency_amount,
|
59
|
+
self.company_id.currency_id,
|
60
|
+
self.company_id,
|
61
|
+
date,
|
62
|
+
)
|
59
63
|
else:
|
60
|
-
|
61
|
-
amount = self.company_id.currency_id._convert(
|
62
|
-
amount, amount_currency, self.company_id, date
|
63
|
-
)
|
64
|
-
currency_amount = amount
|
65
|
-
amount = amount_currency._convert(
|
66
|
-
amount, self.company_id.currency_id, self.company_id, date
|
67
|
-
)
|
64
|
+
currency_amount = line.amount_currency
|
68
65
|
vals = {
|
69
66
|
"reference": "account.move.line;%s" % line.id,
|
70
67
|
"id": line.id,
|
@@ -99,4 +96,4 @@ class AccountReconcileAbstract(models.AbstractModel):
|
|
99
96
|
vals["original_amount_unsigned"] = original_amount
|
100
97
|
if is_counterpart:
|
101
98
|
vals["counterpart_line_ids"] = line.ids
|
102
|
-
return vals
|
99
|
+
return [vals]
|
@@ -367,7 +367,7 @@ ul.auto-toc {
|
|
367
367
|
!! This file is generated by oca-gen-addon-readme !!
|
368
368
|
!! changes will be overwritten. !!
|
369
369
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
370
|
-
!! source digest: sha256:
|
370
|
+
!! source digest: sha256:83727fd11a51544d1b4bdef6e38ceb4fd2bdeacdd56dbf4013fee99ee2a2f542
|
371
371
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -->
|
372
372
|
<p><a class="reference external image-reference" href="https://odoo-community.org/page/development-status"><img alt="Beta" src="https://img.shields.io/badge/maturity-Beta-yellow.png" /></a> <a class="reference external image-reference" href="http://www.gnu.org/licenses/agpl-3.0-standalone.html"><img alt="License: AGPL-3" src="https://img.shields.io/badge/licence-AGPL--3-blue.png" /></a> <a class="reference external image-reference" href="https://github.com/OCA/account-reconcile/tree/16.0/account_reconcile_oca"><img alt="OCA/account-reconcile" src="https://img.shields.io/badge/github-OCA%2Faccount--reconcile-lightgray.png?logo=github" /></a> <a class="reference external image-reference" href="https://translation.odoo-community.org/projects/account-reconcile-16-0/account-reconcile-16-0-account_reconcile_oca"><img alt="Translate me on Weblate" src="https://img.shields.io/badge/weblate-Translate%20me-F47D42.png" /></a> <a class="reference external image-reference" href="https://runboat.odoo-community.org/builds?repo=OCA/account-reconcile&target_branch=16.0"><img alt="Try me on Runboat" src="https://img.shields.io/badge/runboat-Try%20me-875A7B.png" /></a></p>
|
373
373
|
<p>This addon allows to reconcile bank statements and account marked as <cite>reconcile</cite>.</p>
|
@@ -45,6 +45,7 @@ export class AccountReconcileDataWidget extends Component {
|
|
45
45
|
);
|
46
46
|
data[line].amount_currency_format = fieldUtils.format.monetary(
|
47
47
|
data[line].currency_amount,
|
48
|
+
undefined,
|
48
49
|
{
|
49
50
|
currency: session.get_currency(data[line].line_currency_id),
|
50
51
|
}
|
@@ -64,6 +65,7 @@ export class AccountReconcileDataWidget extends Component {
|
|
64
65
|
return data;
|
65
66
|
}
|
66
67
|
onTrashLine(ev, line) {
|
68
|
+
ev.stopPropagation();
|
67
69
|
this.props.record.update({
|
68
70
|
manual_reference: line.reference,
|
69
71
|
manual_delete: true,
|