account_move_line_obj = self.pool.get('account.move.line')
account_analytic_line_obj = self.pool.get('account.analytic.line')
account_bank_statement_line_obj = self.pool.get('account.bank.statement.line')
-
- st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id, context)
+ st_line = account_bank_statement_line_obj.browse(cr, uid, st_line_id.id, context)
st = st_line.statement_id
context.update({'date': st_line.date})
+
move_id = account_move_obj.create(cr, uid, {
'journal_id': st.journal_id.id,
'period_id': st.period_id.id,
account_bank_statement_line()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
open_jrnl = self.search(cr, uid, sql)
if open_jrnl:
raise osv.except_osv('Error', _('You can not have two open register for the same journal'))
-
+
if self.pool.get('account.journal').browse(cr, uid, vals['journal_id']).type == 'cash':
open_close = self._get_cash_open_close_box_lines(cr, uid, context)
vals.update({
super(account_cash_statement, self).button_confirm_bank(cr, uid, ids, context=context)
return self.write(cr, uid, ids, {'closing_date':time.strftime("%Y-%m-%d %H:%M:%S")}, context=context)
-
- def button_cancel(self, cr, uid, ids, context={}):
- done = []
- for st in self.browse(cr, uid, ids, context):
- ids = []
- for line in st.line_ids:
- ids += [x.id for x in line.move_ids]
- self.pool.get('account.move').unlink(cr, uid, ids, context)
- done.append(st.id)
- self.write(cr, uid, done, {'state':'draft'}, context=context)
- return True
-
account_cash_statement()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
<menuitem action="action_account_journal_form" id="menu_action_account_journal_form" parent="account_account_menu"/>
<record id="view_account_bank_statement_filter" model="ir.ui.view">
- <field name="name">account.bank.statement.select</field>
+ <field name="name">account.cash.statement.select</field>
<field name="model">account.bank.statement</field>
<field name="type">search</field>
<field name="arch" type="xml">
<separator orientation="vertical"/>
<field name="date"/>
<field name="name"/>
- <field name="journal_id" widget='selection'/>
+ <field name="journal_id" widget='selection' domain="[('type', '=', 'cash')]" />
</group>
<newline/>
<group expand="0" string="Group By...">
<field name="name"/>
<field name="date"/>
<field name="period_id"/>
- <field name="journal_id" widget="selection"/>
+ <field name="journal_id" widget="selection" domain="[('type', '=', 'bank')]" />
</group>
<newline/>
<group expand="0" string="Group By...">
<field name="view_mode">tree,form,graph</field>
<field name="domain">[('journal_id.type', '=', 'bank')]</field>
<field name="context">{'journal_type':'bank'}</field>
+ <field name="search_view_id" ref="view_bank_statement_search"/>
</record>
<record model="ir.actions.act_window.view" id="action_bank_statement_tree_bank">
<field name="sequence" eval="1"/>
<field name="view_type">form</field>
<field name="view_mode">tree,form,graph</field>
<field name="domain">[('journal_id.type', '=', 'bank')]</field>
+ <field name="search_view_id" ref="view_bank_statement_search"/>
<field name="context">{'journal_type':'bank'}</field>
</record>
<record model="ir.actions.act_window.view" id="action_bank_statement_periodic_tree_bank">
<field name="res_model">account.bank.statement</field>
<field name="view_type">form</field>
<field name="view_mode">form,tree</field>
+ <field name="search_view_id" ref="view_bank_statement_search"/>
<field name="view_id" ref="view_bank_statement_reconcile_form"/>
</record>
period_pool = self.pool.get('account.period')
journal_pool = self.pool.get('account.journal')
-
+
journal_id = self._get_journal(cr, uid, context)
period_id = self._get_period(cr, uid, context)
</group>
<group colspan="4" col="4">
<label string ="" colspan="2"/>
- <button icon="terp-gtk-go-back-rtl" string="Ok" name="action_open_window" type="object"/>
+ <button icon="gtk-cancel" special="cancel" string="Cancel"/>
+ <button icon="terp-gtk-go-back-rtl" string="Open" name="action_open_window" default_focus="1" type="object"/>
</group>
</form>""" % (str(journal), str(period))
-
+
res.update({
'arch':view
})
return res
-
+
def action_open_window(self, cr, uid, ids, context=None):
"""
This function Open action move line window on given period and Journal/Payment Mode
'category': 'Generic Modules/Accounting',
'description': """This module allows accountants to manage analytic and crossovered budgets.
-Once the Master Budgets and the Budgets are defined (in Financial
-Management/Budgets/), the Project Managers can set the planned amount on each
-Analytic Account.
+Once the Master Budgets and the Budgets are defined (in Accounting/Budgets/),
+the Project Managers can set the planned amount on each Analytic Account.
The accountant has the possibility to see the total of amount planned for each
Budget and Master Budget in order to ensure the total planned is not
def spread(self, cr, uid, ids, fiscalyear_id=False, amount=0.0):
dobj = self.pool.get('account.budget.post.dotation')
+ obj_fiscalyear = self.pool.get('account.fiscalyear')
for o in self.browse(cr, uid, ids):
# delete dotations for this post
dobj.unlink(cr, uid, dobj.search(cr, uid, [('post_id','=',o.id)]))
# create one dotation per period in the fiscal year, and spread the total amount/quantity over those dotations
- fy = self.pool.get('account.fiscalyear').browse(cr, uid, [fiscalyear_id])[0]
+ fy = obj_fiscalyear.browse(cr, uid, [fiscalyear_id])[0]
num = len(fy.period_ids)
for p in fy.period_ids:
dobj.create(cr, uid, {'post_id': o.id, 'period_id': p.id, 'amount': amount/num})
class account_budget_post_dotation(osv.osv):
def _tot_planned(self, cr, uid, ids, name, args, context):
+ obj_budget_lines = self.pool.get('crossovered.budget.lines')
res = {}
for line in self.browse(cr, uid, ids):
if line.period_id:
- obj_period=self.pool.get('account.period').browse(cr, uid, line.period_id.id)
-
- total_days=strToDate(obj_period.date_stop) - strToDate(obj_period.date_start)
- budget_id=line.post_id and line.post_id.id or False
- query="select id from crossovered_budget_lines where \
- general_budget_id= %s AND (date_from >=%s and date_from <= %s ) \
- OR (date_to >=%s and date_to <= %s) OR (date_from < %s and date_to > %s)"
- cr.execute(query,(budget_id,obj_period.date_start,obj_period.date_stop,obj_period.date_start,obj_period.date_stop,obj_period.date_start,obj_period.date_stop,))
- res1=cr.fetchall()
- tot_planned=0.00
+ obj_period = self.pool.get('account.period').browse(cr, uid, line.period_id.id)
+
+ total_days = strToDate(obj_period.date_stop) - strToDate(obj_period.date_start)
+ budget_id = line.post_id and line.post_id.id or False
+ query="SELECT id FROM crossovered_budget_lines WHERE \
+ general_budget_id= %s AND (date_from >=%s AND date_from <= %s ) \
+ OR (date_to >=%s AND date_to <= %s) OR (date_from < %s AND date_to > %s)"
+ cr.execute(query, (budget_id, obj_period.date_start, obj_period.date_stop, obj_period.date_start, obj_period.date_stop, obj_period.date_start, obj_period.date_stop,))
+ res1 = cr.fetchall()
+ tot_planned = 0.00
for record in res1:
- obj_lines = self.pool.get('crossovered.budget.lines').browse(cr, uid, record[0])
- count_days = min(strToDate(obj_period.date_stop),strToDate(obj_lines.date_to)) - max(strToDate(obj_period.date_start), strToDate(obj_lines.date_from))
- days_in_period = count_days.days +1
+ obj_lines = obj_budget_lines.browse(cr, uid, record[0])
+ count_days = min(strToDate(obj_period.date_stop), strToDate(obj_lines.date_to)) - max(strToDate(obj_period.date_start), strToDate(obj_lines.date_from))
+ days_in_period = count_days.days + 1
count_days = strToDate(obj_lines.date_to) - strToDate(obj_lines.date_from)
- total_days_of_rec = count_days.days +1
- tot_planned += obj_lines.planned_amount/total_days_of_rec* days_in_period
+ total_days_of_rec = count_days.days + 1
+ tot_planned += obj_lines.planned_amount / total_days_of_rec * days_in_period
res[line.id] = tot_planned
else:
res[line.id] = 0.00
'post_id': fields.many2one('account.budget.post', 'Item', select=True),
'period_id': fields.many2one('account.period', 'Period'),
'amount': fields.float('Amount', digits=(16,2)),
- 'tot_planned':fields.function(_tot_planned, method=True, string='Total Planned Amount', type='float', store=True),
+ 'tot_planned': fields.function(_tot_planned, method=True, string='Total Planned Amount', type='float', store=True),
}
account_budget_post_dotation()
_defaults = {
'state': 'draft',
- 'creating_user_id': lambda self,cr,uid,context: uid,
- 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.budget.post', context=c)
+ 'creating_user_id': lambda self, cr, uid, context: uid,
+ 'company_id': lambda self, cr, uid, c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.budget.post', context=c)
}
def budget_confirm(self, cr, uid, ids, *args):
self.write(cr, uid, ids, {
- 'state':'confirm'
+ 'state': 'confirm'
})
return True
def budget_draft(self, cr, uid, ids, *args):
self.write(cr, uid, ids, {
- 'state':'draft'
+ 'state': 'draft'
})
return True
def budget_validate(self, cr, uid, ids, *args):
self.write(cr, uid, ids, {
- 'state':'validate',
+ 'state': 'validate',
'validating_user_id': uid,
})
return True
def budget_cancel(self, cr, uid, ids, *args):
self.write(cr, uid, ids, {
- 'state':'cancel'
+ 'state': 'cancel'
})
return True
def budget_done(self, cr, uid, ids, *args):
self.write(cr, uid, ids, {
- 'state':'done'
+ 'state': 'done'
})
return True
class crossovered_budget_lines(osv.osv):
- def _prac_amt(self, cr, uid, ids,context={}):
+ def _prac_amt(self, cr, uid, ids, context={}):
res = {}
for line in self.browse(cr, uid, ids):
acc_ids = [x.id for x in line.general_budget_id.account_ids]
date_from = context['wizard_date_from']
if context.has_key('wizard_date_to'):
date_to = context['wizard_date_to']
- cr.execute("select sum(amount) from account_analytic_line where account_id=%s and (date "
- "between to_date(%s,'yyyy-mm-dd') and to_date(%s,'yyyy-mm-dd')) and "
+ cr.execute("SELECT SUM(amount) FROM account_analytic_line WHERE account_id=%s AND (date "
+ "between to_date(%s,'yyyy-mm-dd') AND to_date(%s,'yyyy-mm-dd')) AND "
"general_account_id=ANY(%s)", (line.analytic_account_id.id, date_from, date_to,acc_ids,))
result = cr.fetchone()[0]
if result is None:
def _prac(self, cr, uid, ids, name, args, context):
res={}
for line in self.browse(cr, uid, ids):
- res[line.id]=self._prac_amt(cr, uid, [line.id], context=context)[line.id]
+ res[line.id] = self._prac_amt(cr, uid, [line.id], context=context)[line.id]
return res
- def _theo_amt(self, cr, uid, ids,context={}):
+ def _theo_amt(self, cr, uid, ids, context={}):
res = {}
for line in self.browse(cr, uid, ids):
- today=datetime.datetime.today()
+ today = datetime.datetime.today()
date_to = today.strftime("%Y-%m-%d")
date_from = line.date_from
if context.has_key('wizard_date_from'):
date_to = context['wizard_date_to']
if line.paid_date:
- if strToDate(line.date_to)<=strToDate(line.paid_date):
- theo_amt=0.00
+ if strToDate(line.date_to) <= strToDate(line.paid_date):
+ theo_amt = 0.00
else:
- theo_amt=line.planned_amount
+ theo_amt = line.planned_amount
else:
- total=strToDate(line.date_to) - strToDate(line.date_from)
+ total = strToDate(line.date_to) - strToDate(line.date_from)
elapsed = min(strToDate(line.date_to),strToDate(date_to)) - max(strToDate(line.date_from),strToDate(date_from))
if strToDate(date_to) < strToDate(line.date_from):
elapsed = strToDate(date_to) - strToDate(date_to)
if total.days:
- theo_amt = float(elapsed.days/float(total.days))*line.planned_amount
+ theo_amt = float(elapsed.days / float(total.days)) * line.planned_amount
else:
theo_amt = line.planned_amount
- res[line.id]=theo_amt
+ res[line.id] = theo_amt
return res
def _theo(self, cr, uid, ids, name, args, context):
- res={}
+ res = {}
for line in self.browse(cr, uid, ids):
- res[line.id]=self._theo_amt(cr, uid, [line.id], context=context)[line.id]
-
+ res[line.id] = self._theo_amt(cr, uid, [line.id], context=context)[line.id]
return res
def _perc(self, cr, uid, ids, name, args, context):
res = {}
for line in self.browse(cr, uid, ids):
- if line.theoritical_amount<>0.00:
- res[line.id]=float(line.practical_amount or 0.0 / line.theoritical_amount)*100
+ if line.theoritical_amount <> 0.00:
+ res[line.id] = float(line.practical_amount or 0.0 / line.theoritical_amount) * 100
else:
- res[line.id]=0.00
+ res[line.id] = 0.00
return res
_name = "crossovered.budget.lines"
'date_from': fields.date('Start Date', required=True),
'date_to': fields.date('End Date', required=True),
'paid_date': fields.date('Paid Date'),
- 'planned_amount':fields.float('Planned Amount', required=True, digits=(16,2)),
- 'practical_amount':fields.function(_prac, method=True, string='Practical Amount', type='float', digits=(16,2)),
- 'theoritical_amount':fields.function(_theo, method=True, string='Theoritical Amount', type='float', digits=(16,2)),
- 'percentage':fields.function(_perc, method=True, string='Percentage', type='float'),
+ 'planned_amount': fields.float('Planned Amount', required=True, digits=(16,2)),
+ 'practical_amount': fields.function(_prac, method=True, string='Practical Amount', type='float', digits=(16,2)),
+ 'theoritical_amount': fields.function(_theo, method=True, string='Theoritical Amount', type='float', digits=(16,2)),
+ 'percentage': fields.function(_perc, method=True, string='Percentage', type='float'),
'company_id': fields.related('crossovered_budget_id', 'company_id', type='many2one', relation='res.company', string='Company', store=True, readonly=True)
}
'funct_total': self.funct_total,
'time': time,
})
- self.context=context
-
- def funct(self,object,form,ids={}, done=None, level=1):
+ self.context = context
+ def funct(self, object, form, ids={}, done=None, level=1):
if not ids:
ids = self.ids
if not done:
- done={}
+ done = {}
global tot
- tot={
+ tot = {
'theo':0.00,
'pln':0.00,
'prac':0.00,
'perc':0.00
}
- result=[]
+ result = []
accounts = self.pool.get('account.analytic.account').browse(self.cr, self.uid, [object.id], self.context.copy())
+ c_b_lines_obj = self.pool.get('crossovered.budget.lines')
+ obj_c_budget = self.pool.get('crossovered.budget')
- c_b_lines_obj=self.pool.get('crossovered.budget.lines')
for account_id in accounts:
- res={}
- b_line_ids=[]
-
+ res = {}
+ b_line_ids = []
for line in account_id.crossovered_budget_line:
b_line_ids.append(line.id)
-
if not b_line_ids:
return []
+ d_from = form['date_from']
+ d_to = form['date_to']
- d_from=form['date_from']
- d_to=form['date_to']
-
- self.cr.execute('select distinct(crossovered_budget_id) from crossovered_budget_lines where id =ANY(%s)',(b_line_ids,))
- budget_ids=self.cr.fetchall()
-
- context={'wizard_date_from':d_from,'wizard_date_to':d_to}
- for i in range(0,len(budget_ids)):
+ self.cr.execute('SELECT DISTINCT(crossovered_budget_id) FROM crossovered_budget_lines WHERE id =ANY(%s)',(b_line_ids,))
+ budget_ids = self.cr.fetchall()
- budget_name=self.pool.get('crossovered.budget').browse(self.cr, self.uid,[budget_ids[i][0]])
- res={
+ context = {'wizard_date_from':d_from,'wizard_date_to':d_to}
+ for i in range(0, len(budget_ids)):
+ budget_name = obj_c_budget.browse(self.cr, self.uid, [budget_ids[i][0]])
+ res= {
'b_id':'-1',
'a_id':'-1',
'name':budget_name[0].name,
}
result.append(res)
- line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', b_line_ids),('crossovered_budget_id','=',budget_ids[i][0])])
- line_id =c_b_lines_obj.browse(self.cr,self.uid,line_ids)
- tot_theo=tot_pln=tot_prac=tot_perc=0
+ line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', b_line_ids), ('crossovered_budget_id','=',budget_ids[i][0])])
+ line_id = c_b_lines_obj.browse(self.cr, self.uid, line_ids)
+ tot_theo = tot_pln = tot_prac = tot_perc = 0
- done_budget=[]
+ done_budget = []
for line in line_id:
-
if line.id in b_line_ids:
- theo=pract=0.00
- theo=c_b_lines_obj._theo_amt(self.cr, self.uid, [line.id],context)[line.id]
- pract=c_b_lines_obj._prac_amt(self.cr, self.uid, [line.id],context)[line.id]
-
+ theo = pract = 0.00
+ theo = c_b_lines_obj._theo_amt(self.cr, self.uid, [line.id], context)[line.id]
+ pract = c_b_lines_obj._prac_amt(self.cr, self.uid, [line.id], context)[line.id]
if line.general_budget_id.id in done_budget:
-
for record in result:
- if record['b_id']==line.general_budget_id.id and record['a_id']==line.analytic_account_id.id:
-
- record['theo'] +=theo
- record['pln'] +=line.planned_amount
- record['prac'] +=pract
- record['perc'] +=line.percentage
- tot_theo +=theo
- tot_pln +=line.planned_amount
- tot_prac +=pract
- tot_perc +=line.percentage
+ if record['b_id'] == line.general_budget_id.id and record['a_id'] == line.analytic_account_id.id:
+ record['theo'] += theo
+ record['pln'] += line.planned_amount
+ record['prac'] += pract
+ record['perc'] += line.percentage
+ tot_theo += theo
+ tot_pln += line.planned_amount
+ tot_prac += pract
+ tot_perc += line.percentage
else:
-
- res1={
- 'b_id':line.general_budget_id.id,
- 'a_id':line.analytic_account_id.id,
- 'name':line.general_budget_id.name,
- 'status':2,
- 'theo':theo,
- 'pln':line.planned_amount,
- 'prac':pract,
- 'perc':line.percentage
+ res1 = {
+ 'b_id': line.general_budget_id.id,
+ 'a_id': line.analytic_account_id.id,
+ 'name': line.general_budget_id.name,
+ 'status': 2,
+ 'theo': theo,
+ 'pln': line.planned_amount,
+ 'prac': pract,
+ 'perc': line.percentage
}
-
tot_theo += theo
- tot_pln +=line.planned_amount
- tot_prac +=pract
- tot_perc +=line.percentage
+ tot_pln += line.planned_amount
+ tot_prac += pract
+ tot_perc += line.percentage
result.append(res1)
done_budget.append(line.general_budget_id.id)
else:
continue
else:
res1={
- 'b_id':line.general_budget_id.id,
- 'a_id':line.analytic_account_id.id,
- 'name':line.general_budget_id.name,
- 'status':2,
- 'theo':0.00,
- 'pln':0.00,
- 'prac':0.00,
- 'perc':0.00
+ 'b_id': line.general_budget_id.id,
+ 'a_id': line.analytic_account_id.id,
+ 'name': line.general_budget_id.name,
+ 'status': 2,
+ 'theo': 0.00,
+ 'pln': 0.00,
+ 'prac': 0.00,
+ 'perc': 0.00
}
-
result.append(res1)
done_budget.append(line.general_budget_id.id)
-
- if tot_theo==0.00:
- tot_perc=0.00
+ if tot_theo == 0.00:
+ tot_perc = 0.00
else:
- tot_perc=float(tot_prac /tot_theo)*100
+ tot_perc = float(tot_prac / tot_theo) * 100
- result[-(len(done_budget) +1)]['theo']=tot_theo
+ result[-(len(done_budget) +1)]['theo'] = tot_theo
tot['theo'] +=tot_theo
- result[-(len(done_budget) +1)]['pln']=tot_pln
+ result[-(len(done_budget) +1)]['pln'] = tot_pln
tot['pln'] +=tot_pln
- result[-(len(done_budget) +1)]['prac']=tot_prac
+ result[-(len(done_budget) +1)]['prac'] = tot_prac
tot['prac'] +=tot_prac
- result[-(len(done_budget) +1)]['perc']=tot_perc
-
- if tot['theo']==0.00:
- tot['perc'] =0.00
+ result[-(len(done_budget) +1)]['perc'] = tot_perc
+ if tot['theo'] == 0.00:
+ tot['perc'] = 0.00
else:
- tot['perc']=float(tot['prac'] /tot['theo'])*100
-
+ tot['perc'] = float(tot['prac'] / tot['theo']) * 100
return result
def funct_total(self,form):
- result=[]
- res={}
- res={
- 'tot_theo':tot['theo'],
- 'tot_pln':tot['pln'],
- 'tot_prac':tot['prac'],
- 'tot_perc':tot['perc']
+ result = []
+ res = {}
+ res = {
+ 'tot_theo': tot['theo'],
+ 'tot_pln': tot['pln'],
+ 'tot_prac': tot['prac'],
+ 'tot_perc': tot['perc']
}
result.append(res)
-
return result
report_sxw.report_sxw('report.account.analytic.account.budget', 'account.analytic.account', 'addons/account_budget/report/analytic_account_budget_report.rml',parser=analytic_account_budget_report,header='internal')
def post_total(self, post_obj, date1, date2):
def str2date(date_str):
return datetime.date.fromtimestamp(time.mktime(time.strptime(date_str, '%Y-%m-%d')))
+
def interval(d1str, d2str):
return (str2date(d2str) - str2date(d1str) + datetime.timedelta(days=1)).days
+
prev = reduce(lambda x,d: x + d.amount, post_obj.dotation_ids, 0.0)
period_days = interval(date1, date2)
for d in post_obj.dotation_ids:
i = interval(d.period_id.date_start, d.period_id.date_stop)
total_days = reduce(lambda x,d: x+interval(d.period_id.date_start, d.period_id.date_stop), post_obj.dotation_ids, 0)
achievements = reduce(lambda x,l: x+l['achievements'], self.lines(post_obj, date1, date2), 0.0)
- prev_1=1.00
- if total_days<>0.00:
- prev_1=prev * period_days / total_days
+ prev_1 = 1.00
+ if total_days <> 0.00:
+ prev_1 = prev * period_days / total_days
return [{'prev': prev, 'prev_period': prev_1, 'achievements': achievements}]
def budget_total(self, post_obj, date1, date2):
res.append({'name': a.name, 'code': a.code, 'achievements': achievements})
return res
-report_sxw.report_sxw('report.account.budget', 'account.budget.post', 'addons/account_budget/report/budget_report.rml',parser=budget_report, header="internal")
+report_sxw.report_sxw('report.account.budget', 'account.budget.post', 'addons/account_budget/report/budget_report.rml', parser=budget_report, header="internal")
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
##############################################################################
import time
+import datetime
+
import pooler
from report import report_sxw
-import datetime
import operator
import osv
class budget_report(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(budget_report, self).__init__(cr, uid, name, context=context)
- self.localcontext.update( {
+ self.localcontext.update({
'funct': self.funct,
'funct_total': self.funct_total,
'time': time,
})
- self.context=context
+ self.context = context
def funct(self, object, form, ids={}, done=None, level=1):
-
if not ids:
ids = self.ids
if not done:
- done={}
-
+ done = {}
global tot
- tot={
+ tot = {
'theo':0.00,
'pln':0.00,
'prac':0.00,
'perc':0.00
}
- result=[]
+ result = []
budgets = self.pool.get('crossovered.budget').browse(self.cr, self.uid, [object.id], self.context.copy())
-
- c_b_lines_obj=self.pool.get('crossovered.budget.lines')
+ c_b_lines_obj = self.pool.get('crossovered.budget.lines')
+ acc_analytic_obj = self.pool.get('account.analytic.account')
for budget_id in budgets:
-
- res={}
- budget_lines=[]
- budget_ids=[]
- d_from=form['date_from']
- d_to=form['date_to']
+ res = {}
+ budget_lines = []
+ budget_ids = []
+ d_from = form['date_from']
+ d_to = form['date_to']
for line in budget_id.crossovered_budget_line:
budget_ids.append(line.id)
if not budget_ids:
return []
- self.cr.execute('select distinct(analytic_account_id) from crossovered_budget_lines where id =ANY(%s)',(budget_ids,))
- an_ids=self.cr.fetchall()
-
- context={'wizard_date_from':d_from,'wizard_date_to':d_to}
- for i in range(0,len(an_ids)):
-
- analytic_name=self.pool.get('account.analytic.account').browse(self.cr, self.uid, [an_ids[i][0]])
+ self.cr.execute('SELECT DISTINCT(analytic_account_id) FROM crossovered_budget_lines WHERE id = ANY(%s)',(budget_ids,))
+ an_ids = self.cr.fetchall()
+ context = {'wizard_date_from': d_from, 'wizard_date_to': d_to}
+ for i in range(0, len(an_ids)):
+ analytic_name = acc_analytic_obj.browse(self.cr, self.uid, [an_ids[i][0]])
res={
- 'b_id':'-1',
- 'a_id':'-1',
- 'name':analytic_name[0].name,
- 'status':1,
- 'theo':0.00,
- 'pln':0.00,
- 'prac':0.00,
- 'perc':0.00
+ 'b_id': '-1',
+ 'a_id': '-1',
+ 'name': analytic_name[0].name,
+ 'status': 1,
+ 'theo': 0.00,
+ 'pln': 0.00,
+ 'prac': 0.00,
+ 'perc': 0.00
}
result.append(res)
- line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', budget_ids),('analytic_account_id','=',an_ids[i][0])])
-
+ line_ids = c_b_lines_obj.search(self.cr, self.uid, [('id', 'in', budget_ids), ('analytic_account_id','=',an_ids[i][0])])
line_id = c_b_lines_obj.browse(self.cr, self.uid, line_ids)
- tot_theo=tot_pln=tot_prac=tot_perc=0.00
+ tot_theo = tot_pln = tot_prac = tot_perc = 0.00
- done_budget=[]
+ done_budget = []
for line in line_id:
-
if line.id in budget_ids:
- theo=pract=0.00
- theo=c_b_lines_obj._theo_amt(self.cr, self.uid, [line.id],context)[line.id]
- pract=c_b_lines_obj._prac_amt(self.cr, self.uid, [line.id],context)[line.id]
-
+ theo = pract = 0.00
+ theo = c_b_lines_obj._theo_amt(self.cr, self.uid, [line.id], context)[line.id]
+ pract = c_b_lines_obj._prac_amt(self.cr, self.uid, [line.id], context)[line.id]
if line.general_budget_id.id in done_budget:
-
for record in result:
- if record['b_id']==line.general_budget_id.id and record['a_id']==line.analytic_account_id.id:
-
- record['theo'] +=theo
- record['pln'] +=line.planned_amount
- record['prac'] +=pract
- if record['theo']<>0.00:
- perc=(record['prac']/record['theo'])*100
+ if record['b_id'] == line.general_budget_id.id and record['a_id'] == line.analytic_account_id.id:
+ record['theo'] += theo
+ record['pln'] += line.planned_amount
+ record['prac'] += pract
+ if record['theo'] <> 0.00:
+ perc = (record['prac'] / record['theo']) * 100
else:
- perc=0.00
- record['perc'] =perc
+ perc = 0.00
+ record['perc'] = perc
tot_theo += theo
- tot_pln +=line.planned_amount
- tot_prac +=pract
- tot_perc +=perc
-
+ tot_pln += line.planned_amount
+ tot_prac += pract
+ tot_perc += perc
else:
-
- if theo<>0.00:
- perc=(pract/theo)*100
+ if theo <> 0.00:
+ perc = (pract / theo) * 100
else:
- perc=0.00
- res1={
- 'a_id':line.analytic_account_id.id,
- 'b_id':line.general_budget_id.id,
- 'name':line.general_budget_id.name,
- 'status':2,
- 'theo':theo,
- 'pln':line.planned_amount,
- 'prac':pract,
- 'perc':perc,
+ perc = 0.00
+ res1 = {
+ 'a_id': line.analytic_account_id.id,
+ 'b_id': line.general_budget_id.id,
+ 'name': line.general_budget_id.name,
+ 'status': 2,
+ 'theo': theo,
+ 'pln': line.planned_amount,
+ 'prac': pract,
+ 'perc': perc,
}
tot_theo += theo
- tot_pln +=line.planned_amount
- tot_prac +=pract
- tot_perc +=perc
- if form['report']=='analytic-full':
+ tot_pln += line.planned_amount
+ tot_prac += pract
+ tot_perc += perc
+ if form['report'] == 'analytic-full':
result.append(res1)
done_budget.append(line.general_budget_id.id)
else:
continue
else:
res1={
- 'a_id':line.analytic_account_id.id,
- 'b_id':line.general_budget_id.id,
- 'name':line.general_budget_id.name,
- 'status':2,
- 'theo':0.00,
- 'pln':0.00,
- 'prac':0.00,
- 'perc':0.00
- }
-
- if form['report']=='analytic-full':
+ 'a_id': line.analytic_account_id.id,
+ 'b_id': line.general_budget_id.id,
+ 'name': line.general_budget_id.name,
+ 'status': 2,
+ 'theo': 0.00,
+ 'pln': 0.00,
+ 'prac': 0.00,
+ 'perc': 0.00
+ }
+ if form['report'] == 'analytic-full':
result.append(res1)
done_budget.append(line.general_budget_id.id)
-
- if tot_theo==0.00:
- tot_perc=0.00
+ if tot_theo == 0.00:
+ tot_perc = 0.00
else:
- tot_perc=float(tot_prac /tot_theo)*100
-
- if form['report']=='analytic-full':
-
- result[-(len(done_budget) +1)]['theo']=tot_theo
- tot['theo'] +=tot_theo
- result[-(len(done_budget) +1)]['pln']=tot_pln
- tot['pln'] +=tot_pln
- result[-(len(done_budget) +1)]['prac']=tot_prac
- tot['prac'] +=tot_prac
- result[-(len(done_budget) +1)]['perc']=tot_perc
+ tot_perc = float(tot_prac / tot_theo) * 100
+ if form['report'] == 'analytic-full':
+ result[-(len(done_budget) +1)]['theo'] = tot_theo
+ tot['theo'] += tot_theo
+ result[-(len(done_budget) +1)]['pln'] = tot_pln
+ tot['pln'] += tot_pln
+ result[-(len(done_budget) +1)]['prac'] = tot_prac
+ tot['prac'] += tot_prac
+ result[-(len(done_budget) +1)]['perc'] = tot_perc
else:
- result[-1]['theo']=tot_theo
- tot['theo'] +=tot_theo
- result[-1]['pln']=tot_pln
- tot['pln'] +=tot_pln
- result[-1]['prac']=tot_prac
- tot['prac'] +=tot_prac
- result[-1]['perc']=tot_perc
- if tot['theo']==0.00:
- tot['perc'] =0.00
+ result[-1]['theo'] = tot_theo
+ tot['theo'] += tot_theo
+ result[-1]['pln'] = tot_pln
+ tot['pln'] += tot_pln
+ result[-1]['prac'] = tot_prac
+ tot['prac'] += tot_prac
+ result[-1]['perc'] = tot_perc
+ if tot['theo'] == 0.00:
+ tot['perc'] = 0.00
else:
- tot['perc']=float(tot['prac'] /tot['theo'])*100
+ tot['perc'] = float(tot['prac'] / tot['theo']) * 100
return result
def funct_total(self, form):
- result=[]
- res={}
-
- res={
- 'tot_theo':tot['theo'],
- 'tot_pln':tot['pln'],
- 'tot_prac':tot['prac'],
- 'tot_perc':tot['perc']
+ result = []
+ res = {}
+ res = {
+ 'tot_theo': tot['theo'],
+ 'tot_pln': tot['pln'],
+ 'tot_prac': tot['prac'],
+ 'tot_perc': tot['perc']
}
result.append(res)
-
return result
+
report_sxw.report_sxw('report.crossovered.budget.report', 'crossovered.budget', 'addons/account_budget/report/crossovered_budget_report.rml',parser=budget_report,header='internal')
+
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
_columns = {
'date_from': fields.date('Start of period', required=True),
'date_to': fields.date('End of period', required=True),
- }
+ }
_defaults= {
'date_from': time.strftime('%Y-01-01'),
'date_to': time.strftime('%Y-%m-%d'),
- }
+ }
def check_report(self, cr, uid, ids, context=None):
datas = {}
'ids': context.get('active_ids',[]),
'model': 'account.analytic.account',
'form': data
- }
+ }
return {
'type': 'ir.actions.report.xml',
'report_name': 'account.analytic.account.budget',
'datas': datas,
- }
+ }
account_budget_analytic()
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
-
import time
from osv import fields, osv
_columns = {
'date_from': fields.date('Start of period', required=True),
'date_to': fields.date('End of period', required=True),
- }
+ }
_defaults= {
'date_from': time.strftime('%Y-01-01'),
'date_to': time.strftime('%Y-%m-%d'),
- }
+ }
def check_report(self, cr, uid, ids, context=None):
datas = {}
'ids': context.get('active_ids',[]),
'model': 'crossovered.budget',
'form': data
- }
+ }
datas['form']['report']='analytic-full'
return {
'type': 'ir.actions.report.xml',
'report_name': 'crossovered.budget.report',
'datas': datas,
- }
+ }
account_budget_crossvered_report()
_columns = {
'date_from': fields.date('Start of period', required=True),
'date_to': fields.date('End of period', required=True),
- }
+ }
_defaults= {
'date_from': time.strftime('%Y-01-01'),
'date_to': time.strftime('%Y-%m-%d'),
- }
+ }
def check_report(self, cr, uid, ids, context=None):
datas = {}
'ids': context.get('active_ids',[]),
'model': 'crossovered.budge',
'form': data
- }
- datas['form']['report']='analytic-one'
+ }
+ datas['form']['report'] = 'analytic-one'
return {
'type': 'ir.actions.report.xml',
'report_name': 'crossovered.budget.report',
'datas': datas,
- }
- return {}
+ }
account_budget_crossvered_summary_report()
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
-
import time
from osv import fields, osv
_columns = {
'date1': fields.date('Start of period', required=True),
'date2': fields.date('End of period', required=True),
- }
+ }
_defaults= {
'date1': time.strftime('%Y-01-01'),
'date2': time.strftime('%Y-%m-%d'),
- }
+ }
def check_report(self, cr, uid, ids, context=None):
datas = {}
'ids': context.get('active_ids',[]),
'model': 'account.budget.post',
'form': data
- }
+ }
data_model = self.pool.get(datas['model']).browse(cr, uid, context['active_id'])
if not data_model.dotation_ids:
'type': 'ir.actions.report.xml',
'report_name': 'account.budget',
'datas': datas,
- }
+ }
account_budget_report()
_columns = {
'fiscalyear': fields.many2one('account.fiscalyear', 'Fiscal Year', required=True),
'amount': fields.float('Amount', digits_compute=dp.get_precision('Account')),
- }
+ }
def check_spread(self, cr, uid, ids, context=None):
if context is None:
'period_id':statement.get('period_id',False) or period,# statement.period_id.id
}
voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context)
-
- result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype=(amount < 0 and 'payment' or 'receipt'))
+ context.update({'move_line_ids': rec_id})
+ result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype=(amount < 0 and 'payment' or 'receipt'), context=context)
voucher_line_dict = False
if result['value']['line_ids']:
for line_dict in result['value']['line_ids']:
move_line = line_obj.browse(cr, uid, line_dict['move_line_id'], context)
if line.move_id.id == move_line.move_id.id:
voucher_line_dict = line_dict
-
+
if voucher_line_dict:
voucher_line_dict.update({'voucher_id':voucher_id})
voucher_line_obj.create(cr, uid, voucher_line_dict, context=context)
-
+
# reconcile_id = statement_reconcile_obj.create(cr, uid, {
# 'line_ids': [(6, 0, rec_id)]
# }, context=context)
#
-
+
mv = self.pool.get('account.move.line').browse(cr, uid, rec_id[0], context=context)
if mv.partner_id:
line['partner_id'] = mv.partner_id.id
</record>
<menuitem action="action_account_followup_definition_form" id="account_followup_menu" parent="account.menu_configuration_misc" groups="base.group_system"/>
- <report auto="False" id="account_followup_followup_report" menu="False" model="account_followup.followup" name="account_followup.followup.print" rml="account_followup/report/report_followp_print.rml" string="Followup Report"/>
+ <report auto="False" id="account_followup_followup_report" menu="False" model="account_followup.followup" name="account_followup.followup.print" rml="account_followup/report/account_followup_print.rml" string="Followup Report"/>
<record id="account_move_line_partner_tree" model="ir.ui.view">
<field name="name">account.move.line.partner.tree</field>
#
##############################################################################
-import report_followup_print
+import account_followup_print
import account_followup_report
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
--- /dev/null
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import time
+import ir
+
+import pooler
+from osv import osv
+from report import report_sxw
+
+class report_rappel(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(report_rappel, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update( {
+ 'time': time,
+ 'ids_to_objects': self._ids_to_objects,
+ 'adr_get': self._adr_get,
+ 'getLines': self._lines_get,
+ 'get_text': self._get_text
+ })
+
+ def _ids_to_objects(self, partners_ids):
+ pool = pooler.get_pool(self.cr.dbname)
+ all_partners = []
+ for partner in partners_ids:
+ partners = pool.get('account_followup.stat').browse(self.cr, self.uid, [partner])
+ for par in partners:
+ all_partners.append(par.name)
+ return all_partners
+
+ def _adr_get(self, partner, type):
+ res_partner = pooler.get_pool(self.cr.dbname).get('res.partner')
+ res_partner_address = pooler.get_pool(self.cr.dbname).get('res.partner.address')
+ adr = res_partner.address_get(self.cr, self.uid, [partner.id], [type])[type]
+ return adr and res_partner_address.read(self.cr, self.uid, [adr]) or [{}]
+
+ def _lines_get(self, partner):
+ moveline_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
+ movelines = moveline_obj.search(self.cr, self.uid,
+ [('partner_id', '=', partner.id),
+ ('account_id.type', '=', 'receivable'),
+ ('reconcile_id', '=', False), ('state', '<>', 'draft')])
+ movelines = moveline_obj.read(self.cr, self.uid, movelines)
+ return movelines
+
+ def _get_text(self, partner, followup_id, context={}):
+ fp_obj = pooler.get_pool(self.cr.dbname).get('account_followup.followup')
+ fp_line = fp_obj.browse(self.cr, self.uid, followup_id).followup_line
+ li_delay = []
+ for line in fp_line:
+ li_delay.append(line.delay)
+ li_delay.sort(reverse=True)
+ text = ""
+ a = {}
+ partner_line = pooler.get_pool(self.cr.dbname).get('account.move.line').search(self.cr, self.uid, [('partner_id','=',partner.id),('reconcile_id','=',False)])
+ partner_delay = []
+ context={}
+ context.update({'lang': partner.lang})
+ for i in pooler.get_pool(self.cr.dbname).get('account.move.line').browse(self.cr, self.uid, partner_line, context):
+ for delay in li_delay:
+ if i.followup_line_id and str(i.followup_line_id.delay)==str(delay):
+ text = i.followup_line_id.description
+ a[delay] = text
+ partner_delay.append(delay)
+ text = partner_delay and a[max(partner_delay)] or ''
+ if text:
+ text = text % {
+ 'partner_name': partner.name,
+ 'date': time.strftime('%Y-%m-%d'),
+ 'company_name': fp_obj.browse(self.cr, self.uid, followup_id).company_id.name,
+ 'user_signature': pooler.get_pool(self.cr.dbname).get('res.users').browse(self.cr, self.uid, self.uid, context).signature,
+ }
+
+ return text
+
+report_sxw.report_sxw('report.account_followup.followup.print',
+ 'res.partner', 'addons/account_followup/report/account_followup_print.rml',
+ parser=report_rappel)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
--- /dev/null
+<?xml version="1.0"?>
+<document filename="test.pdf">
+ <template pageSize="(595.0,842.0)" title="Follow UP" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
+ <pageTemplate id="first">
+ <frame id="first" x1="42.0" y1="28.0" width="511" height="786"/>
+ </pageTemplate>
+ </template>
+ <stylesheet>
+ <blockTableStyle id="Standard_Outline">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Tableau2">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table1">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="7,-1" stop="7,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#000000" start="8,-1" stop="8,-1"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table5">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="7,-1" stop="7,-1"/>
+ <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="8,-1" stop="8,-1"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table2">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
+ <lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
+ <lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/>
+ <lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0"/>
+ <lineStyle kind="LINEABOVE" colorName="#000000" start="1,1" stop="1,1"/>
+ <lineStyle kind="LINEABOVE" colorName="#000000" start="2,1" stop="2,1"/>
+ <lineStyle kind="LINEABOVE" colorName="#000000" start="3,1" stop="3,1"/>
+ <lineStyle kind="LINEABOVE" colorName="#000000" start="4,1" stop="4,1"/>
+ <lineStyle kind="LINEABOVE" colorName="#000000" start="5,1" stop="5,1"/>
+ </blockTableStyle>
+ <initialize>
+ <paraStyle name="all" alignment="justify"/>
+ </initialize>
+ <paraStyle name="Standard" fontName="Helvetica"/>
+ <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Table Contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Caption" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="Index" fontName="Helvetica"/>
+ <paraStyle name="Heading" fontName="Helvetica" fontSize="15.0" leading="19" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Footer" fontName="Helvetica"/>
+ <paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
+ <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_9_followup_id" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <images/>
+ </stylesheet>
+ <story>
+ <para style="terp_default_8">[[ repeatIn(ids_to_objects(data['form']['partner_ids']),'o') ]] </para>
+ <para style="terp_default_8">[[ setLang(o.lang) ]]</para>
+ <blockTable colWidths="286.0,224.0" style="Tableau2">
+ <tr>
+ <td>
+ <para style="terp_default_9">[[ repeatIn(adr_get(o,'invoice'),'a' )]]</para>
+ </td>
+ <td>
+ <para style="terp_default_9">[[ o.name ]]</para>
+ <para style="terp_default_9">[[ a['street'] ]]</para>
+ <para style="terp_default_9">[[ a['street2'] or removeParentNode('para') ]]</para>
+ <para style="terp_default_9">[[ a['zip'] ]] [[ a['city'] ]]</para>
+ <para style="terp_default_9">[[( a['state_id'] and a['state_id'][1]) or removeParentNode('para') ]]</para>
+ <para style="terp_default_9">[[( a['country_id'] and a['country_id'][1]) or '']]</para>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ <para style="terp_default_9">VAT: [[ o.vat or removeParentNode('para') ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_8">
+ <font color="white"> </font>
+ </para>
+ <para style="terp_default_9">Document : Customer account statement</para>
+ <para style="terp_default_9">Date : [[ formatLang(time.strftime('%Y-%m-%d'),date = True) ]]</para>
+ <para style="terp_default_9">Customer Ref : [[ o.ref or '' ]]</para>
+ <para style="terp_default_8">
+ <font color="white"> </font>
+ </para>
+ <para style="terp_default_9_followup_id">[[ format(get_text(o,data['form']['followup_id'])) ]]</para>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="68.0,78.0,45.0,70.0,51.0,58.0,62.0,61.0,27.0" style="Table1">
+ <tr>
+ <td>
+ <para style="terp_tblheader_Details_Centre">Invoice Date</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details">Description</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Centre">Ref</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Centre">Maturity Date</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Right">Currency</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Right">Due</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Right">Paid</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Right">Maturity</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Centre">Li.</para>
+ </td>
+ </tr>
+ </blockTable>
+ <section>
+ <para style="terp_default_8">[[repeatIn(getLines(o), 'line') ]]</para>
+ <blockTable colWidths="68.0,79.0,44.0,69.0,49.0,62.0,61.0,60.0,26.0" style="Table5">
+ <tr>
+ <td>
+ <para style="terp_default_9">[[ formatLang(line['date'],date = True) ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_9">[[ line['name'] ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Centre_9">[[ line['ref'] ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Centre_9">[[ line['date_maturity'] and formatLang(line['date_maturity'], date=True) ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">[[ formatLang(line['amount_currency'] )]] [[ line['amount_currency'] and line['currency_id'][1] or '' ]] </para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">[[ formatLang(line['debit']) ]] </para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">[[ formatLang(line['credit']) ]] </para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">[[ (line['date_maturity'] < time.strftime('%Y-%m-%d')) and formatLang(line['debit'] -line['credit']) or formatLang(0.0) ]] [[ company.currency_id.symbol ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Centre_9">[[ line['blocked'] and 'X' or '' ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ </section>
+ <blockTable colWidths="191.0,108.0,73.0,61.0,60.0,26.0" style="Table2">
+ <tr>
+ <td>
+ <para style="terp_default_8">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details">Sub-Total: </para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">[[formatLang(reduce(lambda x,y: x+y['debit'], getLines(o), 0.00)) ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">[[formatLang(reduce(lambda x,y: x+y['credit'], getLines(o), 0.00)) ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">[[ formatLang(reduce(lambda x,y: x+(y['debit'] - y['credit']), filter(lambda x: x['date_maturity'] < time.strftime('%Y-%m-%d'), getLines(o)), 0)) ]] [[ company.currency_id.symbol ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_8">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details">Balance: </para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">[[ formatLang((reduce(lambda x,y: x+(y['debit'] - y['credit']), getLines(o), 0.00))) ]] [[ company.currency_id.symbol]] </para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="Standard">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="Standard">
+ <font color="white"> </font>
+ </para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_8">
+ <font color="white"> </font>
+ </para>
+ </story>
+</document>
\ No newline at end of file
+++ /dev/null
-<?xml version="1.0"?>
-<document filename="test.pdf">
- <template pageSize="(595.0,842.0)" title="Follow UP" author="OpenERP S.A. (sales@openerp.com)" allowSplitting="20">
- <pageTemplate id="first">
- <frame id="first" x1="42.0" y1="28.0" width="511" height="786"/>
- </pageTemplate>
- </template>
- <stylesheet>
- <blockTableStyle id="Standard_Outline">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Tableau2">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Table1">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- <lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
- <lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
- <lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
- <lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
- <lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
- <lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
- <lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/>
- <lineStyle kind="LINEBELOW" colorName="#000000" start="7,-1" stop="7,-1"/>
- <lineStyle kind="LINEBELOW" colorName="#000000" start="8,-1" stop="8,-1"/>
- </blockTableStyle>
- <blockTableStyle id="Table5">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="0,-1" stop="0,-1"/>
- <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="1,-1" stop="1,-1"/>
- <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="2,-1" stop="2,-1"/>
- <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="3,-1" stop="3,-1"/>
- <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="4,-1" stop="4,-1"/>
- <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="5,-1" stop="5,-1"/>
- <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="6,-1" stop="6,-1"/>
- <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="7,-1" stop="7,-1"/>
- <lineStyle kind="LINEBELOW" colorName="#e6e6e6" start="8,-1" stop="8,-1"/>
- </blockTableStyle>
- <blockTableStyle id="Table2">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- <lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
- <lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
- <lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
- <lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/>
- <lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0"/>
- <lineStyle kind="LINEABOVE" colorName="#000000" start="1,1" stop="1,1"/>
- <lineStyle kind="LINEABOVE" colorName="#000000" start="2,1" stop="2,1"/>
- <lineStyle kind="LINEABOVE" colorName="#000000" start="3,1" stop="3,1"/>
- <lineStyle kind="LINEABOVE" colorName="#000000" start="4,1" stop="4,1"/>
- <lineStyle kind="LINEABOVE" colorName="#000000" start="5,1" stop="5,1"/>
- </blockTableStyle>
- <initialize>
- <paraStyle name="all" alignment="justify"/>
- </initialize>
- <paraStyle name="Standard" fontName="Helvetica"/>
- <paraStyle name="Text body" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="List" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Table Contents" fontName="Helvetica" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Table Heading" fontName="Helvetica" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Caption" fontName="Helvetica" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
- <paraStyle name="Index" fontName="Helvetica"/>
- <paraStyle name="Heading" fontName="Helvetica" fontSize="15.0" leading="19" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="Footer" fontName="Helvetica"/>
- <paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="14.0"/>
- <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
- <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
- <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
- <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
- <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="6.0" spaceAfter="6.0"/>
- <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="6.0" spaceAfter="6.0"/>
- <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="15.0" leading="19" alignment="CENTER" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_9_followup_id" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <images/>
- </stylesheet>
- <story>
- <para style="terp_default_8">[[ repeatIn(ids_to_objects(data['form']['partner_ids']),'o') ]] </para>
- <para style="terp_default_8">[[ setLang(o.lang) ]]</para>
- <blockTable colWidths="286.0,224.0" style="Tableau2">
- <tr>
- <td>
- <para style="terp_default_9">[[ repeatIn(adr_get(o,'invoice'),'a' )]]</para>
- </td>
- <td>
- <para style="terp_default_9">[[ o.name ]]</para>
- <para style="terp_default_9">[[ a['street'] ]]</para>
- <para style="terp_default_9">[[ a['street2'] or removeParentNode('para') ]]</para>
- <para style="terp_default_9">[[ a['zip'] ]] [[ a['city'] ]]</para>
- <para style="terp_default_9">[[( a['state_id'] and a['state_id'][1]) or removeParentNode('para') ]]</para>
- <para style="terp_default_9">[[( a['country_id'] and a['country_id'][1]) or '']]</para>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- <para style="terp_default_9">VAT: [[ o.vat or removeParentNode('para') ]]</para>
- </td>
- </tr>
- </blockTable>
- <para style="terp_default_8">
- <font color="white"> </font>
- </para>
- <para style="terp_default_9">Document : Customer account statement</para>
- <para style="terp_default_9">Date : [[ formatLang(time.strftime('%Y-%m-%d'),date = True) ]]</para>
- <para style="terp_default_9">Customer Ref : [[ o.ref or '' ]]</para>
- <para style="terp_default_8">
- <font color="white"> </font>
- </para>
- <para style="terp_default_9_followup_id">[[ format(get_text(o,data['form']['followup_id'])) ]]</para>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- <blockTable colWidths="68.0,78.0,45.0,70.0,51.0,58.0,62.0,61.0,27.0" style="Table1">
- <tr>
- <td>
- <para style="terp_tblheader_Details_Centre">Invoice Date</para>
- </td>
- <td>
- <para style="terp_tblheader_Details">Description</para>
- </td>
- <td>
- <para style="terp_tblheader_Details_Centre">Ref</para>
- </td>
- <td>
- <para style="terp_tblheader_Details_Centre">Maturity Date</para>
- </td>
- <td>
- <para style="terp_tblheader_Details_Right">Currency</para>
- </td>
- <td>
- <para style="terp_tblheader_Details_Right">Due</para>
- </td>
- <td>
- <para style="terp_tblheader_Details_Right">Paid</para>
- </td>
- <td>
- <para style="terp_tblheader_Details_Right">Maturity</para>
- </td>
- <td>
- <para style="terp_tblheader_Details_Centre">Li.</para>
- </td>
- </tr>
- </blockTable>
- <section>
- <para style="terp_default_8">[[repeatIn(getLines(o), 'line') ]]</para>
- <blockTable colWidths="68.0,79.0,44.0,69.0,49.0,62.0,61.0,60.0,26.0" style="Table5">
- <tr>
- <td>
- <para style="terp_default_9">[[ formatLang(line['date'],date = True) ]]</para>
- </td>
- <td>
- <para style="terp_default_9">[[ line['name'] ]]</para>
- </td>
- <td>
- <para style="terp_default_Centre_9">[[ line['ref'] ]]</para>
- </td>
- <td>
- <para style="terp_default_Centre_9">[[ line['date_maturity'] and formatLang(line['date_maturity'], date=True) ]]</para>
- </td>
- <td>
- <para style="terp_default_Right_9">[[ formatLang(line['amount_currency'] )]] [[ line['amount_currency'] and line['currency_id'][1] or '' ]] </para>
- </td>
- <td>
- <para style="terp_default_Right_9">[[ formatLang(line['debit']) ]] </para>
- </td>
- <td>
- <para style="terp_default_Right_9">[[ formatLang(line['credit']) ]] </para>
- </td>
- <td>
- <para style="terp_default_Right_9">[[ (line['date_maturity'] < time.strftime('%Y-%m-%d')) and formatLang(line['debit'] -line['credit']) or formatLang(0.0) ]] [[ company.currency_id.symbol ]]</para>
- </td>
- <td>
- <para style="terp_default_Centre_9">[[ line['blocked'] and 'X' or '' ]]</para>
- </td>
- </tr>
- </blockTable>
- </section>
- <blockTable colWidths="191.0,108.0,73.0,61.0,60.0,26.0" style="Table2">
- <tr>
- <td>
- <para style="terp_default_8">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_tblheader_Details">Sub-Total: </para>
- </td>
- <td>
- <para style="terp_default_Right_9">[[formatLang(reduce(lambda x,y: x+y['debit'], getLines(o), 0.00)) ]]</para>
- </td>
- <td>
- <para style="terp_default_Right_9">[[formatLang(reduce(lambda x,y: x+y['credit'], getLines(o), 0.00)) ]]</para>
- </td>
- <td>
- <para style="terp_default_Right_9">[[ formatLang(reduce(lambda x,y: x+(y['debit'] - y['credit']), filter(lambda x: x['date_maturity'] < time.strftime('%Y-%m-%d'), getLines(o)), 0)) ]] [[ company.currency_id.symbol ]]</para>
- </td>
- <td>
- <para style="terp_default_Right_9">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="terp_default_8">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_tblheader_Details">Balance: </para>
- </td>
- <td>
- <para style="terp_default_Right_9">[[ formatLang((reduce(lambda x,y: x+(y['debit'] - y['credit']), getLines(o), 0.00))) ]] [[ company.currency_id.symbol]] </para>
- </td>
- <td>
- <para style="terp_default_Right_9">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="Standard">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- </blockTable>
- <para style="terp_default_8">
- <font color="white"> </font>
- </para>
- </story>
-</document>
\ No newline at end of file
+++ /dev/null
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-import time
-import ir
-
-import pooler
-from osv import osv
-from report import report_sxw
-
-class report_rappel(report_sxw.rml_parse):
- def __init__(self, cr, uid, name, context):
- super(report_rappel, self).__init__(cr, uid, name, context=context)
- self.localcontext.update( {
- 'time': time,
- 'ids_to_objects': self._ids_to_objects,
- 'adr_get': self._adr_get,
- 'getLines': self._lines_get,
- 'get_text': self._get_text
- })
-
- def _ids_to_objects(self, partners_ids):
- pool = pooler.get_pool(self.cr.dbname)
- all_partners = []
- for partner in partners_ids:
- partners = pool.get('account_followup.stat').browse(self.cr, self.uid, [partner])
- for par in partners:
- all_partners.append(par.name)
- return all_partners
-
- def _adr_get(self, partner, type):
- res_partner = pooler.get_pool(self.cr.dbname).get('res.partner')
- res_partner_address = pooler.get_pool(self.cr.dbname).get('res.partner.address')
- adr = res_partner.address_get(self.cr, self.uid, [partner.id], [type])[type]
- return adr and res_partner_address.read(self.cr, self.uid, [adr]) or [{}]
-
- def _lines_get(self, partner):
- moveline_obj = pooler.get_pool(self.cr.dbname).get('account.move.line')
- movelines = moveline_obj.search(self.cr, self.uid,
- [('partner_id', '=', partner.id),
- ('account_id.type', '=', 'receivable'),
- ('reconcile_id', '=', False), ('state', '<>', 'draft')])
- movelines = moveline_obj.read(self.cr, self.uid, movelines)
- return movelines
-
- def _get_text(self, partner, followup_id, context={}):
- fp_obj = pooler.get_pool(self.cr.dbname).get('account_followup.followup')
- fp_line = fp_obj.browse(self.cr, self.uid, followup_id).followup_line
- li_delay = []
- for line in fp_line:
- li_delay.append(line.delay)
- li_delay.sort(reverse=True)
- text = ""
- a = {}
- partner_line = pooler.get_pool(self.cr.dbname).get('account.move.line').search(self.cr, self.uid, [('partner_id','=',partner.id),('reconcile_id','=',False)])
- partner_delay = []
- context={}
- context.update({'lang': partner.lang})
- for i in pooler.get_pool(self.cr.dbname).get('account.move.line').browse(self.cr, self.uid, partner_line, context):
- for delay in li_delay:
- if i.followup_line_id and str(i.followup_line_id.delay)==str(delay):
- text = i.followup_line_id.description
- a[delay] = text
- partner_delay.append(delay)
- text = partner_delay and a[max(partner_delay)] or ''
- if text:
- text = text % {
- 'partner_name': partner.name,
- 'date': time.strftime('%Y-%m-%d'),
- 'company_name': fp_obj.browse(self.cr, self.uid, followup_id).company_id.name,
- 'user_signature': pooler.get_pool(self.cr.dbname).get('res.users').browse(self.cr, self.uid, self.uid, context).signature,
- }
-
- return text
-
-report_sxw.report_sxw('report.account_followup.followup.print',
- 'res.partner', 'addons/account_followup/report/report_followp_print.rml',
- parser=report_rappel)
-
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
'period_id': statement.period_id.id
}
voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context)
- result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype='payment')
+ context.update({'move_line_ids': [line.move_line_id.id]})
+ result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype='payment', context=context)
voucher_line_dict = False
if result['value']['line_ids']:
for line_dict in result['value']['line_ids']:
#
##############################################################################
-import voucher
+import account_voucher
import report
import wizard
"update_xml" : [
"security/ir.model.access.csv",
- "voucher_sequence.xml",
- "voucher_workflow.xml",
- "voucher_report.xml",
+ "account_voucher_sequence.xml",
+ "account_voucher_workflow.xml",
+ "account_voucher_report.xml",
"wizard/account_voucher_unreconcile_view.xml",
"wizard/account_statement_from_invoice_view.xml",
- "voucher_view.xml",
+ "account_voucher_view.xml",
"voucher_payment_receipt_view.xml",
"voucher_sales_purchase_view.xml",
- "voucher_wizard.xml",
+ "account_voucher_wizard.xml",
"security/account_voucher_security.xml"
],
"test" : [
# "test/account_voucher.yml",
"test/sales_receipt.yml",
"test/sales_payment.yml",
- "test/account_voucher_report.yml"
+ "test/account_voucher_report.yml"
],
'certificate': '0037580727101',
"active": False,
--- /dev/null
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import time
+from lxml import etree
+
+import netsvc
+from osv import fields
+from osv import osv
+from tools.translate import _
+
+class account_move_line(osv.osv):
+ _inherit = 'account.move.line'
+ def _unreconciled(self, cr, uid, ids, prop, unknow_none, context):
+ res={}
+ for line in self.browse(cr, uid, ids, context=context):
+ res[line.id] = line.debit - line.credit
+ if line.reconcile_partial_id:
+ res[line.id] = 0
+ for partial in line.reconcile_partial_id.line_partial_ids:
+ res[line.id] += partial.debit - partial.credit
+ res[line.id] = abs(res[line.id])
+ return res
+
+ _columns = {
+ 'amount_unreconciled': fields.function(_unreconciled, method=True, string='Unreconciled Amount'),
+ }
+account_move_line()
+
+class account_voucher(osv.osv):
+ def _get_type(self, cr, uid, ids, context={}):
+ return context.get('type', False)
+
+ def _get_period(self, cr, uid, context={}):
+ if context.get('period_id', False):
+ return context.get('period_id')
+ periods = self.pool.get('account.period').find(cr, uid)
+ return periods and periods[0] or False
+
+ def _get_journal(self, cr, uid, context={}):
+ journal_pool = self.pool.get('account.journal')
+ if context.get('journal_id', False):
+ return context.get('journal_id')
+ if not context.get('journal_id', False) and context.get('search_default_journal_id', False):
+ return context.get('search_default_journal_id')
+
+ ttype = context.get('type', 'bank')
+ if ttype in ('payment', 'receipt'):
+ ttype = 'bank'
+ res = journal_pool.search(cr, uid, [('type', '=', ttype)], limit=1)
+ return res and res[0] or False
+
+ def _get_tax(self, cr, uid, context={}):
+ journal_pool = self.pool.get('account.journal')
+ journal_id = context.get('journal_id', False)
+ if not journal_id:
+ ttype = context.get('type', 'bank')
+ res = journal_pool.search(cr, uid, [('type', '=', ttype)], limit=1)
+ if not res:
+ return False
+ journal_id = res[0]
+
+ if not journal_id:
+ return False
+ journal = journal_pool.browse(cr, uid, journal_id)
+ account_id = journal.default_credit_account_id or journal.default_debit_account_id
+ if account_id and account_id.tax_ids:
+ tax_id = account_id.tax_ids[0].id
+ return tax_id
+ return False
+
+ def _get_currency(self, cr, uid, context):
+ journal_pool = self.pool.get('account.journal')
+ journal_id = context.get('journal_id', False)
+ if journal_id:
+ journal = journal_pool.browse(cr, uid, journal_id)
+ currency_id = journal.company_id.currency_id.id
+ if journal.currency:
+ currency_id = journal.currency.id
+ return False
+
+ def _get_partner(self, cr, uid, context={}):
+ return context.get('partner_id', False)
+
+ def _get_reference(self, cr, uid, context={}):
+ return context.get('reference', False)
+
+ def _get_narration(self, cr, uid, context={}):
+ return context.get('narration', False)
+
+ def name_get(self, cr, uid, ids, context=None):
+ if not len(ids):
+ return []
+ return [(r['id'], (str("%.2f" % r['amount']) or '')) for r in self.read(cr, uid, ids, ['amount'], context, load='_classic_write')]
+
+ def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
+ res = super(account_voucher,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
+ doc = etree.XML(res['arch'])
+ nodes = doc.xpath("//field[@name='partner_id']")
+ if context.get('type', 'sale') in ('purchase', 'payment'):
+ for node in nodes:
+ node.set('domain', "[('supplier', '=', True)]")
+ res['arch'] = etree.tostring(doc)
+ return res
+
+ _name = 'account.voucher'
+ _description = 'Accounting Voucher'
+ _order = "date desc, id desc"
+# _rec_name = 'number'
+ _columns = {
+ 'type':fields.selection([
+ ('sale','Sale'),
+ ('purchase','Purchase'),
+ ('payment','Payment'),
+ ('receipt','Receipt'),
+ ],'Default Type', readonly=True, states={'draft':[('readonly',False)]}),
+ 'name':fields.char('Memo', size=256, readonly=True, states={'draft':[('readonly',False)]}),
+ 'date':fields.date('Date', readonly=True, states={'draft':[('readonly',False)]}, help="Effective date for accounting entries"),
+ 'journal_id':fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)]}),
+ 'account_id':fields.many2one('account.account', 'Account', required=True, readonly=True, states={'draft':[('readonly',False)]}),
+ 'line_ids':fields.one2many('account.voucher.line','voucher_id','Voucher Lines', readonly=True, states={'draft':[('readonly',False)]}),
+ 'line_cr_ids':fields.one2many('account.voucher.line','voucher_id','Credits',
+ domain=[('type','=','cr')], context={'default_type':'cr'}, readonly=True, states={'draft':[('readonly',False)]}),
+ 'line_dr_ids':fields.one2many('account.voucher.line','voucher_id','Debits',
+ domain=[('type','=','dr')], context={'default_type':'dr'}, readonly=True, states={'draft':[('readonly',False)]}),
+ 'period_id': fields.many2one('account.period', 'Period', required=True, readonly=True, states={'draft':[('readonly',False)]}),
+ 'narration':fields.text('Notes', readonly=True, states={'draft':[('readonly',False)]}),
+ 'currency_id':fields.many2one('res.currency', 'Currency', readonly=True, states={'draft':[('readonly',False)]}),
+# 'currency_id': fields.related('journal_id','currency', type='many2one', relation='res.currency', string='Currency', store=True, readonly=True, states={'draft':[('readonly',False)]}),
+ 'company_id': fields.many2one('res.company', 'Company', required=True, readonly=True, states={'draft':[('readonly',False)]}),
+ 'state':fields.selection(
+ [('draft','Draft'),
+ ('proforma','Pro-forma'),
+ ('posted','Posted'),
+ ('cancel','Cancelled')
+ ], 'State', readonly=True, size=32,
+ help=' * The \'Draft\' state is used when a user is encoding a new and unconfirmed Voucher. \
+ \n* The \'Pro-forma\' when voucher is in Pro-forma state,voucher does not have an voucher number. \
+ \n* The \'Posted\' state is used when user create voucher,a voucher number is generated and voucher entries are created in account \
+ \n* The \'Cancelled\' state is used when user cancel voucher.'),
+ 'amount': fields.float('Total', digits=(16, 2), required=True, readonly=True, states={'draft':[('readonly',False)]}),
+ 'tax_amount':fields.float('Tax Amount', digits=(14,2), readonly=True, states={'draft':[('readonly',False)]}),
+ 'reference': fields.char('Ref #', size=64, readonly=True, states={'draft':[('readonly',False)]}, help="Transaction reference number."),
+ 'number': fields.char('Number', size=32, readonly=True,),
+ 'move_id':fields.many2one('account.move', 'Account Entry'),
+ 'move_ids': fields.related('move_id','line_id', type='one2many', relation='account.move.line', string='Journal Items', readonly=True),
+ 'partner_id':fields.many2one('res.partner', 'Partner', change_default=1, readonly=True, states={'draft':[('readonly',False)]}),
+ 'audit': fields.related('move_id','to_check', type='boolean', relation='account.move', string='Audit Complete ?'),
+ 'pay_now':fields.selection([
+ ('pay_now','Pay Directly'),
+ ('pay_later','Pay Later or Group Funds'),
+ ],'Payment', select=True, readonly=True, states={'draft':[('readonly',False)]}),
+ 'tax_id':fields.many2one('account.tax', 'Tax', readonly=True, states={'draft':[('readonly',False)]}),
+ 'pre_line':fields.boolean('Previous Payments ?', required=False),
+ 'date_due': fields.date('Due Date', readonly=True, states={'draft':[('readonly',False)]}),
+ }
+ _defaults = {
+ 'period_id': _get_period,
+ 'partner_id': _get_partner,
+ 'journal_id':_get_journal,
+ 'currency_id': _get_currency,
+ 'reference': _get_reference,
+ 'narration':_get_narration,
+ 'type':_get_type,
+ 'state': 'draft',
+ 'pay_now': 'pay_later',
+ 'name': '',
+ 'date' : time.strftime('%Y-%m-%d'),
+ 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.voucher',context=c),
+ 'tax_id': _get_tax,
+ }
+
+ def compute_tax(self, cr, uid, ids, context={}):
+ tax_pool = self.pool.get('account.tax')
+ partner_pool = self.pool.get('res.partner')
+ position_pool = self.pool.get('account.fiscal.position')
+ voucher_line_pool = self.pool.get('account.voucher.line')
+ voucher_pool = self.pool.get('account.voucher')
+
+ for voucher in voucher_pool.browse(cr, uid, ids, context):
+ voucher_amount = 0.0
+ for line in voucher.line_ids:
+ voucher_amount += line.untax_amount or line.amount
+ line.amount = line.untax_amount or line.amount
+ voucher_line_pool.write(cr, uid, [line.id], {'amount':line.amount, 'untax_amount':line.untax_amount})
+
+ if not voucher.tax_id:
+ self.write(cr, uid, [voucher.id], {'amount':voucher_amount, 'tax_amount':0.0})
+ continue
+
+ tax = [tax_pool.browse(cr, uid, voucher.tax_id.id)]
+ partner = partner_pool.browse(cr, uid, voucher.partner_id.id) or False
+ taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)
+ tax = tax_pool.browse(cr, uid, taxes)
+
+ total = voucher_amount
+ total_tax = 0.0
+
+ if not tax[0].price_include:
+ for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_amount, 1).get('taxes',[]):
+ total_tax += tax_line.get('amount')
+ total += total_tax
+ else:
+ line_ids2 = []
+ for line in voucher.line_ids:
+ line_total = 0.0
+ line_tax = 0.0
+
+ for tax_line in tax_pool.compute_all(cr, uid, tax, line.untax_amount or line.amount, 1).get('taxes',[]):
+ line_tax += tax_line.get('amount')
+ line_total += tax_line.get('price_unit')
+ total_tax += line_tax
+ untax_amount = line.untax_amount or line.amount
+ voucher_line_pool.write(cr, uid, [line.id], {'amount':line_total, 'untax_amount':untax_amount})
+
+ self.write(cr, uid, [voucher.id], {'amount':total, 'tax_amount':total_tax})
+ return True
+
+ def onchange_price(self, cr, uid, ids, line_ids, tax_id, partner_id=False, context={}):
+ tax_pool = self.pool.get('account.tax')
+ partner_pool = self.pool.get('res.partner')
+ position_pool = self.pool.get('account.fiscal.position')
+ voucher_line_pool = self.pool.get('account.voucher.line')
+ res = {
+ 'tax_amount':False,
+ 'amount':False,
+ }
+ voucher_total_tax = 0.0
+ voucher_total = 0.0
+ voucher_line_ids = []
+
+ total = 0.0
+ total_tax = 0.0
+
+ for line in line_ids:
+ line_amount = 0.0
+ line_amount = line[2].get('amount')
+ voucher_line_ids += [line[1]]
+ voucher_total += line_amount
+
+ total = voucher_total
+ total_tax = 0.0
+ if tax_id:
+ tax = [tax_pool.browse(cr, uid, tax_id)]
+ if partner_id:
+ partner = partner_pool.browse(cr, uid, partner_id) or False
+ taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)
+ tax = tax_pool.browse(cr, uid, taxes)
+
+ if not tax[0].price_include:
+ for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_total, 1).get('taxes',[]):
+ total_tax += tax_line.get('amount')
+ total += total_tax
+
+ res.update({
+ 'amount':total or voucher_total,
+ 'tax_amount':total_tax
+ })
+ return {
+ 'value':res
+ }
+
+ def onchange_term_id(self, cr, uid, ids, term_id, amount):
+ term_pool = self.pool.get('account.payment.term')
+ terms = False
+ due_date = False
+ default = {'date_due':False}
+ if term_id and amount:
+ terms = term_pool.compute(cr, uid, term_id, amount)
+ if terms:
+ due_date = terms[-1][0]
+ default.update({
+ 'date_due':due_date
+ })
+ return {'value':default}
+
+ def onchange_journal_voucher(self, cr, uid, ids, line_ids=False, tax_id=False, price=0.0, partner_id=False, journal_id=False, ttype=False, context={}):
+ """price
+ Returns a dict that contains new values and context
+
+ @param partner_id: latest value from user input for field partner_id
+ @param args: other arguments
+ @param context: context arguments, like lang, time zone
+
+ @return: Returns a dict which contains new values, and context
+ """
+ default = {
+ 'value':{},
+ }
+
+ if not partner_id or not journal_id:
+ return default
+
+ partner_pool = self.pool.get('res.partner')
+ journal_pool = self.pool.get('account.journal')
+
+ journal = journal_pool.browse(cr, uid, journal_id)
+ partner = partner_pool.browse(cr, uid, partner_id)
+ account_id = False
+ tr_type = False
+ if journal.type in ('sale','sale_refund'):
+ account_id = partner.property_account_receivable.id
+ tr_type = 'sale'
+ elif journal.type in ('purchase', 'purchase_refund','expense'):
+ account_id = partner.property_account_payable.id
+ tr_type = 'purchase'
+ else:
+ account_id = journal.default_credit_account_id.id or journal.default_debit_account_id.id
+ tr_type = 'receipt'
+
+ default['value']['account_id'] = account_id
+ default['value']['type'] = ttype or tr_type
+
+ vals = self.onchange_journal(cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context)
+ default['value'].update(vals.get('value'))
+
+ return default
+
+ def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, context={}):
+ """price
+ Returns a dict that contains new values and context
+
+ @param partner_id: latest value from user input for field partner_id
+ @param args: other arguments
+ @param context: context arguments, like lang, time zone
+
+ @return: Returns a dict which contains new values, and context
+ """
+ if not journal_id:
+ return {}
+
+ currency_pool = self.pool.get('res.currency')
+ move_pool = self.pool.get('account.move')
+ line_pool = self.pool.get('account.voucher.line')
+ move_line_pool = self.pool.get('account.move.line')
+ partner_pool = self.pool.get('res.partner')
+ journal_pool = self.pool.get('account.journal')
+
+ vals = self.onchange_journal(cr, uid, ids, journal_id, [], False, partner_id, context)
+ vals = vals.get('value')
+ currency_id = vals.get('currency_id', currency_id)
+ default = {
+ 'value':{'line_ids':[], 'line_dr_ids':[], 'line_cr_ids':[], 'pre_line': False, 'currency_id':currency_id},
+ }
+
+ if not partner_id:
+ return default
+
+ if not partner_id and ids:
+ line_ids = line_pool.search(cr, uid, [('voucher_id','=',ids[0])])
+ if line_ids:
+ line_pool.unlink(cr, uid, line_ids)
+ return default
+
+ journal = journal_pool.browse(cr, uid, journal_id)
+ partner = partner_pool.browse(cr, uid, partner_id)
+ account_id = False
+ if journal.type in ('sale','sale_refund'):
+ account_id = partner.property_account_receivable.id
+ elif journal.type in ('purchase', 'purchase_refund','expense'):
+ account_id = partner.property_account_payable.id
+ else:
+ account_id = journal.default_credit_account_id.id or journal.default_debit_account_id.id
+
+ default['value']['account_id'] = account_id
+ if journal.type not in ('cash', 'bank'):
+ return default
+
+ total_credit = 0.0
+ total_debit = 0.0
+ account_type = 'receivable'
+ if ttype == 'payment':
+ account_type = 'payable'
+ total_debit = price or 0.0
+ else:
+ total_credit = price or 0.0
+ account_type = 'receivable'
+
+ if not context.get('move_line_ids', False):
+ ids = move_line_pool.search(cr, uid, [('account_id.type','=', account_type), ('reconcile_id','=', False), ('partner_id','=',partner_id)], context=context)
+ else:
+ ids = context['move_line_ids']
+ ids.reverse()
+ moves = move_line_pool.browse(cr, uid, ids)
+
+ company_currency = journal.company_id.currency_id.id
+ if company_currency != currency_id and ttype == 'payment':
+ total_debit = currency_pool.compute(cr, uid, currency_id, company_currency, total_debit)
+ elif company_currency != currency_id and ttype == 'receipt':
+ total_credit = currency_pool.compute(cr, uid, currency_id, company_currency, total_credit)
+
+ for line in moves:
+ if line.credit and line.reconcile_partial_id and ttype == 'receipt':
+ continue
+ if line.debit and line.reconcile_partial_id and ttype == 'payment':
+ continue
+ total_credit += line.credit or 0.0
+ total_debit += line.debit or 0.0
+
+ for line in moves:
+ if line.credit and line.reconcile_partial_id and ttype == 'receipt':
+ continue
+ if line.debit and line.reconcile_partial_id and ttype == 'payment':
+ continue
+
+ orignal_amount = line.credit or line.debit or 0.0
+ rs = {
+ 'name':line.move_id.name,
+ 'type': line.credit and 'dr' or 'cr',
+ 'move_line_id':line.id,
+ 'account_id':line.account_id.id,
+ 'amount_original':currency_pool.compute(cr, uid, company_currency, currency_id, orignal_amount),
+ 'date_original':line.date,
+ 'date_due':line.date_maturity,
+ 'amount_unreconciled':currency_pool.compute(cr, uid, company_currency, currency_id, line.amount_unreconciled)
+ }
+ if line.credit:
+ amount = min(line.amount_unreconciled, total_debit)
+ rs['amount'] = currency_pool.compute(cr, uid, company_currency, currency_id, amount)
+ total_debit -= amount
+ else:
+ amount = min(line.amount_unreconciled, total_credit)
+ rs['amount'] = currency_pool.compute(cr, uid, company_currency, currency_id, amount)
+ total_credit -= amount
+
+ default['value']['line_ids'].append(rs)
+ if rs['type'] == 'cr':
+ default['value']['line_cr_ids'].append(rs)
+ else:
+ default['value']['line_dr_ids'].append(rs)
+
+ if ttype == 'payment' and len(default['value']['line_cr_ids']) > 0:
+ default['value']['pre_line'] = 1
+ elif ttype == 'receipt' and len(default['value']['line_dr_ids']) > 0:
+ default['value']['pre_line'] = 1
+ return default
+
+ def onchange_date(self, cr, user, ids, date, context={}):
+ """
+ @param date: latest value from user input for field date
+ @param args: other arguments
+ @param context: context arguments, like lang, time zone
+ @return: Returns a dict which contains new values, and context
+ """
+ period_pool = self.pool.get('account.period')
+ pids = period_pool.search(cr, user, [('date_start','<=',date), ('date_stop','>=',date)])
+ if not pids:
+ return {}
+ return {
+ 'value':{
+ 'period_id':pids[0]
+ }
+ }
+
+ def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context={}):
+ if not journal_id:
+ return False
+ journal_pool = self.pool.get('account.journal')
+ journal = journal_pool.browse(cr, uid, journal_id)
+ account_id = journal.default_credit_account_id or journal.default_debit_account_id
+ tax_id = False
+ if account_id and account_id.tax_ids:
+ tax_id = account_id.tax_ids[0].id
+
+ vals = self.onchange_price(cr, uid, ids, line_ids, tax_id, partner_id, context)
+ vals['value'].update({'tax_id':tax_id})
+ currency_id = journal.company_id.currency_id.id
+ if journal.currency:
+ currency_id = journal.currency.id
+ vals['value'].update({'currency_id':currency_id})
+ return vals
+
+ def proforma_voucher(self, cr, uid, ids, context=None):
+ self.action_move_line_create(cr, uid, ids, context=context)
+ return True
+
+ def action_cancel_draft(self, cr, uid, ids, context={}):
+ wf_service = netsvc.LocalService("workflow")
+ for voucher_id in ids:
+ wf_service.trg_create(uid, 'account.voucher', voucher_id, cr)
+ self.write(cr, uid, ids, {'state':'draft'})
+ return True
+
+ def cancel_voucher(self, cr, uid, ids, context={}):
+ reconcile_pool = self.pool.get('account.move.reconcile')
+ move_pool = self.pool.get('account.move')
+ voucher_line_pool = self.pool.get('account.voucher.line')
+
+ for voucher in self.browse(cr, uid, ids):
+ recs = []
+ for line in voucher.move_ids:
+ if line.reconcile_id:
+ recs += [line.reconcile_id.id]
+ if line.reconcile_partial_id:
+ recs += [line.reconcile_partial_id.id]
+
+ reconcile_pool.unlink(cr, uid, recs)
+
+ if voucher.move_id:
+ move_pool.button_cancel(cr, uid, [voucher.move_id.id])
+ move_pool.unlink(cr, uid, [voucher.move_id.id])
+ res = {
+ 'state':'cancel',
+ 'move_id':False,
+ }
+ self.write(cr, uid, ids, res)
+ return True
+
+ def unlink(self, cr, uid, ids, context=None):
+ for t in self.read(cr, uid, ids, ['state'], context=context):
+ if t['state'] not in ('draft', 'cancel'):
+ raise osv.except_osv(_('Invalid action !'), _('Cannot delete Voucher(s) which are already opened or paid !'))
+ return super(account_voucher, self).unlink(cr, uid, ids, context=context)
+
+ # TODO: may be we can remove this method if not used anyware
+ def onchange_payment(self, cr, uid, ids, pay_now, journal_id, partner_id, ttype='sale'):
+ res = {}
+ if not partner_id:
+ return res
+ res = {'account_id':False}
+ partner_pool = self.pool.get('res.partner')
+ journal_pool = self.pool.get('account.journal')
+ if pay_now == 'pay_later':
+ partner = partner_pool.browse(cr, uid, partner_id)
+ journal = journal_pool.browse(cr, uid, journal_id)
+ if journal.type in ('sale','sale_refund'):
+ account_id = partner.property_account_receivable.id
+ elif journal.type in ('purchase', 'purchase_refund','expense'):
+ account_id = partner.property_account_payable.id
+ else:
+ account_id = journal.default_credit_account_id.id or journal.default_debit_account_id.id
+ res['account_id'] = account_id
+ return {'value':res}
+
+ def action_move_line_create(self, cr, uid, ids, context=None):
+
+ def _get_payment_term_lines(term_id, amount):
+ term_pool = self.pool.get('account.payment.term')
+ if term_id and amount:
+ terms = term_pool.compute(cr, uid, term_id, amount)
+ return terms
+ return False
+ if not context:
+ context = {}
+ move_pool = self.pool.get('account.move')
+ move_line_pool = self.pool.get('account.move.line')
+ analytic_pool = self.pool.get('account.analytic.line')
+ currency_pool = self.pool.get('res.currency')
+ invoice_pool = self.pool.get('account.invoice')
+ for inv in self.browse(cr, uid, ids):
+ if inv.move_id:
+ continue
+ if inv.number:
+ name = inv.number
+ elif inv.journal_id.sequence_id:
+ name = self.pool.get('ir.sequence').get_id(cr, uid, inv.journal_id.sequence_id.id)
+ else:
+ raise osv.except_osv(_('Error !'), _('Please define a sequence on the journal !'))
+
+ move = {
+ 'name' : name,
+ 'journal_id': inv.journal_id.id,
+ 'narration' : inv.narration,
+ 'date':inv.date,
+ 'ref':inv.reference,
+ 'period_id': inv.period_id and inv.period_id.id or False
+ }
+ move_id = move_pool.create(cr, uid, move)
+
+ #create the first line manually
+ company_currency = inv.journal_id.company_id.currency_id.id
+ debit = 0.0
+ credit = 0.0
+ # TODO: is there any other alternative then the voucher type ??
+ # -for sale, purchase we have but for the payment and receipt we do not have as based on the bank/cash journal we can not know its payment or receipt
+ if inv.type in ('purchase', 'payment'):
+ credit = currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.amount)
+ elif inv.type in ('sale', 'receipt'):
+ debit = currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.amount)
+ if debit < 0:
+ credit = -debit
+ debit = 0.0
+ if credit < 0:
+ debit = -credit
+ credit = 0.0
+
+ move_line = {
+ 'name':inv.name or '/',
+ 'debit':debit,
+ 'credit':credit,
+ 'account_id':inv.account_id.id,
+ 'move_id':move_id ,
+ 'journal_id':inv.journal_id.id,
+ 'period_id':inv.period_id.id,
+ 'partner_id':inv.partner_id.id,
+ 'currency_id':inv.currency_id.id,
+ 'amount_currency':inv.amount,
+ 'date':inv.date,
+ 'date_maturity':inv.date_due
+ }
+
+ if (debit == 0.0 or credit == 0.0 or debit+credit > 0) and (debit > 0.0 or credit > 0.0):
+ master_line = move_line_pool.create(cr, uid, move_line)
+
+ rec_list_ids = []
+ line_total = debit - credit
+ if inv.type == 'sale':
+ line_total = line_total - currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.tax_amount)
+ elif inv.type == 'purchase':
+ line_total = line_total + currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.tax_amount)
+
+ for line in inv.line_ids:
+ if not line.amount:
+ continue
+ amount = currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, line.amount)
+
+ move_line = {
+ 'journal_id':inv.journal_id.id,
+ 'period_id':inv.period_id.id,
+ 'name':line.name and line.name or '/',
+ 'account_id':line.account_id.id,
+ 'move_id':move_id,
+ 'partner_id':inv.partner_id.id,
+ 'currency_id':inv.currency_id.id,
+ 'amount_currency':line.amount,
+ 'analytic_account_id':line.account_analytic_id and line.account_analytic_id.id or False,
+ 'quantity':1,
+ 'credit':0.0,
+ 'debit':0.0,
+ 'date':inv.date
+ }
+ if amount < 0:
+ amount = -amount
+ if line.type == 'dr':
+ line.type = 'cr'
+ else:
+ line.type = 'dr'
+
+ if (line.type=='dr'):
+ line_total += amount
+ move_line['debit'] = amount
+ else:
+ line_total -= amount
+ move_line['credit'] = amount
+
+ if inv.tax_id and inv.type in ('sale', 'purchase'):
+ move_line.update({
+ 'account_tax_id':inv.tax_id.id,
+ })
+ master_line = move_line_pool.create(cr, uid, move_line)
+ if line.move_line_id.id:
+ rec_ids = [master_line, line.move_line_id.id]
+ rec_list_ids.append(rec_ids)
+
+ if not self.pool.get('res.currency').is_zero(cr, uid, inv.currency_id, line_total):
+ diff = line_total
+ move_line = {
+ 'name':name,
+ 'account_id':False,
+ 'move_id':move_id ,
+ 'partner_id':inv.partner_id.id,
+ 'date':inv.date,
+ 'credit':diff>0 and diff or 0.0,
+ 'debit':diff<0 and -diff or 0.0,
+ }
+ account_id = False
+ if inv.type in ('sale', 'receipt'):
+# if inv.journal_id.type in ('sale','sale_refund', 'cash', 'bank'):
+ account_id = inv.partner_id.property_account_receivable.id
+ else:
+ account_id = inv.partner_id.property_account_payable.id
+ move_line['account_id'] = account_id
+ move_line_id = move_line_pool.create(cr, uid, move_line)
+
+ self.write(cr, uid, [inv.id], {
+ 'move_id': move_id,
+ 'state': 'posted',
+ 'number': name,
+ })
+ move_pool.post(cr, uid, [move_id], context={})
+ for rec_ids in rec_list_ids:
+ if len(rec_ids) >= 2:
+ move_line_pool.reconcile_partial(cr, uid, rec_ids)
+ return True
+
+ def copy(self, cr, uid, id, default={}, context=None):
+ default.update({
+ 'state':'draft',
+ 'number':False,
+ 'move_id':False,
+ 'line_cr_ids':False,
+ 'line_dr_ids':False,
+ 'reference':False
+ })
+ if 'date' not in default:
+ default['date'] = time.strftime('%Y-%m-%d')
+ return super(account_voucher, self).copy(cr, uid, id, default, context)
+
+account_voucher()
+
+class account_voucher_line(osv.osv):
+ _name = 'account.voucher.line'
+ _description = 'Voucher Lines'
+ _order = "move_line_id"
+
+ def _compute_balance(self, cr, uid, ids, name, args, context=None):
+ currency_pool = self.pool.get('res.currency')
+ rs_data = {}
+ for line in self.browse(cr, uid, ids):
+ res = {}
+ company_currency = line.voucher_id.journal_id.company_id.currency_id.id
+ voucher_currency = line.voucher_id.currency_id.id
+ move_line = line.move_line_id or False
+
+ if not move_line:
+ res['amount_original'] = 0.0
+ res['amount_unreconciled'] = 0.0
+
+ elif move_line and move_line.credit > 0:
+ res['amount_original'] = currency_pool.compute(cr, uid, company_currency, voucher_currency, move_line.credit)
+ else:
+ res['amount_original'] = currency_pool.compute(cr, uid, company_currency, voucher_currency, move_line.debit)
+
+ if move_line:
+ res['amount_unreconciled'] = currency_pool.compute(cr, uid, company_currency, voucher_currency, move_line.amount_unreconciled)
+ rs_data[line.id] = res
+ return rs_data
+
+ _columns = {
+ 'voucher_id':fields.many2one('account.voucher', 'Voucher', required=1, ondelete='cascade'),
+ 'name':fields.char('Description', size=256),
+ 'account_id':fields.many2one('account.account','Account', required=True),
+ 'partner_id':fields.related('voucher_id', 'partner_id', type='many2one', relation='res.partner', string='Partner'),
+ 'untax_amount':fields.float('Untax Amount'),
+ 'amount':fields.float('Amount', digits=(14,2)),
+ 'type':fields.selection([('dr','Debit'),('cr','Credit')], 'Cr/Dr'),
+ 'account_analytic_id': fields.many2one('account.analytic.account', 'Analytic Account'),
+ 'move_line_id': fields.many2one('account.move.line', 'Journal Item'),
+ 'date_original': fields.related('move_line_id','date', type='date', relation='account.move.line', string='Date', readonly=1),
+ 'date_due': fields.related('move_line_id','date_maturity', type='date', relation='account.move.line', string='Due Date', readonly=1),
+ 'amount_original': fields.function(_compute_balance, method=True, multi='dc', type='float', string='Originial Amount', store=True),
+ 'amount_unreconciled': fields.function(_compute_balance, method=True, multi='dc', type='float', string='Open Balance', store=True),
+ 'company_id': fields.related('voucher_id','company_id', relation='res.company', string='Company', store=True),
+ }
+ _defaults = {
+ 'name': lambda *a: ''
+ }
+
+ def onchange_move_line_id(self, cr, user, ids, move_line_id, context={}):
+ """
+ Returns a dict that contains new values and context
+
+ @param move_line_id: latest value from user input for field move_line_id
+ @param args: other arguments
+ @param context: context arguments, like lang, time zone
+
+ @return: Returns a dict which contains new values, and context
+ """
+ res = {}
+ move_line_pool = self.pool.get('account.move.line')
+ if move_line_id:
+ move_line = move_line_pool.browse(cr, user, move_line_id, context=context)
+ move_id = move_line.move_id.id
+ if move_line.credit:
+ ttype='dr'
+ amount = move_line.credit
+ else:
+ ttype='cr'
+ amount = move_line.debit
+ account_id = move_line.account_id.id
+ res.update({
+ 'account_id':account_id,
+ 'type': ttype
+ })
+ return {
+ 'value':res,
+ }
+
+ def default_get(self, cr, user, fields_list, context=None):
+ """
+ Returns default values for fields
+ @param fields_list: list of fields, for which default values are required to be read
+ @param context: context arguments, like lang, time zone
+
+ @return: Returns a dict that contains default values for fields
+ """
+ journal_id = context.get('journal_id', False)
+ partner_id = context.get('partner_id', False)
+ journal_pool = self.pool.get('account.journal')
+ partner_pool = self.pool.get('res.partner')
+ values = super(account_voucher_line, self).default_get(cr, user, fields_list, context=context)
+ if (not journal_id) or ('account_id' not in fields_list):
+ return values
+ journal = journal_pool.browse(cr, user, journal_id)
+ account_id = False
+ ttype = 'cr'
+ if journal.type in ('sale', 'sale_refund'):
+ account_id = journal.default_credit_account_id and journal.default_credit_account_id.id or False
+ ttype = 'cr'
+ elif journal.type in ('purchase', 'expense', 'purchase_refund'):
+ account_id = journal.default_debit_account_id and journal.default_debit_account_id.id or False
+ ttype = 'dr'
+ elif partner_id:
+ partner = partner_pool.browse(cr, user, partner_id, context=context)
+ if context.get('type') == 'payment':
+ ttype = 'dr'
+ account_id = partner.property_account_payable.id
+ elif context.get('type') == 'receipt':
+ account_id = partner.property_account_receivable.id
+
+ if (not account_id) and 'account_id' in fields_list:
+ raise osv.except_osv(_('Invalid Error !'), _('Please change partner and try again !'))
+ values.update({
+ 'account_id':account_id,
+ 'type':ttype
+ })
+ return values
+account_voucher_line()
+
+class account_bank_statement(osv.osv):
+ _inherit = 'account.bank.statement'
+
+ def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, next_number, context=None):
+ voucher_obj = self.pool.get('account.voucher')
+ wf_service = netsvc.LocalService("workflow")
+ st_line = self.pool.get('account.bank.statement.line').browse(cr, uid, st_line_id, context=context)
+ if st_line.voucher_id:
+ voucher_obj.write(cr, uid, [st_line.voucher_id.id], {'number': next_number}, context=context)
+ wf_service.trg_validate(uid, 'account.voucher', st_line.voucher_id.id, 'proforma_voucher', cr)
+ return self.pool.get('account.move.line').write(cr, uid, [x.id for x in st_line.voucher_id.move_ids], {'statement_id': st_line.statement_id.id}, context=context)
+ return super(account_bank_statement, self).create_move_from_st_line(cr, uid, st_line, company_currency_id, next_number, context=context)
+
+account_bank_statement()
+
+class account_bank_statement_line(osv.osv):
+ _inherit = 'account.bank.statement.line'
+
+ def _amount_reconciled(self, cursor, user, ids, name, args, context=None):
+ if not ids:
+ return {}
+
+ res_currency_obj = self.pool.get('res.currency')
+ res = {}
+ company_currency_id = False
+ for line in self.browse(cursor, user, ids, context=context):
+# if not company_currency_id:
+# company_currency_id = line.company_id.id
+ if line.voucher_id:
+ res[line.id] = line.voucher_id.amount#
+# res_currency_obj.compute(cursor, user,
+# company_currency_id, line.statement_id.currency.id,
+# line.voucher_id.amount, context=context)
+ else:
+ res[line.id] = 0.0
+ return res
+
+ _columns = {
+ 'amount_reconciled': fields.function(_amount_reconciled,
+ string='Amount reconciled', method=True, type='float'),
+ 'voucher_id': fields.many2one('account.voucher', 'Payment'),
+
+ }
+
+ def unlink(self, cr, uid, ids, context=None):
+ statement_line = self.browse(cr, uid, ids, context)
+ unlink_ids = []
+ for st_line in statement_line:
+ unlink_ids.append(st_line.voucher_id.id)
+ self.pool.get('account.voucher').unlink(cr, uid, unlink_ids, context=context)
+ return super(account_bank_statement_line, self).unlink(cr, uid, ids, context=context)
+
+account_bank_statement_line()
--- /dev/null
+<?xml version="1.0"?>
+<openerp>
+ <data>
+ <report id="report_account_voucher"
+ string="Voucher"
+ model="account.voucher"
+ name="voucher.cash_receipt.drcr"
+ rml="account_voucher/report/account_voucher.rml"
+ groups="base.group_extended"
+ auto="False"
+ header = "False"
+ menu="True"/>
+
+ <report id="report_account_voucher_print"
+ string="Voucher Print"
+ model="account.voucher"
+ name="voucher.print"
+ rml="account_voucher/report/account_voucher_print.rml"
+ auto="False"
+ header = "False"
+ menu="True"/>
+
+ </data>
+</openerp>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+ <data noupdate="1">
+ <record model="res.request.link" id="req_link_voucher">
+ <field name="name">Voucher</field>
+ <field name="object">account.voucher</field>
+ </record>
+ <!--
+ Sequences types for vouchers
+ -->
+ <record model="ir.sequence.type" id="seq_type_cash_rec_voucher">
+ <field name="name">Cash Receipt</field>
+ <field name="code">rec_voucher</field>
+ </record>
+
+ <record model="ir.sequence.type" id="seq_type_cash_pay_voucher">
+ <field name="name">Cash Payment</field>
+ <field name="code">pay_voucher</field>
+ </record>
+ <record model="ir.sequence.type" id="seq_type_bank_rec_voucher">
+ <field name="name">Bank Receipt</field>
+ <field name="code">bank_rec_voucher</field>
+ </record>
+ <record model="ir.sequence.type" id="seq_type_bank_pay_voucher">
+ <field name="name">Bank Payment</field>
+ <field name="code">bank_pay_voucher</field>
+ </record>
+ <record model="ir.sequence.type" id="seq_type_contra_voucher">
+ <field name="name">Contra Entry</field>
+ <field name="code">cont_voucher</field>
+ </record>
+ <record model="ir.sequence.type" id="seq_type_jou_sale_voucher">
+ <field name="name">Sales Entry</field>
+ <field name="code">journal_sale_vou</field>
+ </record>
+ <record model="ir.sequence.type" id="seq_type_jou_pur_voucher">
+ <field name="name">Purchase Entry</field>
+ <field name="code">journal_pur_vou</field>
+ </record>
+
+ <!--
+ Sequences for vouchers
+ -->
+ <record model="ir.sequence" id="seq_cash_rec_voucher">
+ <field name="name">Cash Receipt</field>
+ <field name="code">rec_voucher</field>
+ <field name="padding" eval="3"/>
+ <field name="prefix">%(year)s/</field>
+ </record>
+
+ <record model="ir.sequence" id="seq_cash_pay_voucher">
+ <field name="name">Cash Payment</field>
+ <field name="code">pay_voucher</field>
+ <field name="padding" eval="3"/>
+ <field name="prefix">%(year)s/</field>
+ </record>
+ <record model="ir.sequence" id="seq_bank_rec_voucher">
+ <field name="name">Bank Receipt</field>
+ <field name="code">bank_rec_voucher</field>
+ <field name="padding" eval="3"/>
+ <field name="prefix">%(year)s/</field>
+ </record>
+ <record model="ir.sequence" id="seq_bank_pay_voucher">
+ <field name="name">Bank Payment</field>
+ <field name="code">bank_pay_voucher</field>
+ <field name="padding" eval="3"/>
+ <field name="prefix">%(year)s/</field>
+ </record>
+ <record model="ir.sequence" id="seq_contra_voucher">
+ <field name="name">Contra Entry</field>
+ <field name="code">cont_voucher</field>
+ <field name="padding" eval="3"/>
+ <field name="prefix">%(year)s/</field>
+ </record>
+ <record model="ir.sequence" id="seq_jou_sale_voucher">
+ <field name="name">Sales Entry</field>
+ <field name="code">journal_sale_vou</field>
+ <field name="padding" eval="3"/>
+ <field name="prefix">%(year)s/</field>
+ </record>
+ <record model="ir.sequence" id="seq_jou_pur_voucher">
+ <field name="name">Purchase Entry</field>
+ <field name="code">journal_pur_vou</field>
+ <field name="padding" eval="3"/>
+ <field name="prefix">%(year)s/</field>
+ </record>
+
+ </data>
+</openerp>
+
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+ <data>
+ <record model="ir.ui.view" id="view_voucher_tree">
+ <field name="name">account.voucher.tree</field>
+ <field name="model">account.voucher</field>
+ <field name="type">tree</field>
+ <field name="arch" type="xml">
+ <tree colors="blue:state in ('draft');gray:state in ('cancel')" string="Voucher Entries">
+ <field name="date"/>
+ <field name="number"/>
+ <field name="reference"/>
+ <field name="partner_id"/>
+ <field name="journal_id"/>
+ <field name="period_id" groups="base.group_extended" invisible="context.get('visible', True)"/>
+ <field name="type" invisible="context.get('visible', True)"/>
+ <field name="amount" sum="Total Amount"/>
+ <field name="state"/>
+ <button name="proforma_voucher" string="Post" states="draft" icon="terp-document-new"/>
+ </tree>
+ </field>
+ </record>
+
+ <record model="ir.ui.view" id="view_voucher_form">
+ <field name="name">account.voucher.form</field>
+ <field name="model">account.voucher</field>
+ <field name="type">form</field>
+ <field name="arch" type="xml">
+ <form string="Accounting Voucher">
+ <group col="6" colspan="4">
+ <field name="partner_id" required="1" on_change="onchange_journal_voucher(line_ids, tax_id, amount, partner_id, journal_id, type)"/>
+ <field name="journal_id" widget="selection" select="1" on_change="onchange_journal_voucher(line_ids, tax_id, amount, partner_id, journal_id, type)"/>
+ <field name="type" required="1"/>
+ <field name="name" colspan="4"/>
+ <field name="reference" select="1"/>
+ <field name="account_id" widget="selection" invisible="True"/>
+ </group>
+ <notebook colspan="4">
+ <page string="Voucher Entry">
+ <field name="line_ids" on_change="onchange_price(line_ids, tax_id, partner_id)" default_get="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" colspan="4" nolabel="1" height="180">
+ <tree string="Voucher Items" editable="bottom">
+ <field name="account_id"/>
+ <field name="name"/>
+ <field name="amount" sum="Total Amount"/>
+ <field name="type"/>
+ <field name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
+ </tree>
+ </field>
+ <group col="2" colspan="3">
+ <separator string="Internal Notes" colspan="2"/>
+ <field name="narration" colspan="2" nolabel="1"/>
+ </group>
+ <group col="2" colspan="1">
+ <group col="2" colspan="1" >
+ <separator string="Other Information" colspan="2"/>
+ <field name="number"/>
+ <field name="date" on_change="onchange_date(date)"/>
+ <field name="currency_id" invisible="True"/>
+ </group>
+ <group col="4" colspan="1" attrs="{'invisible':[('type','in',['payment', 'receipt', False])]}">
+ <separator string="Total" colspan="4"/>
+ <field name="tax_id" on_change="onchange_price(line_ids, tax_id, partner_id)" widget="selection"/><field name="tax_amount" nolabel="1"/><button type="object" icon="terp-stock_format-scientific" name="compute_tax" groups="base.group_extended" string="Compute Tax" attrs="{'invisible': [('state','!=','draft')]}"/>
+ <label colspan="1" string=""/><field name="amount" string="Total"/>
+ </group>
+ </group>
+ </page>
+ <page string="Journal Items" groups="base.group_extended" attrs="{'invisible': [('state','!=','posted')]}">
+ <group col="6" colspan="4">
+ <field name="company_id" widget="selection" groups="base.group_multi_company"/>
+ <field name="period_id"/>
+ <field name="audit"/>
+ </group>
+ <separator string="Journal Items" colspan="4"/>
+ <field name="move_ids" colspan="4" nolabel="1" readonly="1"/>
+ </page>
+ </notebook>
+ <group col="10" colspan="4">
+ <field name="state"/>
+ <button name="cancel_voucher" string="Cancel" states="draft,proforma" icon="gtk-cancel"/>
+ <button name="proforma_voucher" string="Post" states="draft" icon="terp-camera_test"/>
+ <button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/>
+ <button name="cancel_voucher" string="Cancel" type="object" states="posted" icon="terp-stock_effects-object-colorize" confirm="Are you sure to unreconcile this record ?"/>
+ </group>
+ </form>
+ </field>
+ </record>
+
+ <record id="view_voucher_filter" model="ir.ui.view">
+ <field name="name">account.voucher.select</field>
+ <field name="model">account.voucher</field>
+ <field name="type">search</field>
+ <field name="priority">1</field>
+ <field name="arch" type="xml">
+ <search string="Search Vouchers">
+ <group col='8' colspan='4'>
+ <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
+ <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
+ <separator orientation="vertical"/>
+ <filter icon="terp-stock_effects-object-colorize" string="To Review" domain="[('state','=','posted')]" groups="base.group_extended" help="To Review"/>
+ <separator orientation="vertical"/>
+ <field name="date"/>
+ <field name="number"/>
+ <field name="partner_id"/>
+ </group>
+ <newline/>
+ <group col='8' colspan='4'>
+ <field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" />
+ <field name="period_id" groups="base.group_extended"/>
+ </group>
+ <newline/>
+ <group expand="0" string="Group By..." colspan="4" col="10">
+ <filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
+ <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
+ <filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
+ <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
+ </group>
+ <newline/>
+ <group expand="0" string="Extended options..." col='8' colspan='4'>
+ <field name="reference"/>
+ <field name="name"/>
+ <field name="narration"/>
+ <field name="amount"/>
+ </group>
+ </search>
+ </field>
+ </record>
+
+ <record id="account_cash_statement_graph" model="ir.ui.view">
+ <field name="name">account.voucher.graph</field>
+ <field name="model">account.voucher</field>
+ <field name="type">graph</field>
+ <field name="arch" type="xml">
+ <graph string="Voucher Statistics" type="bar">
+ <field name="date"/>
+ <field name="amount" operator="+"/>
+ </graph>
+ </field>
+ </record>
+
+ <!-- Journal Vouchers -->
+ <record model="ir.actions.act_window" id="action_voucher_list">
+ <field name="name">Journal Vouchers</field>
+ <field name="res_model">account.voucher</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree,form,graph</field>
+ <field name="context">{'type':'general'}</field>
+ <field name="view_id" eval="view_voucher_tree"/>
+ <field name="search_view_id" ref="view_voucher_filter"/>
+ </record>
+ <record id="action_journal_voucher_tree" model="ir.actions.act_window.view">
+ <field eval="1" name="sequence"/>
+ <field name="view_mode">tree</field>
+ <field name="act_window_id" ref="action_voucher_list"/>
+ </record>
+ <record id="action_journal_voucher_form" model="ir.actions.act_window.view">
+ <field eval="2" name="sequence"/>
+ <field name="view_mode">form</field>
+ <field name="view_id" ref="view_voucher_form"/>
+ <field name="act_window_id" ref="action_voucher_list"/>
+ </record>
+ <menuitem action="action_voucher_list" id="menu_encode_entries_by_voucher" parent="account.menu_finance_entries" sequence="6"/>
+
+ <act_window
+
+ id="act_journal_voucher_open"
+ name="Voucher Entries"
+ context="{'search_default_journal_id': active_id, 'type':type}"
+ res_model="account.voucher"
+ src_model="account.journal"/>
+
+ <record model="ir.actions.act_window" id="action_review_voucher_list">
+ <field name="name">Vouchers Entries</field>
+ <field name="res_model">account.voucher</field>
+ <field name="view_type">form</field>
+ <field name="view_mode">tree,form</field>
+ <field name="view_id" eval="view_voucher_tree"/>
+ <field name="domain">[('state','=','posted')]</field>
+ <field name="context">{'state':'posted'}</field>
+ <field name="search_view_id" ref="view_voucher_filter"/>
+ </record>
+
+ <record id="view_bank_statement_form_invoice" model="ir.ui.view">
+ <field name="name">account.bank.statement.invoice.form.inherit</field>
+ <field name="model">account.bank.statement</field>
+ <field name="type">form</field>
+ <field name="inherit_id" ref="account.view_bank_statement_form"/>
+ <field name="arch" type="xml">
+ <field name="currency" invisible="1" position="after">
+ <button name="%(action_view_account_statement_from_invoice_lines)d"
+ string="Import Invoices" type="action" icon="gtk-execute"
+ attrs="{'invisible':[('state','=','confirm')]}"/>
+ </field>
+ </field>
+ </record>
+
+ <record id="view_bank_statement_tree_voucher" model="ir.ui.view">
+ <field name="name">account.bank.statement.voucher.tree.inherit</field>
+ <field name="model">account.bank.statement</field>
+ <field name="type">form</field>
+ <field name="inherit_id" ref="account.view_bank_statement_form"/>
+ <field name="arch" type="xml">
+ <xpath expr="/form/notebook/page[@name='statement_line_ids']/field[@name='line_ids']/tree/field[@name='amount']" position="after">
+ <field name="voucher_id" context="{'default_type': amount < 0 and 'payment' or 'receipt', 'type': amount < 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name}"/>
+ <field name="amount_reconciled"/>
+ </xpath>
+ </field>
+ </record>
+
+ <record id="view_bank_statement_form_voucher" model="ir.ui.view">
+ <field name="name">account.bank.statement.voucher.form.inherit</field>
+ <field name="model">account.bank.statement</field>
+ <field name="type">form</field>
+ <field name="inherit_id" ref="account.view_bank_statement_form"/>
+ <field name="arch" type="xml">
+ <xpath expr="/form/notebook/page[@name='statement_line_ids']/field[@name='line_ids']/form/field[@name='sequence']" position="before">
+ <field name="voucher_id" context="{'default_type': amount < 0 and 'payment' or 'receipt', 'type': amount < 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name}"/>
+ <field name="amount_reconciled"/>
+ </xpath>
+ </field>
+ </record>
+
+
+ </data>
+</openerp>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+ <data>
+ </data>
+</openerp>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<openerp>
+ <data>
+ <record id="wkf" model="workflow">
+ <field name="name">account.voucher.basic</field>
+ <field name="osv">account.voucher</field>
+ <field name="on_create">True</field>
+ </record>
+
+ <record id="act_proforma" model="workflow.activity">
+ <field name="wkf_id" ref="wkf"/>
+ <field name="flow_start">True</field>
+ <field name="name">proforma</field>
+ <field name="action">write({'state':'draft'})</field>
+ <field name="kind">function</field>
+ </record>
+
+ <record id="act_done" model="workflow.activity">
+ <field name="wkf_id" ref="wkf"/>
+ <field name="name">done</field>
+ <field name="action">proforma_voucher()</field>
+ <field name="kind">function</field>
+ <field name="flow_stop">True</field>
+ </record>
+
+<!-- <record id="act_recheck" model="workflow.activity">-->
+<!-- <field name="wkf_id" ref="wkf"/>-->
+<!-- <field name="name">recheck</field>-->
+<!-- <field name="action">voucher_recheck()</field>-->
+<!-- <field name="kind">function</field>-->
+<!-- </record>-->
+
+ <record id="act_cancel" model="workflow.activity">
+ <field name="wkf_id" ref="wkf"/>
+ <field name="name">cancel</field>
+ <field name="flow_stop">True</field>
+ <field name="action">cancel_voucher()</field>
+ <field name="kind">function</field>
+ </record>
+
+ <record id="t2" model="workflow.transition">
+ <field name="act_from" ref="act_proforma"/>
+ <field name="act_to" ref="act_done"/>
+ <field name="signal">proforma_voucher</field>
+ <field name="condition">True</field>
+ </record>
+
+<!-- <record id="t3" model="workflow.transition">-->
+<!-- <field name="act_from" ref="act_proforma"/>-->
+<!-- <field name="act_to" ref="act_recheck"/>-->
+<!-- <field name="signal">proforma_voucher</field>-->
+<!-- </record>-->
+<!-- -->
+<!-- <record id="t4" model="workflow.transition">-->
+<!-- <field name="act_from" ref="act_recheck"/>-->
+<!-- <field name="act_to" ref="act_done"/>-->
+<!-- <field name="signal">recheck_voucher</field>-->
+<!-- </record>-->
+<!-- -->
+<!-- <record id="t5" model="workflow.transition">-->
+<!-- <field name="act_from" ref="act_recheck"/>-->
+<!-- <field name="act_to" ref="act_cancel"/>-->
+<!-- <field name="signal">cancel_voucher</field>-->
+<!-- </record>-->
+
+ <record id="t6" model="workflow.transition">
+ <field name="act_from" ref="act_proforma"/>
+ <field name="act_to" ref="act_cancel"/>
+ <field name="signal">cancel_voucher</field>
+ </record>
+
+ <record id="t7" model="workflow.transition">
+ <field name="act_from" ref="act_done"/>
+ <field name="act_to" ref="act_cancel"/>
+ <field name="signal">cancel_voucher</field>
+ </record>
+
+ <record id="t8" model="workflow.transition">
+ <field name="act_from" ref="act_cancel"/>
+ <field name="act_to" ref="act_proforma"/>
+ <field name="signal">cancel_to_draft</field>
+ </record>
+ </data>
+</openerp>
# -*- coding: utf-8 -*-
##############################################################################
-#
+#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
-import report_voucher
-import report_voucher_print
+import account_voucher
+import account_voucher_print
--- /dev/null
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import time
+from report import report_sxw
+from tools import amount_to_text_en
+
+class report_voucher(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(report_voucher, self).__init__(cr, uid, name, context)
+ self.localcontext.update({
+ 'time': time,
+ 'convert':self.convert,
+ 'get_title': self.get_title,
+ 'debit':self.debit,
+ 'credit':self.credit,
+ 'get_ref' : self._get_ref
+ })
+
+ def convert(self, amount, cur):
+ amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur);
+ return amt_en
+
+ def get_title(self, type):
+ title = ''
+ if type:
+ title = type[0].swapcase() + type[1:] + " Voucher"
+ return title
+
+ def debit(self, move_ids):
+ debit = 0.0
+ for move in move_ids:
+ debit +=move.debit
+ return debit
+
+ def credit(self, move_ids):
+ credit = 0.0
+ for move in move_ids:
+ credit +=move.credit
+ return credit
+
+ def _get_ref(self, voucher_id, move_ids):
+ voucher_line = self.pool.get('account.voucher.line').search(self.cr, self.uid, [('partner_id','=',move_ids.partner_id.id), ('voucher_id','=',voucher_id)])
+ if voucher_line:
+ voucher = self.pool.get('account.voucher.line').browse(self.cr, self.uid, voucher_line)[0]
+ return voucher.name
+ else:
+ return
+report_sxw.report_sxw(
+ 'report.voucher.cash_receipt.drcr',
+ 'account.voucher',
+ 'addons/account_voucher/report/account_voucher.rml',
+ parser=report_voucher,header="external"
+)
--- /dev/null
+<?xml version="1.0"?>
+<document filename="test.pdf">
+ <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
+ <pageTemplate id="first">
+ <frame id="first" x1="28.0" y1="42.0" width="525" height="772"/>
+ </pageTemplate>
+ </template>
+ <stylesheet>
+ <blockTableStyle id="Standard_Outline">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table4">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table7">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="0,0" stop="0,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="2,0" stop="2,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="2,-1" stop="2,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEAFTER" colorName="#b3b3b3" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="3,0" stop="3,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="3,-1" stop="3,-1"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table8">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="0,0" stop="0,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="0,0" stop="0,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="2,0" stop="2,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="2,-1" stop="2,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="3,0" stop="3,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="3,0" stop="3,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="3,-1" stop="3,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="4,0" stop="4,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="4,0" stop="4,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="4,-1" stop="4,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="5,0" stop="5,-1"/>
+ <lineStyle kind="LINEAFTER" colorName="#b3b3b3" start="5,0" stop="5,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="5,0" stop="5,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="5,-1" stop="5,-1"/>
+ </blockTableStyle>
+ <blockTableStyle id="Heading1">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="0,0" stop="0,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="2,0" stop="2,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="2,-1" stop="2,-1"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table2">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table6">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table1">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table3">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <initialize>
+ <paraStyle name="all" alignment="justify"/>
+ </initialize>
+ <paraStyle name="P1" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="P2" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="P3" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="P4" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="P5" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="Standard" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
+ <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Text body" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="List" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Caption" fontName="Helvetica-Oblique" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="Index" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
+ <paraStyle name="Table Contents" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Table Heading" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="Footer" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
+ <paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" alignment="LEFT" spaceBefore="0.0" spaceAfter="14.0"/>
+ <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_1" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_8_Italic" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="Drawing" fontName="Helvetica-Oblique" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="Header" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
+ <paraStyle name="Endnote" rightIndent="0.0" leftIndent="14.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT"/>
+ <paraStyle name="Addressee" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="3.0"/>
+ <paraStyle name="Signature" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
+ <paraStyle name="Heading 8" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 7" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 6" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 5" fontName="Helvetica-Bold" fontSize="85%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 4" fontName="Helvetica-BoldOblique" fontSize="85%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 1" fontName="Helvetica-Bold" fontSize="115%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 10" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 2" fontName="Helvetica-BoldOblique" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="First line indent" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Hanging indent" rightIndent="0.0" leftIndent="28.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Salutation" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
+ <paraStyle name="Text body indent" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 3" fontName="Helvetica-Bold" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="List Indent" rightIndent="0.0" leftIndent="142.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Marginalia" rightIndent="0.0" leftIndent="113.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_9_with_indent_10" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_9_50" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <images/>
+ </stylesheet>
+ <story>
+ <para style="P5">[[ repeatIn(objects,'voucher') ]]</para>
+ <blockTable colWidths="524.0" style="Table4">
+ <tr>
+ <td>
+ <para style="terp_header_Centre">[[ get_title(voucher.type) ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="63.0,200.0,52.0,210.0" style="Table7">
+ <tr>
+ <td>
+ <para style="terp_tblheader_General">Journal:</para>
+ </td>
+ <td>
+ <para style="terp_default_9">[[ voucher.type ]]</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_General">Number:</para>
+ </td>
+ <td>
+ <para style="terp_default_9">[[ voucher.number ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <blockTable colWidths="63.0,72.0,44.0,84.0,52.0,210.0" style="Table8">
+ <tr>
+ <td>
+ <para style="terp_tblheader_General">State:</para>
+ </td>
+ <td>
+ <para style="P2">PRO-FORMA [[ ((voucher.state == 'proforma') or removeParentNode('para')) and '' ]]</para>
+ <para style="P2">Draft[[ ((voucher.state == 'draft') or removeParentNode('para')) and '' ]]</para>
+ <para style="P2">Canceled [[ ((voucher.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
+ <para style="P2">Posted [[ ((voucher.state == 'posted') or removeParentNode('para')) and '' ]]</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_General">Ref. :</para>
+ </td>
+ <td>
+ <para style="terp_default_9">[[ voucher.reference or '' ]]</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_General">Date:</para>
+ </td>
+ <td>
+ <para style="terp_default_9">[[ formatLang(voucher.date , date=True) or '' ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_8">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="277.0,124.0,124.0" style="Heading1">
+ <tr>
+ <td>
+ <para style="terp_tblheader_Details">Particulars</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Right">Debit</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Right">Credit</para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_1">
+ <font color="white"> </font>
+ </para>
+ <section>
+ <para style="terp_default_8">[[ repeatIn(voucher.move_ids,'move_ids') ]] </para>
+ <blockTable colWidths="276.0,126.0,123.0" style="Table2">
+ <tr>
+ <td>
+ <para style="P3">[[ (move_ids.partner_id and move_ids.partner_id.name) or 'Account']] </para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">[[ formatLang(move_ids.debit) ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">[[ formatLang(move_ids.credit) ]]</para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="P4">[[ move_ids.account_id.name ]] </para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_8_Italic">[[ move_ids.name ]] - [[ get_ref(voucher.id,move_ids) ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_9_50">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_9_50">
+ <font color="white"> </font>
+ </para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_1">
+ <font color="white"> </font>
+ </para>
+ </section>
+ <para style="terp_default_1">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="276.0,126.0,123.0" style="Table6">
+ <tr>
+ <td>
+ <para style="terp_tblheader_Details">Through : </para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details">
+ <font color="white"> </font>
+ </para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_9">[[ voucher.narration or '']]</para>
+ </td>
+ <td>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_tblheader_Details">On Account of : </para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details">
+ <font color="white"> </font>
+ </para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_9">[[ voucher.name ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_tblheader_Details">Amount (in words) : </para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details">
+ <font color="white"> </font>
+ </para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_9">[[ convert(voucher.amount,voucher.currency_id.name) ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_1">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="276.0,127.0,122.0" style="Table1">
+ <tr>
+ <td>
+ <para style="P1">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold">[[ debit(voucher.move_ids)]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold">[[ credit(voucher.move_ids) ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_1">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="157.0,119.0,126.0,123.0" style="Table3">
+ <tr>
+ <td>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_9">Receiver's Signature</para>
+ </td>
+ <td>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">Authorised Signatory</para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_8">
+ <font color="white"> </font>
+ </para>
+ </story>
+</document>
--- /dev/null
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Affero General Public License as
+# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
+#
+# You should have received a copy of the GNU Affero General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+##############################################################################
+
+import time
+from report import report_sxw
+from tools import amount_to_text_en
+
+class report_voucher_print(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(report_voucher_print, self).__init__(cr, uid, name, context)
+ self.localcontext.update({
+ 'time': time,
+ 'get_title': self.get_title,
+ 'get_lines':self.get_lines,
+ 'get_on_account':self.get_on_account,
+ 'convert':self.convert
+ })
+
+ def convert(self, amount, cur):
+ amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur);
+ return amt_en
+
+ def get_lines(self,voucher):
+ result = []
+ if voucher.type in ('payment','receipt'):
+ type = voucher.line_ids and voucher.line_ids[0].type or False
+ for move in voucher.move_ids:
+ res = {}
+ amount = move.credit
+ if type == 'dr':
+ amount = move.debit
+ if amount > 0.0:
+ res['pname'] = move.partner_id.name
+ res['ref'] = 'Agst Ref'+" "+str(move.name)
+ res['aname'] = move.account_id.name
+ res['amount'] = amount
+ result.append(res)
+ else:
+ type = voucher.line_ids and voucher.line_ids[0].type or False
+ for move in voucher.move_ids:
+ res = {}
+ amount = move.credit
+ if type == 'dr':
+ amount = move.debit
+ if amount > 0.0:
+ res['pname'] = move.partner_id.name
+ res['ref'] = move.name
+ res['aname'] = move.account_id.name
+ res['amount'] = amount
+ result.append(res)
+ return result
+
+ def get_title(self, type):
+ title = ''
+ if type:
+ title = type[0].swapcase() + type[1:] + " Voucher"
+ return title
+
+ def get_on_account(self, voucher):
+ name = ""
+ if voucher.type == 'receipt':
+ name = "Received cash from "+str(voucher.partner_id.name)
+ elif voucher.type == 'payment':
+ name = "Payment from "+str(voucher.partner_id.name)
+ elif voucher.type == 'sale':
+ name = "Sale to "+str(voucher.partner_id.name)
+ elif voucher.type == 'purchase':
+ name = "Purchase from "+str(voucher.partner_id.name)
+ return name
+
+report_sxw.report_sxw(
+ 'report.voucher.print',
+ 'account.voucher',
+ 'addons/account_voucher/report/account_voucher_print.rml',
+ parser=report_voucher_print,header="external"
+)
--- /dev/null
+<?xml version="1.0"?>
+<document filename="test.pdf">
+ <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
+ <pageTemplate id="first">
+ <frame id="first" x1="28.0" y1="42.0" width="525" height="772"/>
+ </pageTemplate>
+ </template>
+ <stylesheet>
+ <blockTableStyle id="Standard_Outline">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table6">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table2">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table4">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Heading1">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table7">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="last_info">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table3">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
+ <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
+ <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
+ <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
+ </blockTableStyle>
+ <blockTableStyle id="Table5">
+ <blockAlignment value="LEFT"/>
+ <blockValign value="TOP"/>
+ </blockTableStyle>
+ <initialize>
+ <paraStyle name="all" alignment="justify"/>
+ </initialize>
+ <paraStyle name="P1" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
+ <paraStyle name="P2" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="P3" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="P4" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="P5" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="Standard" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
+ <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Text body" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="List" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Caption" fontName="Helvetica-Oblique" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="Index" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
+ <paraStyle name="Table Contents" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Table Heading" fontName="Helvetica" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="Footer" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
+ <paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" alignment="LEFT" spaceBefore="0.0" spaceAfter="14.0"/>
+ <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_1" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_8_Italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="Drawing" fontName="Helvetica-Oblique" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
+ <paraStyle name="Header" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
+ <paraStyle name="Endnote" rightIndent="0.0" leftIndent="14.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT"/>
+ <paraStyle name="Addressee" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="3.0"/>
+ <paraStyle name="Signature" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
+ <paraStyle name="Heading 8" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 7" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 6" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 5" fontName="Helvetica-Bold" fontSize="85%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 4" fontName="Helvetica-BoldOblique" fontSize="85%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 1" fontName="Helvetica-Bold" fontSize="115%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 10" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 2" fontName="Helvetica-BoldOblique" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="First line indent" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Hanging indent" rightIndent="0.0" leftIndent="28.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Salutation" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
+ <paraStyle name="Text body indent" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Heading 3" fontName="Helvetica-Bold" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
+ <paraStyle name="List Indent" rightIndent="0.0" leftIndent="142.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="Marginalia" rightIndent="0.0" leftIndent="113.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
+ <paraStyle name="terp_default_9_30" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_9_50" rightIndent="0.0" leftIndent="14.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_9_50_italic" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica-Oblique" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <paraStyle name="terp_default_9_30cm" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
+ <images/>
+ </stylesheet>
+ <story>
+ <para style="P5">[[ repeatIn(objects,'voucher') ]]</para>
+ <blockTable colWidths="524.0" style="Table6">
+ <tr>
+ <td>
+ <para style="terp_header_Centre">[[ get_title(voucher.type) ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="52.0,123.0,50.0,198.0,42.0,59.0" style="Table2">
+ <tr>
+ <td>
+ <para style="terp_tblheader_General">Number:</para>
+ </td>
+ <td>
+ <para style="terp_default_9">[[ voucher.number ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Bold_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_tblheader_General">Date:</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">[[ formatLang(voucher.date , date=True) or '' ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <blockTable colWidths="52.0,123.0,50.0,198.0,42.0,59.0" style="Table4">
+ <tr>
+ <td>
+ <para style="terp_tblheader_Details">State:</para>
+ </td>
+ <td>
+ <para style="P4">PRO-FORMA [[ ((voucher.state == 'proforma') or removeParentNode('para')) and '' ]]</para>
+ <para style="P4">Draft[[ ((voucher.state == 'draft') or removeParentNode('para')) and '' ]]</para>
+ <para style="P4">Canceled [[ ((voucher.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
+ <para style="P4">Posted [[ ((voucher.state == 'posted') or removeParentNode('para')) and '' ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Bold_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="P2">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_tblheader_General">Currency:</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">[[ voucher.currency_id.code ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="381.0,144.0" style="Heading1">
+ <tr>
+ <td>
+ <para style="terp_tblheader_Details">Particulars</para>
+ </td>
+ <td>
+ <para style="terp_tblheader_Details_Right">Amount</para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_1">
+ <font color="white"> </font>
+ </para>
+ <section>
+ <para style="terp_default_8">[[ repeatIn(get_lines(voucher),'p') ]] </para>
+ <blockTable colWidths="380.0,144.0" style="Table7">
+ <tr>
+ <td>
+ <para style="terp_default_Bold_9">Account :</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold">
+ <font color="white"> </font>
+ </para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_9_30cm">[[ p['pname'] ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">[[ p['amount'] ]] [[ voucher.currency_id.symbol ]]</para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_9_30cm">[[ p['ref'] ]] </para>
+ </td>
+ <td>
+ <para style="terp_default_9_50">
+ <font color="white"> </font>
+ </para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_9_30cm">Account : [[ p['aname'] ]] </para>
+ </td>
+ <td>
+ <para style="terp_default_9_50">
+ <font color="white"> </font>
+ </para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_1">
+ <font color="white"> </font>
+ </para>
+ </section>
+ <para style="terp_default_1">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="380.0,144.0" style="last_info">
+ <tr>
+ <td>
+ <para style="terp_default_Bold_9">Through : </para>
+ </td>
+ <td>
+ <para style="terp_default_Bold_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_9_30">[[ voucher.journal_id.name or '' ]] </para>
+ </td>
+ <td>
+ <para style="terp_default_9_50_italic">
+ <font color="white"> </font>
+ </para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_Bold_9">On Account of : </para>
+ </td>
+ <td>
+ <para style="terp_default_Bold_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_9_30">[[ get_on_account(voucher) ]]</para>
+ </td>
+ <td>
+ <para style="terp_default_9_30">
+ <font color="white"> </font>
+ </para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_Bold_9">Amount (in words) : </para>
+ </td>
+ <td>
+ <para style="terp_default_Bold_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_9_30">[[ convert(voucher.amount,voucher.currency_id.name) ]]</para>
+ </td>
+ <td>
+ <para style="P3">
+ <font color="white"> </font>
+ </para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_1">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="380.0,144.0" style="Table3">
+ <tr>
+ <td>
+ <para style="terp_default_Right_9_Bold">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9_Bold">[[ voucher.amount ]] [[ voucher.currency_id.symbol ]]</para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="terp_default_1">
+ <font color="white"> </font>
+ </para>
+ <blockTable colWidths="154.0,108.0,118.0,144.0" style="Table5">
+ <tr>
+ <td>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <para style="terp_default_9">Receiver's Signature</para>
+ </td>
+ <td>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_9">
+ <font color="white"> </font>
+ </para>
+ </td>
+ <td>
+ <para style="terp_default_Right_9">Authorised Signatory</para>
+ </td>
+ </tr>
+ </blockTable>
+ <para style="P1">
+ <font color="white"> </font>
+ </para>
+ </story>
+</document>
+++ /dev/null
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-import time
-from report import report_sxw
-from tools import amount_to_text_en
-
-class report_voucher(report_sxw.rml_parse):
- def __init__(self, cr, uid, name, context):
- super(report_voucher, self).__init__(cr, uid, name, context)
- self.localcontext.update({
- 'time': time,
- 'convert':self.convert,
- 'get_title': self.get_title,
- 'debit':self.debit,
- 'credit':self.credit,
- 'get_ref' : self._get_ref
- })
-
- def convert(self, amount, cur):
- amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur);
- return amt_en
-
- def get_title(self, type):
- title = ''
- if type:
- title = type[0].swapcase() + type[1:] + " Voucher"
- return title
-
- def debit(self, move_ids):
- debit = 0.0
- for move in move_ids:
- debit +=move.debit
- return debit
-
- def credit(self, move_ids):
- credit = 0.0
- for move in move_ids:
- credit +=move.credit
- return credit
-
- def _get_ref(self, voucher_id, move_ids):
- voucher_line = self.pool.get('account.voucher.line').search(self.cr, self.uid, [('partner_id','=',move_ids.partner_id.id), ('voucher_id','=',voucher_id)])
- if voucher_line:
- voucher = self.pool.get('account.voucher.line').browse(self.cr, self.uid, voucher_line)[0]
- return voucher.name
- else:
- return
-report_sxw.report_sxw(
- 'report.voucher.cash_receipt.drcr',
- 'account.voucher',
- 'addons/account_voucher/report/report_voucher.rml',
- parser=report_voucher,header="external"
-)
+++ /dev/null
-<?xml version="1.0"?>
-<document filename="test.pdf">
- <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
- <pageTemplate id="first">
- <frame id="first" x1="28.0" y1="42.0" width="525" height="772"/>
- </pageTemplate>
- </template>
- <stylesheet>
- <blockTableStyle id="Standard_Outline">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Table4">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Table7">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="0,0" stop="0,-1"/>
- <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="0,0" stop="0,0"/>
- <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="0,-1" stop="0,-1"/>
- <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="1,0" stop="1,-1"/>
- <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="1,0" stop="1,0"/>
- <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="1,-1" stop="1,-1"/>
- <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="2,0" stop="2,-1"/>
- <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="2,0" stop="2,0"/>
- <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="2,-1" stop="2,-1"/>
- <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="3,0" stop="3,-1"/>
- <lineStyle kind="LINEAFTER" colorName="#b3b3b3" start="3,0" stop="3,-1"/>
- <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="3,0" stop="3,0"/>
- <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="3,-1" stop="3,-1"/>
- </blockTableStyle>
- <blockTableStyle id="Table8">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="0,0" stop="0,-1"/>
- <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="0,0" stop="0,0"/>
- <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="0,-1" stop="0,-1"/>
- <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="1,0" stop="1,-1"/>
- <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="1,0" stop="1,0"/>
- <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="1,-1" stop="1,-1"/>
- <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="2,0" stop="2,-1"/>
- <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="2,0" stop="2,0"/>
- <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="2,-1" stop="2,-1"/>
- <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="3,0" stop="3,-1"/>
- <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="3,0" stop="3,0"/>
- <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="3,-1" stop="3,-1"/>
- <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="4,0" stop="4,-1"/>
- <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="4,0" stop="4,0"/>
- <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="4,-1" stop="4,-1"/>
- <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="5,0" stop="5,-1"/>
- <lineStyle kind="LINEAFTER" colorName="#b3b3b3" start="5,0" stop="5,-1"/>
- <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="5,0" stop="5,0"/>
- <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="5,-1" stop="5,-1"/>
- </blockTableStyle>
- <blockTableStyle id="Heading1">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="0,0" stop="0,0"/>
- <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="0,-1" stop="0,-1"/>
- <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="1,0" stop="1,-1"/>
- <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="1,0" stop="1,0"/>
- <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="1,-1" stop="1,-1"/>
- <lineStyle kind="LINEBEFORE" colorName="#b3b3b3" start="2,0" stop="2,-1"/>
- <lineStyle kind="LINEABOVE" colorName="#b3b3b3" start="2,0" stop="2,0"/>
- <lineStyle kind="LINEBELOW" colorName="#b3b3b3" start="2,-1" stop="2,-1"/>
- </blockTableStyle>
- <blockTableStyle id="Table2">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Table6">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Table1">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
- <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
- <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
- <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="2,0" stop="2,-1"/>
- <lineStyle kind="LINEABOVE" colorName="#cccccc" start="2,0" stop="2,0"/>
- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="2,-1" stop="2,-1"/>
- </blockTableStyle>
- <blockTableStyle id="Table3">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <initialize>
- <paraStyle name="all" alignment="justify"/>
- </initialize>
- <paraStyle name="P1" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="P2" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="P3" fontName="Helvetica-Bold" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="P4" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="P5" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="Standard" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
- <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="Text body" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="List" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Caption" fontName="Helvetica-Oblique" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
- <paraStyle name="Index" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
- <paraStyle name="Table Contents" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Table Heading" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="Footer" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
- <paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" alignment="LEFT" spaceBefore="0.0" spaceAfter="14.0"/>
- <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_1" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_8_Italic" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="Drawing" fontName="Helvetica-Oblique" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
- <paraStyle name="Header" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
- <paraStyle name="Endnote" rightIndent="0.0" leftIndent="14.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT"/>
- <paraStyle name="Addressee" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="3.0"/>
- <paraStyle name="Signature" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
- <paraStyle name="Heading 8" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="Heading 7" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="Heading 6" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="Heading 5" fontName="Helvetica-Bold" fontSize="85%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="Heading 4" fontName="Helvetica-BoldOblique" fontSize="85%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="Heading 1" fontName="Helvetica-Bold" fontSize="115%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="Heading 10" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="Heading 2" fontName="Helvetica-BoldOblique" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="First line indent" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Hanging indent" rightIndent="0.0" leftIndent="28.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Salutation" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
- <paraStyle name="Text body indent" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Heading 3" fontName="Helvetica-Bold" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="List Indent" rightIndent="0.0" leftIndent="142.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Marginalia" rightIndent="0.0" leftIndent="113.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="terp_default_9_with_indent_10" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_9_50" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <images/>
- </stylesheet>
- <story>
- <para style="P5">[[ repeatIn(objects,'voucher') ]]</para>
- <blockTable colWidths="524.0" style="Table4">
- <tr>
- <td>
- <para style="terp_header_Centre">[[ get_title(voucher.type) ]]</para>
- </td>
- </tr>
- </blockTable>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- <blockTable colWidths="63.0,200.0,52.0,210.0" style="Table7">
- <tr>
- <td>
- <para style="terp_tblheader_General">Journal:</para>
- </td>
- <td>
- <para style="terp_default_9">[[ voucher.type ]]</para>
- </td>
- <td>
- <para style="terp_tblheader_General">Number:</para>
- </td>
- <td>
- <para style="terp_default_9">[[ voucher.number ]]</para>
- </td>
- </tr>
- </blockTable>
- <blockTable colWidths="63.0,72.0,44.0,84.0,52.0,210.0" style="Table8">
- <tr>
- <td>
- <para style="terp_tblheader_General">State:</para>
- </td>
- <td>
- <para style="P2">PRO-FORMA [[ ((voucher.state == 'proforma') or removeParentNode('para')) and '' ]]</para>
- <para style="P2">Draft[[ ((voucher.state == 'draft') or removeParentNode('para')) and '' ]]</para>
- <para style="P2">Canceled [[ ((voucher.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
- <para style="P2">Posted [[ ((voucher.state == 'posted') or removeParentNode('para')) and '' ]]</para>
- </td>
- <td>
- <para style="terp_tblheader_General">Ref. :</para>
- </td>
- <td>
- <para style="terp_default_9">[[ voucher.reference or '' ]]</para>
- </td>
- <td>
- <para style="terp_tblheader_General">Date:</para>
- </td>
- <td>
- <para style="terp_default_9">[[ formatLang(voucher.date , date=True) or '' ]]</para>
- </td>
- </tr>
- </blockTable>
- <para style="terp_default_8">
- <font color="white"> </font>
- </para>
- <blockTable colWidths="277.0,124.0,124.0" style="Heading1">
- <tr>
- <td>
- <para style="terp_tblheader_Details">Particulars</para>
- </td>
- <td>
- <para style="terp_tblheader_Details_Right">Debit</para>
- </td>
- <td>
- <para style="terp_tblheader_Details_Right">Credit</para>
- </td>
- </tr>
- </blockTable>
- <para style="terp_default_1">
- <font color="white"> </font>
- </para>
- <section>
- <para style="terp_default_8">[[ repeatIn(voucher.move_ids,'move_ids') ]] </para>
- <blockTable colWidths="276.0,126.0,123.0" style="Table2">
- <tr>
- <td>
- <para style="P3">[[ (move_ids.partner_id and move_ids.partner_id.name) or 'Account']] </para>
- </td>
- <td>
- <para style="terp_default_Right_9">[[ formatLang(move_ids.debit) ]]</para>
- </td>
- <td>
- <para style="terp_default_Right_9">[[ formatLang(move_ids.credit) ]]</para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="P4">[[ move_ids.account_id.name ]] </para>
- </td>
- <td>
- <para style="terp_default_Right_9">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_default_Right_9">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="terp_default_8_Italic">[[ move_ids.name ]] - [[ get_ref(voucher.id,move_ids) ]]</para>
- </td>
- <td>
- <para style="terp_default_9_50">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_default_9_50">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- </blockTable>
- <para style="terp_default_1">
- <font color="white"> </font>
- </para>
- </section>
- <para style="terp_default_1">
- <font color="white"> </font>
- </para>
- <blockTable colWidths="276.0,126.0,123.0" style="Table6">
- <tr>
- <td>
- <para style="terp_tblheader_Details">Through : </para>
- </td>
- <td>
- <para style="terp_tblheader_Details">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_tblheader_Details">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="terp_default_9">[[ voucher.narration or '']]</para>
- </td>
- <td>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="terp_tblheader_Details">On Account of : </para>
- </td>
- <td>
- <para style="terp_tblheader_Details">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_tblheader_Details">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="terp_default_9">[[ voucher.name ]]</para>
- </td>
- <td>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="terp_tblheader_Details">Amount (in words) : </para>
- </td>
- <td>
- <para style="terp_tblheader_Details">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_tblheader_Details">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="terp_default_9">[[ convert(voucher.amount,voucher.currency_id.name) ]]</para>
- </td>
- <td>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- </blockTable>
- <para style="terp_default_1">
- <font color="white"> </font>
- </para>
- <blockTable colWidths="276.0,127.0,122.0" style="Table1">
- <tr>
- <td>
- <para style="P1">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_default_Right_9_Bold">[[ debit(voucher.move_ids)]]</para>
- </td>
- <td>
- <para style="terp_default_Right_9_Bold">[[ credit(voucher.move_ids) ]]</para>
- </td>
- </tr>
- </blockTable>
- <para style="terp_default_1">
- <font color="white"> </font>
- </para>
- <blockTable colWidths="157.0,119.0,126.0,123.0" style="Table3">
- <tr>
- <td>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="terp_default_9">Receiver's Signature</para>
- </td>
- <td>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_default_Right_9">Authorised Signatory</para>
- </td>
- </tr>
- </blockTable>
- <para style="terp_default_8">
- <font color="white"> </font>
- </para>
- </story>
-</document>
+++ /dev/null
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-import time
-from report import report_sxw
-from tools import amount_to_text_en
-
-class report_voucher_print(report_sxw.rml_parse):
- def __init__(self, cr, uid, name, context):
- super(report_voucher_print, self).__init__(cr, uid, name, context)
- self.localcontext.update({
- 'time': time,
- 'get_title': self.get_title,
- 'get_lines':self.get_lines,
- 'get_on_account':self.get_on_account,
- 'convert':self.convert
- })
-
- def convert(self, amount, cur):
- amt_en = amount_to_text_en.amount_to_text(amount, 'en', cur);
- return amt_en
-
- def get_lines(self,voucher):
- result = []
- if voucher.type in ('payment','receipt'):
- type = voucher.line_ids and voucher.line_ids[0].type or False
- for move in voucher.move_ids:
- res = {}
- amount = move.credit
- if type == 'dr':
- amount = move.debit
- if amount > 0.0:
- res['pname'] = move.partner_id.name
- res['ref'] = 'Agst Ref'+" "+str(move.name)
- res['aname'] = move.account_id.name
- res['amount'] = amount
- result.append(res)
- else:
- type = voucher.line_ids and voucher.line_ids[0].type or False
- for move in voucher.move_ids:
- res = {}
- amount = move.credit
- if type == 'dr':
- amount = move.debit
- if amount > 0.0:
- res['pname'] = move.partner_id.name
- res['ref'] = move.name
- res['aname'] = move.account_id.name
- res['amount'] = amount
- result.append(res)
- return result
-
- def get_title(self, type):
- title = ''
- if type:
- title = type[0].swapcase() + type[1:] + " Voucher"
- return title
-
- def get_on_account(self, voucher):
- name = ""
- if voucher.type == 'receipt':
- name = "Received cash from "+str(voucher.partner_id.name)
- elif voucher.type == 'payment':
- name = "Payment from "+str(voucher.partner_id.name)
- elif voucher.type == 'sale':
- name = "Sale to "+str(voucher.partner_id.name)
- elif voucher.type == 'purchase':
- name = "Purchase from "+str(voucher.partner_id.name)
- return name
-
-report_sxw.report_sxw(
- 'report.voucher.print',
- 'account.voucher',
- 'addons/account_voucher/report/report_voucher_print.rml',
- parser=report_voucher_print,header="external"
-)
+++ /dev/null
-<?xml version="1.0"?>
-<document filename="test.pdf">
- <template pageSize="(595.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
- <pageTemplate id="first">
- <frame id="first" x1="28.0" y1="42.0" width="525" height="772"/>
- </pageTemplate>
- </template>
- <stylesheet>
- <blockTableStyle id="Standard_Outline">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Table6">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Table2">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Table4">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Heading1">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
- <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
- <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
- </blockTableStyle>
- <blockTableStyle id="Table7">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="last_info">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <blockTableStyle id="Table3">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- <lineStyle kind="LINEABOVE" colorName="#cccccc" start="0,0" stop="0,0"/>
- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="0,-1" stop="0,-1"/>
- <lineStyle kind="LINEBEFORE" colorName="#cccccc" start="1,0" stop="1,-1"/>
- <lineStyle kind="LINEABOVE" colorName="#cccccc" start="1,0" stop="1,0"/>
- <lineStyle kind="LINEBELOW" colorName="#cccccc" start="1,-1" stop="1,-1"/>
- </blockTableStyle>
- <blockTableStyle id="Table5">
- <blockAlignment value="LEFT"/>
- <blockValign value="TOP"/>
- </blockTableStyle>
- <initialize>
- <paraStyle name="all" alignment="justify"/>
- </initialize>
- <paraStyle name="P1" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
- <paraStyle name="P2" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="P3" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="P4" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="P5" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="Standard" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
- <paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="Text body" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="List" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Caption" fontName="Helvetica-Oblique" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
- <paraStyle name="Index" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
- <paraStyle name="Table Contents" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Table Heading" fontName="Helvetica" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="terp_header" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_Bold_8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_Bold_9" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_tblheader_General" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_tblheader_General_Centre" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_Centre_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_tblheader_Details" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="Footer" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
- <paraStyle name="Horizontal Line" fontName="Helvetica" fontSize="6.0" leading="8" alignment="LEFT" spaceBefore="0.0" spaceAfter="14.0"/>
- <paraStyle name="Heading 9" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="terp_tblheader_General_Right" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_tblheader_Details_Centre" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_tblheader_Details_Right" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_Right_8" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_header_Right" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_header_Centre" fontName="Helvetica-Bold" fontSize="12.0" leading="15" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_address" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_Centre_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="CENTER" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_Right_9" fontName="Helvetica" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_1" fontName="Helvetica" fontSize="2.0" leading="3" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_Right_9_Bold" fontName="Helvetica-Bold" fontSize="9.0" leading="11" alignment="RIGHT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_8_Italic" fontName="Helvetica-Oblique" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="Drawing" fontName="Helvetica-Oblique" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="6.0" spaceAfter="6.0"/>
- <paraStyle name="Header" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
- <paraStyle name="Endnote" rightIndent="0.0" leftIndent="14.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT"/>
- <paraStyle name="Addressee" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="3.0"/>
- <paraStyle name="Signature" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
- <paraStyle name="Heading 8" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="Heading 7" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="Heading 6" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="Heading 5" fontName="Helvetica-Bold" fontSize="85%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="Heading 4" fontName="Helvetica-BoldOblique" fontSize="85%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="Heading 1" fontName="Helvetica-Bold" fontSize="115%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="Heading 10" fontName="Helvetica-Bold" fontSize="75%" leading="NaN" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="Heading 2" fontName="Helvetica-BoldOblique" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="First line indent" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Hanging indent" rightIndent="0.0" leftIndent="28.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Salutation" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
- <paraStyle name="Text body indent" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Heading 3" fontName="Helvetica-Bold" fontSize="14.0" leading="17" alignment="LEFT" spaceBefore="12.0" spaceAfter="6.0"/>
- <paraStyle name="List Indent" rightIndent="0.0" leftIndent="142.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="Marginalia" rightIndent="0.0" leftIndent="113.0" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
- <paraStyle name="terp_default_9_30" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_9_50" rightIndent="0.0" leftIndent="14.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_9_50_italic" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica-Oblique" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <paraStyle name="terp_default_9_30cm" rightIndent="0.0" leftIndent="9.0" fontName="Helvetica" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="0.0"/>
- <images/>
- </stylesheet>
- <story>
- <para style="P5">[[ repeatIn(objects,'voucher') ]]</para>
- <blockTable colWidths="524.0" style="Table6">
- <tr>
- <td>
- <para style="terp_header_Centre">[[ get_title(voucher.type) ]]</para>
- </td>
- </tr>
- </blockTable>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- <blockTable colWidths="52.0,123.0,50.0,198.0,42.0,59.0" style="Table2">
- <tr>
- <td>
- <para style="terp_tblheader_General">Number:</para>
- </td>
- <td>
- <para style="terp_default_9">[[ voucher.number ]]</para>
- </td>
- <td>
- <para style="terp_default_Bold_9">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_tblheader_General">Date:</para>
- </td>
- <td>
- <para style="terp_default_Right_9">[[ formatLang(voucher.date , date=True) or '' ]]</para>
- </td>
- </tr>
- </blockTable>
- <blockTable colWidths="52.0,123.0,50.0,198.0,42.0,59.0" style="Table4">
- <tr>
- <td>
- <para style="terp_tblheader_Details">State:</para>
- </td>
- <td>
- <para style="P4">PRO-FORMA [[ ((voucher.state == 'proforma') or removeParentNode('para')) and '' ]]</para>
- <para style="P4">Draft[[ ((voucher.state == 'draft') or removeParentNode('para')) and '' ]]</para>
- <para style="P4">Canceled [[ ((voucher.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
- <para style="P4">Posted [[ ((voucher.state == 'posted') or removeParentNode('para')) and '' ]]</para>
- </td>
- <td>
- <para style="terp_default_Bold_9">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="P2">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_tblheader_General">Currency:</para>
- </td>
- <td>
- <para style="terp_default_Right_9">[[ voucher.currency_id.code ]]</para>
- </td>
- </tr>
- </blockTable>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- <blockTable colWidths="381.0,144.0" style="Heading1">
- <tr>
- <td>
- <para style="terp_tblheader_Details">Particulars</para>
- </td>
- <td>
- <para style="terp_tblheader_Details_Right">Amount</para>
- </td>
- </tr>
- </blockTable>
- <para style="terp_default_1">
- <font color="white"> </font>
- </para>
- <section>
- <para style="terp_default_8">[[ repeatIn(get_lines(voucher),'p') ]] </para>
- <blockTable colWidths="380.0,144.0" style="Table7">
- <tr>
- <td>
- <para style="terp_default_Bold_9">Account :</para>
- </td>
- <td>
- <para style="terp_default_Right_9_Bold">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="terp_default_9_30cm">[[ p['pname'] ]]</para>
- </td>
- <td>
- <para style="terp_default_Right_9">[[ p['amount'] ]] [[ voucher.currency_id.symbol ]]</para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="terp_default_9_30cm">[[ p['ref'] ]] </para>
- </td>
- <td>
- <para style="terp_default_9_50">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="terp_default_9_30cm">Account : [[ p['aname'] ]] </para>
- </td>
- <td>
- <para style="terp_default_9_50">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- </blockTable>
- <para style="terp_default_1">
- <font color="white"> </font>
- </para>
- </section>
- <para style="terp_default_1">
- <font color="white"> </font>
- </para>
- <blockTable colWidths="380.0,144.0" style="last_info">
- <tr>
- <td>
- <para style="terp_default_Bold_9">Through : </para>
- </td>
- <td>
- <para style="terp_default_Bold_9">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="terp_default_9_30">[[ voucher.journal_id.name or '' ]] </para>
- </td>
- <td>
- <para style="terp_default_9_50_italic">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="terp_default_Bold_9">On Account of : </para>
- </td>
- <td>
- <para style="terp_default_Bold_9">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="terp_default_9_30">[[ get_on_account(voucher) ]]</para>
- </td>
- <td>
- <para style="terp_default_9_30">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="terp_default_Bold_9">Amount (in words) : </para>
- </td>
- <td>
- <para style="terp_default_Bold_9">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="terp_default_9_30">[[ convert(voucher.amount,voucher.currency_id.name) ]]</para>
- </td>
- <td>
- <para style="P3">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- </blockTable>
- <para style="terp_default_1">
- <font color="white"> </font>
- </para>
- <blockTable colWidths="380.0,144.0" style="Table3">
- <tr>
- <td>
- <para style="terp_default_Right_9_Bold">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_default_Right_9_Bold">[[ voucher.amount ]] [[ voucher.currency_id.symbol ]]</para>
- </td>
- </tr>
- </blockTable>
- <para style="terp_default_1">
- <font color="white"> </font>
- </para>
- <blockTable colWidths="154.0,108.0,118.0,144.0" style="Table5">
- <tr>
- <td>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- </td>
- </tr>
- <tr>
- <td>
- <para style="terp_default_9">Receiver's Signature</para>
- </td>
- <td>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_default_9">
- <font color="white"> </font>
- </para>
- </td>
- <td>
- <para style="terp_default_Right_9">Authorised Signatory</para>
- </td>
- </tr>
- </blockTable>
- <para style="P1">
- <font color="white"> </font>
- </para>
- </story>
-</document>
+++ /dev/null
-# -*- coding: utf-8 -*-
-##############################################################################
-#
-# OpenERP, Open Source Management Solution
-# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Affero General Public License as
-# published by the Free Software Foundation, either version 3 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 Affero General Public License for more details.
-#
-# You should have received a copy of the GNU Affero General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-#
-##############################################################################
-
-import time
-from lxml import etree
-
-import netsvc
-from osv import fields
-from osv import osv
-from tools.translate import _
-
-class account_move_line(osv.osv):
- _inherit = 'account.move.line'
- def _unreconciled(self, cr, uid, ids, prop, unknow_none, context):
- res={}
- for line in self.browse(cr, uid, ids, context=context):
- res[line.id] = line.debit - line.credit
- if line.reconcile_partial_id:
- res[line.id] = 0
- for partial in line.reconcile_partial_id.line_partial_ids:
- res[line.id] += partial.debit - partial.credit
- res[line.id] = abs(res[line.id])
- return res
-
- _columns = {
- 'amount_unreconciled': fields.function(_unreconciled, method=True, string='Unreconciled Amount'),
- }
-account_move_line()
-
-class account_voucher(osv.osv):
- def _get_type(self, cr, uid, ids, context={}):
- return context.get('type', False)
-
- def _get_period(self, cr, uid, context={}):
- if context.get('period_id', False):
- return context.get('period_id')
- periods = self.pool.get('account.period').find(cr, uid)
- return periods and periods[0] or False
-
- def _get_journal(self, cr, uid, context={}):
- journal_pool = self.pool.get('account.journal')
- if context.get('journal_id', False):
- return context.get('journal_id')
- if not context.get('journal_id', False) and context.get('search_default_journal_id', False):
- return context.get('search_default_journal_id')
-
- ttype = context.get('type', 'bank')
- if ttype in ('payment', 'receipt'):
- ttype = 'bank'
- res = journal_pool.search(cr, uid, [('type', '=', ttype)], limit=1)
- return res and res[0] or False
-
- def _get_tax(self, cr, uid, context={}):
- journal_pool = self.pool.get('account.journal')
- journal_id = context.get('journal_id', False)
- if not journal_id:
- ttype = context.get('type', 'bank')
- res = journal_pool.search(cr, uid, [('type', '=', ttype)], limit=1)
- if not res:
- return False
- journal_id = res[0]
-
- if not journal_id:
- return False
- journal = journal_pool.browse(cr, uid, journal_id)
- account_id = journal.default_credit_account_id or journal.default_debit_account_id
- if account_id and account_id.tax_ids:
- tax_id = account_id.tax_ids[0].id
- return tax_id
- return False
-
- def _get_currency(self, cr, uid, context):
- journal_pool = self.pool.get('account.journal')
- journal_id = context.get('journal_id', False)
- if journal_id:
- journal = journal_pool.browse(cr, uid, journal_id)
- currency_id = journal.company_id.currency_id.id
- if journal.currency:
- currency_id = journal.currency.id
- return False
-
- def _get_partner(self, cr, uid, context={}):
- return context.get('partner_id', False)
-
- def _get_reference(self, cr, uid, context={}):
- return context.get('reference', False)
-
- def _get_narration(self, cr, uid, context={}):
- return context.get('narration', False)
-
- def name_get(self, cr, uid, ids, context=None):
- if not len(ids):
- return []
- return [(r['id'], (str(r['amount']) or '')) for r in self.read(cr, uid, ids, ['amount'], context, load='_classic_write')]
-
- def fields_view_get(self, cr, uid, view_id=None, view_type=False, context=None, toolbar=False, submenu=False):
- res = super(account_voucher,self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=submenu)
- doc = etree.XML(res['arch'])
- nodes = doc.xpath("//field[@name='partner_id']")
- if context.get('type', 'sale') in ('purchase', 'payment'):
- for node in nodes:
- node.set('domain', "[('supplier', '=', True)]")
- res['arch'] = etree.tostring(doc)
- return res
-
- _name = 'account.voucher'
- _description = 'Accounting Voucher'
- _order = "date desc, id desc"
-# _rec_name = 'number'
- _columns = {
- 'type':fields.selection([
- ('sale','Sale'),
- ('purchase','Purchase'),
- ('payment','Payment'),
- ('receipt','Receipt'),
- ],'Default Type', readonly=True, states={'draft':[('readonly',False)]}),
- 'name':fields.char('Memo', size=256, readonly=True, states={'draft':[('readonly',False)]}),
- 'date':fields.date('Date', readonly=True, states={'draft':[('readonly',False)]}, help="Effective date for accounting entries"),
- 'journal_id':fields.many2one('account.journal', 'Journal', required=True, readonly=True, states={'draft':[('readonly',False)]}),
- 'account_id':fields.many2one('account.account', 'Account', required=True, readonly=True, states={'draft':[('readonly',False)]}),
- 'line_ids':fields.one2many('account.voucher.line','voucher_id','Voucher Lines', readonly=True, states={'draft':[('readonly',False)]}),
- 'line_cr_ids':fields.one2many('account.voucher.line','voucher_id','Credits',
- domain=[('type','=','cr')], context={'default_type':'cr'}, readonly=True, states={'draft':[('readonly',False)]}),
- 'line_dr_ids':fields.one2many('account.voucher.line','voucher_id','Debits',
- domain=[('type','=','dr')], context={'default_type':'dr'}, readonly=True, states={'draft':[('readonly',False)]}),
- 'period_id': fields.many2one('account.period', 'Period', required=True, readonly=True, states={'draft':[('readonly',False)]}),
- 'narration':fields.text('Notes', readonly=True, states={'draft':[('readonly',False)]}),
- 'currency_id':fields.many2one('res.currency', 'Currency', readonly=True, states={'draft':[('readonly',False)]}),
-# 'currency_id': fields.related('journal_id','currency', type='many2one', relation='res.currency', string='Currency', store=True, readonly=True, states={'draft':[('readonly',False)]}),
- 'company_id': fields.many2one('res.company', 'Company', required=True, readonly=True, states={'draft':[('readonly',False)]}),
- 'state':fields.selection(
- [('draft','Draft'),
- ('proforma','Pro-forma'),
- ('posted','Posted'),
- ('cancel','Cancelled')
- ], 'State', readonly=True, size=32,
- help=' * The \'Draft\' state is used when a user is encoding a new and unconfirmed Voucher. \
- \n* The \'Pro-forma\' when voucher is in Pro-forma state,voucher does not have an voucher number. \
- \n* The \'Posted\' state is used when user create voucher,a voucher number is generated and voucher entries are created in account \
- \n* The \'Cancelled\' state is used when user cancel voucher.'),
- 'amount': fields.float('Total', digits=(16, 2), required=True, readonly=True, states={'draft':[('readonly',False)]}),
- 'tax_amount':fields.float('Tax Amount', digits=(14,2), readonly=True, states={'draft':[('readonly',False)]}),
- 'reference': fields.char('Ref #', size=64, readonly=True, states={'draft':[('readonly',False)]}, help="Transaction reference number."),
- 'number': fields.char('Number', size=32, readonly=True,),
- 'move_id':fields.many2one('account.move', 'Account Entry'),
- 'move_ids': fields.related('move_id','line_id', type='one2many', relation='account.move.line', string='Journal Items', readonly=True),
- 'partner_id':fields.many2one('res.partner', 'Partner', change_default=1, readonly=True, states={'draft':[('readonly',False)]}),
- 'audit': fields.related('move_id','to_check', type='boolean', relation='account.move', string='Audit Complete ?'),
- 'pay_now':fields.selection([
- ('pay_now','Pay Directly'),
- ('pay_later','Pay Later or Group Funds'),
- ],'Payment', select=True, readonly=True, states={'draft':[('readonly',False)]}),
- 'tax_id':fields.many2one('account.tax', 'Tax', readonly=True, states={'draft':[('readonly',False)]}),
- 'pre_line':fields.boolean('Previous Payments ?', required=False),
- 'date_due': fields.date('Due Date', readonly=True, states={'draft':[('readonly',False)]}),
- }
- _defaults = {
- 'period_id': _get_period,
- 'partner_id': _get_partner,
- 'journal_id':_get_journal,
- 'currency_id': _get_currency,
- 'reference': _get_reference,
- 'narration':_get_narration,
- 'type':_get_type,
- 'state': 'draft',
- 'pay_now': 'pay_later',
- 'name': '',
- 'date' : time.strftime('%Y-%m-%d'),
- 'company_id': lambda self,cr,uid,c: self.pool.get('res.company')._company_default_get(cr, uid, 'account.voucher',context=c),
- 'tax_id': _get_tax,
- }
-
- def compute_tax(self, cr, uid, ids, context={}):
- tax_pool = self.pool.get('account.tax')
- partner_pool = self.pool.get('res.partner')
- position_pool = self.pool.get('account.fiscal.position')
- voucher_line_pool = self.pool.get('account.voucher.line')
- voucher_pool = self.pool.get('account.voucher')
-
- for voucher in voucher_pool.browse(cr, uid, ids, context):
- voucher_amount = 0.0
- for line in voucher.line_ids:
- voucher_amount += line.untax_amount or line.amount
- line.amount = line.untax_amount or line.amount
- voucher_line_pool.write(cr, uid, [line.id], {'amount':line.amount, 'untax_amount':line.untax_amount})
-
- if not voucher.tax_id:
- self.write(cr, uid, [voucher.id], {'amount':voucher_amount, 'tax_amount':0.0})
- continue
-
- tax = [tax_pool.browse(cr, uid, voucher.tax_id.id)]
- partner = partner_pool.browse(cr, uid, voucher.partner_id.id) or False
- taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)
- tax = tax_pool.browse(cr, uid, taxes)
-
- total = voucher_amount
- total_tax = 0.0
-
- if not tax[0].price_include:
- for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_amount, 1).get('taxes',[]):
- total_tax += tax_line.get('amount')
- total += total_tax
- else:
- line_ids2 = []
- for line in voucher.line_ids:
- line_total = 0.0
- line_tax = 0.0
-
- for tax_line in tax_pool.compute_all(cr, uid, tax, line.untax_amount or line.amount, 1).get('taxes',[]):
- line_tax += tax_line.get('amount')
- line_total += tax_line.get('price_unit')
- total_tax += line_tax
- untax_amount = line.untax_amount or line.amount
- voucher_line_pool.write(cr, uid, [line.id], {'amount':line_total, 'untax_amount':untax_amount})
-
- self.write(cr, uid, [voucher.id], {'amount':total, 'tax_amount':total_tax})
- return True
-
- def onchange_price(self, cr, uid, ids, line_ids, tax_id, partner_id=False, context={}):
- tax_pool = self.pool.get('account.tax')
- partner_pool = self.pool.get('res.partner')
- position_pool = self.pool.get('account.fiscal.position')
- voucher_line_pool = self.pool.get('account.voucher.line')
- res = {
- 'tax_amount':False,
- 'amount':False,
- }
- voucher_total_tax = 0.0
- voucher_total = 0.0
- voucher_line_ids = []
-
- total = 0.0
- total_tax = 0.0
-
- for line in line_ids:
- line_amount = 0.0
- line_amount = line[2].get('amount')
- voucher_line_ids += [line[1]]
- voucher_total += line_amount
-
- total = voucher_total
- total_tax = 0.0
- if tax_id:
- tax = [tax_pool.browse(cr, uid, tax_id)]
- if partner_id:
- partner = partner_pool.browse(cr, uid, partner_id) or False
- taxes = position_pool.map_tax(cr, uid, partner and partner.property_account_position or False, tax)
- tax = tax_pool.browse(cr, uid, taxes)
-
- if not tax[0].price_include:
- for tax_line in tax_pool.compute_all(cr, uid, tax, voucher_total, 1).get('taxes',[]):
- total_tax += tax_line.get('amount')
- total += total_tax
-
- res.update({
- 'amount':total or voucher_total,
- 'tax_amount':total_tax
- })
- return {
- 'value':res
- }
-
- def onchange_term_id(self, cr, uid, ids, term_id, amount):
- term_pool = self.pool.get('account.payment.term')
- terms = False
- due_date = False
- default = {'date_due':False}
- if term_id and amount:
- terms = term_pool.compute(cr, uid, term_id, amount)
- if terms:
- due_date = terms[-1][0]
- default.update({
- 'date_due':due_date
- })
- return {'value':default}
-
- def onchange_journal_voucher(self, cr, uid, ids, line_ids=False, tax_id=False, price=0.0, partner_id=False, journal_id=False, ttype=False, context={}):
- """price
- Returns a dict that contains new values and context
-
- @param partner_id: latest value from user input for field partner_id
- @param args: other arguments
- @param context: context arguments, like lang, time zone
-
- @return: Returns a dict which contains new values, and context
- """
- default = {
- 'value':{},
- }
-
- if not partner_id or not journal_id:
- return default
-
- partner_pool = self.pool.get('res.partner')
- journal_pool = self.pool.get('account.journal')
-
- journal = journal_pool.browse(cr, uid, journal_id)
- partner = partner_pool.browse(cr, uid, partner_id)
- account_id = False
- tr_type = False
- if journal.type in ('sale','sale_refund'):
- account_id = partner.property_account_receivable.id
- tr_type = 'sale'
- elif journal.type in ('purchase', 'purchase_refund','expense'):
- account_id = partner.property_account_payable.id
- tr_type = 'purchase'
- else:
- account_id = journal.default_credit_account_id.id or journal.default_debit_account_id.id
- tr_type = 'receipt'
-
- default['value']['account_id'] = account_id
- default['value']['type'] = ttype or tr_type
-
- vals = self.onchange_journal(cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context)
- default['value'].update(vals.get('value'))
-
- return default
-
- def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, context={}):
- """price
- Returns a dict that contains new values and context
-
- @param partner_id: latest value from user input for field partner_id
- @param args: other arguments
- @param context: context arguments, like lang, time zone
-
- @return: Returns a dict which contains new values, and context
- """
- if not journal_id:
- return {}
-
- currency_pool = self.pool.get('res.currency')
- move_pool = self.pool.get('account.move')
- line_pool = self.pool.get('account.voucher.line')
- move_line_pool = self.pool.get('account.move.line')
- partner_pool = self.pool.get('res.partner')
- journal_pool = self.pool.get('account.journal')
-
- vals = self.onchange_journal(cr, uid, ids, journal_id, [], False, partner_id, context)
- vals = vals.get('value')
- currency_id = vals.get('currency_id', currency_id)
- default = {
- 'value':{'line_ids':[], 'line_dr_ids':[], 'line_cr_ids':[], 'pre_line': False, 'currency_id':currency_id},
- }
-
- if not partner_id:
- return default
-
- if not partner_id and ids:
- line_ids = line_pool.search(cr, uid, [('voucher_id','=',ids[0])])
- if line_ids:
- line_pool.unlink(cr, uid, line_ids)
- return default
-
- journal = journal_pool.browse(cr, uid, journal_id)
- partner = partner_pool.browse(cr, uid, partner_id)
- account_id = False
- if journal.type in ('sale','sale_refund'):
- account_id = partner.property_account_receivable.id
- elif journal.type in ('purchase', 'purchase_refund','expense'):
- account_id = partner.property_account_payable.id
- else:
- account_id = journal.default_credit_account_id.id or journal.default_debit_account_id.id
-
- default['value']['account_id'] = account_id
- if journal.type not in ('cash', 'bank'):
- return default
-
- total_credit = 0.0
- total_debit = 0.0
- account_type = 'receivable'
- if ttype == 'payment':
- account_type = 'payable'
- total_debit = price or 0.0
- else:
- total_credit = price or 0.0
- account_type = 'receivable'
- ids = move_line_pool.search(cr, uid, [('account_id.type','=', account_type), ('reconcile_id','=', False), ('partner_id','=',partner_id)], context=context)
- ids.reverse()
- moves = move_line_pool.browse(cr, uid, ids)
-
- company_currency = journal.company_id.currency_id.id
- if company_currency != currency_id and ttype == 'payment':
- total_debit = currency_pool.compute(cr, uid, currency_id, company_currency, total_debit)
- elif company_currency != currency_id and ttype == 'receipt':
- total_credit = currency_pool.compute(cr, uid, currency_id, company_currency, total_credit)
-
- for line in moves:
- if line.credit and line.reconcile_partial_id and ttype == 'receipt':
- continue
- if line.debit and line.reconcile_partial_id and ttype == 'payment':
- continue
- total_credit += line.credit or 0.0
- total_debit += line.debit or 0.0
-
- for line in moves:
- if line.credit and line.reconcile_partial_id and ttype == 'receipt':
- continue
- if line.debit and line.reconcile_partial_id and ttype == 'payment':
- continue
-
- orignal_amount = line.credit or line.debit or 0.0
- rs = {
- 'name':line.move_id.name,
- 'type': line.credit and 'dr' or 'cr',
- 'move_line_id':line.id,
- 'account_id':line.account_id.id,
- 'amount_original':currency_pool.compute(cr, uid, company_currency, currency_id, orignal_amount),
- 'date_original':line.date,
- 'date_due':line.date_maturity,
- 'amount_unreconciled':currency_pool.compute(cr, uid, company_currency, currency_id, line.amount_unreconciled)
- }
- if line.credit:
- amount = min(line.amount_unreconciled, total_debit)
- rs['amount'] = currency_pool.compute(cr, uid, company_currency, currency_id, amount)
- total_debit -= amount
- else:
- amount = min(line.amount_unreconciled, total_credit)
- rs['amount'] = currency_pool.compute(cr, uid, company_currency, currency_id, amount)
- total_credit -= amount
-
- default['value']['line_ids'].append(rs)
- if rs['type'] == 'cr':
- default['value']['line_cr_ids'].append(rs)
- else:
- default['value']['line_dr_ids'].append(rs)
-
- if ttype == 'payment' and len(default['value']['line_cr_ids']) > 0:
- default['value']['pre_line'] = 1
- elif ttype == 'receipt' and len(default['value']['line_dr_ids']) > 0:
- default['value']['pre_line'] = 1
- return default
-
- def onchange_date(self, cr, user, ids, date, context={}):
- """
- @param date: latest value from user input for field date
- @param args: other arguments
- @param context: context arguments, like lang, time zone
- @return: Returns a dict which contains new values, and context
- """
- period_pool = self.pool.get('account.period')
- pids = period_pool.search(cr, user, [('date_start','<=',date), ('date_stop','>=',date)])
- if not pids:
- return {}
- return {
- 'value':{
- 'period_id':pids[0]
- }
- }
-
- def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context={}):
- if not journal_id:
- return False
- journal_pool = self.pool.get('account.journal')
- journal = journal_pool.browse(cr, uid, journal_id)
- account_id = journal.default_credit_account_id or journal.default_debit_account_id
- tax_id = False
- if account_id and account_id.tax_ids:
- tax_id = account_id.tax_ids[0].id
-
- vals = self.onchange_price(cr, uid, ids, line_ids, tax_id, partner_id, context)
- vals['value'].update({'tax_id':tax_id})
- currency_id = journal.company_id.currency_id.id
- if journal.currency:
- currency_id = journal.currency.id
- vals['value'].update({'currency_id':currency_id})
- return vals
-
- def proforma_voucher(self, cr, uid, ids, context=None):
- self.action_move_line_create(cr, uid, ids, context=context)
- return True
-
- def action_cancel_draft(self, cr, uid, ids, context={}):
- wf_service = netsvc.LocalService("workflow")
- for voucher_id in ids:
- wf_service.trg_create(uid, 'account.voucher', voucher_id, cr)
- self.write(cr, uid, ids, {'state':'draft'})
- return True
-
- def cancel_voucher(self, cr, uid, ids, context={}):
- reconcile_pool = self.pool.get('account.move.reconcile')
- move_pool = self.pool.get('account.move')
- voucher_line_pool = self.pool.get('account.voucher.line')
-
- for voucher in self.browse(cr, uid, ids):
- recs = []
- for line in voucher.move_ids:
- if line.reconcile_id:
- recs += [line.reconcile_id.id]
- if line.reconcile_partial_id:
- recs += [line.reconcile_partial_id.id]
-
- reconcile_pool.unlink(cr, uid, recs)
-
- if voucher.move_id:
- move_pool.button_cancel(cr, uid, [voucher.move_id.id])
- move_pool.unlink(cr, uid, [voucher.move_id.id])
- res = {
- 'state':'cancel',
- 'move_id':False,
- }
- self.write(cr, uid, ids, res)
- return True
-
- def unlink(self, cr, uid, ids, context=None):
- for t in self.read(cr, uid, ids, ['state'], context=context):
- if t['state'] not in ('draft', 'cancel'):
- raise osv.except_osv(_('Invalid action !'), _('Cannot delete Voucher(s) which are already opened or paid !'))
- return super(account_voucher, self).unlink(cr, uid, ids, context=context)
-
- # TODO: may be we can remove this method if not used anyware
- def onchange_payment(self, cr, uid, ids, pay_now, journal_id, partner_id, ttype='sale'):
- res = {}
- if not partner_id:
- return res
- res = {'account_id':False}
- partner_pool = self.pool.get('res.partner')
- journal_pool = self.pool.get('account.journal')
- if pay_now == 'pay_later':
- partner = partner_pool.browse(cr, uid, partner_id)
- journal = journal_pool.browse(cr, uid, journal_id)
- if journal.type in ('sale','sale_refund'):
- account_id = partner.property_account_receivable.id
- elif journal.type in ('purchase', 'purchase_refund','expense'):
- account_id = partner.property_account_payable.id
- else:
- account_id = journal.default_credit_account_id.id or journal.default_debit_account_id.id
- res['account_id'] = account_id
- return {'value':res}
-
- def action_move_line_create(self, cr, uid, ids, context=None):
-
- def _get_payment_term_lines(term_id, amount):
- term_pool = self.pool.get('account.payment.term')
- if term_id and amount:
- terms = term_pool.compute(cr, uid, term_id, amount)
- return terms
- return False
- if not context:
- context = {}
- move_pool = self.pool.get('account.move')
- move_line_pool = self.pool.get('account.move.line')
- analytic_pool = self.pool.get('account.analytic.line')
- currency_pool = self.pool.get('res.currency')
- invoice_pool = self.pool.get('account.invoice')
- for inv in self.browse(cr, uid, ids):
- if inv.move_id:
- continue
- if inv.number:
- name = inv.number
- elif inv.journal_id.sequence_id:
- name = self.pool.get('ir.sequence').get_id(cr, uid, inv.journal_id.sequence_id.id)
- else:
- raise osv.except_osv(_('Error !'), _('Please define a sequence on the journal !'))
-
- move = {
- 'name' : name,
- 'journal_id': inv.journal_id.id,
- 'narration' : inv.narration,
- 'date':inv.date,
- 'ref':inv.reference,
- 'period_id': inv.period_id and inv.period_id.id or False
- }
- move_id = move_pool.create(cr, uid, move)
-
- #create the first line manually
- company_currency = inv.journal_id.company_id.currency_id.id
- debit = 0.0
- credit = 0.0
- # TODO: is there any other alternative then the voucher type ??
- # -for sale, purchase we have but for the payment and receipt we do not have as based on the bank/cash journal we can not know its payment or receipt
- if inv.type in ('purchase', 'payment'):
- credit = currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.amount)
- elif inv.type in ('sale', 'receipt'):
- debit = currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.amount)
- if debit < 0:
- credit = -debit
- debit = 0.0
- if credit < 0:
- debit = -credit
- credit = 0.0
-
- move_line = {
- 'name':inv.name or '/',
- 'debit':debit,
- 'credit':credit,
- 'account_id':inv.account_id.id,
- 'move_id':move_id ,
- 'journal_id':inv.journal_id.id,
- 'period_id':inv.period_id.id,
- 'partner_id':inv.partner_id.id,
- 'currency_id':inv.currency_id.id,
- 'amount_currency':inv.amount,
- 'date':inv.date,
- 'date_maturity':inv.date_due
- }
-
- if (debit == 0.0 or credit == 0.0 or debit+credit > 0) and (debit > 0.0 or credit > 0.0):
- master_line = move_line_pool.create(cr, uid, move_line)
-
- rec_list_ids = []
- line_total = debit - credit
- if inv.type == 'sale':
- line_total = line_total - currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.tax_amount)
- elif inv.type == 'purchase':
- line_total = line_total + currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.tax_amount)
-
- for line in inv.line_ids:
- if not line.amount:
- continue
- amount = currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, line.amount)
-
- move_line = {
- 'journal_id':inv.journal_id.id,
- 'period_id':inv.period_id.id,
- 'name':line.name and line.name or '/',
- 'account_id':line.account_id.id,
- 'move_id':move_id,
- 'partner_id':inv.partner_id.id,
- 'currency_id':inv.currency_id.id,
- 'amount_currency':line.amount,
- 'analytic_account_id':line.account_analytic_id and line.account_analytic_id.id or False,
- 'quantity':1,
- 'credit':0.0,
- 'debit':0.0,
- 'date':inv.date
- }
- if amount < 0:
- amount = -amount
- if line.type == 'dr':
- line.type = 'cr'
- else:
- line.type = 'dr'
-
- if (line.type=='dr'):
- line_total += amount
- move_line['debit'] = amount
- else:
- line_total -= amount
- move_line['credit'] = amount
-
- if inv.tax_id and inv.type in ('sale', 'purchase'):
- move_line.update({
- 'account_tax_id':inv.tax_id.id,
- })
- master_line = move_line_pool.create(cr, uid, move_line)
- if line.move_line_id.id:
- rec_ids = [master_line, line.move_line_id.id]
- rec_list_ids.append(rec_ids)
-
- if not self.pool.get('res.currency').is_zero(cr, uid, inv.currency_id, line_total):
- diff = line_total
- move_line = {
- 'name':name,
- 'account_id':False,
- 'move_id':move_id ,
- 'partner_id':inv.partner_id.id,
- 'date':inv.date,
- 'credit':diff>0 and diff or 0.0,
- 'debit':diff<0 and -diff or 0.0,
- }
- account_id = False
- if inv.type in ('sale', 'receipt'):
-# if inv.journal_id.type in ('sale','sale_refund', 'cash', 'bank'):
- account_id = inv.partner_id.property_account_receivable.id
- else:
- account_id = inv.partner_id.property_account_payable.id
- move_line['account_id'] = account_id
- move_line_id = move_line_pool.create(cr, uid, move_line)
-
- self.write(cr, uid, [inv.id], {
- 'move_id': move_id,
- 'state': 'posted',
- 'number': name,
- })
- move_pool.post(cr, uid, [move_id], context={})
- for rec_ids in rec_list_ids:
- if len(rec_ids) >= 2:
- move_line_pool.reconcile_partial(cr, uid, rec_ids)
- return True
-
- def copy(self, cr, uid, id, default={}, context=None):
- default.update({
- 'state':'draft',
- 'number':False,
- 'move_id':False,
- 'line_cr_ids':False,
- 'line_dr_ids':False,
- 'reference':False
- })
- if 'date' not in default:
- default['date'] = time.strftime('%Y-%m-%d')
- return super(account_voucher, self).copy(cr, uid, id, default, context)
-
-account_voucher()
-
-class account_voucher_line(osv.osv):
- _name = 'account.voucher.line'
- _description = 'Voucher Lines'
- _order = "move_line_id"
-
- def _compute_balance(self, cr, uid, ids, name, args, context=None):
- currency_pool = self.pool.get('res.currency')
- rs_data = {}
- for line in self.browse(cr, uid, ids):
- res = {}
- company_currency = line.voucher_id.journal_id.company_id.currency_id.id
- voucher_currency = line.voucher_id.currency_id.id
- move_line = line.move_line_id or False
-
- if not move_line:
- res['amount_original'] = 0.0
- res['amount_unreconciled'] = 0.0
-
- elif move_line and move_line.credit > 0:
- res['amount_original'] = currency_pool.compute(cr, uid, company_currency, voucher_currency, move_line.credit)
- else:
- res['amount_original'] = currency_pool.compute(cr, uid, company_currency, voucher_currency, move_line.debit)
-
- if move_line:
- res['amount_unreconciled'] = currency_pool.compute(cr, uid, company_currency, voucher_currency, move_line.amount_unreconciled)
- rs_data[line.id] = res
- return rs_data
-
- _columns = {
- 'voucher_id':fields.many2one('account.voucher', 'Voucher', required=1, ondelete='cascade'),
- 'name':fields.char('Description', size=256),
- 'account_id':fields.many2one('account.account','Account', required=True),
- 'partner_id':fields.related('voucher_id', 'partner_id', type='many2one', relation='res.partner', string='Partner'),
- 'untax_amount':fields.float('Untax Amount'),
- 'amount':fields.float('Amount', digits=(14,2)),
- 'type':fields.selection([('dr','Debit'),('cr','Credit')], 'Cr/Dr'),
- 'account_analytic_id': fields.many2one('account.analytic.account', 'Analytic Account'),
- 'move_line_id': fields.many2one('account.move.line', 'Journal Item'),
- 'date_original': fields.related('move_line_id','date', type='date', relation='account.move.line', string='Date', readonly=1),
- 'date_due': fields.related('move_line_id','date_maturity', type='date', relation='account.move.line', string='Due Date', readonly=1),
- 'amount_original': fields.function(_compute_balance, method=True, multi='dc', type='float', string='Originial Amount', store=True),
- 'amount_unreconciled': fields.function(_compute_balance, method=True, multi='dc', type='float', string='Open Balance', store=True),
- 'company_id': fields.related('voucher_id','company_id', relation='res.company', string='Company', store=True),
- }
- _defaults = {
- 'name': lambda *a: ''
- }
-
- def onchange_move_line_id(self, cr, user, ids, move_line_id, context={}):
- """
- Returns a dict that contains new values and context
-
- @param move_line_id: latest value from user input for field move_line_id
- @param args: other arguments
- @param context: context arguments, like lang, time zone
-
- @return: Returns a dict which contains new values, and context
- """
- res = {}
- move_line_pool = self.pool.get('account.move.line')
- if move_line_id:
- move_line = move_line_pool.browse(cr, user, move_line_id, context=context)
- move_id = move_line.move_id.id
- if move_line.credit:
- ttype='dr'
- amount = move_line.credit
- else:
- ttype='cr'
- amount = move_line.debit
- account_id = move_line.account_id.id
- res.update({
- 'account_id':account_id,
- 'type': ttype
- })
- return {
- 'value':res,
- }
-
- def default_get(self, cr, user, fields_list, context=None):
- """
- Returns default values for fields
- @param fields_list: list of fields, for which default values are required to be read
- @param context: context arguments, like lang, time zone
-
- @return: Returns a dict that contains default values for fields
- """
- journal_id = context.get('journal_id', False)
- partner_id = context.get('partner_id', False)
- journal_pool = self.pool.get('account.journal')
- partner_pool = self.pool.get('res.partner')
- values = super(account_voucher_line, self).default_get(cr, user, fields_list, context=context)
- if (not journal_id) or ('account_id' not in fields_list):
- return values
- journal = journal_pool.browse(cr, user, journal_id)
- account_id = False
- ttype = 'cr'
- if journal.type in ('sale', 'sale_refund'):
- account_id = journal.default_credit_account_id and journal.default_credit_account_id.id or False
- ttype = 'cr'
- elif journal.type in ('purchase', 'expense', 'purchase_refund'):
- account_id = journal.default_debit_account_id and journal.default_debit_account_id.id or False
- ttype = 'dr'
- elif partner_id:
- partner = partner_pool.browse(cr, user, partner_id, context=context)
- if context.get('type') == 'payment':
- ttype = 'dr'
- account_id = partner.property_account_payable.id
- elif context.get('type') == 'receipt':
- account_id = partner.property_account_receivable.id
-
- if (not account_id) and 'account_id' in fields_list:
- raise osv.except_osv(_('Invalid Error !'), _('Please change partner and try again !'))
- values.update({
- 'account_id':account_id,
- 'type':ttype
- })
- return values
-account_voucher_line()
-
-class account_bank_statement(osv.osv):
- _inherit = 'account.bank.statement'
-
- def create_move_from_st_line(self, cr, uid, st_line_id, company_currency_id, next_number, context=None):
- st_line = self.pool.get('account.bank.statement.line').browse(cr, uid, st_line_id, context=context)
- if st_line.voucher_id:
- self.pool.get('account.voucher').write(cr, uid, [st_line.voucher_id.id], {'number': next_number}, context=context)
- wf_service = netsvc.LocalService("workflow")
- wf_service.trg_validate(uid, 'account.voucher', st_line.voucher_id.id, 'proforma_voucher', cr)
- return self.pool.get('account.move.line').write(cr, uid, [x.id for x in st_line.voucher_id.move_ids], {'statement_id': st_line.statement_id.id}, context=context)
- return super(account_bank_statement, self).create_move_from_st_line(cr, uid, st_line, company_currency_id, next_number, context=context)
-
-account_bank_statement()
-
-class account_bank_statement_line(osv.osv):
- _inherit = 'account.bank.statement.line'
-
- def _amount_reconciled(self, cursor, user, ids, name, args, context=None):
- if not ids:
- return {}
- res_currency_obj = self.pool.get('res.currency')
- res = {}
- company_currency_id = False
-
- for line in self.browse(cursor, user, ids, context=context):
- if not company_currency_id:
- company_currency_id = line.company_id.id
- if line.voucher_id:
- res[line.id] = res_currency_obj.compute(cursor, user,
- company_currency_id, line.statement_id.currency.id,
- line.voucher_id.amount, context=context)
- else:
- res[line.id] = 0.0
- return res
-
- _columns = {
- 'amount_reconciled': fields.function(_amount_reconciled,
- string='Amount reconciled', method=True, type='float'),
- 'voucher_id': fields.many2one('account.voucher', 'Payment'),
-
- }
-
- def unlink(self, cr, uid, ids, context=None):
- statement_line = self.browse(cr, uid, ids, context)
- unlink_ids = []
- for st_line in statement_line:
- unlink_ids.append(st_line.voucher_id.id)
- self.pool.get('account.voucher').unlink(cr, uid, unlink_ids, context=context)
- return super(account_bank_statement_line, self).unlink(cr, uid, ids, context=context)
-
-account_bank_statement_line()
+++ /dev/null
-<?xml version="1.0"?>
-<openerp>
- <data>
- <report id="report_account_voucher"
- string="Voucher"
- model="account.voucher"
- name="voucher.cash_receipt.drcr"
- rml="account_voucher/report/report_voucher.rml"
- groups="base.group_extended"
- auto="False"
- header = "False"
- menu="True"/>
-
- <report id="report_account_voucher_print"
- string="Voucher Print"
- model="account.voucher"
- name="voucher.print"
- rml="account_voucher/report/report_voucher_print.rml"
- auto="False"
- header = "False"
- menu="True"/>
-
- </data>
-</openerp>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<openerp>
- <data noupdate="1">
- <record model="res.request.link" id="req_link_voucher">
- <field name="name">Voucher</field>
- <field name="object">account.voucher</field>
- </record>
- <!--
- Sequences types for vouchers
- -->
- <record model="ir.sequence.type" id="seq_type_cash_rec_voucher">
- <field name="name">Cash Receipt</field>
- <field name="code">rec_voucher</field>
- </record>
-
- <record model="ir.sequence.type" id="seq_type_cash_pay_voucher">
- <field name="name">Cash Payment</field>
- <field name="code">pay_voucher</field>
- </record>
- <record model="ir.sequence.type" id="seq_type_bank_rec_voucher">
- <field name="name">Bank Receipt</field>
- <field name="code">bank_rec_voucher</field>
- </record>
- <record model="ir.sequence.type" id="seq_type_bank_pay_voucher">
- <field name="name">Bank Payment</field>
- <field name="code">bank_pay_voucher</field>
- </record>
- <record model="ir.sequence.type" id="seq_type_contra_voucher">
- <field name="name">Contra Entry</field>
- <field name="code">cont_voucher</field>
- </record>
- <record model="ir.sequence.type" id="seq_type_jou_sale_voucher">
- <field name="name">Sales Entry</field>
- <field name="code">journal_sale_vou</field>
- </record>
- <record model="ir.sequence.type" id="seq_type_jou_pur_voucher">
- <field name="name">Purchase Entry</field>
- <field name="code">journal_pur_vou</field>
- </record>
-
- <!--
- Sequences for vouchers
- -->
- <record model="ir.sequence" id="seq_cash_rec_voucher">
- <field name="name">Cash Receipt</field>
- <field name="code">rec_voucher</field>
- <field name="padding" eval="3"/>
- <field name="prefix">%(year)s/</field>
- </record>
-
- <record model="ir.sequence" id="seq_cash_pay_voucher">
- <field name="name">Cash Payment</field>
- <field name="code">pay_voucher</field>
- <field name="padding" eval="3"/>
- <field name="prefix">%(year)s/</field>
- </record>
- <record model="ir.sequence" id="seq_bank_rec_voucher">
- <field name="name">Bank Receipt</field>
- <field name="code">bank_rec_voucher</field>
- <field name="padding" eval="3"/>
- <field name="prefix">%(year)s/</field>
- </record>
- <record model="ir.sequence" id="seq_bank_pay_voucher">
- <field name="name">Bank Payment</field>
- <field name="code">bank_pay_voucher</field>
- <field name="padding" eval="3"/>
- <field name="prefix">%(year)s/</field>
- </record>
- <record model="ir.sequence" id="seq_contra_voucher">
- <field name="name">Contra Entry</field>
- <field name="code">cont_voucher</field>
- <field name="padding" eval="3"/>
- <field name="prefix">%(year)s/</field>
- </record>
- <record model="ir.sequence" id="seq_jou_sale_voucher">
- <field name="name">Sales Entry</field>
- <field name="code">journal_sale_vou</field>
- <field name="padding" eval="3"/>
- <field name="prefix">%(year)s/</field>
- </record>
- <record model="ir.sequence" id="seq_jou_pur_voucher">
- <field name="name">Purchase Entry</field>
- <field name="code">journal_pur_vou</field>
- <field name="padding" eval="3"/>
- <field name="prefix">%(year)s/</field>
- </record>
-
- </data>
-</openerp>
-
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<openerp>
- <data>
- <record model="ir.ui.view" id="view_voucher_tree">
- <field name="name">account.voucher.tree</field>
- <field name="model">account.voucher</field>
- <field name="type">tree</field>
- <field name="arch" type="xml">
- <tree colors="blue:state in ('draft');gray:state in ('cancel')" string="Voucher Entries">
- <field name="date"/>
- <field name="number"/>
- <field name="reference"/>
- <field name="partner_id"/>
- <field name="journal_id"/>
- <field name="period_id" groups="base.group_extended" invisible="context.get('visible', True)"/>
- <field name="type" invisible="context.get('visible', True)"/>
- <field name="amount" sum="Total Amount"/>
- <field name="state"/>
- <button name="proforma_voucher" string="Post" states="draft" icon="terp-document-new"/>
- </tree>
- </field>
- </record>
-
- <record model="ir.ui.view" id="view_voucher_form">
- <field name="name">account.voucher.form</field>
- <field name="model">account.voucher</field>
- <field name="type">form</field>
- <field name="arch" type="xml">
- <form string="Accounting Voucher">
- <group col="6" colspan="4">
- <field name="partner_id" required="1" on_change="onchange_journal_voucher(line_ids, tax_id, amount, partner_id, journal_id, type)"/>
- <field name="journal_id" widget="selection" select="1" on_change="onchange_journal_voucher(line_ids, tax_id, amount, partner_id, journal_id, type)"/>
- <field name="type" required="1"/>
- <field name="name" colspan="4"/>
- <field name="reference" select="1"/>
- <field name="account_id" widget="selection" invisible="True"/>
- </group>
- <notebook colspan="4">
- <page string="Voucher Entry">
- <field name="line_ids" on_change="onchange_price(line_ids, tax_id, partner_id)" default_get="{'journal_id':journal_id, 'type':type, 'partner_id':partner_id}" colspan="4" nolabel="1" height="180">
- <tree string="Voucher Items" editable="bottom">
- <field name="account_id"/>
- <field name="name"/>
- <field name="amount" sum="Total Amount"/>
- <field name="type"/>
- <field name="account_analytic_id" groups="analytic.group_analytic_accounting"/>
- </tree>
- </field>
- <group col="2" colspan="3">
- <separator string="Internal Notes" colspan="2"/>
- <field name="narration" colspan="2" nolabel="1"/>
- </group>
- <group col="2" colspan="1">
- <group col="2" colspan="1" >
- <separator string="Other Information" colspan="2"/>
- <field name="number"/>
- <field name="date" on_change="onchange_date(date)"/>
- <field name="currency_id" invisible="True"/>
- </group>
- <group col="4" colspan="1" attrs="{'invisible':[('type','in',['payment', 'receipt', False])]}">
- <separator string="Total" colspan="4"/>
- <field name="tax_id" on_change="onchange_price(line_ids, tax_id, partner_id)" widget="selection"/><field name="tax_amount" nolabel="1"/><button type="object" icon="terp-stock_format-scientific" name="compute_tax" groups="base.group_extended" string="Compute Tax" attrs="{'invisible': [('state','!=','draft')]}"/>
- <label colspan="1" string=""/><field name="amount" string="Total"/>
- </group>
- </group>
- </page>
- <page string="Journal Items" groups="base.group_extended" attrs="{'invisible': [('state','!=','posted')]}">
- <group col="6" colspan="4">
- <field name="company_id" widget="selection" groups="base.group_multi_company"/>
- <field name="period_id"/>
- <field name="audit"/>
- </group>
- <separator string="Journal Items" colspan="4"/>
- <field name="move_ids" colspan="4" nolabel="1" readonly="1"/>
- </page>
- </notebook>
- <group col="10" colspan="4">
- <field name="state"/>
- <button name="cancel_voucher" string="Cancel" states="draft,proforma" icon="gtk-cancel"/>
- <button name="proforma_voucher" string="Post" states="draft" icon="terp-camera_test"/>
- <button name="action_cancel_draft" type="object" states="cancel" string="Set to Draft" icon="terp-stock_effects-object-colorize"/>
- <button name="cancel_voucher" string="Cancel" type="object" states="posted" icon="terp-stock_effects-object-colorize" confirm="Are you sure to unreconcile this record ?"/>
- </group>
- </form>
- </field>
- </record>
-
- <record id="view_voucher_filter" model="ir.ui.view">
- <field name="name">account.voucher.select</field>
- <field name="model">account.voucher</field>
- <field name="type">search</field>
- <field name="priority">1</field>
- <field name="arch" type="xml">
- <search string="Search Vouchers">
- <group col='8' colspan='4'>
- <filter icon="terp-document-new" string="Draft" domain="[('state','=','draft')]" help="Draft Vouchers"/>
- <filter icon="terp-camera_test" string="Posted" domain="[('state','=','posted')]" help="Posted Vouchers"/>
- <separator orientation="vertical"/>
- <filter icon="terp-stock_effects-object-colorize" string="To Review" domain="[('state','=','posted')]" groups="base.group_extended" help="To Review"/>
- <separator orientation="vertical"/>
- <field name="date"/>
- <field name="number"/>
- <field name="partner_id"/>
- </group>
- <newline/>
- <group col='8' colspan='4'>
- <field name="journal_id" widget="selection" context="{'journal_id': self, 'set_visible':False}" />
- <field name="period_id" groups="base.group_extended"/>
- </group>
- <newline/>
- <group expand="0" string="Group By..." colspan="4" col="10">
- <filter string="Partner" icon="terp-partner" domain="[]" context="{'group_by':'partner_id'}"/>
- <filter string="Journal" icon="terp-folder-orange" domain="[]" context="{'group_by':'journal_id'}"/>
- <filter string="Period" icon="terp-go-month" domain="[]" context="{'group_by':'period_id','visible':True}"/>
- <filter string="State" icon="terp-stock_effects-object-colorize" domain="[]" context="{'group_by':'state'}"/>
- </group>
- <newline/>
- <group expand="0" string="Extended options..." col='8' colspan='4'>
- <field name="reference"/>
- <field name="name"/>
- <field name="narration"/>
- <field name="amount"/>
- </group>
- </search>
- </field>
- </record>
-
- <record id="account_cash_statement_graph" model="ir.ui.view">
- <field name="name">account.voucher.graph</field>
- <field name="model">account.voucher</field>
- <field name="type">graph</field>
- <field name="arch" type="xml">
- <graph string="Voucher Statistics" type="bar">
- <field name="date"/>
- <field name="amount" operator="+"/>
- </graph>
- </field>
- </record>
-
- <!-- Journal Vouchers -->
- <record model="ir.actions.act_window" id="action_voucher_list">
- <field name="name">Journal Vouchers</field>
- <field name="res_model">account.voucher</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form,graph</field>
- <field name="context">{'type':'general'}</field>
- <field name="view_id" eval="view_voucher_tree"/>
- <field name="search_view_id" ref="view_voucher_filter"/>
- </record>
- <record id="action_journal_voucher_tree" model="ir.actions.act_window.view">
- <field eval="1" name="sequence"/>
- <field name="view_mode">tree</field>
- <field name="act_window_id" ref="action_voucher_list"/>
- </record>
- <record id="action_journal_voucher_form" model="ir.actions.act_window.view">
- <field eval="2" name="sequence"/>
- <field name="view_mode">form</field>
- <field name="view_id" ref="view_voucher_form"/>
- <field name="act_window_id" ref="action_voucher_list"/>
- </record>
- <menuitem action="action_voucher_list" id="menu_encode_entries_by_voucher" parent="account.menu_finance_entries" sequence="6"/>
-
- <act_window
-
- id="act_journal_voucher_open"
- name="Voucher Entries"
- context="{'search_default_journal_id': active_id, 'type':type}"
- res_model="account.voucher"
- src_model="account.journal"/>
-
- <record model="ir.actions.act_window" id="action_review_voucher_list">
- <field name="name">Vouchers Entries</field>
- <field name="res_model">account.voucher</field>
- <field name="view_type">form</field>
- <field name="view_mode">tree,form</field>
- <field name="view_id" eval="view_voucher_tree"/>
- <field name="domain">[('state','=','posted')]</field>
- <field name="context">{'state':'posted'}</field>
- <field name="search_view_id" ref="view_voucher_filter"/>
- </record>
-
- <record id="view_bank_statement_form_invoice" model="ir.ui.view">
- <field name="name">account.bank.statement.invoice.form.inherit</field>
- <field name="model">account.bank.statement</field>
- <field name="type">form</field>
- <field name="inherit_id" ref="account.view_bank_statement_form"/>
- <field name="arch" type="xml">
- <field name="currency" invisible="1" position="after">
- <button name="%(action_view_account_statement_from_invoice_lines)d"
- string="Import Invoices" type="action" icon="gtk-execute"
- attrs="{'invisible':[('state','=','confirm')]}"/>
- </field>
- </field>
- </record>
-
-
- <record id="view_bank_statement_form_voucher" model="ir.ui.view">
- <field name="name">account.bank.statement.voucher.form.inherit</field>
- <field name="model">account.bank.statement</field>
- <field name="type">form</field>
- <field name="inherit_id" ref="account.view_bank_statement_form"/>
- <field name="arch" type="xml">
- <xpath expr="/form/notebook/page[@name='statement_line_ids']/field[@name='line_ids']/tree/field[@name='amount']" position="after">
- <field name="voucher_id" context="{'default_type': amount < 0 and 'payment' or 'receipt', 'type': amount < 0 and 'payment' or 'receipt', 'default_partner_id': partner_id, 'default_journal_id': parent.journal_id, 'default_amount': abs(amount), 'default_reference': ref, 'default_date': date, 'default_name': name}"/>
- <field name="amount_reconciled"/>
- </xpath>
- </field>
- </record>
-
- </data>
-</openerp>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<openerp>
- <data>
- </data>
-</openerp>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<openerp>
- <data>
- <record id="wkf" model="workflow">
- <field name="name">account.voucher.basic</field>
- <field name="osv">account.voucher</field>
- <field name="on_create">True</field>
- </record>
-
- <record id="act_proforma" model="workflow.activity">
- <field name="wkf_id" ref="wkf"/>
- <field name="flow_start">True</field>
- <field name="name">proforma</field>
- <field name="action">write({'state':'draft'})</field>
- <field name="kind">function</field>
- </record>
-
- <record id="act_done" model="workflow.activity">
- <field name="wkf_id" ref="wkf"/>
- <field name="name">done</field>
- <field name="action">proforma_voucher()</field>
- <field name="kind">function</field>
- <field name="flow_stop">True</field>
- </record>
-
-<!-- <record id="act_recheck" model="workflow.activity">-->
-<!-- <field name="wkf_id" ref="wkf"/>-->
-<!-- <field name="name">recheck</field>-->
-<!-- <field name="action">voucher_recheck()</field>-->
-<!-- <field name="kind">function</field>-->
-<!-- </record>-->
-
- <record id="act_cancel" model="workflow.activity">
- <field name="wkf_id" ref="wkf"/>
- <field name="name">cancel</field>
- <field name="flow_stop">True</field>
- <field name="action">cancel_voucher()</field>
- <field name="kind">function</field>
- </record>
-
- <record id="t2" model="workflow.transition">
- <field name="act_from" ref="act_proforma"/>
- <field name="act_to" ref="act_done"/>
- <field name="signal">proforma_voucher</field>
- <field name="condition">True</field>
- </record>
-
-<!-- <record id="t3" model="workflow.transition">-->
-<!-- <field name="act_from" ref="act_proforma"/>-->
-<!-- <field name="act_to" ref="act_recheck"/>-->
-<!-- <field name="signal">proforma_voucher</field>-->
-<!-- </record>-->
-<!-- -->
-<!-- <record id="t4" model="workflow.transition">-->
-<!-- <field name="act_from" ref="act_recheck"/>-->
-<!-- <field name="act_to" ref="act_done"/>-->
-<!-- <field name="signal">recheck_voucher</field>-->
-<!-- </record>-->
-<!-- -->
-<!-- <record id="t5" model="workflow.transition">-->
-<!-- <field name="act_from" ref="act_recheck"/>-->
-<!-- <field name="act_to" ref="act_cancel"/>-->
-<!-- <field name="signal">cancel_voucher</field>-->
-<!-- </record>-->
-
- <record id="t6" model="workflow.transition">
- <field name="act_from" ref="act_proforma"/>
- <field name="act_to" ref="act_cancel"/>
- <field name="signal">cancel_voucher</field>
- </record>
-
- <record id="t7" model="workflow.transition">
- <field name="act_from" ref="act_done"/>
- <field name="act_to" ref="act_cancel"/>
- <field name="signal">cancel_voucher</field>
- </record>
-
- <record id="t8" model="workflow.transition">
- <field name="act_from" ref="act_cancel"/>
- <field name="act_to" ref="act_proforma"/>
- <field name="signal">cancel_to_draft</field>
- </record>
- </data>
-</openerp>
elif (line.invoice and line.invoice.currency_id.id <> statement.currency.id):
amount = currency_obj.compute(cr, uid, line.invoice.currency_id.id,
statement.currency.id, amount, context=ctx)
-
+
voucher_res = { 'type':(amount < 0 and 'payment' or 'receipt') ,
- 'name': line.name,
+ 'name': line.name,
'partner_id': line.partner_id.id,
'journal_id': statement.journal_id.id,
'account_id': line.account_id.id,
'amount':abs(amount),
'period_id':statement.period_id.id}
voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context)
- result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype=(amount < 0 and 'payment' or 'receipt'))
+ context.update({'move_line_ids': [line.id]})
+ result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype=(amount < 0 and 'payment' or 'receipt'), context=context)
voucher_line_dict = False
if result['value']['line_ids']:
for line_dict in result['value']['line_ids']:
'period_id': statement.period_id.id
}
voucher_id = voucher_obj.create(cr, uid, voucher_res, context=context)
- result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype='payment')
+ context.update({'move_line_ids': line_ids})
+ result = voucher_obj.onchange_partner_id(cr, uid, [], partner_id=line.partner_id.id, journal_id=statement.journal_id.id, price=abs(amount), currency_id= statement.currency.id, ttype='payment', context=context)
voucher_line_dict = False
if result['value']['line_ids']:
for line_dict in result['value']['line_ids']:
from datetime import datetime, timedelta
from dateutil.relativedelta import relativedelta
+import time
+
from osv import fields, osv
from tools.translate import _
import decimal_precision as dp
import netsvc
-import time
-
class sale_shop(osv.osv):
_name = "sale.shop"
'shipped': False,
'invoice_ids': [],
'picking_ids': [],
+ 'date_confirm':False,
'name': self.pool.get('ir.sequence').get(cr, uid, 'sale.order'),
})
return super(sale_order, self).copy(cr, uid, id, default, context=context)