@@ -156,7 +156,7 @@
[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]
- [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
+ [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
diff --git a/addons/account/report/general_ledger_landscape.py b/addons/account/report/general_ledger_landscape.py
deleted file mode 100644
index 472f0675519..00000000000
--- a/addons/account/report/general_ledger_landscape.py
+++ /dev/null
@@ -1,396 +0,0 @@
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# Copyright (c) 2005-2006 CamptoCamp
-#
-# WARNING: This program as such is intended to be used by professional
-# programmers who take the whole responsability of assessing all potential
-# consequences resulting from its eventual inadequacies and bugs
-# End users who are looking for a ready-to-use solution with commercial
-# garantees and support are strongly adviced to contract a Free Software
-# Service Company
-#
-# This program is Free Software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-##############################################################################
-
-import time
-from report import report_sxw
-import xml
-import rml_parse
-import pooler
-
-class general_ledger_landscape(rml_parse.rml_parse):
- _name = 'report.account.general.ledger_landscape'
-
-
- def set_context(self, objects, data, ids, report_type = None):
- ##
- self.borne_date = self.get_min_date(data['form'])
- ##
- new_ids = []
- if (data['model'] == 'account.account'):
- new_ids = 'active_ids' in data['form']['context'] and data['form']['context']['active_ids'] or []
- else:
- new_ids.append(data['form']['Account_list'])
- objects = self.pool.get('account.account').browse(self.cr, self.uid, new_ids)
- super(general_ledger_landscape, self).set_context(objects, data, new_ids,report_type)
-
- def __init__(self, cr, uid, name, context):
- super(general_ledger_landscape, self).__init__(cr, uid, name, context=context)
- self.date_borne = {}
- self.query = ""
- self.child_ids = ""
- self.tot_currency = 0.0
- self.period_sql = ""
- self.sold_accounts = {}
- self.localcontext.update( {
- 'time': time,
- 'lines': self.lines,
- 'sum_debit_account': self._sum_debit_account,
- 'sum_credit_account': self._sum_credit_account,
- 'sum_solde_account': self._sum_solde_account,
- 'sum_debit': self._sum_debit,
- 'sum_credit': self._sum_credit,
- 'sum_solde': self._sum_solde,
- 'get_children_accounts': self.get_children_accounts,
- 'sum_currency_amount_account': self._sum_currency_amount_account
- })
- self.context = context
- def _calc_contrepartie(self,cr,uid,ids, context={}):
- result = {}
- #for id in ids:
- # result.setdefault(id, False)
-
- for account_line in self.pool.get('account.move.line').browse(cr, uid, ids, context):
- # For avoid long text in the field we will limit it to 5 lines
- #
- #
- #
- result[account_line.id] = ' '
- num_id_move = account_line.move_id.id
- num_id_line = account_line.id
- account_id = account_line.account_id.id
- # search the basic account
- # We have the account ID we will search all account move line from now until this time
- # We are in the case of we are on the top of the account move Line
- cr.execute('SELECT distinct(ac.code) as code_rest,ac.name as name_rest from account_account AS ac, account_move_line mv\
- where ac.id = mv.account_id and mv.move_id = %s and mv.account_id <> %s' , (num_id_move,account_id,))
- res_mv = cr.dictfetchall()
- # we need a result more than 2 line to make the test so we will made the the on 1 because we have exclude the current line
- if (len(res_mv) >=1):
- concat = ''
- rup_id = 0
- for move_rest in res_mv:
- concat = concat + move_rest['code_rest'] + '|'
- result[account_line.id] = concat
- if rup_id >5:
- # we need to stop the computing and to escape but before we will add "..."
- result[account_line.id] = concat + '...'
- break
- rup_id+=1
- return result
-
- def get_min_date(self,form):
-
- ## Get max born from account_fiscal year
- #
- sql = """ select min(fy.date_start) as start_date,max(fy.date_stop) as stop_date from account_fiscalyear
- As fy where fy.state <> 'close'
- """
- self.cr.execute(sql)
- res = self.cr.dictfetchall()
- borne_min = res[0]['start_date']
- borne_max = res[0]['stop_date']
- if form['state'] == 'byperiod':
- ## This function will return the most aged date
- periods = form['periods']
- if not periods:
- self.cr.execute("""
- Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.fiscalyear_id = %s""" ,(form['fiscalyear'],))
- else:
- self.cr.execute("""
- Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.id =ANY(%s)""",(periods,))
-
- res = self.cr.dictfetchall()
- borne_min = res[0]['start_date']
- borne_max = res[0]['stop_date']
- elif form['state'] == 'bydate':
- borne_min = form['date_from']
- borne_max = form['date_to']
- elif form['state'] == 'all':
- periods = form['periods']
- if not periods:
- if form['fiscalyear'] == False:
- fiscalyears = self.pool.get('account.fiscalyear').search(self.cr, self.uid, [('state', '=', 'draft')])
- else:
- fiscalyears = [form['fiscalyear']]
- self.cr.execute("select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.fiscalyear_id =ANY(%s)" ,(fiscalyears,))
- else:
- self.cr.execute("""
- Select min(p.date_start) as start_date,max(p.date_stop) as stop_date from account_period as p where p.id =ANY(%s)""",(periods,))
- res = self.cr.dictfetchall()
- period_min = res[0]['start_date']
- period_max = res[0]['stop_date']
- date_min = form['date_from']
- date_max = form['date_to']
- if period_min 0 :
- res.append(child_account)
- elif form['display_account'] == 'bal_solde':
- if child_account.type != 'view' \
- and len(self.pool.get('account.move.line').search(self.cr, self.uid,
- [('account_id','=',child_account.id)],
- context=ctx)) <> 0 :
- if ( sold_account <> 0.0):
- res.append(child_account)
- else:
- if child_account.type != 'view' \
- and len(self.pool.get('account.move.line').search(self.cr, self.uid,
- [('account_id','>=',child_account.id)],
- context=ctx)) <> 0 :
- res.append(child_account)
- ##
- if not len(res):
-
- return [account]
- else:
- ## We will now compute solde initiaux
- for move in res:
- self.cr.execute("""SELECT sum(l.debit) AS sum_debit, sum(l.credit) AS sum_credit FROM account_move_line l \
- WHERE l.account_id = %s AND l.date < %s AND l.date > %s""",(move.id,self.borne_date['max_date'],self.borne_date['min_date']))
- resultat = self.cr.dictfetchall()
- if resultat[0] :
- if resultat[0]['sum_debit'] == None:
- sum_debit = 0
- else:
- sum_debit = resultat[0]['sum_debit']
- if resultat[0]['sum_credit'] == None:
- sum_credit = 0
- else:
- sum_credit = resultat[0]['sum_credit']
-
- move.init_credit = sum_credit
- move.init_debit = sum_debit
-
- else:
- move.init_credit = 0
- move.init_debit = 0
-
-
- return res
-
- def lines(self, account, form):
- inv_types = {
- 'out_invoice': 'CI: ',
- 'in_invoice': 'SI: ',
- 'out_refund': 'OR: ',
- 'in_refund': 'SR: ',
- }
-
- if form['sortbydate'] == 'sort_date':
- sorttag = 'l.date'
- else:
- sorttag = 'j.code'
- sql = """
- SELECT l.id, l.date, j.code,c.code AS currency_code,l.amount_currency,l.ref, l.name , COALESCE(l.debit,0) as debit, COALESCE(l.credit,0) as credit, l.period_id
- FROM account_move_line as l
- LEFT JOIN res_currency c on (l.currency_id=c.id)
- JOIN account_journal j on (l.journal_id=j.id)
- AND account_id = %%s
- AND %s
- WHERE l.date<=%%s
- AND l.date>=%%s
- ORDER by %s""" % (self.query, sorttag)
-
- self.cr.execute(sql, (account.id, self.date_borne['max_date'], self.date_borne['min_date'],))
-
- res = self.cr.dictfetchall()
- sum = 0.0
- account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
- for l in res:
- line = self.pool.get('account.move.line').browse(self.cr, self.uid, l['id'])
- l['move'] = line.move_id.name
- self.cr.execute('Select id from account_invoice where move_id =%s',(line.move_id.id,))
- tmpres = self.cr.dictfetchall()
- if len(tmpres) > 0 :
- inv = self.pool.get('account.invoice').browse(self.cr, self.uid, tmpres[0]['id'])
- l['ref'] = inv_types[inv.type] + ': '+str(inv.number)
- if line.partner_id :
- l['partner'] = line.partner_id.name
- else :
- l['partner'] = ''
- sum = l['debit'] - l ['credit']
-# c = time.strptime(l['date'],"%Y-%m-%d")
-# l['date'] = time.strftime("%d-%m-%Y",c)
- l['progress'] = sum
- l['line_corresp'] = self._calc_contrepartie(self.cr,self.uid,[l['id']])[l['id']]
- # Modification du amount Currency
- if (l['credit'] > 0):
- if l['amount_currency'] != None:
- l['amount_currency'] = abs(l['amount_currency']) * -1
-
- #
- if l['amount_currency'] != None:
- self.tot_currency = self.tot_currency + l['amount_currency']
- return res
-
- def _sum_debit_account(self, account, form):
-
- self.cr.execute("SELECT sum(debit) "\
- "FROM account_move_line l "\
- "WHERE l.account_id = %s AND "+self.query,(account.id,))
- ## Add solde init to the result
- #
- sum_debit = self.cr.fetchone()[0] or 0.0
- if form['soldeinit']:
- sum_debit += account.init_debit
- #
- ##
- return sum_debit
-
- def _sum_credit_account(self, account, form):
-
- self.cr.execute("SELECT sum(credit) "\
- "FROM account_move_line l "\
- "WHERE l.account_id = %s AND "+self.query,(account.id,))
- ## Add solde init to the result
- #
- sum_credit = self.cr.fetchone()[0] or 0.0
- if form['soldeinit']:
- sum_credit += account.init_credit
- #
- ##
-
- return sum_credit
-
- def _sum_solde_account(self, account, form):
- self.cr.execute("SELECT (sum(debit) - sum(credit)) as tot_solde "\
- "FROM account_move_line l "\
- "WHERE l.account_id = %s AND "+self.query,(account.id,))
- sum_solde = self.cr.fetchone()[0] or 0.0
- if form.get('soldeinit',False):
- sum_solde += account.init_debit - account.init_credit
-
- return sum_solde
-
- def _sum_debit(self, form):
- if not self.ids:
- return 0.0
- self.cr.execute("SELECT sum(debit) "\
- "FROM account_move_line l "\
- "WHERE l.account_id =ANY(%s) AND "+self.query,(self.child_ids,))
- sum_debit = self.cr.fetchone()[0] or 0.0
- return sum_debit
-
- def _sum_credit(self, form):
- if not self.ids:
- return 0.0
- self.cr.execute("SELECT sum(credit) "\
- "FROM account_move_line l "\
- "WHERE l.account_id =ANY(%s) AND "+self.query,(self.child_ids,))
- ## Add solde init to the result
- #
- sum_credit = self.cr.fetchone()[0] or 0.0
- return sum_credit
-
- def _sum_solde(self, form):
- if not self.ids:
- return 0.0
- self.cr.execute("SELECT (sum(debit) - sum(credit)) as tot_solde "\
- "FROM account_move_line l "\
- "WHERE l.account_id =ANY(%s) AND "+self.query,(self.child_ids,))
- sum_solde = self.cr.fetchone()[0] or 0.0
- return sum_solde
-
- def _set_get_account_currency_code(self, account_id):
- self.cr.execute("SELECT c.code as code "\
- "FROM res_currency c,account_account as ac "\
- "WHERE ac.id = %s AND ac.currency_id = c.id",(account_id,))
- result = self.cr.fetchone()
- if result:
- self.account_currency = result[0]
- else:
- self.account_currency = False
-
- def _sum_currency_amount_account(self, account, form):
- self._set_get_account_currency_code(account.id)
- self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %s ", (account.id,))
- total = self.cr.fetchone()
-
- if self.account_currency:
- return_field = str(total[0]) + self.account_currency
- return return_field
- else:
- currency_total = self.tot_currency = 0.0
- return currency_total
-
-report_sxw.report_sxw('report.account.general.ledger_landscape', 'account.account', 'addons/account/report/general_ledger_landscape.rml', parser=general_ledger_landscape, header=False)
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/report/general_ledger_landscape.rml b/addons/account/report/general_ledger_landscape.rml
index 9e937a72baf..a707a47d0bd 100644
--- a/addons/account/report/general_ledger_landscape.rml
+++ b/addons/account/report/general_ledger_landscape.rml
@@ -104,7 +104,7 @@
[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]
- [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
+ [[ data['form']['amount_currency'] == True or removeParentNode('blockTable') ]]
@@ -165,7 +165,7 @@
[[ repeatIn(get_children_accounts(a,data['form']), 'o') ]]
- [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
+ [[ data['form']['amount_currency'] == False or removeParentNode('blockTable') ]]
|
diff --git a/addons/account/report/overdue.rml b/addons/account/report/overdue.rml
index 2713b665d06..e8e1a7dc84c 100644
--- a/addons/account/report/overdue.rml
+++ b/addons/account/report/overdue.rml
@@ -84,8 +84,8 @@
+
-
[[ repeatIn(objects,'o') ]]
[[ setLang(o.lang) ]]
@@ -177,16 +177,16 @@
[[ line['ref'] ]]
|
- [[ line['date_maturity'] ]]
+ [[ line['date_maturity'] and formatLang(line['date_maturity'],date=True) or '' ]]
|
- [[ formatLang(line['debit']) and formatLang(line['debit'] * (line['account_id']['type'] == 'payable' and -1 or 1)) ]]
+ [[ (line['account_id']['type'] == 'receivable' and formatLang(line['debit']) or 0) or (line['account_id']['type'] == 'payable' and formatLang(line['credit'] * -1) or ' ') ]]
|
- [[ formatLang(line['credit']) and formatLang(line['credit'] * (line['account_id']['type'] == 'payable' and -1 or 1)) ]]
+ [[ (line['account_id']['type'] == 'receivable' and formatLang(line['credit']) or 0) or (line['account_id']['type'] == 'payable' and formatLang(line['debit'] * -1) or 0) ]]
|
- [[ formatLang((line['date_maturity'] < time.strftime('%Y-%m-%d')) and ((line['debit'] - line['credit']) * (line['account_id']['type'] == 'payable' and -1 or 1))) ]]
+ [[ formatLang((line['date_maturity'] < time.strftime('%Y-%m-%d'))) and (line['debit'] - line['credit']) ]]
|
[[ line['blocked'] and 'X' or '' ]]
@@ -205,13 +205,13 @@
Sub-Total :
|
- [[ formatLang((reduce(lambda x, y: x + (y['debit'] * (y['account_id']['type'] == 'payable' and -1 or 1)), getLines(o), 0))) ]]
+ [[ formatLang((reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['debit'] or 0) or (y['account_id']['type'] == 'payable' and y['credit'] * -1 or 0)), getLines(o), 0))) ]]
|
- [[ formatLang((reduce(lambda x ,y: x + (y['credit'] * (y['account_id']['type'] == 'payable' and -1 or 1)), getLines(o), 0))) ]]
+ [[ formatLang((reduce(lambda x, y: x + ((y['account_id']['type'] == 'receivable' and y['credit'] or 0) or (y['account_id']['type'] == 'payable' and y['debit'] * -1 or 0)), getLines(o), 0))) ]]
|
- [[ formatLang((reduce(lambda x, y: x + ((y['debit'] - y['credit']) * (y['account_id']['type'] == 'payable' and -1 or 1)), filter(lambda x: x['date_maturity'] < time.strftime('%Y-%m-%d'), getLines(o)), 0))) ]]
+ [[ formatLang((reduce(lambda x, y: x + (y['debit'] - y['credit']), filter(lambda x: x['date_maturity'] < time.strftime('%Y-%m-%d'), getLines(o)), 0))) ]]
|
@@ -229,7 +229,7 @@
Balance :
|
- [[ formatLang((reduce(lambda x, y: x +((y['debit'] - y['credit']) * (y['account_id']['type'] == 'payable' and -1 or 1)), getLines(o), 0))) ]]
+ [[ formatLang((reduce(lambda x, y: x +(y['debit'] - y['credit']), getLines(o), 0))) ]]
|
@@ -248,9 +248,9 @@
|
- Total amount due: [[ formatLang((reduce(lambda x, y: x + ((y['debit'] - y['credit']) * (y['account_id']['type'] == 'payable' and -1 or 1)), getLines(o), 0))) ]] [[ company.currency_id.name ]].
+ Total amount due: [[ formatLang((reduce(lambda x, y: x + (y['debit'] - y['credit']), getLines(o), 0))) ]] [[ company.currency_id.name ]].
-
+
\ No newline at end of file
diff --git a/addons/account/report/third_party_ledger.py b/addons/account/report/third_party_ledger.py
index 1dca4dfb64a..c10fcb33313 100644
--- a/addons/account/report/third_party_ledger.py
+++ b/addons/account/report/third_party_ledger.py
@@ -167,9 +167,9 @@ class third_party_ledger(rml_parse.rml_parse):
#
#new_ids = [id for (id,) in self.cr.fetchall()]
if data['form']['result_selection'] == 'supplier':
- self.ACCOUNT_TYPE = ['receivable']
- elif data['form']['result_selection'] == 'customer':
self.ACCOUNT_TYPE = ['payable']
+ elif data['form']['result_selection'] == 'customer':
+ self.ACCOUNT_TYPE = ['receivable']
elif data['form']['result_selection'] == 'all':
self.ACCOUNT_TYPE = ['payable','receivable']
diff --git a/addons/account/security/ir.model.access.csv b/addons/account/security/ir.model.access.csv
index e1aa3b6510a..7458594d240 100644
--- a/addons/account/security/ir.model.access.csv
+++ b/addons/account/security/ir.model.access.csv
@@ -15,8 +15,8 @@
"access_account_move","account.move","model_account_move","account.group_account_user",1,1,1,1
"access_account_move_line","account.move.line","model_account_move_line","account.group_account_user",1,1,1,1
"access_account_move_reconcile","account.move.reconcile","model_account_move_reconcile","account.group_account_user",1,1,1,1
-"access_account_tax_code","account.tax.code","model_account_tax_code",,1,0,0,0
-"access_account_tax","account.tax","model_account_tax",,1,0,0,0
+"access_account_tax_code","account.tax.code","model_account_tax_code","account.group_account_invoice",1,0,0,0
+"access_account_tax","account.tax","model_account_tax","account.group_account_invoice",1,0,0,0
"access_account_model","account.model","model_account_model","account.group_account_user",1,1,1,1
"access_account_model_line","account.model.line","model_account_model_line","account.group_account_user",1,1,1,1
"access_account_subscription","account.subscription","model_account_subscription","account.group_account_user",1,1,1,1
@@ -93,3 +93,13 @@
"access_report_account_type_sales","report.account_type.sales","model_report_account_type_sales","account.group_account_manager",1,0,0,0
"access_report_account_sales","report.account.sales","model_report_account_sales","account.group_account_manager",1,0,0,0
"access_account_invoice_report","account.invoice.report","model_account_invoice_report","account.group_account_manager",1,0,0,0
+"access_project_account_analytic_line","project.account.analytic.line","model_project_account_analytic_line","account.group_account_manager",1,1,1,1
+"access_account_move_line_reconcile_select","account.move.line.reconcile.select","model_account_move_line_reconcile_select","account.group_account_manager",1,1,1,1
+"access_account_move_line_unreconcile_select","account.move.line.unreconcile.select","model_account_move_line_unreconcile_select","account.group_account_manager",1,1,1,1
+"access_account_invoice_refund","account.invoice.refund","model_account_invoice_refund","account.group_account_manager",1,1,1,1
+"access_account_move_journal","account.move.journal","model_account_move_journal","account.group_account_manager",1,1,1,1
+"access_account_move_bank_reconcile","account.move.bank.reconcile","model_account_move_bank_reconcile","account.group_account_manager",1,1,1,1
+"access_account_subscription_generate","account.subscription.generate","model_account_subscription_generate","account.group_account_manager",1,1,1,1
+"access_account_period_close","account.period.close","model_account_period_close","account.group_account_manager",1,1,1,1
+"access_account_fiscalyear_close_state","account.fiscalyear.close.state","model_account_fiscalyear_close_state","account.group_account_manager",1,1,1,1
+"access_account_chart","account.chart","model_account_chart","account.group_account_manager",1,1,1,1
diff --git a/addons/account/sequence.py b/addons/account/sequence.py
index d48f23eb1cf..e23ec1e3def 100644
--- a/addons/account/sequence.py
+++ b/addons/account/sequence.py
@@ -42,7 +42,7 @@ class ir_sequence(osv.osv):
_columns = {
'fiscal_ids' : fields.one2many('account.sequence.fiscalyear', 'sequence_main_id', 'Sequences')
}
- def get_id(self, cr, uid, sequence_id, test='id', context={}):
+ def get_id(self, cr, uid, sequence_id, test='id', context={}):
cr.execute('select id from ir_sequence where '+test+'=%s and active=%s', (sequence_id, True,))
res = cr.dictfetchone()
if res:
diff --git a/addons/account/wizard/account_aged_trial_balance_view.xml b/addons/account/wizard/account_aged_trial_balance_view.xml
index 7984f69e86e..769d7ee268f 100644
--- a/addons/account/wizard/account_aged_trial_balance_view.xml
+++ b/addons/account/wizard/account_aged_trial_balance_view.xml
@@ -8,7 +8,7 @@
form
| | |