Commit d74f56b6 authored by Jérome Perrin's avatar Jérome Perrin

accounting_l10n_fr: set a default value for PieceRef in FEC

according to https://bofip.impots.gouv.fr/bofip/9028-PGP.html/identifiant%3DBOI-CF-IOR-60-40-20-20170607#III._Donnees_devant_figurer_12

> Dans le cas des écritures pour lesquelles il n’existe pas de référence
> de pièce (par exemple, dans le cas des écritures d’à nouveau), ce
> champ doit néanmoins être rempli. Dans ce cas précis, la référence
> sera alors remplacée par une valeur conventionnelle définie par
> l’entreprise. Celle-ci sera précisée dans le descriptif remis au
> vérificateur en même temps que le fichier des écritures comptables
> (cf. VI § 390).

La valeur conventionnelle dans cet export est de donner à PieceRef la
même valeur que EcritureNum pour les écritures sans référence de pièce.
parent 7597c300
......@@ -2,7 +2,7 @@
<EcritureNum tal:content="context/getDestinationReference">Specific Reference</EcritureNum>
<EcritureDate tal:content="python: context.getStopDate().strftime('%Y-%m-%d')">Specific Date</EcritureDate>
<EcritureLib tal:content="context/getTitle">Title</EcritureLib>
<PieceRef tal:content="context/getReference">Reference</PieceRef>
<PieceRef tal:content="python: (context.getReference() or context.getDestinationReference() if options['test_compta_demat_compatibility'] else context.getReference())">Reference</PieceRef>
<PieceDate tal:content="python: context.getStopDate().strftime('%Y-%m-%d')"></PieceDate>
<tal:block tal:replace="nothing"><EcritureLet></EcritureLet>
<DateLet></DateLet></tal:block>
......
......@@ -2,7 +2,7 @@
<EcritureNum tal:content="context/getSourceReference">Specific Reference</EcritureNum>
<EcritureDate tal:content="python: context.getStartDate().strftime('%Y-%m-%d')">Specific Date</EcritureDate>
<EcritureLib tal:content="context/getTitle">Title</EcritureLib>
<PieceRef tal:content="context/getReference">Reference</PieceRef>
<PieceRef tal:content="python: (context.getReference() or context.getSourceReference() if options['test_compta_demat_compatibility'] else context.getReference())">Reference</PieceRef>
<PieceDate tal:content="python: context.getStartDate().strftime('%Y-%m-%d')"></PieceDate>
<tal:block tal:replace="nothing"><EcritureLet></EcritureLet>
<DateLet></DateLet></tal:block>
......
......@@ -533,6 +533,51 @@ class TestAccounting_l10n_fr(AccountingTestCase):
'//ecriture/PieceRef[text()="source"]/../ligne/Credit/text()'),
['0.00', '40.00', '200.00'])
def test_PieceRefDefaultValue(self):
account_module = self.portal.account_module
invoice = self._makeOne(
portal_type='Purchase Invoice Transaction',
title='Première Écriture',
simulation_state='delivered',
source_section_value=self.organisation_module.supplier,
stop_date=DateTime(2014, 2, 2),
lines=(
dict(
destination_value=account_module.payable, destination_debit=132.00),
dict(
destination_value=account_module.refundable_vat,
destination_credit=22.00),
dict(
destination_value=account_module.goods_purchase,
destination_credit=110.00)))
invoice.setSourceReference('source_reference')
invoice.setDestinationReference('destination_reference')
tree = etree.fromstring(
invoice.AccountingTransaction_viewAsSourceFECXML(
test_compta_demat_compatibility=True))
self.assertEqual(tree.xpath('//EcritureNum/text()'), ['source_reference'])
self.assertEqual(tree.xpath('//PieceRef/text()'), ['source_reference'])
tree = etree.fromstring(
invoice.AccountingTransaction_viewAsDestinationFECXML(
test_compta_demat_compatibility=True))
self.assertEqual(
tree.xpath('//EcritureNum/text()'), ['destination_reference'])
self.assertEqual(
tree.xpath('//PieceRef/text()'), ['destination_reference'])
tree = etree.fromstring(
invoice.AccountingTransaction_viewAsSourceFECXML(
test_compta_demat_compatibility=False))
self.assertEqual(tree.xpath('//EcritureNum/text()'), ['source_reference'])
self.assertEqual([n.text for n in tree.xpath('//PieceRef')], [None])
tree = etree.fromstring(
invoice.AccountingTransaction_viewAsDestinationFECXML(
test_compta_demat_compatibility=False))
self.assertEqual(
tree.xpath('//EcritureNum/text()'), ['destination_reference'])
self.assertEqual([n.text for n in tree.xpath('//PieceRef')], [None])
def test_suite():
suite = unittest.TestSuite()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment