Browse Source

himport produce chart_of_accounts for hreport (>2016/03)

Philippe Le Brouster 8 years ago
parent
commit
e458ef1481
3 changed files with 6 additions and 5 deletions
  1. 1 1
      bin/himport
  2. 1 1
      himport.conf.template
  3. 4 3
      himports/dolibarrWriter.py

+ 1 - 1
bin/himport

@@ -89,7 +89,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(options['years'])
+    Writer.write_hreport_chart_of_accounts(options['years'])
 
     dolibarr.disconnect()
 

+ 1 - 1
himport.conf.template

@@ -20,7 +20,7 @@ OUTPUT_FILES = {
     "sells":     "exercices/%year%/ecritures.d/vente.journal",
     "suppliers": "exercices/%year%/ecritures.d/achat.journal",
     "social":    "exercices/%year%/ecritures.d/cotisations_sociales.journal",
-    "pc":        "plan.journal",
+    "chart_of_accounts" : "exercices/%year%/chart_of_accounrs.journal"
 }
 
 #

+ 4 - 3
himports/dolibarrWriter.py

@@ -30,20 +30,21 @@ class Writer(object):
                 f.close()
 
     @staticmethod
-    def write_hreport_plan(years):
+    def write_hreport_chart_of_accounts(years):
         pc_names = settings.get('PC_NAMES')
         pc_descriptions = settings.get('PC_DESCRIPTIONS')
         for year in years:
-            filename = Writer.output_files['pc']
+            filename = Writer.output_files['chart_of_accounts']
             output_file = os.path.join(Writer.output_dir, filename).replace("%year%", year)
 
             f = codecs.open(output_file, 'w', 'utf-8')
+            f.write("%s/01/01 * Chart of account\n" % (year))
             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)
+                s = "    %s    0 ;  %s  %s\n" % (name, pc, desc)
                 f.write(s)
             f.close()