Compelted partner balance and partner ledger report with wizard...
authorapa-tiny <patelamit2003@gmail.com>
Mon, 20 Oct 2008 11:14:38 +0000 (16:44 +0530)
committerapa-tiny <patelamit2003@gmail.com>
Mon, 20 Oct 2008 11:14:38 +0000 (16:44 +0530)
bzr revid: patelamit2003@gmail.com-20081020111438-xyqsoxc3ef5luabz

addons/account/report/partner_balance.py
addons/account/report/partner_balance.rml
addons/account/report/third_party_ledger.py
addons/account/report/third_party_ledger.rml
addons/account/wizard/wizard_partner_balance_report.py
addons/account/wizard/wizard_third_party_ledger.py

index ea0a986..5194565 100644 (file)
@@ -161,13 +161,13 @@ class partner_balance(report_sxw.rml_parse):
         if data['form']['state'] == 'none':
             print"========none=========="
             self.transform_none_into_date_array(data)
-        if data['form']['state'] == 'bydate':
+        elif data['form']['state'] == 'bydate':
             print"========bydate=========="
             self.transform_date_into_date_array(data)
-        if data['form']['state'] == 'byperiod':
+        elif data['form']['state'] == 'byperiod':
             print"========byperiod=========="
             self.transform_period_into_date_array(data)
-        if data['form']['state'] == 'all':
+        elif data['form']['state'] == 'all':
             print"========both=========="
             self.transform_both_into_date_array(data)      
                   
index 8eaf6ec..561eb07 100644 (file)
@@ -3,6 +3,7 @@
   <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
     <pageTemplate id="first">
       <frame id="first" x1="57.0" y1="57.0" width="481" height="728"/>
+               <header>
                        <pageGraphics>
                                <!--logo-->
                                <!--<fill color="darkblue"/>-->
 
                                <!--COL 1-->
                                <drawString x="1.0cm" y="28.1cm">[[ company.name ]]</drawString>
-                               <drawString x="12.7cm" y="28.1cm">Partner Balance [[ data['form']['result_selection'] == 'customer' and '/ Débiteur' ]] [[ data['form']['result_selection'] == 'supplier' and '/ Créancier' ]] [[ data['form']['result_selection'] == 'all' and '/ Créancier et Débiteur' ]] - [[ get_currency(data['form']) ]]</drawString>
+                               <drawRightString x="20cm" y="28.1cm">Partnar Balance [[ data['form']['result_selection'] == 'customer' and '/ Débiteur' ]] [[ data['form']['result_selection'] == 'supplier' and '/ Créancier' ]] [[ data['form']['result_selection'] == 'all' and '/ Créancier et Débiteur' ]] [[ company.currency_id.name ]]</drawRightString>
+
 
                                <!-- Header -->
 
 
                                <setFont name="Helvetica" size="9"/>
-                               <drawString x="1.0cm" y="1cm"> [[ time.strftime("%m-%d-%y %H:%M", time.localtime()) ]]</drawString>
+                               <drawString x="1.0cm" y="1cm"> [[ time.strftime("%Y-%m-%d %H:%M", time.localtime()) ]]</drawString>
                                <drawString x="19.0cm" y="1cm">Page <pageNumber/></drawString>
-
                                <!--<drawRightString x="19.8cm" y="28cm">[[ company.rml_header1 ]]</drawRightString>-->
 
 
@@ -32,6 +33,7 @@
                                <lines>1cm 27.7cm 20cm 27.7cm</lines>
                                <setFont name="Helvetica" size="8"/>
                        </pageGraphics>
+               </header>
     </pageTemplate>
   </template>
   <stylesheet>
       <lineStyle kind="GRID" colorName="black"/>
     </blockTableStyle>
     <blockTableStyle id="Table2">
-       <lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
-       <lineStyle kind="LINEBELOW" colorName="#000000" start="0,1" stop="-1,1"/>
-       <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,2" stop="-1,-1"/>
        <lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
        <lineStyle kind="LINEBELOW" colorName="#000000" start="0,1" stop="-1,1"/>
