Masse salariale: ajout couleur arriere plan des separateurs de l'export ODS
authorJean-Philippe Caissy <jpcaissy@piji.ca>
Thu, 29 Mar 2012 15:46:36 +0000 (10:46 -0500)
committerJean-Philippe Caissy <jpcaissy@piji.ca>
Thu, 29 Mar 2012 15:46:36 +0000 (10:46 -0500)
project/rh/masse_salariale.py
project/rh/ods.py

index f859766..7a46d80 100644 (file)
@@ -40,7 +40,7 @@ TYPE_NATURE_INDEMN = u"Indemnité"
 TYPE_NATURE_PAIEMENT = u"Accessoire"
 TYPE_NATURE_CHARGES = u"Charges"
 TYPE_NATURE_TRAITEMENT = u"Traitement"
-HEADER_SEPARATOR = ('sep', '', {'columnwidth': '0.4cm'})
+HEADER_SEPARATOR = ('sep', ods.Separator, {'columnwidth': '0.4cm'})
 
 
 class MasseSalariale():
@@ -476,7 +476,7 @@ class MasseSalariale():
                     'masse_salariale_annee_euro': \
                             masse_salariale_euro.montant * regime *
                             rapport_nombre_jours,
-                    'sep': None,
+                    'sep': ods.Separator(),
             }
 
             grand_total += round(masse_salariale, 2)
index 3b48784..cfccc89 100644 (file)
@@ -10,6 +10,12 @@ from odf.style import Style, MasterPage, PageLayout, PageLayoutProperties, \
         DrawingPageProperties
 
 
+class Separator():
+
+    def __unicode__(self):
+        return u""
+
+
 def valuetype(val):
     valuetype = "string"
     if isinstance(val, str):
@@ -109,17 +115,20 @@ class TableRow(Wrapper):
                 kwargs['value'] = float(value)
             elif type(value) == type(None):
                 kwargs['stringvalue'] = u""
-                kwargs['stringvalue'] = u""
             else:
                 kwargs['stringvalue'] = unicode(value)
 
+        style = self._doc.add_automatic_style(family='table-cell')
         if 'verticalalign' in kwargs:
-            style = self._doc.add_automatic_style(family='table-cell')
             style.addElement(odf.style.TableCellProperties(
-                verticalalign=kwargs['verticalalign']))
-            kwargs['stylename'] = style.getAttribute('name')
+                verticalalign=kwargs['verticalalign'], wrapoption='wrap'))
             del kwargs['verticalalign']
 
+        if isinstance(value, Separator):
+            style.addElement(odf.style.TableCellProperties(
+                backgroundcolor='#D3D3D3'))
+
+        kwargs['stylename'] = style.getAttribute('name')
 #        props = {}
 #        if 'fontweight' in kwargs:
 #            props['fontweight'] = kwargs.pop('fontweight')