changeset 5985f439fd9c in modules/account_fr:default
details:
https://hg.tryton.org/modules/account_fr?cmd=changeset;node=5985f439fd9c
description:
Use reconciliation date as date instead of datetime
issue8843
review282451002
diffstat:
account.py | 3 ++-
tests/FEC.csv | 4 ++++
tests/scenario_fec.rst | 50 +++++++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 55 insertions(+), 2 deletions(-)
diffs (91 lines):
diff -r 0f650dec8bbd -r 5985f439fd9c account.py
--- a/account.py Sun Mar 01 16:12:37 2020 +0100
+++ b/account.py Mon Mar 16 21:43:17 2020 +0100
@@ -299,7 +299,8 @@
format_number(line.debit or 0),
format_number(line.credit or 0),
reconciliation.rec_name if reconciliation else '',
- format_date(reconciliation.create_date) if reconciliation else '',
+ format_date(reconciliation.create_date.date())
+ if reconciliation else '',
format_date(line.move.post_date),
format_number(line.amount_second_currency)
if line.amount_second_currency else '',
diff -r 0f650dec8bbd -r 5985f439fd9c tests/FEC.csv
--- a/tests/FEC.csv Sun Mar 01 16:12:37 2020 +0100
+++ b/tests/FEC.csv Mon Mar 16 21:43:17 2020 +0100
@@ -3,3 +3,7 @@
OUV Balance Initiale 0 20180101 7011 Produits finis
(ou groupe) A - 20180101 - 0,00 5,00
20180101
REV Revenue 1 20180101 7011 Produits finis (ou groupe) A
- 20180101 - 0,00 10,00
20180101
REV Revenue 1 20180101 4111 Clients - Ventes de biens ou de
prestations de services 2 Party - 20180101 - 10,00
0,00 20180101
+REV Revenue 2 20180101 7011 Produits finis (ou groupe) A
- 20180101 - 0,00 42,00
20180101
+REV Revenue 2 20180101 4111 Clients - Ventes de biens ou de
prestations de services 2 Party - 20180101 - 42,00
0,00 1 {current_date} 20180101
+CASH Cash 3 20180101 5311 Caisse en monnaie nationale
- 20180101 - 42,00 0,00
20180101
+CASH Cash 3 20180101 4111 Clients - Ventes de biens ou de
prestations de services 2 Party - 20180101 - 0,00
42,00 1 {current_date} 20180101
diff -r 0f650dec8bbd -r 5985f439fd9c tests/scenario_fec.rst
--- a/tests/scenario_fec.rst Sun Mar 01 16:12:37 2020 +0100
+++ b/tests/scenario_fec.rst Mon Mar 16 21:43:17 2020 +0100
@@ -110,6 +110,49 @@
... }, config.context)
>>> move.click('post')
+With reconciliation::
+
+ >>> move = Move()
+ >>> move.period = period
+ >>> move.journal = journal_revenue
+ >>> move.date = period.start_date
+ >>> line = move.lines.new()
+ >>> line.account = revenue
+ >>> line.credit = Decimal(42)
+ >>> line = move.lines.new()
+ >>> line.account = receivable
+ >>> line.debit = Decimal(42)
+ >>> line.party = party
+ >>> move.save()
+ >>> reconcile1, = [l for l in move.lines if l.account == receivable]
+ >>> Move.write([move.id], {
+ ... 'post_date': period.start_date,
+ ... 'post_number': '2',
+ ... }, config.context)
+ >>> move.click('post')
+ >>> move = Move()
+ >>> move.period = period
+ >>> move.journal = journal_cash
+ >>> move.date = period.start_date
+ >>> line = move.lines.new()
+ >>> line.account = cash
+ >>> line.debit = Decimal(42)
+ >>> line = move.lines.new()
+ >>> line.account = receivable
+ >>> line.credit = Decimal(42)
+ >>> line.party = party
+ >>> move.save()
+ >>> Move.write([move.id], {
+ ... 'post_date': period.start_date,
+ ... 'post_number': '3',
+ ... }, config.context)
+ >>> move.click('post')
+ >>> reconcile2, = [l for l in move.lines if l.account == receivable]
+ >>> reconcile_lines = Wizard('account.move.reconcile_lines',
+ ... [reconcile1, reconcile2])
+ >>> reconcile_lines.state == 'end'
+ True
+
Balance non-deferral::
>>> Sequence = Model.get('ir.sequence')
@@ -152,7 +195,12 @@
>>> FEC.form.filename
>>> file = os.path.join(os.path.dirname(__file__), 'FEC.csv')
>>> with io.open(file, mode='rb') as fp:
- ... FEC.form.file.decode('utf-8') == fp.read().decode('utf-8')
+ ... template = fp.read().decode('utf-8')
+ >>> current_date = datetime.date.today().strftime('%Y%m%d')
+ >>> template = template.format(
+ ... current_date=current_date,
+ ... )
+ >>> FEC.form.file.decode('utf-8') == template
True
Generate FEC for previous fiscal year::