-
-
-      <blockValign value="TOP"/>
-      <blockAlignment value="RIGHT" start="2,1" stop="-1,-1"/>
+      <!--<lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,2" stop="-1,-1"/>
+       <lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
+       <lineStyle kind="LINEBELOW" colorName="#000000" start="0,1" stop="-1,1"/> -->
+    <blockValign value="TOP"/>
+    <blockAlignment value="RIGHT" start="2,1" stop="-1,-1"/>
     </blockTableStyle>
     <blockTableStyle id="Table3">
       <blockAlignment value="LEFT"/>
     <initialize>
       <paraStyle name="all" alignment="justify"/>
     </initialize>
-    <paraStyle name="P1" fontName="Helvetica" fontSize="8.0" leading="25" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
-    <paraStyle name="P2" fontName="Helvetica" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+
     <paraStyle name="P3" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
     <paraStyle name="P4" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
     <paraStyle name="P5" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
     <paraStyle name="P6" fontName="Helvetica" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+
+    <paraStyle name="P7" fontName="Helvetica-Bold" fontSize="9.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="P8" fontName="Helvetica-Bold" fontSize="9.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+
     <paraStyle name="P7" fontName="Helvetica-Bold" fontSize="8.5" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
     <paraStyle name="P8" fontName="Helvetica-Bold" fontSize="8.5" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+
     <paraStyle name="P9" fontName="Helvetica" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
     <paraStyle name="P9b" fontName="Helvetica-Bold" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
     <paraStyle name="P10" fontName="Helvetica" alignment="CENTER"/>
     <paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
     <paraStyle name="Caption" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
     <paraStyle name="Index" fontName="Helvetica"/>
+
+     <blockTableStyle id="TrLevel8">
+      <blockLeftPadding length="0" start="0,0" stop="-1,0"/>
+    </blockTableStyle>
+    <blockTableStyle id="TrLevel7">
+      <blockLeftPadding length="0" start="0,0" stop="-1,0"/>
+    </blockTableStyle>
+    <blockTableStyle id="TrLevel6">
+      <blockLeftPadding length="0" start="0,0" stop="-1,0"/>
+     </blockTableStyle>
+    <blockTableStyle id="TrLevel5">
+      <blockLeftPadding length="0" start="0,0" stop="-1,0"/>
+    </blockTableStyle>
+    <blockTableStyle id="TrLevel4">
+     <blockLeftPadding length="0" start="0,0" stop="-1,0"/>
+    </blockTableStyle>
+    <blockTableStyle id="TrLevel3">
+     <lineStyle kind="LINEBELOW" colorName="#777777" start="1,0" stop="1,0"/>
+      <blockLeftPadding length="0" start="0,3" stop="1,3"/>
+    </blockTableStyle>
+    <blockTableStyle id="TrLevel2">
+      <lineStyle kind="LINEBELOW" colorName="#777777" start="1,0" stop="-1,0"/>
+      <blockLeftPadding length="0" start="0,0" stop="1,0"/>
+    </blockTableStyle>
+       <blockTableStyle id="TrLevel1">
+      <lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
+      <blockLeftPadding length="0" start="0,0" stop="1,0"/>
+    </blockTableStyle>
+
+    <blockTableStyle id="TrLevel0">
+      <lineStyle kind="LINEBELOW" colorName="#777777" start="0,2" stop="1,2"/>
+      <lineStyle kind="LINEBELOW" colorName="#ffffff" start="2,2" stop="-1,2"/>
+    </blockTableStyle>
+    <blockTableStyle id="LineLevel1">
+               <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,2" stop="-1,-1"/>
+       </blockTableStyle>
+
+       <blockTableStyle id="Line1">
+               <lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
+       </blockTableStyle>
+
+       <blockTableStyle id="Line2">
+       <lineStyle kind="LINEBELOW" colorName="#000000" start="0,1" stop="-1,1"/>
+       </blockTableStyle>
+
+    <paraStyle
+               name="Level8"
+               fontName="Helvetica-Bold"
+               fontSize="8.0" />
+     <paraStyle
+               name="Level7"
+               fontName="Helvetica-Bold"
+               fontSize="8.0" />
+     <paraStyle
+               name="Level6"
+               fontName="Helvetica-Bold"
+               fontSize="8.0" />
+    <paraStyle
+               name="Level5"
+               fontName="Helvetica-Bold"
+               fontSize="8.0" />
+    <paraStyle
+               name="Level4"
+               fontName="Helvetica-Bold"
+               fontSize="8.0" />
+    <paraStyle
+               name="Level3"
+               fontName="Helvetica-Bold"
+               fontSize="8.0" />
+    <paraStyle name="Level2"
+               fontSize="8.0"
+               fontName="Helvetica-Bold"
+               />
+       <paraStyle name="Level1"
+               fontSize="8.0"
+               fontName="Helvetica-Bold"
+               />
+
+       <paraStyle
+               name="Amt_Level8"
+               fontName="Helvetica-Bold"
+               fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+     <paraStyle
+               name="Amt_Level7"
+               fontName="Helvetica-Bold"
+               fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+     <paraStyle
+               name="Amt_Level6"
+               fontName="Helvetica-Bold"
+               fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle
+               name="Amt_Level5"
+               fontName="Helvetica-Bold"
+               fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle
+               name="Amt_Level4"
+               fontName="Helvetica-Bold"
+               fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle
+               name="Amt_Level3"
+               fontName="Helvetica-Bold"
+               fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="Amt_Level2"
+               fontSize="8.0"
+               fontName="Helvetica-Bold" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"
+               />
+       <paraStyle name="Amt_Level1"
+               fontSize="8.0"
+               fontName="Helvetica-Bold" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"
+               />
+
+       <paraStyle
+               name="Det_Level8"
+               fontName="Times-Italic"
+               fontSize="8.0" leading="5"/>
+     <paraStyle
+               name="Det_Level7"
+               fontName="Times-Italic"
+               fontSize="8.0" leading="5"/>
+     <paraStyle
+               name="Det_Level6"
+               fontName="Times-Italic"
+               fontSize="8.0" leading="5"/>
+    <paraStyle
+               name="Det_Level5"
+               fontName="Times-Italic"
+               fontSize="8.0" leading="5"/>
+    <paraStyle
+               name="Det_Level4"
+               fontName="Times-Italic"
+               fontSize="8.0" leading="5"/>
+    <paraStyle
+               name="Det_Level3"
+               fontName="Times-Italic"
+               fontSize="8.0" leading="5"/>
+    <paraStyle name="Det_Level2"
+               fontSize="8.0" leading="5"
+               fontName="Times-Italic"
+               />
+       <paraStyle name="Det_Level1"
+               fontSize="8.0" leading="5"
+               fontName="Times-Italic"
+               />
+
+       <paraStyle
+               name="Det_Amt_Level8"
+               fontName="Times-Italic"
+               fontSize="8.0" leading="5" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+     <paraStyle
+               name="Det_Amt_Level7"
+               fontName="Times-Italic"
+               fontSize="8.0" leading="5" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+     <paraStyle
+               name="Det_Amt_Level6"
+               fontName="Times-Italic"
+               fontSize="8.0" leading="5" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle
+               name="Det_Amt_Level5"
+               fontName="Times-Italic"
+               fontSize="8.0" leading="5" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle
+               name="Det_Amt_Level4"
+               fontName="Times-Italic"
+               fontSize="8.0" leading="5" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle
+               name="Det_Amt_Level3"
+               fontName="Times-Italic"
+               fontSize="8.0" leading="5" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
+    <paraStyle name="Det_Amt_Level2"
+               fontSize="8.0"
+               fontName="Times-Italic" leading="5" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"
+               />
+       <paraStyle name="Det_Amt_Level1"
+               fontSize="8.0"
+               fontName="Times-Italic" leading="5" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"
+               />
+
+
   </stylesheet>
   <story>
-
-        <blockTable colWidths="61.0,240.0,60.0,60.0,60.0,60.0" repeatRows="1" style="Table2">
+        <blockTable colWidths="61.0,206.0,69.0,68.0,69.0,68.0" repeatRows="1" style="Table2">
       <tr>
         <td>
-          <para style="P12a">Code</para>
+          <para style="P12a">[[ setTag('tr','tr',{'style':'Line1'}) ]] Code </para>
         </td>
         <td>
           <para style="P12a">Partner name</para>
       </tr>
       <tr>
         <td>
