Skip to content

Commit

Permalink
Merge pull request #11 from Starou/py2to3
Browse files Browse the repository at this point in the history
Py2to3
  • Loading branch information
Starou committed Mar 5, 2021
2 parents 9beebc4 + c473259 commit a2b4aba
Show file tree
Hide file tree
Showing 47 changed files with 2,158 additions and 2,204 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ sudo: required
language: python

python:
- 2.7
- 3.9

install:
install:
- pip install -q coverage
- pip install -q coveralls
- pip install .
Expand Down
110 changes: 55 additions & 55 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Colbert
:target: https://travis-ci.org/Starou/Colbert
:alt: Travis C.I.

*Colbert* is not about `Stephen Colbert <http://www.colbertnation.com/the-colbert-report-videos/430767/november-21-2013/intro---11-21-13>`_.
*Colbert* is not about this douche `Stephen Colbert <https://www.rt.com/usa/507821-barack-obama-stephen-colbert-interview/>`_.
It is serious matter.

The name is a tribute to `Jean-Baptiste Colbert <http://en.wikipedia.org/wiki/Jean-Baptiste_Colbert>`_,
Expand Down Expand Up @@ -79,11 +79,11 @@ automation) you can produce beautiful documents.
| |
| LaTex, etc. | LaTeX, etc.
| |
v v
v v
file-A.tex file-C.tex
file-A.pdf
file-A.ps


The core of accountancy is *le livre-journal*. This is our database where every
single operation occuring in your business is recorded. Each operation must be
Expand All @@ -96,29 +96,29 @@ operations by type.
The scaffold I use is the following::


+ MyBusiness/ +-- accountancy/ +-- livre-journal/ +-- livre-journal.txt
| |
| +-- Makefile
+ MyBusiness/ +-- accountancy/ +-- livre-journal/ +-- livre-journal.txt
| |
| +-- Makefile
|
+-- 2011/ +-- grand-livre/
| |
| +-- releves-bancaires/
| +-- releves-bancaires/
| |
| +-- factures/
| +-- factures/
| |
| +-- balance-des-comptes/
| |
| +-- bilan/
| |
| +-- compte-de-resultat/
| +-- compte-de-resultat/
| |
| +-- TVA/
| +-- TVA/
| |
| +-- ecritures-de-cloture/
|
+-- 2012/ +-- grand-livre/
| |
| +-- releves-bancaires/
| +-- releves-bancaires/
...


Expand Down Expand Up @@ -202,7 +202,7 @@ document):
Each entry is a multiline row in the table.
Each entry is a multiline row in the table.

I use *Line Blocks* to get a descent formatting in the multiline cells. Trying
to right-align the content of the two last columns was a failure.
Expand Down Expand Up @@ -235,7 +235,7 @@ A first script allows you to check the entries balance of the book:
My Makefile in the Livre-journal directory being:

.. code-block:: make
FILENAME="livre-journal"
all: pdf
Expand Down Expand Up @@ -591,7 +591,7 @@ And the Sed script::

s/\\setlength{\\DUtablewidth}{\\linewidth}/\\setlength{\\tabcolsep}{25pt} \\setlength{\\extrarowheight}{4.5pt}/
s/\\begin{longtable\*}.*/\\begin{longtable*}[c]{lrrr|lr}/


The reStructuredText output:

Expand Down Expand Up @@ -880,8 +880,8 @@ and use the script *colbert_calculer_facture.py* to fill it out:
"date_fin_execution": "30/04/2011",
"devise": "Euro",
"symbole_devise": "",
"nom_compte": "Produits - prestations de services",
"numero_compte": "706",
"nom_compte": "Produits - prestations de services",
"numero_compte": "706",
"detail": [
{
"reference": "ref-A",
Expand Down Expand Up @@ -912,53 +912,53 @@ Produce the following:
.. code-block:: json
{
"date_facture": "10/05/2011",
"symbole_devise": "\u20ac",
"deja_paye": "0.00",
"taux_penalites": "11",
"montant_ht": "5360.89",
"date_fin_execution": "30/04/2011",
"date_facture": "10/05/2011",
"symbole_devise": "\u20ac",
"deja_paye": "0.00",
"taux_penalites": "11",
"montant_ht": "5360.89",
"date_fin_execution": "30/04/2011",
"detail": [
{
"quantite": "4",
"description": "Prestation A.",
"reference": "ref-A",
"montant_ht": "400.00",
"prix_unitaire_ht": "100.00",
"unite": "jours",
"quantite": "4",
"description": "Prestation A.",
"reference": "ref-A",
"montant_ht": "400.00",
"prix_unitaire_ht": "100.00",
"unite": "jours",
"taux_tva": "19.6"
},
},
{
"quantite": "11",
"description": "Prestation B.",
"reference": "ref-B",
"montant_ht": "4960.89",
"prix_unitaire_ht": "450.99",
"unite": "jours",
"quantite": "11",
"description": "Prestation B.",
"reference": "ref-B",
"montant_ht": "4960.89",
"prix_unitaire_ht": "450.99",
"unite": "jours",
"taux_tva": "19.6"
}
],
"numero_facture": "YYYYYYY",
"devise": "Euro",
"nom_compte": "Produits - prestations de services",
"numero_compte": "706",
],
"numero_facture": "YYYYYYY",
"devise": "Euro",
"nom_compte": "Produits - prestations de services",
"numero_compte": "706",
"client": {
"ville": "Cupertino",
"code_postal": "11222",
"nom": "MyClient#1",
"adresse": "1, Infinite Loop",
"reference_commande": "XXXXX",
"ville": "Cupertino",
"code_postal": "11222",
"nom": "MyClient#1",
"adresse": "1, Infinite Loop",
"reference_commande": "XXXXX",
"nom_compte": "Clients - ventes de biens ou prestations de services",
"numero_compte": "4111-CL1"
},
"montant_ttc": "6411.62",
"date_debut_execution": "10/04/2011",
"reste_a_payer": "6411.62",
"nb_jours_payable_fin_de_mois": "60",
"date_debut_penalites": "01/08/2011",
},
"montant_ttc": "6411.62",
"date_debut_execution": "10/04/2011",
"reste_a_payer": "6411.62",
"nb_jours_payable_fin_de_mois": "60",
"date_debut_penalites": "01/08/2011",
"tva": {
"19.6": "1050.73"
},
},
"date_reglement": "31/07/2011"
}
Expand Down Expand Up @@ -1029,8 +1029,8 @@ Makefile (the same to generate the invoice associated with):
month = Juin
month_index = 007
year = 2012
date_debut = 01/06/2012
date_fin = 30/06/2012
date_debut = 01/06/2012
date_fin = 30/06/2012
ref_facture = $(year)-$(month_index)
Expand Down Expand Up @@ -1175,7 +1175,7 @@ Tests
Requirements
============

