Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM | e-Commerce | Accounting | Inventory | PoS | Project management | MRP | etc.
Hello All ,
I am currently overiding the default partner ledger report . I want to add a field in the report called invcompany_id , currently i have only edited one function of the report which is def Lines and i have inserted some lines in the sql of the function. :
def lines(self, partner):
move_state = ['draft','posted']
if self.target_move == 'posted':
move_state = ['posted']
full_account = 
RECONCILE_TAG = " "
RECONCILE_TAG = "AND l.reconcile_id IS NULL"
"SELECT l.id, aaa.invcompany_id as invcompany_id ,l.partner_id ,l.analytic_account_id as analytic_account_id,l.company_id, l.date, j.code, acc.code as a_code, acc.name as a_name, l.ref, m.name as move_name, l.name, l.debit, l.credit " \
"FROM account_move_line l " \
" LEFT JOIN account_analytic_account aaa ON (l.analytic_account_id = aaa.id)" \
"LEFT JOIN account_journal j " \
"ON (l.journal_id = j.id) " \
"LEFT JOIN account_account acc " \
"ON (l.account_id = acc.id) " \
"LEFT JOIN res_currency c ON (l.currency_id=c.id) " \
"LEFT JOIN account_move m ON (m.id=l.move_id)" \
"WHERE l.partner_id = %s " \
"AND l.account_id IN %s AND " + self.query +" " \
"AND m.state IN %s " \
" " + RECONCILE_TAG + " "\
"ORDER BY aaa.invcompany_id ,l.date",
(partner.id, tuple(self.account_ids), tuple(move_state)))
res = self.cr.dictfetchall()
sum = 0.0
sum = self.init_bal_sum
for r in res:
sum += r['debit'] - r['credit']
r['progress'] = sum
If i run this report the field i want to display is empty , when i print the dinctionary(res) it shows empty for field i am calling which is aaa.invoicing company , However when i run this sql query in pgadmin / postgres i get the right results and data .
Is there a reason why the code shows empty data for my sql but in pgadmin i get the right results ?.
About This Community
This platform 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.Register
Odoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.Test it now
|Asked: 4/13/15, 6:27 AM|
|Seen: 924 times|
|Last updated: 4/24/15, 9:53 AM|