-          <para style="P7">Grand total</para>
+          <para style="P7">[[ setTag('tr','tr',{'style':'Line2'}) ]] Grand total</para>
         </td>
         <td>
           <para style="P8"></para>
           <para style="P3">[[ repeatIn(lines(data), 'a') ]]<font face="Helvetica">[[ a['type']==3 and ( setTag('para','para',{'fontName':'Helvetica-Bold'})) ]] [[ a['ref'] ]] [[ a['type']==3 and a['code'] ]]</font></para>
         </td>
         <td>
-          <para style="P3">[[ a['type']==3 and ( setTag('para','para',{'fontName':'Helvetica-Bold'})) ]]   [[ a['name']  ]] </para>
+          <para style="P3">[[ a['type']==3 and ( setTag('tr','tr',{'style':'TrLevel0'})) ]] [[ a['type']==3 and ( setTag('para','para',{'fontName':'Helvetica-Bold'})) ]] [[ a['type']==1 and ( setTag('blockTable','blockTable',{'style':'LineLevel1'})) ]] [[ a['name'] ]]</para>
         </td>
         <td>
-          <para style="P4">[[ a['type']==3 and ( setTag('para','para',{'fontName':'Helvetica-Bold'})) ]]  [[ a['debit'] or '0.0' ]]</para>
+          <para style="P4">
+               <font><u>[[ (a['type']==3 or removeParentNode('font')) and setTag('para','para',{'fontName':'Helvetica-Bold'}) ]] [[ a['debit'] or '0.0' ]]</u></font>
+               <font>[[ (a['type']!=3 or removeParentNode('font')) and setTag('para','para',{'fontName':'Helvetica'}) ]] [[ a['debit'] or '0.0' ]]</font>
+                 </para>
         </td>
         <td>
-          <para style="P4">[[ a['type']==3 and ( setTag('para','para',{'fontName':'Helvetica-Bold'})) ]] [[ a['credit'] or '0.0' ]]</para>
+          <para style="P4">
+               <font><u>[[ (a['type']==3 or removeParentNode('font')) and setTag('para','para',{'fontName':'Helvetica-Bold'}) ]] [[ a['credit'] or '0.0' ]]</u></font>
+               <font>[[ (a['type']!=3 or removeParentNode('font')) and setTag('para','para',{'fontName':'Helvetica'}) ]] [[ a['credit'] or '0.0' ]]</font>
+                 </para>
         </td>
         <td>
-          <para style="P4">[[ a['type']==3 and ( setTag('para','para',{'fontName':'Helvetica-Bold'})) ]] [[ a['balance'] or '0.0' ]]</para>
+          <para style="P4">
+               <font><u>[[ (a['type']==3 or removeParentNode('font')) and setTag('para','para',{'fontName':'Helvetica-Bold'}) ]] [[ a['balance'] or '0.0' ]]</u></font>
+               <font>[[ (a['type']!=3 or removeParentNode('font')) and setTag('para','para',{'fontName':'Helvetica'}) ]] [[ a['balance'] or '0.0' ]]</font>
+                 </para>
         </td>
         <td>
-          <para style="P4">[[ a['type']==3 and ( setTag('para','para',{'fontName':'Helvetica-Bold'})) ]] [[ a['enlitige'] or '0.0' ]]</para>
+          <para style="P4">
+               <font><u>[[ (a['type']==3 or removeParentNode('font')) and setTag('para','para',{'fontName':'Helvetica-Bold'}) ]] [[ a['enlitige'] or '0.0' ]]</u></font>
+               <font>[[ (a['type']!=3 or removeParentNode('font')) and setTag('para','para',{'fontName':'Helvetica'}) ]] [[ a['enlitige'] or '0.0' ]]</font>
+                 </para>
         </td>
       </tr>
     </blockTable>
-
   </story>
 </document>
\ No newline at end of file
index aa04279..afc5635 100755 (executable)
@@ -79,6 +79,54 @@ class third_party_ledger(rml_parse.rml_parse):
                self.date_lst = return_array
                self.date_lst.sort()
 
