Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

0

how can i combination fields in reports OpenERP?

By
Muaz
on 1/7/14, 2:56 AM 1,399 views

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

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

Please briefly explain your exact requirements.

Jasad
on 1/7/14, 5:10 AM
0
Muaz
On 1/7/14, 5:44 AM

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>

Your Answer

Please try to give a substantial answer. If you wanted to comment on the question or answer, just use the commenting tool. Please remember that you can always revise your answers - no need to answer the same question twice. Also, please don't forget to vote - it really helps to select the best questions and answers!

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 1/7/14, 2:56 AM
Seen: 1399 times
Last updated: 3/16/15, 8:10 AM