- Python 2.7.x
- Python 3.9+
- pytz
- Python Icalendar (https://github.com/collective/icalendar)
- Docutils (SVN)
Expand Down
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setup(
name="Colbert",
version="0.24",
version="0.30",
license='BSD Licence',
author='Stanislas Guerra',
author_email='stanislas.guerra@gmail.com',
Expand Down Expand Up @@ -43,6 +43,6 @@
'License :: OSI Approved :: BSD License',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.9',
],
)
44 changes: 22 additions & 22 deletions src/colbert/balance_des_comptes.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

import datetime
from decimal import Decimal
from colbert.utils import fmt_number, rst_table
from colbert.utils import DATE_FMT
from colbert.common import titre_principal_rst
from colbert.common import (TOTAL_DEBIT, TOTAL_CREDIT, SOLDE_DEBITEUR, SOLDE_CREDITEUR,
DATE_DEBUT, DATE_FIN, LABEL, NOM, NUMERO, COMPTES)
from .common import titre_principal_rst
from .common import (TOTAL_DEBIT, TOTAL_CREDIT, SOLDE_DEBITEUR, SOLDE_CREDITEUR,
DATE_DEBUT, DATE_FIN, LABEL, NOM, NUMERO, COMPTES)
from .utils import fmt_number, rst_table
from .utils import DATE_FMT

TOTAL_DEBITS = u'total_debits'
TOTAL_CREDITS = u'total_credits'
TOTAL_SOLDES_DEBITEURS = u'total_soldes_debiteurs'
TOTAL_SOLDES_CREDITEURS = u'total_soldes_crediteurs'
TOTAL_DEBITS = 'total_debits'
TOTAL_CREDITS = 'total_credits'
TOTAL_SOLDES_DEBITEURS = 'total_soldes_debiteurs'
TOTAL_SOLDES_CREDITEURS = 'total_soldes_crediteurs'


def balance_des_comptes(grand_livre, label="Balance des comptes"):
Expand Down Expand Up @@ -96,12 +96,12 @@ def balance_des_comptes_to_rst(balance_des_comptes, output_file):
table = [
# BUG dans la largeur du tableau pour conversion en PDF
# [(u"**Comptes**", COMPTES_LEN), (u"**Totaux**", TOTAUX_LEN), (u"**Soldes**", SOLDES_LEN)],
[(u"N°", NUMERO_COMPTE_LEN),
(u"Libellé", LIBELLE_COMPTE_LEN),
(u"Total débit", DEBIT_LEN),
(u"Total crédit", CREDIT_LEN),
(u"Solde débit", DEBIT_LEN),
(u"Solde crédit", CREDIT_LEN)]
[("N°", NUMERO_COMPTE_LEN),
("Libellé", LIBELLE_COMPTE_LEN),
("Total débit", DEBIT_LEN),
("Total crédit", CREDIT_LEN),
("Solde débit", DEBIT_LEN),
("Solde crédit", CREDIT_LEN)]
]

for compte in balance_des_comptes[COMPTES]:
Expand All @@ -127,16 +127,16 @@ def balance_des_comptes_to_rst(balance_des_comptes, output_file):

table.append([
('', NUMERO_COMPTE_LEN),
(u"**Totaux**", LIBELLE_COMPTE_LEN),
(total_debits and u"**%s**" % fmt_number(total_debits) or '', DEBIT_LEN),
(total_credits and u"**%s**" % fmt_number(total_credits) or '', CREDIT_LEN),
(total_soldes_debiteurs and u"**%s**" % fmt_number(total_soldes_debiteurs) or '', DEBIT_LEN),
(total_soldes_crediteurs and u"**%s**" % fmt_number(total_soldes_crediteurs) or '', CREDIT_LEN),
("**Totaux**", LIBELLE_COMPTE_LEN),
(total_debits and "**%s**" % fmt_number(total_debits) or '', DEBIT_LEN),
(total_credits and "**%s**" % fmt_number(total_credits) or '', CREDIT_LEN),
(total_soldes_debiteurs and "**%s**" % fmt_number(total_soldes_debiteurs) or '', DEBIT_LEN),
(total_soldes_crediteurs and "**%s**" % fmt_number(total_soldes_crediteurs) or '', CREDIT_LEN),
])

lines.append(rst_table(table))

output_file.write(u"\n".join(lines))
output_file.write(u"\n\n")
output_file.write("\n".join(lines))
output_file.write("\n\n")

return output_file
Loading

0 comments on commit a2b4aba

Please sign in to comment.