+       def transform_both_into_date_array(self,data):
+               
+               if not data['form']['periods'][0][2] :
+                       periods_id =  self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
+               else:
+                       periods_id = data['form']['periods'][0][2]
+               date_array = [] 
+               for period_id in periods_id:
+                       period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
+                       date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop)
+                       
+               period_start_date = date_array[0]
+               date_start_date = data['form']['date1']
+               period_stop_date = date_array[-1]
+               date_stop_date = data['form']['date2']
+               
+               if period_start_date<date_start_date:
+                       start_date = period_start_date
+               else :
+                       start_date = date_start_date
+                       
+               if date_stop_date<period_stop_date:
+                       stop_date = period_stop_date
+               else :
+                       stop_date = date_stop_date
+                       
+               print"start_date",start_date
+               print"stop_date",stop_date
+               final_date_array = []
+               final_date_array = final_date_array + self.date_range(start_date, stop_date)
+               self.date_lst = final_date_array
+               self.date_lst.sort()
+               
+       def transform_none_into_date_array(self,data):
+               sql = "SELECT min(date) as start_date from account_move_line"
+               self.cr.execute(sql)
+               start_date = self.cr.fetchone()[0]
+               print"start_date",start_date
+               sql = "SELECT max(date) as start_date from account_move_line"
+               self.cr.execute(sql)
+               stop_date = self.cr.fetchone()[0]
+               print"stop_date",stop_date
+               array= []
+               array = array + self.date_range(start_date, stop_date)
+               self.date_lst = array
+               self.date_lst.sort()
+               
+       
        def comma_me(self,amount):
                if  type(amount) is float :
                        amount = str('%.2f'%amount)
@@ -108,11 +156,25 @@ class third_party_ledger(rml_parse.rml_parse):
                # Transformation des date
                #
                #
-               if data['form']['fiscalyear']: 
-                       self.transform_period_into_date_array(data)
-               else:
-                       self.transform_date_into_date_array(data)
+#              if data['form']['fiscalyear']: 
+#                      self.transform_period_into_date_array(data)
+#              else:
+#                      self.transform_date_into_date_array(data)
                ##
+               if data['form']['state'] == 'none':
+                       print"-----none-----"
+                       self.transform_none_into_date_array(data)
+               elif data['form']['state'] == 'bydate':
+                       print"-----bydate-------"
+                       self.transform_date_into_date_array(data)
+               elif data['form']['state'] == 'byperiod':
+                       print"-----byperiod-------"
+                       self.transform_period_into_date_array(data)
+               elif data['form']['state'] == 'all':
+                       print"-----all-------"
+                       self.transform_both_into_date_array(data)
+                       
+               
                self.date_lst_string = '\'' + '\',\''.join(map(str,self.date_lst)) + '\''
                #
                #new_ids = [id for (id,) in self.cr.fetchall()]
index 02f52a0..d19a339 100755 (executable)
@@ -2,7 +2,7 @@
 <document filename="test.pdf">
   <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
     <pageTemplate id="first">
-    
+
       <frame id="first" x1="57.0" y1="57.0" width="481" height="728"/>
        <header>
                        <pageGraphics>
                                <!--COL 1-->
                                <drawString x="1.0cm" y="28.1cm">[[ company.name ]]</drawString>
                                <drawRightString x="20cm" y="28.1cm">Third Party Ledger [[ data['form']['result_selection'] == 'customer' and '/ Débiteur' ]] [[ data['form']['result_selection'] == 'supplier' and '/ Créancier' ]] [[ data['form']['result_selection'] == 'all' and '/ Créancier et Débiteur' ]]</drawRightString>
-                               
+
                                <!-- Header -->
-                               
-                               
+
+
                                <setFont name="Helvetica" size="9"/>
                                <drawString x="1.0cm" y="1cm"> [[ time.strftime("%Y-%m-%d %H:%M", time.localtime()) ]]</drawString>
                                <drawString x="19.0cm" y="1cm">Page <pageNumber/></drawString>
                                <!--<drawRightString x="19.8cm" y="28cm">[[ company.rml_header1 ]]</drawRightString>-->
