Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FFDN
himport
Commits
50a2ce3e
Commit
50a2ce3e
authored
Mar 26, 2017
by
plb
Browse files
python 3 compatiblity
parent
c3a2c786
Changes
4
Hide whitespace changes
Inline
Side-by-side
bin/himport
View file @
50a2ce3e
...
...
@@ -32,8 +32,8 @@ def process_args(argv):
[
"mysql-password="
,
"mysql-port"
,
"year="
]
)
except
getopt
.
GetoptError
:
print
"himport: Invalid options"
print
usage
print
(
"himport: Invalid options"
)
print
(
usage
)
sys
.
exit
(
2
)
options
[
'years'
]
=
list
()
...
...
@@ -41,7 +41,7 @@ def process_args(argv):
for
opt
,
arg
in
opts
:
if
opt
==
'-h'
:
print
usage
print
(
usage
)
sys
.
exit
()
elif
opt
in
(
"-v"
,
"--verbose"
):
options
[
'verbose'
]
+=
1
...
...
@@ -49,9 +49,9 @@ def process_args(argv):
options
[
'years'
].
append
(
str
(
arg
))
if
len
(
options
[
'years'
])
==
0
:
print
"You need to specify the accounting years"
print
""
print
usage
print
(
"You need to specify the accounting years"
)
print
(
""
)
print
(
usage
)
sys
.
exit
(
1
)
return
options
...
...
@@ -80,7 +80,7 @@ def do_sqlalchemy(options):
pc_missing
.
update
(
supplier_journal
.
check_pc
())
pc_missing
.
update
(
social_journal
.
check_pc
())
if
len
(
pc_missing
)
>
0
:
print
"WARNING: poste comptable manquant"
print
(
"WARNING: poste comptable manquant"
)
for
pc
in
pc_missing
:
sys
.
stdout
.
write
(
"%s
\n
"
%
(
pc
))
...
...
himports/dolibarrAlchemyHledger.py
View file @
50a2ce3e
...
...
@@ -41,7 +41,7 @@ class HledgerEntry(object):
# get_ledger : Print ledger output. Only defined in derived class
def
get_ledger
(
self
):
print
"WARNING: get_ledger not done"
print
(
"WARNING: get_ledger not done"
)
return
u
""
# check_pc : verify the accounting chart corresponding to the entry. Only defined in derived class.
...
...
@@ -137,7 +137,7 @@ class HledgerBankEntry(HledgerEntry):
for
fn
in
fns
:
try
:
third_code
=
fn
(
e
)
if
third_code
is
None
or
not
isinstance
(
third_code
,
unicode
):
if
third_code
is
None
or
not
isinstance
(
third_code
,
str
):
third_code
=
""
except
:
third_code
=
""
...
...
@@ -332,11 +332,11 @@ class HledgerSupplierEntry(HledgerBillingEntry):
total_ht
-=
ed
.
total_ht
if
total_ttc
>
1e-10
:
print
"Erreur dans l'écriture %s: total ttc = %s"
%
(
e
.
ref_supplier
,
total_ttc
)
print
(
"Erreur dans l'écriture %s: total ttc = %s"
%
(
e
.
ref_supplier
,
total_ttc
)
)
if
total_ht
>
1e-10
:
print
"Erreur dans l'écriture %s: total ht = %s"
%
(
e
.
ref_supplier
,
total_ht
)
print
(
"Erreur dans l'écriture %s: total ht = %s"
%
(
e
.
ref_supplier
,
total_ht
)
)
if
total_tva
>
1e-10
:
print
"Erreur dans l'écriture %s: total tva = %s"
%
(
e
.
ref_supplier
,
total_tva
)
print
(
"Erreur dans l'écriture %s: total tva = %s"
%
(
e
.
ref_supplier
,
total_tva
)
)
# getMissingPC: retrieve missing accounts
def
getMissingPC
(
self
):
...
...
@@ -519,11 +519,11 @@ class HledgerSellEntry(HledgerBillingEntry):
total_ht
-=
ed
.
total_ht
if
total_ttc
>
1e-10
:
print
"Erreur dans l'écriture %s: total ttc = %s"
%
(
e
.
facnumber
,
total_ttc
)
print
(
"Erreur dans l'écriture %s: total ttc = %s"
%
(
e
.
facnumber
,
total_ttc
)
)
if
total_ht
>
1e-10
:
print
"Erreur dans l'écriture %s: total ht = %s"
%
(
e
.
facnumber
,
total_ht
)
print
(
"Erreur dans l'écriture %s: total ht = %s"
%
(
e
.
facnumber
,
total_ht
)
)
if
total_tva
>
1e-10
:
print
"Erreur dans l'écriture %s: total tva = %s"
%
(
e
.
facnumber
,
total_tva
)
print
(
"Erreur dans l'écriture %s: total tva = %s"
%
(
e
.
facnumber
,
total_tva
)
)
#
...
...
himports/dolibarrWriter.py
View file @
50a2ce3e
...
...
@@ -20,7 +20,7 @@ class Writer(object):
if
not
os
.
path
.
exists
(
output_dir
):
os
.
makedirs
(
os
.
path
.
dirname
(
output_file
))
elif
not
os
.
path
.
isdir
(
output_dir
):
print
"Error: %s is not a dir
\n
"
%
(
output_dir
)
print
(
"Error: %s is not a dir
\n
"
%
(
output_dir
)
)
raise
os
.
error
()
f
=
codecs
.
open
(
output_file
,
'w'
,
'utf-8'
)
...
...
himports/settings.py
View file @
50a2ce3e
...
...
@@ -30,7 +30,9 @@ def get_ledger_account(code):
__settings
=
{}
for
conf_file
in
CONF_FILES
:
if
os
.
path
.
isfile
(
conf_file
):
execfile
(
conf_file
,
__settings
)
with
open
(
conf_file
)
as
f
:
code
=
compile
(
f
.
read
(),
conf_file
,
'exec'
)
exec
(
code
,
__settings
)
if
__settings
is
None
:
raise
Exception
(
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment