This question has been flagged
1 Reply
3993 Views

how can i combination fields (account.analytic.account) and (account.account) in reports ?

not: i have module _inhirt="account.analytic.account".

Avatar
Discard

Please briefly explain your exact requirements.

Author Best Answer

i have module _inherit = 'account.analytic.account' i want get fields 'name.debit,credit' from account.account. and i want to union (account.analytic.account) and (account.account)

report.py:

import time
from report import report_sxw
from osv import osv
from openerp import pooler

class iec_report_webkit(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
    super(iec_report_webkit, self).__init__(cr, uid, name, context=context)
    self.pool = pooler.get_pool(self.cr.dbname)
    self.cursor = self.cr

    name_obj= self.pool.get('account.account').browse(cr, uid, uid).name
    credit_obj= self.pool.get('account.account').browse(cr, uid, uid).credit
    debit_obj= self.pool.get('account.account').browse(cr, uid, uid).debit
    parent_obj= self.pool.get('account.account').browse(cr, uid, uid).parent_id

    self.localcontext.update({
            'time': time,
            'cr':cr,
            'uid': uid,
            })

report_sxw.report_sxw('report.iec.report.webkit',
                  'account.analytic.account',
                  'addons/iec/report/iec_report_webkit.mako', parser=iec_report_webkit)

mako templet:

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.0 Transitional//EN”>
<html>
<head> </head>
<body>
<table width="500" border="0" align="center">
<tr>
<td colspan="2" style="background-color:#FFA500;">
<h1 align="center">
  report webkit
 </h1>
 </td>
 </tr>
 <tr>
 <td style="background-color:#eeeeee;height:200px;width:400px;">
<table dir="rtl" align="center" border="1"  bordercolor="#c1d3e1"  size="90*90" >
  <caption>mezan</caption>
  <br/>
  <br/>
  <br/>
   <colgroup>
       <tr align="right">
       <th font-size="30" >field1</th>
       <th font-size="30" >field2</th>
      <th font-size="30" >field3</th>
       <th font-size="30" >field4</th>
       </tr>
      %for o in objects :
      <tr>
        <td>${o.debit}</td>
        <td>${o.credit}</td> 
        <td>${o.name}</td>          
         <td>${o.debit.name}</td>
        <td>${o.credit.name}</td> 
        <td>${o.name.name}</td>             
     </tr>
    %endfor
    </table> 
   </td>
  </tr>
   <tr>
  <td colspan="2" style="background-color:#FFA500;text-align:center;">
 </td>
  </tr>
  </table>
  </body>
  </html>
Avatar
Discard