-                               
+
 
                            <lineMode width="0.7"/>
                                <lines>1cm 27.7cm 20cm 27.7cm</lines>
                                <setFont name="Helvetica" size="8"/>
-                       
+
                        </pageGraphics>
-                       </header>            
+                       </header>
     </pageTemplate>
-    
+
   </template>
   <stylesheet>
     <blockTableStyle id="Standard_Outline">
       <blockBackground colorName="#e6e6e6" start="1,1" stop="1,1"/>
       <blockBackground colorName="#e6e6e6" start="2,1" stop="2,1"/>
     </blockTableStyle>
-    
+
     <blockTableStyle id="tbl_heading">
-      
+
       <blockValign value="TOP"/>
-   
+
        <lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,0"/>
     </blockTableStyle>
-         
+
        <blockTableStyle id="Table2">
       <blockAlignment value="LEFT"/>
       <blockValign value="LEFT"/>
-     
+
       <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
-     
-      
+
+
     </blockTableStyle>
     <blockTableStyle id="Table3">
       <blockLeftPadding length="0" start="1,0" stop="1,0"/>
       <blockAlignment value="LEFT"/>
       <blockValign value="LEFT"/>
-    
-     <lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,-1"/> 
+
+     <lineStyle kind="LINEBELOW" colorName="#000000" start="0,0" stop="-1,-1"/>
     </blockTableStyle>
     <blockTableStyle id="Table5">
       <blockAlignment value="LEFT"/>
       <blockValign value="LEFT"/>
          <lineStyle kind="LINEBELOW" colorName="#777777" start="0,0" stop="0,-1"/>
-     
-      
+
+
     </blockTableStyle>
     <blockTableStyle id="Table4">
       <blockAlignment value="LEFT"/>
       <blockValign value="LEFT"/>
       <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,0" stop="-1,-1"/>
     </blockTableStyle>
-    
-    
+
+
     <initialize>
       <paraStyle name="all" alignment="justify"/>
     </initialize>
     <paraStyle name="Index" fontName="Helvetica"/>
   </stylesheet>
   <story>
-       
+
        <para style="P2"><font color="white"></font></para>
        <para>
                <font color="white">[[ data['form']['page_split'] == True or removeParentNode('para') ]] </font>
     <blockTable colWidths="50.0,30.0,42.0,220.0,69.0,72.0,63.0" repeatRows="1" style="tbl_heading">
         <tr>
         <td>
-        
+
                        <para style="date">Date</para>
                </td>
                <td>
                </td>
                <td>
                        <para style="P16">Debit</para>
-               </td>   
+               </td>
                <td>
                        <para style="P16">Credit</para>
                </td>
                      <font color="white">[[ data['form']['page_split'] == False or removeParentNode('para') ]] </font>
                       <font color="white">[[ repeatIn(objects, 'p') ]]</font>
                    </para>
-                       <blockTable colWidths="200.0,137.0,69.0,72.0,63.0" style="Table5">
+                       <blockTable colWidths="300.0,37.0,69.0,72.0,63.0" style="Table5">
                     <tr>
                        <td>
                                <para style="total">[[ p.ref ]] - [[ p.name ]]</para>
                        </td>
                     </tr>
                    </blockTable>
-                   <blockTable colWidths="45.0,30.0,42.0,220.0,69.0,72.0,63.0" style="Table2">
+                   <blockTable colWidths="45.0,30.0,262.0,0.0,69.0,72.0,63.0" style="Table2">
                     <tr>
                             <td>
                                <para style="P15"><font face="Helvetica">[[ repeatIn(lines(p,data), 'line') ]]</font>[[ line['date'] ]]</para>
                                <para style="P3">[[ line['code'] ]]</para>
                         </td>
                         <td>
-                               <para style="P3">[[ line['ref'] ]]</para>
+                               <para style="P3">[[ line['ref'] ]] / [[ line['name'] ]]</para>
                         </td>
                         <td>
-                               <para style="P4">[[ line['name'] ]]</para>
+                               <para style="P4"></para>
                         </td>
                         <td>
                                <para style="P5">[[ (line['debit']) or '' ]]</para>
                         </td>
                     </tr>
                    </blockTable>
