Browse Source

Ecriture du plan comptable pour chaque année comptable.

Philippe Le Brouster 9 years ago
parent
commit
e8aaf8099b
2 changed files with 16 additions and 16 deletions
  1. 1 1
      bin/himport
  2. 15 15
      himports/dolibarrWriter.py

+ 1 - 1
bin/himport

@@ -94,7 +94,7 @@ def do_sqlalchemy(options):
     Writer.write("sells", sell_journal, options['years'])
     Writer.write("suppliers", supplier_journal, options['years'])
     Writer.write("social", social_journal, options['years'])
-    Writer.write_hreport_plan()
+    Writer.write_hreport_plan(options['years'])
 
     dolibarr.disconnect()
 

+ 15 - 15
himports/dolibarrWriter.py

@@ -30,20 +30,20 @@ class Writer(object):
                 f.close()
 
     @staticmethod
-    def write_hreport_plan():
+    def write_hreport_plan(years):
         pc_names = settings.get('PC_NAMES')
         pc_descriptions = settings.get('PC_DESCRIPTIONS')
-
-        filename = Writer.output_files['pc']
-        output_file = os.path.join(Writer.output_dir, filename)
-
-        f = codecs.open(output_file, 'w', 'utf-8')
-        for pc in sorted(pc_names.keys()):
-            name = pc_names[pc]
-            if pc in pc_descriptions:
-                desc = pc_descriptions[pc]
-            else:
-                desc = name
-            s = "%s  %s  %s\n" % (name.ljust(80), pc.ljust(12), desc)
-            f.write(s)
-        f.close()
+        for year in years:
+            filename = Writer.output_files['pc']
+            output_file = os.path.join(Writer.output_dir, filename).replace("%year%", year)
+
+            f = codecs.open(output_file, 'w', 'utf-8')
+            for pc in sorted(pc_names.keys()):
+                name = pc_names[pc]
+                if pc in pc_descriptions:
+                    desc = pc_descriptions[pc]
+                else:
+                    desc = name
+                s = "%s  %s  %s\n" % (name.ljust(80), pc.ljust(12), desc)
+                f.write(s)
+            f.close()