[[ format(o.amount_tax or removeParentNode('blockTable')) ]]
-
+
|
Tax
@@ -498,16 +480,11 @@
|
-
-
-
-
- |
[[ repeatIn(o.tax_line,'t') ]]
-
+
|
[[ t.name ]]
@@ -521,16 +498,23 @@
|
|
+
+
-
+
|
-
+
|
-
+
+
+
+ |
+
+
|
@@ -539,15 +523,15 @@
-
+
|
-
+
|
-
+
|
@@ -573,8 +557,5 @@
-
-
-
diff --git a/addons/account/report/rml_parse.py b/addons/account/report/rml_parse.py
new file mode 100755
index 00000000000..9f11a844260
--- /dev/null
+++ b/addons/account/report/rml_parse.py
@@ -0,0 +1,157 @@
+from report import report_sxw
+import xml.dom.minidom
+import os, time
+import osv
+import re
+import tools
+import pooler
+import re
+import sys
+
+
+class rml_parse(report_sxw.rml_parse):
+
+ def __init__(self, cr, uid, name, context):
+ super(rml_parse, self).__init__(cr, uid, name, context=None)
+ self.localcontext.update({
+ 'comma_me': self.comma_me,
+ 'format_date': self._get_and_change_date_format_for_swiss,
+ 'strip_name' : self._strip_name,
+ 'explode_name' : self._explode_name,
+ })
+
+ def comma_me(self,amount):
+ #print "#" + str(amount) + "#"
+ if not amount:
+ amount = 0.0
+ if type(amount) is float :
+ amount = str('%.2f'%amount)
+ else :
+ amount = str(amount)
+ if (amount == '0'):
+ return ' '
+ orig = amount
+ new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount)
+ if orig == new:
+ return new
+ else:
+ return self.comma_me(new)
+ def _ellipsis(self, string, maxlen=100, ellipsis = '...'):
+ ellipsis = ellipsis or ''
+ try:
+ return string[:maxlen - len(ellipsis) ] + (ellipsis, '')[len(string) < maxlen]
+ except Exception, e:
+ return False
+ def _strip_name(self, name, maxlen=50):
+ return self._ellipsis(name, maxlen, '...')
+
+ def _get_and_change_date_format_for_swiss (self,date_to_format):
+ date_formatted=''
+ if date_to_format:
+ date_formatted = strptime (date_to_format,'%Y-%m-%d').strftime('%d.%m.%Y')
+ return date_formatted
+
+ def _explode_name(self,chaine,length):
+ # We will test if the size is less then account
+ full_string = ''
+ if (len(str(chaine)) <= length):
+ return chaine
+ #
+ else:
+ chaine = unicode(chaine,'utf8').encode('iso-8859-1')
+ rup = 0
+ for carac in chaine:
+ rup = rup + 1
+ if rup == length:
+ full_string = full_string + '\n'
+ full_string = full_string + carac
+ rup = 0
+ else:
+ full_string = full_string + carac
+
+ return full_string
+
+ def makeAscii(self,str):
+ try:
+ Stringer = str.encode("utf-8")
+ except UnicodeDecodeError:
+ try:
+ Stringer = str.encode("utf-16")
+ except UnicodeDecodeError:
+ print "UTF_16 Error"
+ Stringer = str
+ else:
+ return Stringer
+ else:
+ return Stringer
+ return Stringer
+ def explode_this(self,chaine,length):
+ #chaine = self.repair_string(chaine)
+ chaine = rstrip(chaine)
+ ast = list(chaine)
+ i = length
+ while i <= len(ast):
+ ast.insert(i,'\n')
+ i = i + length
+ chaine = str("".join(ast))
+ return chaine
+ def repair_string(self,chaine):
+ ast = list(chaine)
+ UnicodeAst = []
+ _previouslyfound = False
+ i = 0
+ #print str(ast)
+ while i < len(ast):
+ elem = ast[i]
+ try:
+ Stringer = elem.encode("utf-8")
+ except UnicodeDecodeError:
+ to_reencode = elem + ast[i+1]
+ print str(to_reencode)
+ Good_char = to_reencode.decode('utf-8')
+ UnicodeAst.append(Good_char)
+ i += i +2
+ else:
+ UnicodeAst.append(elem)
+ i += i + 1
+
+
+ return "".join(UnicodeAst)
+
+ def ReencodeAscii(self,str):
+ print sys.stdin.encoding
+ try:
+ Stringer = str.decode("ascii")
+ except UnicodeEncodeError:
+ print "REENCODING ERROR"
+ return str.encode("ascii")
+ except UnicodeDecodeError:
+ print "DECODING ERROR"
+ return str.encode("ascii")
+
+ else:
+ print Stringer
+ return Stringer
+
+
+ # def _add_header(self, node):
+ # rml_head = tools.file_open('specific_param/report/header/corporate_rml_header_ch.rml').read()
+ # head_dom = xml.dom.minidom.parseString(rml_head)
+ # #for frame in head_dom.getElementsByTagName('frame'):
+ # # frame.parentNode.removeChild(frame)
+ # node2 = head_dom.documentElement
+ # for tag in node2.childNodes:
+ # if tag.nodeType==tag.ELEMENT_NODE:
+ # found = self._find_node(node, tag.localName)
+ # # rml_frames = found.getElementsByTagName('frame')
+ # if found:
+ # if tag.hasAttribute('position') and (tag.getAttribute('position')=='inside'):
+ # found.appendChild(tag)
+ # else:
+ # found.parentNode.replaceChild(tag, found)
+ # # for frame in rml_frames:
+ # # tag.appendChild(frame)
+ # return True
+
+
+
diff --git a/addons/account/report/tax_report.py b/addons/account/report/tax_report.py
old mode 100644
new mode 100755
index 01bf81a6aed..445ca968878
--- a/addons/account/report/tax_report.py
+++ b/addons/account/report/tax_report.py
@@ -1,9 +1,6 @@
-# -*- encoding: utf-8 -*-
##############################################################################
#
-# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id$
+# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
@@ -30,92 +27,206 @@
import time
import pooler
+import rml_parse
+import copy
from report import report_sxw
+import pdb
+import re
-class tax_report(report_sxw.rml_parse):
+class tax_report(rml_parse.rml_parse):
+ _name = 'report.account.vat.declaration'
+ def __init__(self, cr, uid, name, context):
+ super(tax_report, self).__init__(cr, uid, name, context)
+ self.localcontext.update({
+ 'time': time,
+ 'get_period': self._get_period,
+ 'get_codes': self._get_codes,
+ 'get_general': self._get_general,
+ 'get_company': self._get_company,
+ 'get_currency': self._get_currency,
+ 'get_lines' : self._get_lines,
+ })
- def __init__(self, cr, uid, name, context):
- super(tax_report, self).__init__(cr, uid, name, context)
- self.localcontext.update({
- 'time': time,
- 'get_period': self._get_period,
- 'get_codes': self._get_codes,
- 'get_general': self._get_general,
- 'get_company': self._get_company,
- 'get_currency': self._get_currency,
- })
+
+ def comma_me(self,amount):
+
+ if type(amount) is float :
+ amount = str('%.2f'%amount)
+ else :
+ amount = str(amount)
+ if (amount == '0'):
+ return ' '
+ orig = amount
+ new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount)
+ if orig == new:
+ return new
+ else:
+ return self.comma_me(new)
+ def _get_lines(self, based_on,period_list,company_id=False, parent=False, level=0):
+ res = self._get_codes(based_on,parent,level,period_list)
+ res = self._add_codes(based_on,res,period_list)
+
+ i = 0
+ top_result = []
+
+ while i < len(res):
+
+ res_dict = { 'code' : res[i][1].code,
+ 'name' : res[i][1].name,
+ 'debit' : 0,
+ 'credit' : 0,
+ 'tax_amount' : res[i][1].sum_period,
+ 'type' : 1,
+ 'level' : res[i][0],
+ 'pos' : 0
+ }
+
+ top_result.append(res_dict)
+ res_general = self._get_general(res[i][1].id,period_list,company_id,based_on)
+ ind_general = 0
+ while ind_general < len(res_general) :
+ res_general[ind_general]['type'] = 2
+ res_general[ind_general]['pos'] = 0
+ res_general[ind_general]['level'] = res_dict['level'] + ' '
+ top_result.append(res_general[ind_general])
+ ind_general+=1
+ i+=1
+ #array_result = self.sort_result(top_result)
+ return top_result
+ #return array_result
- def _add_header(self, node):
- return True
+ def _get_period(self, period_id):
+ return self.pool.get('account.period').browse(self.cr, self.uid, period_id).name
- def _get_period(self, period_id):
- return self.pool.get('account.period').browse(self.cr, self.uid, period_id).name
+ def _get_general(self, tax_code_id,period_list ,company_id, based_on):
+ res=[]
+ period_sql_list = ','.join(map(str, period_list[0][2]))
+
+ if based_on == 'payments':
+ self.cr.execute('SELECT SUM(line.tax_amount) AS tax_amount, \
+ SUM(line.debit) AS debit, \
+ SUM(line.credit) AS credit, \
+ COUNT(*) AS count, \
+ account.id AS account_id, \
+ account.name AS name, \
+ account.code AS code \
+ FROM account_move_line AS line, \
+ account_account AS account, \
+ account_move AS move \
+ LEFT JOIN account_invoice invoice ON \
+ (invoice.move_id = move.id) \
+ WHERE line.state<>%s \
+ AND line.tax_code_id = %d \
+ AND line.account_id = account.id \
+ AND account.company_id = %d \
+ AND move.id = line.move_id \
+ AND ((invoice.state = %s) \
+ OR (invoice.id IS NULL)) \
+ GROUP BY account.id,account.name,account.code', ('draft',tax_code_id,
+ company_id, 'paid'))
- def _get_general(self, tax_code_id, period_id, company_id, based_on):
- res=[]
- if based_on == 'payments':
- self.cr.execute('SELECT SUM(line.tax_amount) AS tax_amount, \
- SUM(line.debit) AS debit, \
- SUM(line.credit) AS credit, \
- COUNT(*) AS count, \
- account.id AS account_id \
- FROM account_move_line AS line, \
- account_account AS account, \
- account_move AS move \
- LEFT JOIN account_invoice invoice ON \
- (invoice.move_id = move.id) \
- WHERE line.state<>%s \
- AND line.period_id = %d \
- AND line.tax_code_id = %d \
- AND line.account_id = account.id \
- AND account.company_id = %d \
- AND move.id = line.move_id \
- AND ((invoice.state = %s) \
- OR (invoice.id IS NULL)) \
- GROUP BY account.id', ('draft', period_id, tax_code_id,
- company_id, 'paid'))
- else :
- self.cr.execute('SELECT SUM(line.tax_amount) AS tax_amount, \
- SUM(line.debit) AS debit, \
- SUM(line.credit) AS credit, \
- COUNT(*) AS count, \
- account.id AS account_id \
- FROM account_move_line AS line, \
- account_account AS account \
- WHERE line.state <> %s \
- AND line.period_id = %d \
- AND line.tax_code_id = %d \
- AND line.account_id = account.id \
- AND account.company_id = %d \
- AND account.active \
- GROUP BY account.id', ('draft', period_id, tax_code_id,
- company_id))
- res = self.cr.dictfetchall()
- i = 0
- while i %s \
+ AND line.tax_code_id = %d \
+ AND line.account_id = account.id \
+ AND account.company_id = %d \
+ AND account.active \
+ GROUP BY account.id,account.name,account.code', ('draft',tax_code_id,
+ company_id))
+ res = self.cr.dictfetchall()
+ #AND line.period_id IN ('+ period_sql_list +') \
+
+ i = 0
+ while i= int(accounts[bcl_rup_ind]['level']) and bcl_rup_ind >= 0 ):
+ tot_elem = copy.copy(accounts[bcl_rup_ind])
+ res_tot = { 'code' : accounts[bcl_rup_ind]['code'],
+ 'name' : '',
+ 'debit' : 0,
+ 'credit' : 0,
+ 'tax_amount' : accounts[bcl_rup_ind]['tax_amount'],
+ 'type' : accounts[bcl_rup_ind]['type'],
+ 'level' : 0,
+ 'pos' : 0
+ }
+
+ if res_tot['type'] == 1:
+ # on change le type pour afficher le total
+ res_tot['type'] = 2
+ result_accounts.append(res_tot)
+ bcl_current_level = accounts[bcl_rup_ind]['level']
+ bcl_rup_ind -= 1
+
+ old_level = account_elem['level']
+ result_accounts.append(account_elem)
+ ind+=1
+
+
+ return result_accounts
+
report_sxw.report_sxw('report.account.vat.declaration', 'account.tax.code',
- 'addons/account/report/tax_report.rml', parser=tax_report, header=False)
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+ 'addons/account/report/tax_report.rml', parser=tax_report, header=False)
diff --git a/addons/account/report/tax_report.rml b/addons/account/report/tax_report.rml
old mode 100644
new mode 100755
index ab2d3a0c24a..cd8ee532948
--- a/addons/account/report/tax_report.rml
+++ b/addons/account/report/tax_report.rml
@@ -2,7 +2,34 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [[ company.name ]]
+ Tax Report
+
+
+
+ [[ time.strftime("%Y-%m-%d %H:%M", time.localtime()) ]]
+ Page
+
+
+
+
+ 1cm 27.7cm 20cm 27.7cm
+
+
+
@@ -20,10 +47,21 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -36,131 +74,145 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
|
-
-
-
+ Code
|
- Tax Report
+ Débit
|
- Period: [[ get_period(data['form']['period_id']) ]]
+ Crédit
+ |
+
+ Solde
|
+
+
- |
- [[ get_company(data['form']) ]]
- |
-
-
-
-
- |
-
- Currency: [[ get_currency(data['form']) ]]
- |
+
+ [[ repeatIn(get_lines(data['form']['based_on'],data['form']['periods'],data['form']['company_id']), 'o') ]]
+
+ [[ o['level'] ]]
+ [[o['type']==1 and ( setTag('para','para',{'fontName':'Helvetica'}))]]
+ [[ setTag('tr','tr',{'style':'TrLevel'+str(o['level']), 'paraStyle':('Level'+str(o['level']))}) ]]
+ [[ o['code'] ]] [[ o['name'] ]]
+
+ |
+
+ [[o['type']==2 and (o['debit']) ]]
+ |
+
+ [[o['type']==2 and (o['credit']) ]]
+ |
+
+ [[ o['tax_amount'] ]]
+ |
+
-
-
-
-
- Printing date: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]]
-
-
-
-
-
- |
- Tax Code / Account
- |
-
- General Account
- |
-
- Debit
- |
-
- Credit
- |
-
- Tax Amount
- |
-
-
-
-
-
-
- [[ repeatIn(get_codes(data['form']['period_id'], data['form']['based_on']), 'o') ]]
-
-
- |
- [[ o[0] ]] [[ o[1].code ]] - [[ o[1].name ]]
- |
-
-
-
-
- |
-
-
-
-
- |
-
- [[ o[1].sum_period and ('%.2f' % o[1].sum_period) or '' ]]
- |
-
-
-
-
- |
- [[repeatIn(get_general(o[1], data['form']['period_id'], data['form']['company_id'], data['form']['based_on']), 'g') ]]
- |
-
- [[ g['account'].code ]] - [[ g['account'].name ]]
- |
-
- [[ g['debit'] and '%.2f' % g['debit'] or '' ]]
- |
-
- [[ g['credit'] and '%.2f' % g['credit'] or '' ]]
- |
-
- [[ g['tax_amount'] and '%.2f' % g['tax_amount'] or '' ]]
- |
-
-
-
-
-
-
+
+
+
+
-
diff --git a/addons/account/report/third_party_ledger.py b/addons/account/report/third_party_ledger.py
old mode 100644
new mode 100755
index bf060555e7e..c8bda2a3045
--- a/addons/account/report/third_party_ledger.py
+++ b/addons/account/report/third_party_ledger.py
@@ -1,9 +1,6 @@
-# -*- encoding: utf-8 -*-
##############################################################################
#
-# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id$
+# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
@@ -30,153 +27,364 @@
import pooler
import time
+import re
+import rml_parse
+import datetime
from report import report_sxw
-class third_party_ledger(report_sxw.rml_parse):
- def __init__(self, cr, uid, name, context):
- super(third_party_ledger, self).__init__(cr, uid, name, context)
- self.localcontext.update( {
- 'time': time,
- 'lines': self.lines,
- 'sum_debit_partner': self._sum_debit_partner,
- 'sum_credit_partner': self._sum_credit_partner,
- 'sum_debit': self._sum_debit,
- 'sum_credit': self._sum_credit,
- 'get_company': self._get_company,
- 'get_currency': self._get_currency,
- })
+class third_party_ledger(rml_parse.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ self.date_lst = []
+ self.date_lst_string = ''
+ super(third_party_ledger, self).__init__(cr, uid, name, context)
+ self.localcontext.update( {
+ 'time': time,
+ 'lines': self.lines,
+ 'sum_debit_partner': self._sum_debit_partner,
+ 'sum_credit_partner': self._sum_credit_partner,
+ 'sum_debit': self._sum_debit,
+ 'sum_credit': self._sum_credit,
+ 'get_company': self._get_company,
+ 'get_currency': self._get_currency,
+ 'comma_me' : self.comma_me,
+ })
+ def date_range(self,start,end):
+ start = datetime.date.fromtimestamp(time.mktime(time.strptime(start,"%Y-%m-%d")))
+ end = datetime.date.fromtimestamp(time.mktime(time.strptime(end,"%Y-%m-%d")))
+ full_str_date = []
+ #
+ r = (end+datetime.timedelta(days=1)-start).days
+ #
+ date_array = [start+datetime.timedelta(days=i) for i in range(r)]
+ for date in date_array:
+ full_str_date.append(str(date))
+ return full_str_date
+
+ #
+ def transform_period_into_date_array(self,data):
+ ## Get All Period Date
+ if not data['form']['periods'][0][2] :
+ periods_id = self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
+ else:
+ periods_id = data['form']['periods'][0][2]
+ date_array = []
+ for period_id in periods_id:
+ period_obj = self.pool.get('account.period').browse(self.cr, self.uid, period_id)
+ date_array = date_array + self.date_range(period_obj.date_start,period_obj.date_stop)
+ self.date_lst = date_array
+ self.date_lst.sort()
+
+ def transform_date_into_date_array(self,data):
+ return_array = self.date_range(data['form']['date1'],data['form']['date2'])
+ self.date_lst = return_array
+ self.date_lst.sort()
- def preprocess(self, objects, data, ids):
- account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
- line_query = account_move_line_obj._query_get(self.cr, self.uid, obj='line',
- context={'fiscalyear': data['form']['fiscalyear'],'state':data['form']['state']})
- self.cr.execute(
- "SELECT DISTINCT line.partner_id " \
- "FROM account_move_line AS line, account_account AS account " \
- "WHERE line.partner_id IS NOT NULL " \
- "AND line.date >= %s " \
- "AND line.date <= %s " \
- "AND " + line_query + " " \
- "AND line.account_id = account.id " \
- "AND account.company_id = %d " \
- "AND account.active",
- (data['form']['date1'], data['form']['date2'],
- data['form']['company_id']))
- new_ids = [id for (id,) in self.cr.fetchall()]
- self.cr.execute(
- "SELECT a.id " \
- "FROM account_account a " \
- "LEFT JOIN account_account_type t " \
- "ON (a.type=t.code) " \
- "WHERE t.partner_account=TRUE " \
- "AND a.company_id = %d " \
- "AND a.active", (data['form']['company_id'],))
- self.account_ids = ','.join([str(a) for (a,) in self.cr.fetchall()])
- self.partner_ids = ','.join(map(str, new_ids))
- objects = self.pool.get('res.partner').browse(self.cr, self.uid, new_ids)
- super(third_party_ledger, self).preprocess(objects, data, new_ids)
+ def comma_me(self,amount):
+ if type(amount) is float :
+ amount = str('%.2f'%amount)
+ else :
+ amount = str(amount)
+ if (amount == '0'):
+ return ' '
+ orig = amount
+ new = re.sub("^(-?\d+)(\d{3})", "\g<1>'\g<2>", amount)
+ if orig == new:
+ return new
+ else:
+ return self.comma_me(new)
+ def special_map(self):
+ string_map = ''
+ for date_string in self.date_lst:
+ string_map = date_string + ','
+ return string_map
+
+ def preprocess(self, objects, data, ids):
+ PARTNER_REQUEST = ''
+ if (data['model'] == 'res.partner'):
+ print"data['model']",data['model']
+ ## Si on imprime depuis les partenaires
+ if ids:
+ PARTNER_REQUEST = "AND line.partner_id IN (" + ','.join(map(str, ids)) + ")"
+ # Transformation des date
+ #
+ #
+ if data['form'].has_key('fiscalyear'):
+ self.transform_period_into_date_array(data)
+ else:
+ self.transform_date_into_date_array(data)
+ ##
+ self.date_lst_string = '\'' + '\',\''.join(map(str,self.date_lst)) + '\''
+ #
+ #new_ids = [id for (id,) in self.cr.fetchall()]
+ if data['form']['result_selection'] == 'supplier':
+ ACCOUNT_TYPE = "AND a.type='payable' "
+ elif data['form']['result_selection'] == 'customer':
+ ACCOUNT_TYPE = "AND a.type='receivable' "
+ elif data['form']['result_selection'] == 'all':
+ ACCOUNT_TYPE = "AND (a.type='receivable' OR a.type='payable') "
- def lines(self, partner):
- account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
- line_query = account_move_line_obj._query_get(self.cr, self.uid, obj='l',
- context={'fiscalyear': self.datas['form']['fiscalyear'],'state':self.datas['form']['state']})
- self.cr.execute(
- "SELECT l.date, j.code, l.ref, l.name, l.debit, l.credit " \
- "FROM account_move_line l " \
- "LEFT JOIN account_journal j " \
- "ON (l.journal_id = j.id) " \
- "WHERE l.partner_id = %d " \
- "AND l.account_id IN (" + self.account_ids + ") " \
- "AND l.date >= %s " \
- "AND l.date <= %s "
- "AND " + line_query + " " \
- "ORDER BY l.id",
- (partner.id, self.datas['form']['date1'], self.datas['form']['date2']))
- res = self.cr.dictfetchall()
- sum = 0.0
- for r in res:
- sum += r['debit'] - r['credit']
- r['progress'] = sum
- return res
+ self.cr.execute(
+ "SELECT a.id " \
+ "FROM account_account a " \
+ "LEFT JOIN account_account_type t " \
+ "ON (a.type=t.code) " \
+ "WHERE t.partner_account=TRUE " \
+ "AND a.company_id = %d " \
+ " " + ACCOUNT_TYPE + " " \
+ "AND a.active", (data['form']['company_id'],))
+ self.account_ids = ','.join([str(a) for (a,) in self.cr.fetchall()])
+ account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
+ partner_to_use = []
+
+ if data['form']['soldeinit'] :
+ self.cr.execute(
+ "SELECT DISTINCT line.partner_id " \
+ "FROM account_move_line AS line, account_account AS account " \
+ "WHERE line.partner_id IS NOT NULL " \
+ "AND line.account_id = account.id " \
+ "AND line.date < %s " \
+ "AND line.reconcile_id IS NULL " \
+# "AND line.account_id IN (" + self.account_ids + ") " \
+ " " + PARTNER_REQUEST + " " \
+ "AND account.company_id = %d " \
+ "AND account.active " ,
+ (self.date_lst[len(self.date_lst)-1],data['form']['company_id']))
+ else:
+ self.cr.execute(
+ "SELECT DISTINCT line.partner_id " \
+ "FROM account_move_line AS line, account_account AS account " \
+ "WHERE line.partner_id IS NOT NULL " \
+ "AND line.account_id = account.id " \
+ "AND line.date IN (" + self.date_lst_string + ") " \
+# "AND line.account_id IN (" + self.account_ids + ") " \
+ " " + PARTNER_REQUEST + " " \
+ "AND account.company_id = %d " \
+ "AND account.active " ,
+ (data['form']['company_id']))
+ res = self.cr.dictfetchall()
+ for res_line in res:
+ partner_to_use.append(res_line['partner_id'])
+ res = self.cr.dictfetchall()
+
+ for res_line in res:
+ partner_to_use.append(res_line['partner_id'])
+ new_ids = partner_to_use
+ self.partner_ids = ','.join(map(str, new_ids))
+ objects = self.pool.get('res.partner').browse(self.cr, self.uid, new_ids)
+ super(third_party_ledger, self).preprocess(objects, data, new_ids)
- def _sum_debit_partner(self, partner):
- account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
- line_query = account_move_line_obj._query_get(self.cr, self.uid,
- obj='account_move_line',
- context={'fiscalyear': self.datas['form']['fiscalyear'],'state':self.datas['form']['state']})
- self.cr.execute(
- "SELECT sum(debit) " \
- "FROM account_move_line " \
- "WHERE partner_id = %d " \
- "AND account_id IN (" + self.account_ids + ") " \
- "AND date >= %s " \
- "AND date <= %s " \
- "AND " + line_query,
- (partner.id, self.datas['form']['date1'], self.datas['form']['date2']))
- return self.cr.fetchone()[0] or 0.0
-
- def _sum_credit_partner(self, partner):
- account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
- line_query = account_move_line_obj._query_get(self.cr, self.uid,
- obj='account_move_line',
- context={'fiscalyear': self.datas['form']['fiscalyear'],'state':self.datas['form']['state']})
- self.cr.execute(
- "SELECT sum(credit) " \
- "FROM account_move_line " \
- "WHERE partner_id=%d " \
- "AND account_id IN (" + self.account_ids + ") " \
- "AND date >= %s " \
- "AND date <= %s " \
- "AND " + line_query,
- (partner.id, self.datas["form"]["date1"], self.datas["form"]["date2"]))
- return self.cr.fetchone()[0] or 0.0
-
- def _sum_debit(self):
- if not self.ids:
- return 0.0
- account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
- line_query = account_move_line_obj._query_get(self.cr, self.uid,
- obj='account_move_line',
- context={'fiscalyear': self.datas['form']['fiscalyear'],'state':self.datas['form']['state']})
- self.cr.execute(
- "SELECT sum(debit) " \
- "FROM account_move_line " \
- "WHERE partner_id IN (" + self.partner_ids + ") " \
- "AND account_id IN (" + self.account_ids + ") " \
- "AND date >= %s " \
- "AND date <= %s " \
- "AND " + line_query,
- (self.datas['form']['date1'], self.datas['form']['date2']))
- return self.cr.fetchone()[0] or 0.0
-
- def _sum_credit(self):
- if not self.ids:
- return 0.0
- account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
- line_query = account_move_line_obj._query_get(self.cr, self.uid,
- obj='account_move_line',
- context={'fiscalyear': self.datas['form']['fiscalyear'],'state':self.datas['form']['state']})
- self.cr.execute(
- "SELECT sum(credit) " \
- "FROM account_move_line " \
- "WHERE partner_id IN (" + self.partner_ids + ") " \
- "AND account_id IN (" + self.account_ids + ") " \
- "AND date >= %s " \
- "AND date <= %s " \
- "AND " + line_query,
- (self.datas['form']['date1'], self.datas['form']['date2']))
- return self.cr.fetchone()[0] or 0.0
+ def lines(self, partner,data):
+ account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
+ full_account = []
+ if data['form']['reconcil'] :
+ RECONCILE_TAG = " "
+ else:
+ RECONCILE_TAG = "AND l.reconcile_id IS NULL"
+ if data['form']['soldeinit'] :
+ self.cr.execute(
+ "SELECT l.id,l.date,j.code, l.ref, l.name, l.debit, l.credit " \
+ "FROM account_move_line l " \
+ "LEFT JOIN account_journal j " \
+ "ON (l.journal_id = j.id) " \
+ "WHERE l.partner_id = %d " \
+# "AND l.account_id IN (" + self.account_ids + ") " \
+ "AND l.date < %s " \
+ "AND l.reconcile_id IS NULL "
+ "ORDER BY l.id",
+ (partner.id, self.date_lst[0]))
+ res = self.cr.dictfetchall()
+ sum = 0.0
+ for r in res:
+ sum = r['debit'] - r['credit']
+ r['progress'] = sum
+ full_account.append(r)
+
+ self.cr.execute(
+ "SELECT l.id,l.date,j.code, l.ref, l.name, l.debit, l.credit " \
+ "FROM account_move_line l " \
+ "LEFT JOIN account_journal j " \
+ "ON (l.journal_id = j.id) " \
+ "WHERE l.partner_id = %d " \
+# "AND l.account_id IN (" + self.account_ids + ") " \
+ "AND l.date IN (" + self.date_lst_string + ") " \
+ " " + RECONCILE_TAG + " "\
+ "ORDER BY l.id",
+ (partner.id,))
+ res = self.cr.dictfetchall()
+ sum = 0.0
+ for r in res:
+ sum = r['debit'] - r['credit']
+ r['progress'] = sum
+ full_account.append(r)
+
+ return full_account
- def _get_company(self, form):
- return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).name
+ def _sum_debit_partner(self, partner,data):
+
+ account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
+ result_tmp = 0.0
+ if data['form']['reconcil'] :
+ RECONCILE_TAG = " "
+ else:
+ RECONCILE_TAG = "AND reconcile_id IS NULL"
+ if data['form']['soldeinit'] :
+ self.cr.execute(
+ "SELECT sum(debit) " \
+ "FROM account_move_line " \
+ "WHERE partner_id = %d " \
+# "AND account_id IN (" + self.account_ids + ") " \
+ "AND reconcile_id IS NULL " \
+ "AND date < %s " ,
+ (partner.id, self.date_lst[0],))
+ contemp = self.cr.fetchone()
+ if contemp != None:
+ result_tmp = contemp[0] or 0.0
+ else:
+ result_tmp = result_tmp + 0.0
+
- def _get_currency(self, form):
- return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).currency_id.name
+ self.cr.execute(
+ "SELECT sum(debit) " \
+ "FROM account_move_line " \
+ "WHERE partner_id = %d " \
+# "AND account_id IN (" + self.account_ids + ") " \
+ " " + RECONCILE_TAG + " " \
+ "AND date IN (" + self.date_lst_string + ") " ,
+ (partner.id,))
+
+ contemp = self.cr.fetchone()
+ if contemp != None:
+ result_tmp = contemp[0] or 0.0
+ else:
+ result_tmp = result_tmp + 0.0
+ return result_tmp
+
+ def _sum_credit_partner(self, partner,data):
+ account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
+ result_tmp = 0.0
+ if data['form']['reconcil'] :
+ RECONCILE_TAG = " "
+ else:
+ RECONCILE_TAG = "AND reconcile_id IS NULL"
+ if data['form']['soldeinit'] :
+ self.cr.execute(
+ "SELECT sum(credit) " \
+ "FROM account_move_line " \
+ "WHERE partner_id=%d " \
+# "AND account_id IN (" + self.account_ids + ") " \
+ "AND reconcile_id IS NULL " \
+ "AND date < %s " ,
+ (partner.id,self.date_lst[0],))
+ contemp = self.cr.fetchone()
+ if contemp != None:
+ result_tmp = contemp[0] or 0.0
+ else:
+ result_tmp = result_tmp + 0.0
+
+ self.cr.execute(
+ "SELECT sum(credit) " \
+ "FROM account_move_line " \
+ "WHERE partner_id=%d " \
+# "AND account_id IN (" + self.account_ids + ") " \
+ " " + RECONCILE_TAG + " " \
+ "AND date IN (" + self.date_lst_string + ") " ,
+ (partner.id,))
+ contemp = self.cr.fetchone()
+ if contemp != None:
+ result_tmp = contemp[0] or 0.0
+ else:
+ result_tmp = result_tmp + 0.0
+ return result_tmp
+
+ def _sum_debit(self,data):
+ if not self.ids:
+ return 0.0
+ account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
+ result_tmp = 0.0
+ if data['form']['reconcil'] :
+ RECONCILE_TAG = " "
+ else:
+ RECONCILE_TAG = "AND reconcile_id IS NULL"
+ if data['form']['soldeinit'] :
+ self.cr.execute(
+ "SELECT sum(debit) " \
+ "FROM account_move_line " \
+ "WHERE partner_id IN (" + self.partner_ids + ") " \
+# "AND account_id IN (" + self.account_ids + ") " \
+ "AND reconcile_id IS NULL " \
+ "AND date < %s " ,
+ (self.date_lst[0],))
+ contemp = self.cr.fetchone()
+ if contemp != None:
+ result_tmp = contemp[0] or 0.0
+ else:
+ result_tmp = result_tmp + 0.0
+
+ self.cr.execute(
+ "SELECT sum(debit) " \
+ "FROM account_move_line " \
+ "WHERE partner_id IN (" + self.partner_ids + ") " \
+# "AND account_id IN (" + self.account_ids + ") " \
+ " " + RECONCILE_TAG + " " \
+ "AND date IN (" + self.date_lst_string + ") "
+ )
+
+ contemp = self.cr.fetchone()
+ if contemp != None:
+ result_tmp = contemp[0] or 0.0
+ else:
+ result_tmp = result_tmp + 0.0
+
+ return result_tmp
+
+
+ def _sum_credit(self,data):
+ if not self.ids:
+ return 0.0
+ account_move_line_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
+ result_tmp = 0.0
+ if data['form']['reconcil'] :
+ RECONCILE_TAG = " "
+ else:
+ RECONCILE_TAG = "AND reconcile_id IS NULL"
+ if data['form']['soldeinit'] :
+ self.cr.execute(
+ "SELECT sum(credit) " \
+ "FROM account_move_line " \
+ "WHERE partner_id IN (" + self.partner_ids + ") " \
+# "AND account_id IN (" + self.account_ids + ") " \
+ "AND reconcile_id IS NULL " \
+ "AND date < %s " ,
+ (self.date_lst[0],))
+ contemp = self.cr.fetchone()
+ if contemp != None:
+ result_tmp = contemp[0] or 0.0
+ else:
+ result_tmp = result_tmp + 0.0
+ self.cr.execute(
+ "SELECT sum(credit) " \
+ "FROM account_move_line " \
+ "WHERE partner_id IN (" + self.partner_ids + ") " \
+# "AND account_id IN (" + self.account_ids + ") " \
+ " " + RECONCILE_TAG + " " \
+ "AND date IN (" + self.date_lst_string + ") "
+ )
+ contemp = self.cr.fetchone()
+ if contemp != None:
+ result_tmp = contemp[0] or 0.0
+ else:
+ result_tmp = result_tmp + 0.0
+
+ return result_tmp
+
+ def _get_company(self, form):
+ return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).name
+
+ def _get_currency(self, form):
+ return pooler.get_pool(self.cr.dbname).get('res.company').browse(self.cr, self.uid, form['company_id']).currency_id.name
+
report_sxw.report_sxw('report.account.third_party_ledger', 'res.partner',
- 'addons/account/report/third_party_ledger.rml',parser=third_party_ledger,
- header=False)
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+ 'addons/account/report/third_party_ledger.rml',parser=third_party_ledger,
+ header=False)
diff --git a/addons/account/report/third_party_ledger.rml b/addons/account/report/third_party_ledger.rml
old mode 100644
new mode 100755
index a44bbb4f2ca..b8967de5d2c
--- a/addons/account/report/third_party_ledger.rml
+++ b/addons/account/report/third_party_ledger.rml
@@ -2,8 +2,41 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ [[ company.name ]]
+ Third Party Ledger [[ data['form']['result_selection'] == 'customer' and '/ Débiteur' ]] [[ data['form']['result_selection'] == 'supplier' and '/ Créancier' ]] [[ data['form']['result_selection'] == 'all' and '/ Créancier et Débiteur' ]]
+
+
+
+
+
+ [[ time.strftime("%Y-%m-%d %H:%M", time.localtime()) ]]
+ Page
+
+
+
+
+ 1cm 27.7cm 20cm 27.7cm
+
+
+
+
+
@@ -13,227 +46,194 @@
-
-
-
-
-
-
+
+
+
+
+
+
-
-
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
+
+
+
+ [[ data['form']['page_split'] == True or removeParentNode('para') ]]
+ [[ repeatIn(objects, 'p') ]] [[ setLang(p.partner_id.lang) ]]
+
+
+
|
-
-
-
- |
-
- Third party ledger
- |
-
- From [[ formatLang(data['form']['date1'], date=True) ]]
- to [[ formatLang(data['form']['date2'], date=True) ]]
- |
-
-
- |
- [[ get_company(data['form']) ]]
- |
-
- Complete
- |
-
- Currency: [[ get_currency(data['form']) ]]
- |
-
+
+ Date
+
+
+ JNRL
+ |
+
+ Ref.
+ |
+
+ Entry label
+ |
+
+ Debit
+ |
+
+ Credit
+ |
+
+ Balance
+ |
+
+
+
+
+
+
+
+ |
+ Balance brought forward
+ |
+
+ [[ (sum_debit(data)) ]]
+ |
+
+ [[ (sum_credit(data)) ]]
+ |
+
+ [[ (sum_debit(data) - sum_credit(data)) ]]
+ |
+
+
+ |
+
+
+
+
+ [[ data['form']['page_split'] == False or removeParentNode('para') ]]
+ [[ repeatIn(objects, 'p') ]]
+
+
+
+ |
+ [[ p.ref ]] - [[ p.name ]]
+ |
+
+
+ |
+
+ [[ (sum_debit_partner(p,data)) ]]
+ |
+
+ [[ (sum_credit_partner(p,data)) ]]
+ |
+
+ [[ (sum_debit_partner(p,data) - sum_credit_partner(p,data)) ]]
+ |
+
+
+
+
+ |
+ [[ repeatIn(lines(p,data), 'line') ]][[ line['date'] ]]
+ |
+
+ [[ line['code'] ]]
+ |
+
+ [[ line['ref'] ]]
+ |
+
+ [[ line['name'] ]]
+ |
+
+ [[ (line['debit']) or '' ]]
+ |
+
+ [[ (line['credit']) or '' ]]
+ |
+
+ [[ (line['progress']) or '' ]]
+ |
+
+
+
+ |
+
-
-
-
- Printing date: [[ formatLang(time.strftime('%Y-%m-%d'), date=True) ]] at [[ time.strftime('%H:%M:%S') ]]
-
-
-
-
-
- |
- Date
- |
-
- J. code
- |
-
- Voucher Nb
- |
-
- Entry label
- |
-
- Debit
- |
-
- Credit
- |
-
- Progressive balance
- |
-
-
-
-
-
-
- [[ repeatIn(objects, 'p') ]]
- [[ p.ref ]] [[ p.name ]]
-
-
- |
- [[ repeatIn(lines(p), 'line') ]][[ formatLang(line['date'], date=True) ]]
- |
-
- [[ line['code'] ]]
- |
-
- [[ line['ref'] ]]
- |
-
- [[ line['name'] ]]
- |
-
- [[ formatLang(line['debit']) ]]
- |
-
- [[ formatLang(line['credit']) ]]
- |
-
- [[ formatLang(line['progress']) ]]
- |
-
-
-
-
- |
- Total for [[ p.ref ]]
-
-
-
- |
-
- [[ formatLang(sum_debit_partner(p)) ]]
- |
-
- [[ formatLang(sum_credit_partner(p)) ]]
- |
-
- [[ formatLang((sum_debit_partner(p) - sum_credit_partner(p))) ]]
- |
-
-
-
-
-
-
-
-
-
-
-
- |
- Balance brought forward
- |
-
- [[ formatLang(sum_debit()) ]]
- |
-
- [[ formatLang(sum_credit()) ]]
- |
-
- [[ formatLang((sum_debit() - sum_credit())) ]]
- |
-
-
-
-
-
+
+
+
+
-
diff --git a/addons/account/wizard/wizard_account_balance_report.py b/addons/account/wizard/wizard_account_balance_report.py
index 90eeaf44256..f038ce2bd68 100644
--- a/addons/account/wizard/wizard_account_balance_report.py
+++ b/addons/account/wizard/wizard_account_balance_report.py
@@ -1,9 +1,7 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
-# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id$
+# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
@@ -30,37 +28,117 @@
import wizard
import pooler
+import time
+
+report_type = '''
+'''
+
dates_form = '''
'''
dates_fields = {
+ 'date_from': {'string':"Start date",'type':'date','required':True ,'default': lambda *a: time.strftime('%Y-01-01')},
+ 'date_to': {'string':"End date",'type':'date','required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
+ 'display_account':{'string':"Display accounts",'type':'selection','selection':[('bal_mouvement','With movements'),('bal_all','All'),('bal_solde','With balance is not equal to 0')]}
+}
+
+
+period_form = '''
+'''
+
+
+
+period_fields = {
'fiscalyear': {'string': 'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear',
'help': 'Keep empty for all open fiscal year'},
'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'},
- 'state':{'string':'Target Moves','type':'selection','selection': [('all','All Entries'),('posted','All Posted Entries')]}
+ 'display_account':{'string':"Display accounts ",'type':'selection','selection':[('bal_mouvement','With movements'),('bal_all','All'),('bal_solde','With balance is not equal to 0')]}
}
+account_form = '''
+'''
+
+account_fields = {
+ 'Account_list': {'string':'Account', 'type':'many2one', 'relation':'account.account', 'required':True},
+}
+
+
class wizard_report(wizard.interface):
def _get_defaults(self, cr, uid, data, context):
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
+ periods_obj=pooler.get_pool(cr.dbname).get('account.period')
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
- data['form']['target_move'] = False
- data['form']['state']='all'
- if context.has_key('target_move'):
- data['form']['target_move'] = context['target_move']
+ data['form']['periods'] =periods_obj.search(cr, uid, [('fiscalyear_id','=',data['form']['fiscalyear'])])
+ data['form']['display_account']='bal_all'
return data['form']
+ def _get_defaults_fordate(self, cr, uid, data, context):
+ data['form']['display_account']='bal_all'
+ return data['form']
+
+
+ def _check_path(self, cr, uid, data, context):
+ if data['model'] == 'account.account':
+ return 'checktype'
+ else:
+ return 'account_selection'
+
+
+ def _check_date(self, cr, uid, data, context):
+ sql = """
+ SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where '%s' between f.date_start and f.date_stop """%(data['form']['date_from'])
+ cr.execute(sql)
+ res = cr.dictfetchall()
+ if res:
+ if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_to'] < res[0]['date_start']):
+ raise wizard.except_wizard('UserError','Date to must be set between ' + res[0]['date_start'] + " and " + res[0]['date_stop'])
+ else:
+ return 'report'
+
+ else:
+ raise wizard.except_wizard('UserError','Date not in a defined fiscal year')
+
states = {
+
'init': {
- 'actions': [_get_defaults],
- 'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('report','Print')]}
+ 'actions': [],
+ 'result': {'type':'choice','next_state':_check_path}
},
+ 'account_selection': {
+ 'actions': [],
+ 'result': {'type':'form', 'arch':account_form,'fields':account_fields, 'state':[('end','Cancel'),('checktype','Print')]}
+ },
+ 'checktype': {
+ 'actions': [],
+ 'result': {'type':'form', 'arch':report_type,'fields':{}, 'state':[('with_period','Use with Period'),('with_date','Use with Date')]}
+ },
+ 'with_period': {
+ 'actions': [_get_defaults],
+ 'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel'),('report','Print')]}
+ },
+ 'with_date': {
+ 'actions': [_get_defaults_fordate],
+ 'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('checkdate','Print')]}
+ },
+ 'checkdate': {
+ 'actions': [],
+ 'result': {'type':'choice','next_state':_check_date}
+ },
+
'report': {
'actions': [],
'result': {'type':'print', 'report':'account.account.balance', 'state':'end'}
@@ -69,6 +147,3 @@ class wizard_report(wizard.interface):
wizard_report('account.account.balance.report')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/wizard/wizard_aged_trial_balance.py b/addons/account/wizard/wizard_aged_trial_balance.py
old mode 100644
new mode 100755
index bf458e03069..ce95c2c8ab1
--- a/addons/account/wizard/wizard_aged_trial_balance.py
+++ b/addons/account/wizard/wizard_aged_trial_balance.py
@@ -1,9 +1,7 @@
-# -*- encoding: utf-8 -*-
##############################################################################
#
-# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id$
+# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
+# Fabien Pinckaers
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
@@ -34,78 +32,79 @@ import datetime
import pooler
from mx.DateTime import *
-from tools.translate import _
_aged_trial_form = """
"""
_aged_trial_fields = {
- 'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
- 'fiscalyear': {'string': 'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear',
- 'help': 'Keep empty for all open fiscal year'},
- 'period_length': {'string': 'Period length (days)', 'type': 'integer', 'required': True, 'default': lambda *a:30},
- 'sorting_on':{'string': 'Sorting On', 'type': 'selection', 'selection': [('partner','By Partner Name (asc)'), ('amount','By Amount (desc)')],'required': True, 'default': lambda *a:'partner'},
- 'computation':{'string': 'Computational Method', 'type': 'selection', 'selection': [("\'receivable\'",'On Receivables Only'), ("\'payable\'",'On Payables Only'), ("\'receivable\',\'payable\'",'On Receivables & Payables')], 'required': True, 'default': lambda *a:"\'receivable\'"},
- 'state':{'string':'Target Moves','type':'selection','selection': [('all','All Entries'),('posted','All Posted Entries')]}
-}
+ 'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
+ 'period_length': {'string': 'Period length (days)', 'type': 'integer', 'required': True, 'default': lambda *a:30},
+ 'date1': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
+ 'result_selection':{'string':"Display partner",'type':'selection','selection':[('customer','Debiteur'),('supplier','Creancier'),('all','Tous')]},
+ 'direction_selection':{'string':"Display aged balance of",'type':'selection','selection':[('past','Due amount'),('future','Not due amount')]},
+ }
def _calc_dates(self, cr, uid, data, context):
- res = {}
- period_length = data['form']['period_length']
- if period_length<=0:
- raise wizard.except_wizard(_('UserError'), _('You must enter a period length that cannot be 0 or below !'))
- start = now()
- for i in range(5)[::-1]:
- stop = start-RelativeDateTime(days=period_length)
- res[str(i)] = {
- 'name' : str((5-i)*period_length)+' days',
- 'stop': start.strftime('%Y-%m-%d'),
- 'start' : stop.strftime('%Y-%m-%d'),
- }
- start = stop - RelativeDateTime(days=1)
- return res
+ res = {}
+ period_length = data['form']['period_length']
+ if period_length<=0:
+ raise wizard.except_wizard('UserError', 'You must enter a period length that cannot be 0 or below !')
+ start = datetime.date.fromtimestamp(time.mktime(time.strptime(data['form']['date1'],"%Y-%m-%d")))
+ start = DateTime(int(start.year),int(start.month),int(start.day))
+ if data['form']['direction_selection'] == 'past':
+ for i in range(5)[::-1]:
+ stop = start - RelativeDateTime(days=period_length)
+ res[str(i)] = {
+ 'name' : str((5-(i+1))*period_length) + '-' + str((5-i)*period_length),
+
+ 'stop': start.strftime('%Y-%m-%d'),
+ 'start' : stop.strftime('%Y-%m-%d'),
+ }
+ start = stop - RelativeDateTime(days=1)
+ else:
+ for i in range(5):
+ stop = start + RelativeDateTime(days=period_length)
+ res[str(5-(i+1))] = {
+ 'name' : str((i)*period_length)+'-'+str((i+1)*period_length),
+ 'start': start.strftime('%Y-%m-%d'),
+ 'stop' : stop.strftime('%Y-%m-%d'),
+ }
+ start = stop + RelativeDateTime(days=1)
+ return res
class wizard_report(wizard.interface):
- def _get_defaults(self, cr, uid, data, context):
- fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
- data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
+ def _get_defaults(self, cr, uid, data, context):
+ fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
+ data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
- user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
- if user.company_id:
- company_id = user.company_id.id
- else:
- company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
- data['form']['company_id'] = company_id
- data['form']['state']='all'
- return data['form']
+ user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
+ if user.company_id:
+ company_id = user.company_id.id
+ else:
+ company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
+ data['form']['company_id'] = company_id
+
+ return data['form']
- states = {
- 'init': {
- 'actions': [_get_defaults],
- 'result': {'type':'form', 'arch':_aged_trial_form, 'fields':_aged_trial_fields, 'state':[('end','Cancel'),('print','Print Aged Partner Balance')]},
- },
- 'print': {
- 'actions': [_calc_dates],
- 'result': {'type':'print', 'report':'account.aged.trial.balance', 'state':'end'},
- },
- }
-
+ states = {
+ 'init': {
+ 'actions': [_get_defaults],
+ 'result': {'type':'form', 'arch':_aged_trial_form, 'fields':_aged_trial_fields, 'state':[('end','Cancel'),('print','Print Aged Trial Balance')]},
+ },
+ 'print': {
+ 'actions': [_calc_dates],
+ 'result': {'type':'print', 'report':'account.aged_trial_balance', 'state':'end'},
+ },
+ }
wizard_report('account.aged.trial.balance')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/wizard/wizard_general_ledger_report.py b/addons/account/wizard/wizard_general_ledger_report.py
index 2e2407b5217..80a25dde35e 100644
--- a/addons/account/wizard/wizard_general_ledger_report.py
+++ b/addons/account/wizard/wizard_general_ledger_report.py
@@ -1,10 +1,6 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
-# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id$
-#
# 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
@@ -30,33 +26,144 @@
import wizard
import pooler
+import locale
+import time
+
+report_type = '''
+'''
dates_form = '''
-'''
dates_fields = {
+ 'date_from': {'string':"Start date",'type':'date','required':True ,'default': lambda *a: time.strftime('%Y-01-01')},
+ 'date_to': {'string':"End date",'type':'date','required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
+ 'sortbydate':{'string':"Sort by",'type':'selection','selection':[('sort_date','Date'),('sort_mvt','Mouvement')]},
+ 'display_account':{'string':"Display accounts ",'type':'selection','selection':[('bal_mouvement','With movements'),('bal_all','All'),('bal_solde','With balance is not equal to 0')]},
+ 'landscape':{'string':"Print in Landscape Mode",'type':'boolean'},
+ 'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'},
+ 'amount_currency':{'string':"with amount in currency",'type':'boolean'}
+
+}
+
+account_form = '''
+'''
+
+account_fields = {
+ 'Account_list': {'string':'Account', 'type':'many2one', 'relation':'account.account', 'required':True},
+}
+
+
+
+
+period_form = '''
+'''
+
+period_fields = {
'fiscalyear': {'string': 'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear',
'help': 'Keep empty for all open fiscal year'},
'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'},
- 'state':{'string':'Target Moves','type':'selection','selection': [('all','All Entries'),('posted','All Posted Entries')]}
+ 'sortbydate':{'string':"Sort by:",'type':'selection','selection':[('sort_date','Date'),('sort_mvt','Mouvement')]},
+ 'display_account':{'string':"Display accounts ",'type':'selection','selection':[('bal_mouvement','With movements'),('bal_all','All'),('bal_solde','With balance is not equal to 0')]},
+ 'landscape':{'string':"Print in Landscape Mode",'type':'boolean'},
+ 'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'},
+ 'amount_currency':{'string':"with amount in currency",'type':'boolean'}
}
+def _check_path(self, cr, uid, data, context):
+ if data['model'] == 'account.account':
+ return 'checktype'
+ else:
+ return 'account_selection'
+
+def _check(self, cr, uid, data, context):
+ if data['form']['landscape']==True:
+ return 'report_landscape'
+ else:
+ return 'report'
+
+def _check_date(self, cr, uid, data, context):
+ sql = """
+ SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where '%s' between f.date_start and f.date_stop """%(data['form']['date_from'])
+ cr.execute(sql)
+ res = cr.dictfetchall()
+ if res:
+ if (data['form']['date_to'] > res[0]['date_stop'] or data['form']['date_to'] < res[0]['date_start']):
+ raise wizard.except_wizard('UserError','Date to must be set between ' + res[0]['date_start'] + " and " + res[0]['date_stop'])
+ else:
+ return 'checkreport'
+
+ else:
+ raise wizard.except_wizard('UserError','Date not in a defined fiscal year')
+
class wizard_report(wizard.interface):
def _get_defaults(self, cr, uid, data, context):
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
- data['form']['state']='all'
+ data['form']['sortbydate'] = 'sort_date'
+ data['form']['display_account']='bal_all'
+ data['form']['landscape']=True
+ data['form']['amount_currency'] = True
return data['form']
+ def _get_defaults_fordate(self, cr, uid, data, context):
+ data['form']['sortbydate'] = 'sort_date'
+ data['form']['display_account']='bal_all'
+ data['form']['landscape']=True
+ data['form']['amount_currency'] = True
+ return data['form']
+
states = {
'init': {
+ 'actions': [],
+ 'result': {'type':'choice','next_state':_check_path}
+ },
+ 'account_selection': {
+ 'actions': [],
+ 'result': {'type':'form', 'arch':account_form,'fields':account_fields, 'state':[('end','Cancel'),('checktype','Print')]}
+ },
+ 'checktype': {
+ 'actions': [],
+ 'result': {'type':'form', 'arch':report_type,'fields':{}, 'state':[('with_period','Use with Period'),('with_date','Use with Date')]}
+ },
+ 'with_period': {
'actions': [_get_defaults],
- 'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('report','Print')]}
+ 'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel'),('checkreport','Print')]}
+ },
+ 'with_date': {
+ 'actions': [_get_defaults_fordate],
+ 'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('checkdate','Print')]}
+ },
+ 'checkdate': {
+ 'actions': [],
+ 'result': {'type':'choice','next_state':_check_date}
+ },
+ 'checkreport': {
+ 'actions': [],
+ 'result': {'type':'choice','next_state':_check}
+ },
+ 'report_landscape': {
+ 'actions': [],
+ 'result': {'type':'print', 'report':'account.general.ledger_landscape', 'state':'end'}
},
'report': {
'actions': [],
@@ -64,7 +171,3 @@ class wizard_report(wizard.interface):
}
}
wizard_report('account.general.ledger.report')
-
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/account/wizard/wizard_third_party_ledger.py b/addons/account/wizard/wizard_third_party_ledger.py
old mode 100644
new mode 100755
index 2c64c8f1df2..e9f2daf4b01
--- a/addons/account/wizard/wizard_third_party_ledger.py
+++ b/addons/account/wizard/wizard_third_party_ledger.py
@@ -1,9 +1,6 @@
-# -*- encoding: utf-8 -*-
##############################################################################
#
-# Copyright (c) 2004-2008 TINY SPRL. (http://tiny.be) All Rights Reserved.
-#
-# $Id$
+# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
@@ -32,54 +29,133 @@ import time
import wizard
import pooler
+
+report_type = '''
+'''
+
+
dates_form = '''
'''
dates_fields = {
- 'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
- 'fiscalyear': {'string': 'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear',
- 'help': 'Keep empty for all open fiscal year'},
- 'date1': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
- 'date2': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
- 'state':{'string':'Target Moves','type':'selection','selection': [('all','All Entries'),('posted','All Posted Entries')]}
+ 'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
+ 'date1': {'string':'Start date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
+ 'date2': {'string':'End date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
+ 'result_selection':{'string':"Display partners",'type':'selection','selection':[('customer','Debiteur'),('supplier','Creancier'),('all','Tous')]},
+ 'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'},
+ 'reconcil':{'string':"Inclure les ecritures reconsiliees",'type':'boolean'},
+ 'page_split':{'string':"Un partenaire par page",'type':'boolean'},
}
+period_form = '''
+'''
+
+period_fields = {
+ 'company_id': {'string': 'Company', 'type': 'many2one', 'relation': 'res.company', 'required': True},
+ 'fiscalyear': {'string': 'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear',
+ 'help': 'Keep empty for all open fiscal year'},
+ 'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'},
+ 'result_selection':{'string':"Display partners",'type':'selection','selection':[('customer','Debiteur'),('supplier','Creancier'),('all','Tous')]},
+ 'soldeinit':{'string':"Inclure les soldes initiaux",'type':'boolean'},
+ 'reconcil':{'string':"Inclure les ecritures reconsiliees",'type':'boolean'},
+ 'page_split':{'string':"Un partenaire par page",'type':'boolean'},
+}
+
+
class wizard_report(wizard.interface):
- def _get_defaults(self, cr, uid, data, context):
- fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
- data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
+
+ def _get_defaults(self, cr, uid, data, context):
- user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
- if user.company_id:
- company_id = user.company_id.id
- else:
- company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
- data['form']['company_id'] = company_id
- data['form']['state']='all'
- return data['form']
+ fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
+ data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
+ data['form']['display_account']='bal_all'
+
+ data['form']['result_selection'] = 'all'
+ user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
+ if user.company_id:
+ company_id = user.company_id.id
+ else:
+ company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
+ data['form']['company_id'] = company_id
+ data['form']['page_split'] = False
+ data['form']['reconcil'] = False
+ data['form']['soldeinit'] = True
+ return data['form']
+
+ def _get_defaults_fordate(self, cr, uid, data, context):
+ data['form']['result_selection'] = 'all'
+ user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
+ if user.company_id:
+ company_id = user.company_id.id
+ else:
+ company_id = pooler.get_pool(cr.dbname).get('res.company').search(cr, uid, [('parent_id', '=', False)])[0]
+ data['form']['company_id'] = company_id
+ data['form']['page_split'] = False
+ data['form']['reconcil'] = False
+ data['form']['soldeinit'] = True
+ return data['form']
- states = {
- 'init': {
- 'actions': [_get_defaults],
- 'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('report','Print') ]}
- },
- 'report': {
- 'actions': [],
- 'result': {'type':'print', 'report':'account.third_party_ledger', 'state':'end'}
- }
- }
+
+ def _check_date(self, cr, uid, data, context):
+ sql = """
+ SELECT f.id, f.date_start, f.date_stop FROM account_fiscalyear f Where '%s' between f.date_start and f.date_stop """%(data['form']['date1'])
+ cr.execute(sql)
+ res = cr.dictfetchall()
+ if res:
+ if (data['form']['date2'] > res[0]['date_stop'] or data['form']['date2'] < res[0]['date_start']):
+ raise wizard.except_wizard('UserError','Date to must be set between ' + res[0]['date_start'] + " and " + res[0]['date_stop'])
+ else:
+ return 'report'
+
+ else:
+ raise wizard.except_wizard('UserError','Date not in a defined fiscal year')
+
+
+ states = {
+ 'init': {
+ 'actions': [],
+ 'result': {'type':'form', 'arch':report_type,'fields':{}, 'state':[('with_period','Use with Period'),('with_date','Use with Date')]}
+ },
+ 'with_period': {
+ 'actions': [_get_defaults],
+ 'result': {'type':'form', 'arch':period_form, 'fields':period_fields, 'state':[('end','Cancel'),('report','Print')]}
+ },
+ 'with_date': {
+ 'actions': [_get_defaults_fordate],
+ 'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('checkdate','Print')]}
+ },
+ 'checkdate': {
+ 'actions': [],
+ 'result': {'type':'choice','next_state':_check_date}
+ },
+ 'report': {
+ 'actions': [],
+ 'result': {'type':'print', 'report':'account.third_party_ledger', 'state':'end'}
+ }
+ }
wizard_report('account.third_party_ledger.report')
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
-
diff --git a/addons/purchase/report/order.rml b/addons/purchase/report/order.rml
index 0fa6edb2ef3..26956a2b0bf 100644
--- a/addons/purchase/report/order.rml
+++ b/addons/purchase/report/order.rml
@@ -96,7 +96,7 @@
-
+
@@ -141,32 +141,32 @@
[[ repeatIn(o.dest_address_id and [o.dest_address_id] or [],'addr') ]]
Shipping address :
- [[ o.partner_id.title or '' ]][[ o.partner_id.name ]]
- [[ addr.title or '' ]][[ addr.name ]]
+ [[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]
+ [[ addr.title or '' ]] [[ addr.name ]]
[[ addr.street ]]
[[ addr.street2 or '' ]]
- [[ addr.zip or '' ]][[ addr.city or '' ]]
- [[ addr.state_id and addr.state_id.name or '' ]]
+ [[ addr.zip or '' ]] [[ addr.city or '' ]]
+ [[ addr.state_id and addr.state_id.name or '' ]]
[[ addr.country_id and addr.country_id.name or '' ]]
|
- [[ o.partner_id.title or '' ]][[ o.partner_id.name ]]
- [[ o.partner_address_id.title or '' ]][[ o.partner_address_id.name ]]
+ [[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]
+ [[ o.partner_address_id.title or '' ]] [[ o.partner_address_id.name ]]
[[ o.partner_address_id.street ]]
[[ o.partner_address_id.street2 or '' ]]
- [[ o.partner_address_id.zip or '' ]][[ o.partner_address_id.city or '' ]]
- [[ o.partner_address_id.state_id and o.partner_address_id.state_id.name or '' ]]
+ [[ o.partner_address_id.zip or '' ]] [[ o.partner_address_id.city or '' ]]
+ [[ o.partner_address_id.state_id and o.partner_address_id.state_id.name or '' ]]
[[ o.partner_address_id.country_id and o.partner_address_id.country_id.name or '' ]]
Tél. : [[ o.partner_address_id.phone or '' ]]
Fax : [[ o.partner_address_id.fax or '' ]]
- TVA :[[ o.partner_id.vat or '' ]]
+ TVA :[[ o.partner_id.vat or '' ]]
|
- Request for Quotation [[ (o.state=='draft' or removeParentNode('font')) and '' ]] Order [[ (o.state<>'draft' or removeParentNode('font')) and '' ]] N° [[ o.name ]]
+ Request for Quotation [[ (o.state=='draft' or removeParentNode('font')) and '' ]] Order [[ (o.state<>'draft' or removeParentNode('font')) and '' ]] N° :[[ o.name ]]
@@ -195,20 +195,20 @@
[[ o.name or '' ]]
|
- [[ o.partner_ref or '' ]]
+ [[ o.partner_ref or '' ]]
|
[[ time.strftime('%d/%m/%Y', time.strptime(o.date_order, '%Y-%m-%d')) ]]
|
- [[ o.validator and o.validator.name or '' ]]
+ [[ o.validator and o.validator.name or '' ]]
|
-
+
Description
@@ -232,7 +232,7 @@
[[ repeatIn(o.order_line,'line') ]]
-
+
|
[[ line.name ]]
@@ -244,7 +244,7 @@
[[ time.strftime('%d/%m/%Y', time.strptime( line.date_planned, '%Y-%m-%d')) ]]
|
- [[ line.product_qty ]]
+ [[ line.product_qty ]]
|
[[ line.product_uom.name ]]
@@ -258,8 +258,7 @@
|
|
- [[ repeatIn((line.notes and line.notes.splitlines()) or [], 'l') ]]
- [[ l or removeParentNode('table') ]]
+ [[ line.notes or removeParentNode('tr') ]]
|
@@ -308,7 +307,7 @@
[[ o.amount_untaxed ]]
|
- [[ o.pricelist_id.currency_id.name ]]
+ [[ o.pricelist_id.currency_id.name ]]
|
@@ -324,7 +323,7 @@
[[ o.amount_tax ]]
|
- [[ o.pricelist_id.currency_id.name ]]
+ [[ o.pricelist_id.currency_id.name ]]
|
diff --git a/addons/purchase/report/request_quotation.rml b/addons/purchase/report/request_quotation.rml
index 99cd2a14a6e..e82482a8e31 100644
--- a/addons/purchase/report/request_quotation.rml
+++ b/addons/purchase/report/request_quotation.rml
@@ -29,14 +29,11 @@
-
-
-
-
+
@@ -68,6 +65,8 @@
+
+
@@ -76,6 +75,13 @@
|
+ Expected Delivery address:
+ [[( order.warehouse_id and order.warehouse_id.name) or order.partner_address_id.partner_id.name]]
+ [[ (order.warehouse_id and order.warehouse_id.partner_address_id and order.warehouse_id.partner_address_id.title) or ' ']] [[ (order.warehouse_id and order.warehouse_id.partner_address_id and order.warehouse_id.partner_address_id.name) or order.partner_address_id.name ]]
+ [[ (order.warehouse_id and order.warehouse_id.partner_address_id and order.warehouse_id.partner_address_id.street) or order.partner_address_id.street ]]
+ [[ (order.warehouse_id and order.warehouse_id.partner_address_id and order.warehouse_id.partner_address_id.street2) or order.partner_address_id.street2 ]]
+ [[ (order.warehouse_id and order.warehouse_id.partner_address_id and order.warehouse_id.partner_address_id.zip) or order.partner_address_id.zip ]] [[ (order.warehouse_id and order.warehouse_id.partner_address_id and order.warehouse_id.partner_address_id.city) or order.partner_address_id.city ]]
+ [[(order.warehouse_id and order.warehouse_id.partner_address_id and order.warehouse_id.partner_address_id.state_id and order.warehouse_id.partner_address_id.state_id.name) or order.partner_address_id.state_id.name ]] [[(order.warehouse_id and order.warehouse_id.partner_address_id and order.warehouse_id.partner_address_id.country_id and order.warehouse_id.partner_address_id.country_id.name) or order.partner_address_id.country_id.name ]]
@@ -100,30 +106,20 @@
|
-
-
-
- Request for quotation : [[order.name]]
+ Request for Quotation : [[order.name]]
-
-
-
- Please find hereby a request for quotation.
-
-
-
-
+
|
Description
|
- Date
+ Expected Date
|
Qty
@@ -132,13 +128,13 @@
[[ repeatIn(order.order_line,'order_line') ]]
-
+
|
[[ order_line.name ]]
|
- [[ time.strftime('%d/%m/%Y', time.strptime( order_line.date_planned, '%Y-%m-%d')) ]]
+ [[ time.strftime('%d/%m/%Y', time.strptime( order_line.date_planned, '%Y-%m-%d')) ]]
|
[[ order_line.product_qty or '' ]]
@@ -149,23 +145,7 @@
|
|
- [[ repeatIn((order_line.notes and order_line.notes.splitlines()) or [], 'l') ]]
- [[ l or removeParentNode('table') ]]
- |
-
-
-
-
- |
-
-
-
-
- |
-
-
-
-
+ [[ format(order_line.notes or removeParentNode('tr')) ]]
|
@@ -173,14 +153,18 @@
- [[ order.notes or '' ]]
+ [[ format(order.notes or '') ]]
- Thanks,
+ Regards,
+ [[ user.name or '' ]]
+
+
+
[[ user.signature or '' ]]
diff --git a/addons/sale/report/order.rml b/addons/sale/report/order.rml
index 2283465f634..a5a29a6f38c 100644
--- a/addons/sale/report/order.rml
+++ b/addons/sale/report/order.rml
@@ -97,7 +97,7 @@
-
+
@@ -130,6 +130,7 @@
+
@@ -168,15 +169,18 @@
Tel. : [[ o.partner_order_id.phone or removeParentNode('para') ]]
Fax : [[ o.partner_order_id.fax or removeParentNode('para') ]]
- VAT :[[ o.partner_id.vat or removeParentNode('para') ]]
+ TVA : [[ o.partner_id.vat or removeParentNode('para') ]]
+
+
+
|
- [[ o.state<>'draft' and removeParentNode('para') ]] Quotation N° : [[ o.name ]]
- [[ o.state=='draft' and removeParentNode('para') ]] Order N° : [[ o.name ]]
+ [[ o.state<>'draft' and removeParentNode('para') ]] Quotation N° [[ o.name ]]
+ [[ o.state=='draft' and removeParentNode('para') ]] Order N° [[ o.name ]]
@@ -265,8 +269,7 @@
|
- [[ repeatIn((line.notes and line.notes.splitlines()) or [], 'l') ]]
- [[ l or removeParentNode('table') ]]
+ [[ format(line.notes or removeParentNode('tr')) ]]
|
@@ -312,7 +315,7 @@
Net Total :
|
- 0.00
+ [[ o.amount_untaxed ]]
|
[[ o.pricelist_id.currency_id.name ]]
@@ -328,7 +331,7 @@
Taxes :
|
- 0.00
+ [[ o.amount_tax ]]
|
[[ o.pricelist_id.currency_id.name ]]
diff --git a/addons/sale/report/shipping.rml b/addons/sale/report/shipping.rml
index 1eb49c91d61..82b3eac3cc0 100644
--- a/addons/sale/report/shipping.rml
+++ b/addons/sale/report/shipping.rml
@@ -2,7 +2,7 @@
-
+
@@ -14,7 +14,7 @@
-
+
@@ -27,11 +27,14 @@
-
+
+
+
+
-
+
@@ -44,31 +47,52 @@
-
+
+
+
+
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
@@ -99,6 +123,7 @@
+
@@ -118,7 +143,6 @@
[[ o.sale_id and o.sale_id.partner_invoice_id and o.sale_id.partner_invoice_id.country_id and o.sale_id.partner_invoice_id.country_id.name or '']]
|
- Shipped to
[[ o.sale_id and o.sale_id.partner_shipping_id and o.sale_id.partner_shipping_id.name or '']]
[[ o.sale_id and o.sale_id.partner_shipping_id and o.sale_id.partner_shipping_id.street or '']]
[[ o.sale_id and o.sale_id.partner_shipping_id and o.sale_id.partner_shipping_id.zip or '']]
@@ -127,17 +151,11 @@
|
-
+ Delivery Order : [[ o.name ]]
+
- Delivery order [[ o.sale_id and o.sale_id.name ]]
-
-
-
-
-
-
-
+
|
Order Ref.
@@ -151,9 +169,12 @@
|
Carrier
|
+
+ Weight
+ |
-
+
|
[[ o.sale_id and o.sale_id.name ]]
@@ -167,12 +188,15 @@
|
[[ o.carrier_id and o.carrier_id.name or '' ]]
|
+
+ [[ o.weight ]]
+ |
-
+
-
+
|
Reference
@@ -180,17 +204,26 @@
|
Designation
|
+
+ Lot
+ |
Quantity
|
- S.U.
+ Unit Price
+ |
+
+ Price
|
+
+
+
- [[ repeatIn(o.move_lines, 'line') ]]
-
+ [[ repeatIn(o.move_lines,'line') ]]
+
|
[[line.product_id.code ]]
@@ -199,10 +232,19 @@
[[ line.product_id and line.product_id.name or '']]
|
- [[ line.product_qty ]]
+ [[ (line.prodlot_id and line.prodlot_id.name) or ' ' ]]
|
- [[ line.product_uom and line.product_uom.name ]]
+ [[ line.product_qty ]]
+ |
+
+ [[ line.product_uom and line.product_uom.name ]]
+ |
+
+ [[ line.sale_line_id.price_unit ]]
+ |
+
+ [[ line.sale_line_id.price_subtotal ]]
|
@@ -210,5 +252,36 @@
+
+
+ |
+
+
+
+ |
+
+ Net Total :
+ |
+
+ [[ o.sale_id.amount_untaxed ]]
+ |
+
+
+ |
+
+
+
+ |
+
+ Total :
+ |
+
+ [[ o.sale_id.amount_total ]]
+ |
+
+
+
+
+
diff --git a/addons/stock/report/picking.rml b/addons/stock/report/picking.rml
index c7c76406db8..9a3cdaf5a64 100644
--- a/addons/stock/report/picking.rml
+++ b/addons/stock/report/picking.rml
@@ -10,7 +10,11 @@
-
+
+
+
+
+
@@ -27,12 +31,9 @@
+
-
-
-
-
@@ -47,12 +48,9 @@
+
-
-
-
-
| |