-                   
+
        </td>
      </tr>
     </blockTable>
-    
-       
-    
-       
+
+
+
+
   </story>
-</document>
+</document>
\ No newline at end of file
index 1fb8012..d90a68a 100644 (file)
@@ -73,7 +73,7 @@ period_fields = {
         'required':True
     },
     'soldeinit':{'string':" Inclure les soldes initiaux",'type':'boolean'},
-    'date1': {'string':'  Start date', 'type':'date', 'required':True,'default': lambda *a: time.strftime('%Y-01-01')},
+    'date1': {'string':'          Start date', 'type':'date', 'required':True,'default': lambda *a: time.strftime('%Y-01-01')},
     'date2': {'string':'End date', 'type':'date', 'required':True,'default': lambda *a: time.strftime('%Y-%m-%d')},
 }
 
index d62aaef..f4b9c5a 100755 (executable)
@@ -33,41 +33,51 @@ import pooler
 period_form = '''<?xml version="1.0"?>
 <form string="Select period">
        
-       <group colspan = "4" >
-    <field name="company_id" colspan = "4"/>
-    </group>
-    <group colspan = "4" >
-       <field name="state" required="True"/>
-   
-       </group>
-       <newline/>
-       <group attrs="{'invisible':[('state','=','byperiod')]}" colspan = "4">
-       <field name="date1"/>
-       <field name="date2"/>
-       </group>
-       <newline/>
-       
-       <group attrs="{'invisible':[('state','=','bydate')]}" colspan = "4">
-    <field name="fiscalyear" colspan = "4"/>
-    <field name="periods" colspan = "4"/>
-    </group>
-    <group colspan = "4" >
+       <field name="company_id"/>
     <field name="result_selection"/>
-       <field name="soldeinit"/>
-       </group>
-       <group colspan = "4" >
+    <newline/>
+    <field name="fiscalyear"/>
+    <label colspan="2" string="(Keep empty for all open fiscal years)" align="0.0"/>
+    <group colspan = "4" >
        <field name="reconcil"/>
        <field name="page_split"/>
        </group>
+    <newline/>
+    <separator string="Filters" colspan="4"/>
+    <field name="state" required="True"/>
+    <newline/>
+    
+    <group attrs="{'invisible':[('state','=','byperiod'),('state','=','none')]}" colspan="4">
+        <separator string="Date Filter" colspan="4"/>
+        <field name="date1"/>
+        <field name="date2"/>
+    </group>
+    <group attrs="{'invisible':[('state','=','bydate'),('state','=','none')]}" colspan="4">
+        <separator string="Filter on Periods" colspan="4"/>
+        <field name="periods" colspan="4" nolabel="1"/>
+    </group>
+   
 </form>'''
 
 period_fields = {
-       'company_id': {'string': '   Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
-       'state':{'string':"Report Type",'type':'selection','selection':[('bydate','By Date'),('byperiod','By Period')],'default': lambda *a:'byperiod' },
-       'fiscalyear': {'string': 'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear',
-               'help': 'Keep empty for all open fiscal year'},
-       'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'},
-       'result_selection':{'string':"     Partners",'type':'selection','selection':[('customer','Debiteur'),('supplier','Creancier'),('all','Tous')]},
+       'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
+    'state':{
+        'string':"Date/Period Filter",
+        'type':'selection',
+        'selection':[('bydate','By Date'),('byperiod','By Period'),('all','By Date and Period'),('none','No Filter')],
+        'default': lambda *a:'all'
+    },
+    'fiscalyear': {
+        'string':'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear',
+        'help': 'Keep empty for all open fiscal year'
+    },
+    'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty','states':{'none':[('readonly',True)],'bydate':[('readonly',True)]}},
+    'result_selection':{
+        'string':"Partner",
+        'type':'selection',
+        'selection':[('customer','Receivable Accounts'),('supplier','Payable Accounts'),('all','Receivable and Payable Accounts')],
+        'required':True
+    },
        'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'},
        'reconcil':{'string':"     Inclure les ecritures reconsiliees",'type':'boolean'},
        'page_split':{'string':"Un partenaire par page",'type':'boolean'},