[IMP] Partner ledger reports

bzr revid: mra@mra-laptop-20100802090656-03dco2bnamdrh4rq
This commit is contained in:
Mustufa Rangwala 2010-08-02 14:36:56 +05:30
parent 2e44854582
commit 5e6432000f
5 changed files with 17 additions and 20 deletions

View File

@ -96,7 +96,7 @@ class account_analytic_line(osv.osv):
# Take the company currency as the reference one
context['currency_id']=company_obj.browse(cr, uid, company_id).currency_id.id
amount_unit=prod.price_get(pricetype.field, context)[prod.id]
amount=amount_unit*unit_amount or 1.0
amount = amount_unit*unit_amount or 1.0
return {'value': {
'amount': - round(amount, 2),
'general_account_id': a,

View File

@ -56,7 +56,6 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
'get_intial_balance':self._get_intial_balance,
'display_initial_balance':self._display_initial_balance,
'display_currency':self._display_currency,
})
@ -81,8 +80,10 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
return string_map
def set_context(self, objects, data, ids, report_type=None):
self.query = data['form']['query_line']
self.init_query = data['form']['initial_bal_query']
self.query = data['form'].get('query_line', '')
self.init_query = data['form'].get('initial_bal_query', '')
self.reconcil = data['form'].get('reconcil', True)
self.initial_balance = data['form'].get('initial_balance', True)
PARTNER_REQUEST = ''
if (data['model'] == 'res.partner'):
## Si on imprime depuis les partenaires
@ -101,7 +102,6 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
"FROM account_account a " \
"LEFT JOIN account_account_type t " \
"ON (a.type=t.code) " \
# "WHERE a.company_id = %s " \
'WHERE a.type IN %s' \
"AND a.active", (tuple(self.ACCOUNT_TYPE), ))
self.account_ids = [a for (a,) in self.cr.fetchall()]
@ -119,7 +119,6 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
(tuple(self.account_ids),))
res = self.cr.dictfetchall()
for res_line in res:
partner_to_use.append(res_line['partner_id'])
new_ids = partner_to_use
@ -129,7 +128,7 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
def lines(self, partner, data):
full_account = []
if data['form']['reconcil'] :
if self.reconcil:
RECONCILE_TAG = " "
else:
RECONCILE_TAG = "AND l.reconcile_id IS NULL"
@ -166,7 +165,7 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
def _sum_debit_partner(self, partner, data):
result_tmp = 0.0
if data['form']['reconcil'] :
if self.reconcil :
RECONCILE_TAG = " "
else:
RECONCILE_TAG = "AND reconcile_id IS NULL"
@ -188,7 +187,7 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
def _sum_credit_partner(self, partner, data):
result_tmp = 0.0
if data['form']['reconcil'] :
if self.reconcil :
RECONCILE_TAG = " "
else:
RECONCILE_TAG = "AND reconcile_id IS NULL"
@ -213,11 +212,11 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
return 0.0
result_tmp = 0.0
result_init = 0.0
if data['form']['reconcil'] :
if self.reconcil :
RECONCILE_TAG = " "
else:
RECONCILE_TAG = "AND reconcile_id IS NULL"
if data['form']['initial_balance']:
if self.initial_balance:
self.cr.execute(
"SELECT sum(debit) " \
"FROM account_move_line AS l " \
@ -252,11 +251,11 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
return 0.0
result_tmp = 0.0
result_init = 0.0
if data['form']['reconcil'] :
if self.reconcil :
RECONCILE_TAG = " "
else:
RECONCILE_TAG = "AND reconcile_id IS NULL"
if data['form']['initial_balance']: #self.date_lst and
if self.initial_balance:
self.cr.execute(
"SELECT sum(credit) " \
"FROM account_move_line AS l " \
@ -308,7 +307,7 @@ class third_party_ledger(rml_parse.rml_parse, common_report_header):
return currency_total
def _display_initial_balance(self, data):
if data['form']['initial_balance'] :
if self.initial_balance :
return True
return False
@ -325,4 +324,4 @@ report_sxw.report_sxw('report.account.third_party_ledger_other', 'res.partner',
'addons/account/report/third_party_ledger_other.rml',parser=third_party_ledger,
header='internal')
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

View File

@ -8,7 +8,7 @@
<field name="type">form</field>
<field name="arch" type="xml">
<form string="Report Options">
<group height="430" width="800">
<group height="500" width="800">
<field name="chart_account_id" widget='selection'/>
<field name="fiscalyear_id"/>
<group colspan="2" name='Journals'>

View File

@ -37,7 +37,7 @@ class account_partner_ledger(osv.osv_memory):
'amount_currency': fields.boolean("With Currency", help="It adds the currency column if the currency is different then the company currency"),
}
_defaults = {
'reconcile': True,
'reconcil': True,
'initial_balance': True,
'page_split': False,
}
@ -52,13 +52,11 @@ class account_partner_ledger(osv.osv_memory):
'type': 'ir.actions.report.xml',
'report_name': 'account.third_party_ledger',
'datas': data,
'nodestroy':True,
}
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.third_party_ledger_other',
'datas': data,
'nodestroy':True,
}
account_partner_ledger()

View File

@ -12,8 +12,8 @@
<field name="result_selection"/>
<field name="initial_balance"/>
<field name="reconcil"/>
<field name="page_split"/>
<field name="amount_currency"/>
<field name="page_split"/>
<newline/>
</field>
</field>