added from extra-addons
bzr revid: fp@tinyerp.com-20080824144543-33o2j8ddmvaxx4ce
This commit is contained in:
parent
1d5ade4b22
commit
734fa42184
|
@ -0,0 +1,34 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||||
|
# Fabien Pinckaers <fp@tiny.Be>
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting from its eventual inadequacies and bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees and support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
import account_analytic_plans
|
||||||
|
import wizard
|
||||||
|
import report
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
{
|
||||||
|
"name" : "Multiple-plans management in analytic accounting",
|
||||||
|
"version" : "1.0",
|
||||||
|
"depends" : ["account", "base","product_analytic_default"],
|
||||||
|
"author" : "Tiny",
|
||||||
|
"description": """The goal is to allow several analytic plans, according to the general journal,
|
||||||
|
so that multiple analytic lines are created when the invoice is confirmed.
|
||||||
|
Second goal is to allow creating automatic analytic entries when writing general entries manually
|
||||||
|
through: Finance > Entries > By Journal.
|
||||||
|
|
||||||
|
For example, the analytic structure:
|
||||||
|
Projects
|
||||||
|
»···Project 1
|
||||||
|
»···»···SubProj 1.1
|
||||||
|
»···»···SubProj 1.2
|
||||||
|
»···Project 2
|
||||||
|
Salesman
|
||||||
|
»···Eric
|
||||||
|
»···Fabien
|
||||||
|
|
||||||
|
Here, we have two plans: Projects and Salesman. An invoice line must
|
||||||
|
be able to write analytic entries in the 2 plans: SubProj 1.1 and
|
||||||
|
Fabien. The amount can also be splitted, example:
|
||||||
|
|
||||||
|
Plan1:
|
||||||
|
SubProject 1.1 : 50%
|
||||||
|
SubProject 1.2 : 50%
|
||||||
|
Plan2:
|
||||||
|
Eric: 100%
|
||||||
|
|
||||||
|
So when this line of invoice will be confirmed, It must generate 3
|
||||||
|
analytic lines.
|
||||||
|
""",
|
||||||
|
"website" : "http://tinyerp.com/module_account.html",
|
||||||
|
"category" : "Generic Modules/Accounting",
|
||||||
|
"init_xml" : [
|
||||||
|
],
|
||||||
|
"demo_xml" : [
|
||||||
|
],
|
||||||
|
"update_xml" : ["model_wizard.xml","account_analytic_plans_view.xml",
|
||||||
|
"account_analytic_plans_report.xml"],
|
||||||
|
|
||||||
|
"active": False,
|
||||||
|
"installable": True
|
||||||
|
}
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,404 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||||
|
#
|
||||||
|
# $Id: account.py 1005 2005-07-25 08:41:42Z nicoe $
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting from its eventual inadequacies and bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees and support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
from xml import dom
|
||||||
|
|
||||||
|
from mx import DateTime
|
||||||
|
from mx.DateTime import now
|
||||||
|
import time
|
||||||
|
|
||||||
|
import netsvc
|
||||||
|
from osv import fields, osv,orm
|
||||||
|
import ir
|
||||||
|
|
||||||
|
import tools
|
||||||
|
|
||||||
|
class one2many_mod2(fields.one2many):
|
||||||
|
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
|
||||||
|
if not context:
|
||||||
|
context = {}
|
||||||
|
res = {}
|
||||||
|
for id in ids:
|
||||||
|
res[id] = []
|
||||||
|
ids2 = None
|
||||||
|
if 'journal_id' in context:
|
||||||
|
journal = obj.pool.get('account.journal').browse(cr, user, context['journal_id'], context)
|
||||||
|
pnum = int(name[7]) -1
|
||||||
|
plan = journal.plan_id
|
||||||
|
if plan and len(plan.plan_ids)>pnum:
|
||||||
|
acc_id = plan.plan_ids[pnum].root_analytic_id.id
|
||||||
|
ids2 = obj.pool.get(self._obj).search(cr, user, [(self._fields_id,'in',ids),('analytic_account_id','child_of',[acc_id])], limit=self._limit)
|
||||||
|
if ids2 is None:
|
||||||
|
ids2 = obj.pool.get(self._obj).search(cr, user, [(self._fields_id,'in',ids)], limit=self._limit)
|
||||||
|
for r in obj.pool.get(self._obj)._read_flat(cr, user, ids2, [self._fields_id], context=context, load='_classic_write'):
|
||||||
|
res[r[self._fields_id]].append( r['id'] )
|
||||||
|
return res
|
||||||
|
|
||||||
|
class account_analytic_plan(osv.osv):
|
||||||
|
_name = "account.analytic.plan"
|
||||||
|
_description = "Analytic Plans"
|
||||||
|
_columns = {
|
||||||
|
'name': fields.char('Analytic Plan', size=64, required=True, select=True,),
|
||||||
|
'plan_ids': fields.one2many('account.analytic.plan.line','plan_id','Analytic Plans'),
|
||||||
|
}
|
||||||
|
account_analytic_plan()
|
||||||
|
|
||||||
|
class account_analytic_plan_line(osv.osv):
|
||||||
|
_name = "account.analytic.plan.line"
|
||||||
|
_description = "Analytic Plan Lines"
|
||||||
|
_columns = {
|
||||||
|
'plan_id':fields.many2one('account.analytic.plan','Analytic Plan'),
|
||||||
|
'name': fields.char('Plan Name', size=64, required=True, select=True),
|
||||||
|
'sequence':fields.integer('Sequence'),
|
||||||
|
'root_analytic_id': fields.many2one('account.analytic.account','Root Account',help="Root account of this plan.",required=True),
|
||||||
|
'min_required': fields.float('Minimum Allowed (%)'),
|
||||||
|
'max_required': fields.float('Maximum Allowed (%)'),
|
||||||
|
}
|
||||||
|
_defaults = {
|
||||||
|
'min_required': lambda *args: 100.0,
|
||||||
|
'max_required': lambda *args: 100.0,
|
||||||
|
}
|
||||||
|
_order = "sequence,id"
|
||||||
|
account_analytic_plan_line()
|
||||||
|
|
||||||
|
class account_analytic_plan_instance(osv.osv):
|
||||||
|
_name='account.analytic.plan.instance'
|
||||||
|
_description = 'Object for create analytic entries from invoice lines'
|
||||||
|
_columns={
|
||||||
|
'name':fields.char('Analytic Distribution',size=64),
|
||||||
|
'code':fields.char('Distribution Code',size=16),
|
||||||
|
'journal_id': fields.many2one('account.analytic.journal', 'Analytic Journal', required=True),
|
||||||
|
'account_ids':fields.one2many('account.analytic.plan.instance.line','plan_id','Account Id'),
|
||||||
|
'account1_ids':one2many_mod2('account.analytic.plan.instance.line','plan_id','Account1 Id'),
|
||||||
|
'account2_ids':one2many_mod2('account.analytic.plan.instance.line','plan_id','Account2 Id'),
|
||||||
|
'account3_ids':one2many_mod2('account.analytic.plan.instance.line','plan_id','Account3 Id'),
|
||||||
|
'account4_ids':one2many_mod2('account.analytic.plan.instance.line','plan_id','Account4 Id'),
|
||||||
|
'account5_ids':one2many_mod2('account.analytic.plan.instance.line','plan_id','Account5 Id'),
|
||||||
|
'account6_ids':one2many_mod2('account.analytic.plan.instance.line','plan_id','Account6 Id'),
|
||||||
|
'plan_id':fields.many2one('account.analytic.plan', "Model's Plan"),
|
||||||
|
}
|
||||||
|
def copy(self, cr, uid, id, default=None, context=None):
|
||||||
|
if not default:
|
||||||
|
default = {}
|
||||||
|
default.update({'account1_ids':False, 'account2_ids':False, 'account3_ids':False,
|
||||||
|
'account4_ids':False, 'account5_ids':False, 'account6_ids':False})
|
||||||
|
return super(account_analytic_plan_instance, self).copy(cr, uid, id, default, context)
|
||||||
|
|
||||||
|
_defaults = {
|
||||||
|
'plan_id': lambda *args: False,
|
||||||
|
}
|
||||||
|
def name_get(self, cr, uid, ids, context={}):
|
||||||
|
res = []
|
||||||
|
for inst in self.browse(cr, uid, ids, context):
|
||||||
|
name = inst.name or '/'
|
||||||
|
if name and inst.code:
|
||||||
|
name=name+' ('+inst.code+')'
|
||||||
|
res.append((inst.id, name))
|
||||||
|
return res
|
||||||
|
|
||||||
|
def name_search(self, cr, uid, name, args=None, operator='ilike', context=None, limit=80):
|
||||||
|
args= args or []
|
||||||
|
if name:
|
||||||
|
ids = self.search(cr, uid, [('code', '=', name)] + args, limit=limit, context=context or {})
|
||||||
|
if not ids:
|
||||||
|
ids = self.search(cr, uid, [('name', operator, name)] + args, limit=limit, context=context or {})
|
||||||
|
else:
|
||||||
|
ids = self.search(cr, uid, args, limit=limit, context=context or {})
|
||||||
|
return self.name_get(cr, uid, ids, context or {})
|
||||||
|
|
||||||
|
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False):
|
||||||
|
wiz_id = self.pool.get('ir.actions.wizard').search(cr, uid, [("wiz_name","=","create.model")])
|
||||||
|
res = super(account_analytic_plan_instance,self).fields_view_get(cr, uid, view_id, view_type, context, toolbar)
|
||||||
|
if (res['type']=='form'):
|
||||||
|
plan_id = False
|
||||||
|
if context.get('journal_id',False):
|
||||||
|
plan_id = self.pool.get('account.journal').browse(cr, uid, int(context['journal_id']), context).plan_id
|
||||||
|
elif context.get('plan_id',False):
|
||||||
|
plan_id = self.pool.get('account.analytic.plan').browse(cr, uid, int(context['plan_id']), context).plan_id
|
||||||
|
if plan_id:
|
||||||
|
i=1
|
||||||
|
res['arch'] = """<form string="%s">
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="code"/>
|
||||||
|
<field name="journal_id"/>
|
||||||
|
<button name="%d" string="Save This Distribution as a Model" type="action" colspan="2"/>
|
||||||
|
"""% (tools.to_xml(plan_id.name), wiz_id[0])
|
||||||
|
for line in plan_id.plan_ids:
|
||||||
|
res['arch']+="""
|
||||||
|
<field name="account%d_ids" string="%s" colspan="4">
|
||||||
|
<tree string="%s" editable="bottom">
|
||||||
|
<field name="rate"/>
|
||||||
|
<field name="analytic_account_id" domain="[('parent_id','child_of',[%d])]"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
<newline/>"""%(i,tools.to_xml(line.name),tools.to_xml(line.name),line.root_analytic_id and line.root_analytic_id.id or 0)
|
||||||
|
i+=1
|
||||||
|
res['arch'] += "</form>"
|
||||||
|
doc = dom.minidom.parseString(res['arch'])
|
||||||
|
xarch, xfields = self._view_look_dom_arch(cr, uid, doc, context=context)
|
||||||
|
res['arch'] = xarch
|
||||||
|
res['fields'] = xfields
|
||||||
|
return res
|
||||||
|
else:
|
||||||
|
return res
|
||||||
|
|
||||||
|
def create(self, cr, uid, vals, context=None):
|
||||||
|
if context and 'journal_id' in context:
|
||||||
|
journal= self.pool.get('account.journal').browse(cr,uid,context['journal_id'])
|
||||||
|
vals.update({'plan_id': journal.plan_id.id})
|
||||||
|
|
||||||
|
pids = self.pool.get('account.analytic.plan.instance').search(cr, uid, [('name','=',vals['name']),('code','=',vals['code']),('plan_id','<>',False)])
|
||||||
|
if pids:
|
||||||
|
raise osv.except_osv('Error', 'A model having this name and code already exists !')
|
||||||
|
|
||||||
|
res = self.pool.get('account.analytic.plan.line').search(cr,uid,[('plan_id','=',journal.plan_id.id)])
|
||||||
|
for i in res:
|
||||||
|
total_per_plan = 0
|
||||||
|
item = self.pool.get('account.analytic.plan.line').browse(cr,uid,i)
|
||||||
|
temp_list=['account1_ids','account2_ids','account3_ids','account4_ids','account5_ids','account6_ids']
|
||||||
|
for l in temp_list:
|
||||||
|
if vals.has_key(l):
|
||||||
|
for tempo in vals[l]:
|
||||||
|
if self.pool.get('account.analytic.account').search(cr,uid,[('parent_id','child_of',[item.root_analytic_id.id]),('id','=',tempo[2]['analytic_account_id'])]):
|
||||||
|
total_per_plan += tempo[2]['rate']
|
||||||
|
if total_per_plan < item.min_required or total_per_plan > item.max_required:
|
||||||
|
raise osv.except_osv("Value Error" ,"The Total Should be Between " + str(item.min_required) + " and " + str(item.max_required))
|
||||||
|
|
||||||
|
return super(account_analytic_plan_instance, self).create(cr, uid, vals, context)
|
||||||
|
|
||||||
|
def write(self, cr, uid, ids, vals, context={}, check=True, update_check=True):
|
||||||
|
this = self.browse(cr,uid,ids[0])
|
||||||
|
res = self.pool.get('account.analytic.plan.line').search(cr,uid,[('plan_id','=',this.plan_id.id)])
|
||||||
|
for i in res:
|
||||||
|
item = self.pool.get('account.analytic.plan.line').browse(cr,uid,i)
|
||||||
|
total_per_plan = 0
|
||||||
|
for j in self.pool.get('account.analytic.plan.instance.line').search(cr,uid,[('plan_id','=',this.id),('analytic_account_id','child_of',[item.root_analytic_id.id])]):
|
||||||
|
plan_line = self.pool.get('account.analytic.plan.instance.line').browse(cr,uid,j)
|
||||||
|
unchanged = True
|
||||||
|
temp_list=['account1_ids','account2_ids','account3_ids','account4_ids','account5_ids','account6_ids']
|
||||||
|
for l in temp_list:
|
||||||
|
if vals.has_key(l):
|
||||||
|
for tempo in vals[l]:
|
||||||
|
if tempo[1] == plan_line.id:
|
||||||
|
unchanged = False
|
||||||
|
if tempo[2] != False:
|
||||||
|
total_per_plan += tempo[2]['rate']
|
||||||
|
if tempo[1] == 0:
|
||||||
|
if self.pool.get('account.analytic.account').search(cr,uid,[('parent_id','child_of',[item.root_analytic_id.id]),('id','=',tempo[2]['analytic_account_id'])]):
|
||||||
|
total_per_plan += tempo[2]['rate']
|
||||||
|
if unchanged:
|
||||||
|
total_per_plan += plan_line.rate
|
||||||
|
if total_per_plan < item.min_required or total_per_plan > item.max_required:
|
||||||
|
raise osv.except_osv("Value Error" ,"The Total Should be Between " + str(item.min_required) + " and " + str(item.max_required))
|
||||||
|
if context.get('journal_id',False):
|
||||||
|
new_copy=self.copy(cr, uid, ids[0], context=context)
|
||||||
|
vals['plan_id']=this.plan_id.id
|
||||||
|
return super(account_analytic_plan_instance, self).write(cr, uid, ids, vals, context)
|
||||||
|
account_analytic_plan_instance()
|
||||||
|
|
||||||
|
class account_analytic_plan_instance_line(osv.osv):
|
||||||
|
_name='account.analytic.plan.instance.line'
|
||||||
|
_description = 'Object for create analytic entries from invoice lines'
|
||||||
|
_columns={
|
||||||
|
'plan_id':fields.many2one('account.analytic.plan.instance','Plan Id'),
|
||||||
|
'analytic_account_id':fields.many2one('account.analytic.account','Analytic Account', required=True),
|
||||||
|
'rate':fields.float('Rate (%)', required=True),
|
||||||
|
}
|
||||||
|
def name_get(self, cr, uid, ids, context={}):
|
||||||
|
if not len(ids):
|
||||||
|
return []
|
||||||
|
reads = self.read(cr, uid, ids, ['analytic_account_id'], context)
|
||||||
|
res = []
|
||||||
|
for record in reads:
|
||||||
|
res.append((record['id'], record['analytic_account_id']))
|
||||||
|
return res
|
||||||
|
|
||||||
|
account_analytic_plan_instance_line()
|
||||||
|
|
||||||
|
class account_journal(osv.osv):
|
||||||
|
_inherit='account.journal'
|
||||||
|
_name='account.journal'
|
||||||
|
_columns = {
|
||||||
|
'plan_id':fields.many2one('account.analytic.plan','Analytic Plans'),
|
||||||
|
}
|
||||||
|
account_journal()
|
||||||
|
|
||||||
|
class account_invoice_line(osv.osv):
|
||||||
|
_inherit='account.invoice.line'
|
||||||
|
_name='account.invoice.line'
|
||||||
|
_columns = {
|
||||||
|
'analytics_id':fields.many2one('account.analytic.plan.instance','Analytic Distribution'),
|
||||||
|
}
|
||||||
|
|
||||||
|
def create(self, cr, uid, vals, context=None):
|
||||||
|
if 'analytics_id' in vals and isinstance(vals['analytics_id'],tuple):
|
||||||
|
vals['analytics_id'] = vals['analytics_id'][0]
|
||||||
|
return super(account_invoice_line, self).create(cr, uid, vals, context)
|
||||||
|
|
||||||
|
def move_line_get_item(self, cr, uid, line, context={}):
|
||||||
|
res= super(account_invoice_line,self).move_line_get_item(cr, uid, line, context={})
|
||||||
|
res ['analytics_id']=line.analytics_id and line.analytics_id.id or False
|
||||||
|
return res
|
||||||
|
|
||||||
|
def product_id_change(self, cr, uid, ids, product, uom, qty=0, name='', type='out_invoice', partner_id=False, price_unit=False, address_invoice_id=False, context={}):
|
||||||
|
res_prod = super(account_invoice_line,self).product_id_change(cr, uid, ids, product, uom, qty, name, type, partner_id, price_unit, address_invoice_id, context)
|
||||||
|
if product:
|
||||||
|
res = self.pool.get('product.product').browse(cr, uid, product, context=context)
|
||||||
|
res_prod['value'].update({'analytics_id':res.property_account_distribution.id})
|
||||||
|
return res_prod
|
||||||
|
|
||||||
|
|
||||||
|
account_invoice_line()
|
||||||
|
|
||||||
|
class account_move_line(osv.osv):
|
||||||
|
_inherit='account.move.line'
|
||||||
|
_name='account.move.line'
|
||||||
|
_columns = {
|
||||||
|
'analytics_id':fields.many2one('account.analytic.plan.instance','Analytic Distribution'),
|
||||||
|
}
|
||||||
|
# def _analytic_update(self, cr, uid, ids, context):
|
||||||
|
# for line in self.browse(cr, uid, ids, context):
|
||||||
|
# if line.analytics_id:
|
||||||
|
# print "line.analytics_id",line,"now",line.analytics_id
|
||||||
|
# toremove = self.pool.get('account.analytic.line').search(cr, uid, [('move_id','=',line.id)], context=context)
|
||||||
|
# print "toremove",toremove
|
||||||
|
# if toremove:
|
||||||
|
# obj_line=self.pool.get('account.analytic.line')
|
||||||
|
# self.pool.get('account.analytic.line').unlink(cr, uid, toremove, context=context)
|
||||||
|
# for line2 in line.analytics_id.account_ids:
|
||||||
|
# val = (line.debit or 0.0) - (line.credit or 0.0)
|
||||||
|
# amt=val * (line2.rate/100)
|
||||||
|
# al_vals={
|
||||||
|
# 'name': line.name,
|
||||||
|
# 'date': line.date,
|
||||||
|
# 'unit_amount':1,
|
||||||
|
# 'product_id':12,
|
||||||
|
# 'account_id': line2.analytic_account_id.id,
|
||||||
|
# 'amount': amt,
|
||||||
|
# 'general_account_id': line.account_id.id,
|
||||||
|
# 'move_id': line.id,
|
||||||
|
# 'journal_id': line.analytics_id.journal_id.id,
|
||||||
|
# 'ref': line.ref,
|
||||||
|
# }
|
||||||
|
# ali_id=self.pool.get('account.analytic.line').create(cr,uid,al_vals)
|
||||||
|
# return True
|
||||||
|
#
|
||||||
|
# def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
|
||||||
|
# result = super(account_move_line, self).write(cr, uid, ids, vals, context, check, update_check)
|
||||||
|
# self._analytic_update(cr, uid, ids, context)
|
||||||
|
# return result
|
||||||
|
#
|
||||||
|
# def create(self, cr, uid, vals, context=None, check=True):
|
||||||
|
# result = super(account_move_line, self).create(cr, uid, vals, context, check)
|
||||||
|
# self._analytic_update(cr, uid, [result], context)
|
||||||
|
# return result
|
||||||
|
account_move_line()
|
||||||
|
|
||||||
|
class account_invoice(osv.osv):
|
||||||
|
_name = "account.invoice"
|
||||||
|
_inherit="account.invoice"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def line_get_convert(self, cr, uid, x, part, date, context={}):
|
||||||
|
res=super(account_invoice,self).line_get_convert(cr, uid, x, part, date, context)
|
||||||
|
res['analytics_id']=x.get('analytics_id',False)
|
||||||
|
return res
|
||||||
|
|
||||||
|
def _get_analityc_lines(self, cr, uid, id):
|
||||||
|
inv = self.browse(cr, uid, [id])[0]
|
||||||
|
cur_obj = self.pool.get('res.currency')
|
||||||
|
|
||||||
|
company_currency = inv.company_id.currency_id.id
|
||||||
|
if inv.type in ('out_invoice', 'in_refund'):
|
||||||
|
sign = 1
|
||||||
|
else:
|
||||||
|
sign = -1
|
||||||
|
|
||||||
|
iml = self.pool.get('account.invoice.line').move_line_get(cr, uid, inv.id)
|
||||||
|
|
||||||
|
for il in iml:
|
||||||
|
if il['analytics_id']:
|
||||||
|
|
||||||
|
if inv.type in ('in_invoice', 'in_refund'):
|
||||||
|
ref = inv.reference
|
||||||
|
else:
|
||||||
|
ref = self._convert_ref(cr, uid, inv.number)
|
||||||
|
obj_move_line=self.pool.get('account.analytic.plan.instance').browse(cr,uid,il['analytics_id'])
|
||||||
|
amount_calc=cur_obj.compute(cr, uid, inv.currency_id.id, company_currency, il['price'], context={'date': inv.date_invoice}) * sign
|
||||||
|
qty=il['quantity']
|
||||||
|
il['analytic_lines']=[]
|
||||||
|
for line2 in obj_move_line.account_ids:
|
||||||
|
amt=amount_calc * (line2.rate/100)
|
||||||
|
qtty=qty* (line2.rate/100)
|
||||||
|
al_vals={
|
||||||
|
'name': il['name'],
|
||||||
|
'date': inv['date_invoice'],
|
||||||
|
'unit_amount':qtty,
|
||||||
|
'product_id':il['product_id'],
|
||||||
|
'account_id': line2.analytic_account_id.id,
|
||||||
|
'amount': amt,
|
||||||
|
'product_uom_id': il['uos_id'],
|
||||||
|
'general_account_id': il['account_id'],
|
||||||
|
'journal_id': self._get_journal_analytic(cr, uid, inv.type),
|
||||||
|
'ref': ref,
|
||||||
|
}
|
||||||
|
il['analytic_lines'].append((0,0,al_vals))
|
||||||
|
return iml
|
||||||
|
|
||||||
|
account_invoice()
|
||||||
|
|
||||||
|
class account_analytic_plan(osv.osv):
|
||||||
|
_inherit = "account.analytic.plan"
|
||||||
|
_columns = {
|
||||||
|
'default_instance_id': fields.many2one('account.analytic.plan.instance', 'Default Entries'),
|
||||||
|
}
|
||||||
|
account_analytic_plan()
|
||||||
|
|
||||||
|
class product_product(osv.osv):
|
||||||
|
_name = 'product.product'
|
||||||
|
_inherit = 'product.product'
|
||||||
|
_description = 'Product'
|
||||||
|
|
||||||
|
_columns = {
|
||||||
|
'property_account_distribution': fields.property(
|
||||||
|
'account.analytic.plan.instance',
|
||||||
|
type='many2one',
|
||||||
|
relation='account.analytic.plan.instance',
|
||||||
|
string="Analytic Distribution",
|
||||||
|
method=True,
|
||||||
|
view_load=True,
|
||||||
|
group_name="Accounting Properties",
|
||||||
|
help="This Analytic Distribution will be use in sale order line and invoice lines",
|
||||||
|
),
|
||||||
|
}
|
||||||
|
|
||||||
|
product_product()
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<terp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<report
|
||||||
|
id="account_analytic_account_crossovered_analytic"
|
||||||
|
string="Crossovered Analytic"
|
||||||
|
model="account.analytic.account"
|
||||||
|
name="account.analytic.account.crossovered.analytic"
|
||||||
|
rml="account_analytic_plans/report/crossovered_analytic.rml"
|
||||||
|
auto="False"
|
||||||
|
menu="False"/>
|
||||||
|
|
||||||
|
<wizard
|
||||||
|
id="account_analytic_account_inverted_balance_report"
|
||||||
|
string="Crossovered Analytic"
|
||||||
|
model="account.analytic.account"
|
||||||
|
name="wizard.crossovered.analytic"
|
||||||
|
keyword="client_print_multi"/>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</terp>
|
||||||
|
|
|
@ -0,0 +1,248 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<terp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<!-- Add plan_id after user_id in account.journal many2one with account.analytic.plan -->
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="view_account_journal_form_inherit">
|
||||||
|
<field name="name">account.journal.form.inherit</field>
|
||||||
|
<field name="model">account.journal</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="inherit_id" ref="account.view_account_journal_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="centralisation" position="before">
|
||||||
|
<field name="plan_id" />
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="view_move_line_form_inherit">
|
||||||
|
<field name="name">account.move.line.form.inherit</field>
|
||||||
|
<field name="model">account.move.line</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="inherit_id" ref="account.view_move_line_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="move_id" position="after">
|
||||||
|
<field name="analytics_id" />
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="view_move_line_tree_inherit">
|
||||||
|
<field name="name">account.move.line.tree.inherit</field>
|
||||||
|
<field name="model">account.move.line</field>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="inherit_id" ref="account.view_move_line_tree"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="move_id" position="after">
|
||||||
|
<field name="analytics_id" />
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- Replace analytic_id with analytics_id in account.invoice.line -->
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="view_invoice_line_form_inherit">
|
||||||
|
<field name="name">account.invoice.line.form.inherit</field>
|
||||||
|
<field name="model">account.invoice.line</field>
|
||||||
|
<field name="inherit_id" ref="account.view_invoice_line_form"/>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="account_analytic_id" position="replace">
|
||||||
|
<field name="analytics_id" context="{'journal_id':parent.journal_id}" domain="[('plan_id','<>',False)]"/>
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="invoice_supplier_form_inherit">
|
||||||
|
<field name="name">account.invoice.supplier.form.inherit</field>
|
||||||
|
<field name="model">account.invoice</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="inherit_id" ref="account.invoice_supplier_form"/>
|
||||||
|
<field name="priority">2</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="account_analytic_id" position="replace">
|
||||||
|
<field name="analytics_id" domain="[('plan_id','<>',False)]" context="{'journal_id':parent.journal_id}" />
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="account_analytic_plan_instance_form">
|
||||||
|
<field name="name">account.analytic.plan.instance.form</field>
|
||||||
|
<field name="model">account.analytic.plan.instance</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Analytic Distribution">
|
||||||
|
<field name="name" select="1"/>
|
||||||
|
<field name="code" select="1"/>
|
||||||
|
<field name="plan_id" select="2" required="True"/>
|
||||||
|
<field name="journal_id" select="2"/>
|
||||||
|
<field name="account_ids" string="Analytic Distribution" colspan="4">
|
||||||
|
<tree string="Analytic Distribution" editable="bottom">
|
||||||
|
<field name="rate"/>
|
||||||
|
<field name="analytic_account_id"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="account_analytic_plan_instance_tree">
|
||||||
|
<field name="name">account.analytic.plan.instance.tree</field>
|
||||||
|
<field name="model">account.analytic.plan.instance</field>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree string="Analytic Distribution">
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="code"/>
|
||||||
|
<field name="plan_id"/>
|
||||||
|
<field name="journal_id"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.actions.act_window" id="account_analytic_plan_instance_action">
|
||||||
|
<field name="name">Analytic Distribution's Models</field>
|
||||||
|
<field name="type">ir.actions.act_window</field>
|
||||||
|
<field name="res_model">account.analytic.plan.instance</field>
|
||||||
|
<field name="domain">[('plan_id','<>',False)]</field>
|
||||||
|
<field name="view_type">form</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<act_window name="Distribution Models"
|
||||||
|
domain="[('plan_id', '=', active_id),('plan_id','<>',False)]"
|
||||||
|
context="{'plan_id': active_id}"
|
||||||
|
res_model="account.analytic.instance"
|
||||||
|
src_model="account.analytic.plan"
|
||||||
|
id="account_analytic_instance_model_open"/>
|
||||||
|
|
||||||
|
<menuitem
|
||||||
|
name="Analytic Distribution's models" parent="account.next_id_32"
|
||||||
|
id="menu_account_analytic_plan_instance_action"
|
||||||
|
action="account_analytic_plan_instance_action"/>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="account_analytic_plan_instance_line_form">
|
||||||
|
<field name="name">account.analytic.plan.instance.line.form</field>
|
||||||
|
<field name="model">account.analytic.plan.instance.line</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Analytic Distribution Line">
|
||||||
|
<field name="plan_id"/>
|
||||||
|
<field name="analytic_account_id"/>
|
||||||
|
<field name="rate"/>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="account_analytic_plan_instance_line_tree">
|
||||||
|
<field name="name">account.analytic.plan.instance.line.tree</field>
|
||||||
|
<field name="model">account.analytic.plan.instance.line</field>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree string="Analytic Distribution Lines">
|
||||||
|
<field name="plan_id" select="1"/>
|
||||||
|
<field name="analytic_account_id" select="1"/>
|
||||||
|
<field name="rate"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="account_analytic_plan_form">
|
||||||
|
<field name="name">account.analytic.plan.form</field>
|
||||||
|
<field name="model">account.analytic.plan</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Analytic Plan">
|
||||||
|
<field name="name" select="1"/>
|
||||||
|
<field name="default_instance_id"/>
|
||||||
|
<field name="plan_ids" colspan="4"/>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="account_analytic_plan_tree">
|
||||||
|
<field name="name">account.analytic.plan.tree</field>
|
||||||
|
<field name="model">account.analytic.plan</field>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree string="Analytic Plans">
|
||||||
|
<field name="name"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<record model="ir.actions.act_window" id="account_analytic_plan_form_action">
|
||||||
|
<field name="name">Analytic Plan</field>
|
||||||
|
<field name="type">ir.actions.act_window</field>
|
||||||
|
<field name="res_model">account.analytic.plan</field>
|
||||||
|
<field name="view_type">form</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<menuitem
|
||||||
|
parent="account.next_id_39"
|
||||||
|
id="menu_account_analytic_plan_action"
|
||||||
|
action="account_analytic_plan_form_action"/>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="account_analytic_plan_line_form">
|
||||||
|
<field name="name">account.analytic.plan.line.form</field>
|
||||||
|
<field name="model">account.analytic.plan.line</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Analytic Plan Line">
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="sequence"/>
|
||||||
|
<field name="root_analytic_id"/>
|
||||||
|
<newline/>
|
||||||
|
<field name="min_required"/>
|
||||||
|
<field name="max_required"/>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="account_analytic_plan_line_tree">
|
||||||
|
<field name="name">account.analytic.plan.line.tree</field>
|
||||||
|
<field name="model">account.analytic.plan.line</field>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree string="Analytic Plan Lines">
|
||||||
|
<field name="name" select="1"/>
|
||||||
|
<field name="sequence"/>
|
||||||
|
<field name="root_analytic_id" select="2"/>
|
||||||
|
<field name="min_required"/>
|
||||||
|
<field name="max_required"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- add property field on product -->
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="view_template_property_distribution_form">
|
||||||
|
<field name="name">product.template.property.distribution.form.inherit</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="model">product.template</field>
|
||||||
|
<field name="inherit_id" ref="product.product_template_form_view"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="property_account_analytic" position="replace">
|
||||||
|
<field name="property_account_distribution"/>
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.ui.view" id="view_normal_property_distribution_form">
|
||||||
|
<field name="name">product.normal.property.distribution.form.inherit</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="model">product.product</field>
|
||||||
|
<field name="inherit_id" ref="product.product_normal_form_view"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="property_account_analytic" position="replace">
|
||||||
|
<field name="property_account_distribution"/>
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</terp>
|
|
@ -0,0 +1,11 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<terp>
|
||||||
|
<data>
|
||||||
|
<wizard
|
||||||
|
string="Create Model"
|
||||||
|
model="account.analytic.plan.instance"
|
||||||
|
name="create.model" id="create_model"
|
||||||
|
menu="False"/>
|
||||||
|
</data>
|
||||||
|
</terp>
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
import crossovered_analytic
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,183 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||||
|
# Fabien Pinckaers <fp@tiny.Be>
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting FROM its eventual inadequacies AND bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees AND support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it AND/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
import pooler
|
||||||
|
import time
|
||||||
|
from report import report_sxw
|
||||||
|
|
||||||
|
class crossovered_analytic(report_sxw.rml_parse):
|
||||||
|
def __init__(self, cr, uid, name, context):
|
||||||
|
super(crossovered_analytic, self).__init__(cr, uid, name, context)
|
||||||
|
self.localcontext.update( {
|
||||||
|
'time': time,
|
||||||
|
'lines': self._lines,
|
||||||
|
'ref_lines' : self._ref_lines,
|
||||||
|
'find_children':self.find_children,
|
||||||
|
})
|
||||||
|
self.base_amount=0.00
|
||||||
|
|
||||||
|
def find_children(self,ref_ids):
|
||||||
|
to_return_ids = []
|
||||||
|
final_list = []
|
||||||
|
parent_list = []
|
||||||
|
set_list = []
|
||||||
|
for id in ref_ids:
|
||||||
|
# to avoid duplicate entries
|
||||||
|
if id not in to_return_ids:
|
||||||
|
to_return_ids.append(self.pool.get('account.analytic.account').search(self.cr,self.uid,[('parent_id','child_of',[id])]))
|
||||||
|
data_accnt = self.pool.get('account.analytic.account').browse(self.cr,self.uid,to_return_ids[0])
|
||||||
|
for data in data_accnt:
|
||||||
|
if data.parent_id and data.parent_id.id == ref_ids[0]:
|
||||||
|
parent_list.append(data.id)
|
||||||
|
final_list.append(ref_ids[0])
|
||||||
|
set_list = self.set_account(parent_list)
|
||||||
|
final_list.extend(set_list)
|
||||||
|
return final_list #to_return_ids[0]
|
||||||
|
|
||||||
|
def set_account(self,cats):
|
||||||
|
lst = []
|
||||||
|
category = self.pool.get('account.analytic.account').read(self.cr,self.uid,cats)
|
||||||
|
for cat in category:
|
||||||
|
lst.append(cat['id'])
|
||||||
|
if cat['child_ids']:
|
||||||
|
lst.extend(self.set_account(cat['child_ids']))
|
||||||
|
return lst
|
||||||
|
|
||||||
|
def _ref_lines(self,form):
|
||||||
|
result = []
|
||||||
|
res = {}
|
||||||
|
acc_id = []
|
||||||
|
final = []
|
||||||
|
acc_pool = self.pool.get('account.analytic.account')
|
||||||
|
line_pool = self.pool.get('account.analytic.line')
|
||||||
|
|
||||||
|
self.dict_acc_ref = {}
|
||||||
|
if form['journal_ids'][0][2]:
|
||||||
|
journal = " in (" + ','.join(map(lambda x: str(x), form['journal_ids'][0][2])) + ")"
|
||||||
|
else:
|
||||||
|
journal = 'is not null'
|
||||||
|
|
||||||
|
query_general = "select id from account_analytic_line where (journal_id " + journal +") AND date>='"+ str(form['date1']) +"'"" AND date<='" + str(form['date2']) + "'"
|
||||||
|
|
||||||
|
self.cr.execute(query_general)
|
||||||
|
l_ids=self.cr.fetchall()
|
||||||
|
line_ids = [x[0] for x in l_ids]
|
||||||
|
|
||||||
|
obj_line = line_pool.browse(self.cr,self.uid,line_ids)
|
||||||
|
|
||||||
|
#this structure will be usefull for easily knowing the account_analytic_line that are related to the reference account. At this purpose, we save the move_id of analytic lines.
|
||||||
|
self.dict_acc_ref[form['ref']] = []
|
||||||
|
children_list = self.pool.get('account.analytic.account').search(self.cr,self.uid,[('parent_id','child_of',[form['ref']])])
|
||||||
|
for obj in obj_line:
|
||||||
|
if obj.account_id.id in children_list:
|
||||||
|
if obj.move_id and obj.move_id.id not in self.dict_acc_ref[form['ref']]:
|
||||||
|
self.dict_acc_ref[form['ref']].append(obj.move_id.id)
|
||||||
|
|
||||||
|
res['ref_name'] = acc_pool.name_get(self.cr,self.uid,[form['ref']])[0][1]
|
||||||
|
res['ref_code'] = acc_pool.browse(self.cr,self.uid,form['ref']).code
|
||||||
|
|
||||||
|
self.final_list = children_list
|
||||||
|
selected_ids = line_pool.search(self.cr,self.uid,[('account_id','in',self.final_list)])
|
||||||
|
|
||||||
|
query="SELECT sum(aal.amount) AS amt, sum(aal.unit_amount) AS qty FROM account_analytic_line AS aal, account_analytic_account AS aaa \
|
||||||
|
WHERE aal.account_id=aaa.id AND aal.id IN ("+','.join(map(str,selected_ids))+") AND (aal.journal_id " + journal +") AND aal.date>='"+ str(form['date1']) +"'"" AND aal.date<='" + str(form['date2']) + "'"
|
||||||
|
|
||||||
|
self.cr.execute(query)
|
||||||
|
info=self.cr.dictfetchall()
|
||||||
|
|
||||||
|
res['ref_qty']=info[0]['qty']
|
||||||
|
res['ref_amt']=info[0]['amt']
|
||||||
|
self.base_amount= info[0]['amt']
|
||||||
|
|
||||||
|
result.append(res)
|
||||||
|
return result
|
||||||
|
|
||||||
|
def _lines(self,form,ids={}):
|
||||||
|
if not ids:
|
||||||
|
ids = self.ids
|
||||||
|
|
||||||
|
if form['journal_ids'][0][2]:
|
||||||
|
journal=" in (" + ','.join(map(lambda x: str(x), form['journal_ids'][0][2])) + ")"
|
||||||
|
else:
|
||||||
|
journal= 'is not null'
|
||||||
|
|
||||||
|
acc_pool = self.pool.get('account.analytic.account')
|
||||||
|
line_pool=self.pool.get('account.analytic.line')
|
||||||
|
acc_id=[]
|
||||||
|
final=[]
|
||||||
|
child_ids=[]
|
||||||
|
self.list_ids=[]
|
||||||
|
|
||||||
|
self.final_list = self.find_children(ids)
|
||||||
|
|
||||||
|
for acc_id in self.final_list:
|
||||||
|
selected_ids = line_pool.search(self.cr,self.uid,[('account_id','=',acc_id),('move_id','in',self.dict_acc_ref[form['ref']])])
|
||||||
|
if selected_ids:
|
||||||
|
query="SELECT aaa.code as code , sum(aal.amount) AS amt, sum(aal.unit_amount) AS qty,aaa.name as acc_name,aal.account_id as id FROM account_analytic_line AS aal, account_analytic_account AS aaa \
|
||||||
|
WHERE aal.account_id=aaa.id AND aal.id IN ("+','.join(map(str,selected_ids))+") AND (aal.journal_id " + journal +") AND aal.date>='"+ str(form['date1']) +"'"" AND aal.date<='" + str(form['date2']) + "'"" GROUP BY aal.account_id,aaa.name,aaa.code ORDER BY aal.account_id"
|
||||||
|
|
||||||
|
self.cr.execute(query)
|
||||||
|
res = self.cr.dictfetchall()
|
||||||
|
if res:
|
||||||
|
for element in res:
|
||||||
|
if self.base_amount<>0.00:
|
||||||
|
element['perc']= (element['amt'] / self.base_amount) * 100.00
|
||||||
|
else:
|
||||||
|
element['perc']=0.00
|
||||||
|
else:
|
||||||
|
result={}
|
||||||
|
res=[]
|
||||||
|
result['id']=acc_id
|
||||||
|
data_account = acc_pool.browse(self.cr,self.uid,acc_id)
|
||||||
|
result['acc_name']=data_account.name
|
||||||
|
result['code'] = data_account.code
|
||||||
|
result['amt']=result['qty']=result['perc']=0.00
|
||||||
|
if not form['empty_line']:
|
||||||
|
res.append(result)
|
||||||
|
else:
|
||||||
|
result={}
|
||||||
|
res=[]
|
||||||
|
result['id']=acc_id
|
||||||
|
data_account = acc_pool.browse(self.cr,self.uid,acc_id)
|
||||||
|
result['acc_name']=data_account.name
|
||||||
|
result['code'] = data_account.code
|
||||||
|
result['amt']=result['qty']=result['perc']=0.00
|
||||||
|
if not form['empty_line']:
|
||||||
|
res.append(result)
|
||||||
|
|
||||||
|
for item in res:
|
||||||
|
obj_acc=acc_pool.name_get(self.cr,self.uid,[item['id']])
|
||||||
|
item['acc_name']=obj_acc[0][1]
|
||||||
|
final.append(item)
|
||||||
|
return final
|
||||||
|
|
||||||
|
report_sxw.report_sxw('report.account.analytic.account.crossovered.analytic', 'account.analytic.account', 'addons/account_analytic_plans/report/crossovered_analytic.rml',parser=crossovered_analytic, header=False)
|
||||||
|
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,222 @@
|
||||||
|
<?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="34.0" y1="28.0" width="527" height="786"/>
|
||||||
|
</pageTemplate>
|
||||||
|
</template>
|
||||||
|
<stylesheet>
|
||||||
|
<blockTableStyle id="Standard_Outline">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Tableau1">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="0,1" stop="0,1"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="1,1" stop="1,1"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="2,1" stop="2,1"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table3">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<lineStyle kind="GRID" colorName="black"/>
|
||||||
|
<blockBackground colorName="#cccccc" start="0,0" stop="0,0"/>
|
||||||
|
<blockBackground colorName="#cccccc" start="1,0" stop="1,0"/>
|
||||||
|
<blockBackground colorName="#cccccc" start="2,0" stop="2,0"/>
|
||||||
|
<blockBackground colorName="#cccccc" start="3,0" stop="3,0"/>
|
||||||
|
<blockBackground colorName="#cccccc" start="4,0" stop="4,0"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table4">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<lineStyle kind="GRID" colorName="black"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table1">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<lineStyle kind="GRID" colorName="black"/>
|
||||||
|
<blockBackground colorName="#cccccc" start="0,0" stop="0,0"/>
|
||||||
|
<blockBackground colorName="#cccccc" start="1,0" stop="1,0"/>
|
||||||
|
<blockBackground colorName="#cccccc" start="2,0" stop="2,0"/>
|
||||||
|
<blockBackground colorName="#cccccc" start="3,0" stop="3,0"/>
|
||||||
|
<blockBackground colorName="#cccccc" start="4,0" stop="4,0"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table2">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<lineStyle kind="GRID" colorName="black"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<initialize>
|
||||||
|
<paraStyle name="all" alignment="justify"/>
|
||||||
|
</initialize>
|
||||||
|
<paraStyle name="P1" fontName="Times-Roman"/>
|
||||||
|
<paraStyle name="P2" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="CENTER"/>
|
||||||
|
<paraStyle name="P3" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="LEFT"/>
|
||||||
|
<paraStyle name="P4" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="CENTER"/>
|
||||||
|
<paraStyle name="P5" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT"/>
|
||||||
|
<paraStyle name="P6" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT"/>
|
||||||
|
<paraStyle name="P7" fontName="Times-Roman" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P8" fontName="Times-Bold" fontSize="20.0" leading="25" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P9" fontName="Times-Bold" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P10" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P11" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P12" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P13" fontName="Times-Bold" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P14" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P15" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P16" fontName="Times-Bold" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P17" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||||
|
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||||
|
</stylesheet>
|
||||||
|
<story>
|
||||||
|
<blockTable colWidths="176.0,176.0,176.0" repeatRows="1" style="Tableau1">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P7">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P8">Crossovered Analytic</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P9">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<para style="P10">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P7">[[ company.name ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P11">Period from [[ data['form']['date1'] ]]</para>
|
||||||
|
<para style="P11">to [[ data['form']['date2'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P10">Currency: [[ company.currency_id.name ]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<para style="Standard">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<para style="P1">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<para style="P4">Printing date: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]]</para>
|
||||||
|
<para style="P5">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<para style="P6">Analytic Account Reference:</para>
|
||||||
|
<para style="P6">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<blockTable colWidths="152.0,123.0,90.0,63.0,99.0" style="Table3">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P13">Account Name</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P13">Code</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P13">Quantity</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P13">Amount</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P13">Percentage</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<blockTable colWidths="152.0,123.0,90.0,63.0,100.0" style="Table4">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P14">[[ repeatIn(ref_lines(data['form']),'a') ]]<font face="Times-Roman" size="10.0">[[ a['ref_name'] ]]</font></para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P12">[[ a['ref_code'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P12">[[ '%.2f' % a['ref_qty'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P12">[[ '%.2f' % a['ref_amt'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P12">100.00%</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<para style="P4">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<para style="P4">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<para style="P3">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<para style="P3">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<blockTable colWidths="152.0,123.0,89.0,64.0,99.0" style="Table1">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P13">Account Name</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P13">Code</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P13">Quantity</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P13">Amount</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P13">Percentage</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<blockTable colWidths="152.0,123.0,89.0,64.0,99.0" style="Table2">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P15">[[ repeatIn(lines(data['form']),'a') ]] </para>
|
||||||
|
<para style="P15">[[a['acc_name'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P12">[[ a['code'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P12">[[ '%.2f' % a['qty'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P12">[[ '%.2f' % a['amt'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P12">[[ '%.2f' % a['perc'] ]]%</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<para style="P2">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</story>
|
||||||
|
</document>
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
import create_model
|
||||||
|
import wizard_crossovered_analytic
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,47 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
import wizard
|
||||||
|
import time
|
||||||
|
import netsvc
|
||||||
|
import pooler
|
||||||
|
|
||||||
|
info = '''<?xml version="1.0"?>
|
||||||
|
<form string="Distribution Model Saved">
|
||||||
|
<label string="This distribution model has been saved.\nYou will be able to reuse it later."/>
|
||||||
|
</form>'''
|
||||||
|
|
||||||
|
def activate(self, cr, uid, data, context):
|
||||||
|
plan_obj = pooler.get_pool(cr.dbname).get('account.analytic.plan.instance')
|
||||||
|
if data['id']:
|
||||||
|
plan = plan_obj.browse(cr, uid, data['id'], context)
|
||||||
|
if (not plan.name) or (not plan.code):
|
||||||
|
raise wizard.except_wizard('Error', 'Please put a name and a code before saving the model !')
|
||||||
|
pids = pooler.get_pool(cr.dbname).get('account.analytic.plan').search(cr, uid, [], context=context)
|
||||||
|
if (not pids):
|
||||||
|
raise wizard.except_wizard('Error', 'No analytic plan defined !')
|
||||||
|
plan_obj.write(cr,uid,[data['id']],{'plan_id':pids[0]})
|
||||||
|
return 'info'
|
||||||
|
else:
|
||||||
|
return 'endit'
|
||||||
|
|
||||||
|
|
||||||
|
class create_model(wizard.interface):
|
||||||
|
|
||||||
|
states = {
|
||||||
|
'init': {
|
||||||
|
'actions': [],
|
||||||
|
'result': {'type':'choice','next_state':activate}
|
||||||
|
},
|
||||||
|
'info': {
|
||||||
|
'actions': [],
|
||||||
|
'result': {'type':'form', 'arch':info, 'fields':{}, 'state':[('end','OK')]}
|
||||||
|
},
|
||||||
|
'endit': {
|
||||||
|
'actions': [],
|
||||||
|
'result': {'type':'form', 'arch':'', 'fields':{}, 'state':'end'}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
create_model('create.model')
|
||||||
|
|
||||||
|
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
import wizard
|
||||||
|
import time
|
||||||
|
import datetime
|
||||||
|
import pooler
|
||||||
|
|
||||||
|
form = """<?xml version="1.0"?>
|
||||||
|
<form string="Select Information">
|
||||||
|
<field name="date1"/>
|
||||||
|
<field name="date2"/>
|
||||||
|
<field name="ref" colspan="4"/>
|
||||||
|
<field name="journal_ids" colspan="4"/>
|
||||||
|
<field name="empty_line"/>
|
||||||
|
</form>"""
|
||||||
|
|
||||||
|
fields = {
|
||||||
|
'date1': {'string':'Start Date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
|
||||||
|
'date2': {'string':'End Date', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
|
||||||
|
'journal_ids': {'string':'Analytic Journal', 'type':'many2many', 'relation':'account.analytic.journal'},
|
||||||
|
'ref' :{'string':'Analytic Account Ref.', 'type':'many2one', 'relation':'account.analytic.account','required':True},
|
||||||
|
'empty_line': {'string':'Dont show empty lines', 'type':'boolean', 'default': lambda *a:False},
|
||||||
|
}
|
||||||
|
|
||||||
|
class wizard_crossovered_analytic(wizard.interface):
|
||||||
|
def _checklines(self, cr, uid, data, context):
|
||||||
|
cr.execute('select account_id from account_analytic_line')
|
||||||
|
res=cr.fetchall()
|
||||||
|
acc_ids=[x[0] for x in res]
|
||||||
|
|
||||||
|
obj_acc = pooler.get_pool(cr.dbname).get('account.analytic.account').browse(cr,uid,data['form']['ref'])
|
||||||
|
name=obj_acc.name
|
||||||
|
|
||||||
|
account_ids = pooler.get_pool(cr.dbname).get('account.analytic.account').search(cr, uid, [('parent_id', 'child_of', [data['form']['ref']])])
|
||||||
|
|
||||||
|
flag = True
|
||||||
|
for acc in account_ids:
|
||||||
|
if acc in acc_ids:
|
||||||
|
flag = False
|
||||||
|
break
|
||||||
|
|
||||||
|
if flag:
|
||||||
|
raise wizard.except_wizard('User Error',"There are no Analytic lines related to Account '" + name +"'" )
|
||||||
|
return {}
|
||||||
|
|
||||||
|
states = {
|
||||||
|
'init': {
|
||||||
|
'actions': [],
|
||||||
|
'result': {'type':'form', 'arch':form, 'fields':fields, 'state':[('end','Cancel'),('print','Print')]},
|
||||||
|
},
|
||||||
|
'print': {
|
||||||
|
'actions': [_checklines],
|
||||||
|
'result': {'type':'print', 'report':'account.analytic.account.crossovered.analytic', 'state':'end'},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
wizard_crossovered_analytic('wizard.crossovered.analytic')
|
||||||
|
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
import account
|
||||||
|
import account_move_line
|
||||||
|
import wizard
|
||||||
|
import report
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
{
|
||||||
|
"name" : "Accounting and financial management-Compare Accounts",
|
||||||
|
"version" : "1.1",
|
||||||
|
"depends" : ["account"],
|
||||||
|
"author" : "Tiny",
|
||||||
|
"description": """Account Balance Module is an added functionality to the Financial Management module.
|
||||||
|
|
||||||
|
This module gives you the various options for printing balance sheet.
|
||||||
|
|
||||||
|
1. You can compare the balance sheet for different years.
|
||||||
|
|
||||||
|
2. You can set the cash or percentage comparision between two years.
|
||||||
|
|
||||||
|
3. You can set the referencial account for the percentage comparision for particular years.
|
||||||
|
|
||||||
|
4. You can select periods as an actual date or periods as creation date.
|
||||||
|
|
||||||
|
5. You have an option to print the desired report in Landscape format.
|
||||||
|
""",
|
||||||
|
"website" : "http://tinyerp.com/account_balance.html",
|
||||||
|
"category" : "Generic Modules/Accounting",
|
||||||
|
"init_xml" : [
|
||||||
|
],
|
||||||
|
"demo_xml" : [],
|
||||||
|
"update_xml" : ["account_report.xml","account_wizard.xml",],
|
||||||
|
# "translations" : {
|
||||||
|
# "fr": "i18n/french_fr.csv"
|
||||||
|
# },
|
||||||
|
"active": False,
|
||||||
|
"installable": True
|
||||||
|
}
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,93 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||||
|
#
|
||||||
|
# $Id: account.py 1005 2005-07-25 08:41:42Z nicoe $
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting from its eventual inadequacies and bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees and support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
import time
|
||||||
|
import netsvc
|
||||||
|
from osv import fields, osv
|
||||||
|
|
||||||
|
|
||||||
|
class account_move_line(osv.osv):
|
||||||
|
_name="account.move.line"
|
||||||
|
_inherit="account.move.line"
|
||||||
|
_description = "Entry lines"
|
||||||
|
|
||||||
|
def _query_get(self, cr, uid, obj='l', context={}):
|
||||||
|
|
||||||
|
if not 'fiscalyear' in context:
|
||||||
|
context['fiscalyear'] = self.pool.get('account.fiscalyear').find(cr, uid, exception=False)
|
||||||
|
|
||||||
|
strQuery = ""
|
||||||
|
if context.get('periods', False):
|
||||||
|
ids = ','.join([str(x) for x in context['periods']])
|
||||||
|
|
||||||
|
if not 'period_manner' in context:
|
||||||
|
strQuery = obj+".active AND "+obj+".state<>'draft' AND "+obj+".period_id in (SELECT id from account_period WHERE fiscalyear_id=%d)" % (context['fiscalyear'],)
|
||||||
|
else:
|
||||||
|
if context['period_manner']=='actual':
|
||||||
|
|
||||||
|
strQuery = obj+".active AND "+obj+".state<>'draft' AND "+obj+".period_id in (SELECT id from account_period WHERE fiscalyear_id=%d AND id in (%s))" % (context['fiscalyear'], ids)
|
||||||
|
else:
|
||||||
|
# p_id="in (SELECT id from account_period WHERE fiscalyear_id=%d AND id in (%s)))" % (context['fiscalyear'], ids)
|
||||||
|
strQuery = obj+".active AND "+obj+".state<>'draft' AND("
|
||||||
|
|
||||||
|
p_id=self.pool.get('account.period').search(cr,uid,[('fiscalyear_id','=',context['fiscalyear']),('id','in',context['periods'])])
|
||||||
|
|
||||||
|
periods = self.pool.get('account.period').read(cr,uid,p_id,['date_start','date_stop'])
|
||||||
|
|
||||||
|
count=1
|
||||||
|
len_periods=len(p_id)
|
||||||
|
|
||||||
|
|
||||||
|
for period in periods:
|
||||||
|
strQuery += "("+obj+".create_date between to_date('" + period['date_start'] + "','yyyy-mm-dd') and to_date('" + period['date_stop'] + "','yyyy-mm-dd'))"
|
||||||
|
if len_periods!=1 and count!=len_periods:
|
||||||
|
strQuery+=" OR "
|
||||||
|
count=count+1
|
||||||
|
if p_id==[]:
|
||||||
|
strQuery+=obj+".period_id in (SELECT id from account_period WHERE fiscalyear_id=%d))" % (context['fiscalyear'],)
|
||||||
|
else:
|
||||||
|
strQuery+=")"
|
||||||
|
else:
|
||||||
|
strQuery = obj+".active AND "+obj+".state<>'draft' AND "+obj+".period_id in (SELECT id from account_period WHERE fiscalyear_id=%d)" % (context['fiscalyear'],)
|
||||||
|
|
||||||
|
return strQuery
|
||||||
|
account_move_line()
|
||||||
|
|
||||||
|
|
||||||
|
class account_bank_statement_reconcile(osv.osv):
|
||||||
|
_inherit = "account.bank.statement.reconcile"
|
||||||
|
_columns = {
|
||||||
|
'line_ids': fields.many2many('account.move.line', 'account_bank_statement_line_rel', 'statement_id', 'line_id', 'Entries'),
|
||||||
|
}
|
||||||
|
account_bank_statement_reconcile()
|
||||||
|
|
||||||
|
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<terp>
|
||||||
|
<data>
|
||||||
|
<report id="account_account_balance"
|
||||||
|
string="Account balance"
|
||||||
|
model="account.account"
|
||||||
|
name="account.balance.account.balance"
|
||||||
|
rml="account_balance/report/account_balance.rml"
|
||||||
|
auto="False"
|
||||||
|
menu="False"/>
|
||||||
|
<report id="account_account_balance_landscape"
|
||||||
|
string="Account balance"
|
||||||
|
model="account.account"
|
||||||
|
name="account.account.balance.landscape"
|
||||||
|
rml="account_balance/report/account_balance_landscape.rml"
|
||||||
|
auto="False"
|
||||||
|
menu="False"/>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</terp>
|
|
@ -0,0 +1,14 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<terp>
|
||||||
|
<data>
|
||||||
|
<menuitem parent="account.menu_finance" icon="terp-account"/>
|
||||||
|
|
||||||
|
<wizard
|
||||||
|
string="Account balance-Compare Years"
|
||||||
|
model="account.account"
|
||||||
|
name="account.balance.account.balance.report"
|
||||||
|
keyword="client_print_multi"
|
||||||
|
id="wizard_account_balance_report"/>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</terp>
|
|
@ -0,0 +1,4 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
import account_balance
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,598 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting from its eventual inadequacies and bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees and support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
import time
|
||||||
|
import locale
|
||||||
|
from report import report_sxw
|
||||||
|
|
||||||
|
#from addons.account.wizard import wizard_account_balance_report
|
||||||
|
|
||||||
|
parents = {
|
||||||
|
'tr':1,
|
||||||
|
'li':1,
|
||||||
|
'story': 0,
|
||||||
|
'section': 0
|
||||||
|
}
|
||||||
|
|
||||||
|
class account_balance(report_sxw.rml_parse):
|
||||||
|
def __init__(self, cr, uid, name, context):
|
||||||
|
super(account_balance, self).__init__(cr, uid, name, context)
|
||||||
|
self.flag=1
|
||||||
|
self.parent_bal=0
|
||||||
|
self.status=0
|
||||||
|
self.done_total=0
|
||||||
|
self.baldiv={}
|
||||||
|
self.empty_parent=0
|
||||||
|
self.result_total = {}
|
||||||
|
self.total_for_perc=[]
|
||||||
|
self.localcontext.update({
|
||||||
|
'time': time,
|
||||||
|
'lines': self.lines,
|
||||||
|
'linesForTotal': self.linesForTotal,
|
||||||
|
'linesForYear': self.linesForYear,
|
||||||
|
})
|
||||||
|
self.context = context
|
||||||
|
|
||||||
|
def repeatIn(self, lst, name, nodes_parent=False,td=False,width=[],value=[],type=[]):
|
||||||
|
self._node.data = ''
|
||||||
|
node = self._find_parent(self._node, nodes_parent or parents)
|
||||||
|
ns = node.nextSibling
|
||||||
|
#start
|
||||||
|
if value==['Cash','%']:
|
||||||
|
if show==1:
|
||||||
|
if perc==1:
|
||||||
|
if pattern=='none':
|
||||||
|
value=['','Cash','%']
|
||||||
|
type=['lable','lable','lable']
|
||||||
|
width=[130,65,65]
|
||||||
|
else:
|
||||||
|
value=[' ','','Cash','%']
|
||||||
|
type=['string','lable','lable','lable']
|
||||||
|
width=[65,130,65,65]
|
||||||
|
else:
|
||||||
|
if pattern=='none':
|
||||||
|
value=['']
|
||||||
|
type=['lable']
|
||||||
|
width=[195]
|
||||||
|
else:
|
||||||
|
value=[' ','']
|
||||||
|
type=['string','lable']
|
||||||
|
width=[65,195]
|
||||||
|
else:
|
||||||
|
if perc==1:
|
||||||
|
if pattern=='none':
|
||||||
|
value=['Cash','%']
|
||||||
|
type=['lable','lable']
|
||||||
|
width=[65,65]
|
||||||
|
else:
|
||||||
|
value=[' ','Cash','%']
|
||||||
|
type=['string','lable','lable']
|
||||||
|
width=[65,65,65]
|
||||||
|
else:
|
||||||
|
if pattern=='none':
|
||||||
|
value=['']
|
||||||
|
type=['lable']
|
||||||
|
width=[65]
|
||||||
|
else:
|
||||||
|
value=[' ','']
|
||||||
|
type=['string','lable']
|
||||||
|
width=[65,65]
|
||||||
|
|
||||||
|
|
||||||
|
if value==['year']:
|
||||||
|
if show==1:
|
||||||
|
if perc==1:
|
||||||
|
if pattern=='none':
|
||||||
|
width=[260]
|
||||||
|
else:
|
||||||
|
value=[' ','year']
|
||||||
|
type=['string','string']
|
||||||
|
width=[65,260]
|
||||||
|
else:
|
||||||
|
if pattern=='none':
|
||||||
|
width=[195]
|
||||||
|
else:
|
||||||
|
value=[' ','year']
|
||||||
|
type=['string','string']
|
||||||
|
width=[65,195]
|
||||||
|
else:
|
||||||
|
if perc==1:
|
||||||
|
if pattern=='none':
|
||||||
|
width=[130]
|
||||||
|
else:
|
||||||
|
value=[' ','year']
|
||||||
|
type=['string','string']
|
||||||
|
width=[65,130]
|
||||||
|
|
||||||
|
else:
|
||||||
|
if pattern=='none':
|
||||||
|
width=[65]
|
||||||
|
else:
|
||||||
|
value=[' ','year']
|
||||||
|
type=['string','string']
|
||||||
|
width=[65,65]
|
||||||
|
|
||||||
|
if value==['Debit','Credit','Balance']:
|
||||||
|
if show==1:
|
||||||
|
if perc==1:
|
||||||
|
if pattern=='none':
|
||||||
|
width=[65,65,130]
|
||||||
|
else:
|
||||||
|
value=[' ','Debit','Credit','Balance']
|
||||||
|
type=['string','lable','lable','lable']
|
||||||
|
width=[65,65,65,130]
|
||||||
|
else:
|
||||||
|
if pattern=='none':
|
||||||
|
width=[65,65,65]
|
||||||
|
else:
|
||||||
|
value=[' ','Debit','Credit','Balance']
|
||||||
|
type=['string','lable','lable','lable']
|
||||||
|
width=[65,65,65,65]
|
||||||
|
|
||||||
|
else:
|
||||||
|
if perc==1:
|
||||||
|
if pattern=='none':
|
||||||
|
value=['Balance']
|
||||||
|
type=['lable']
|
||||||
|
width=[130]
|
||||||
|
else:
|
||||||
|
value=[' ','Balance']
|
||||||
|
type=['string','lable']
|
||||||
|
width=[65,130]
|
||||||
|
else:
|
||||||
|
if pattern=='none':
|
||||||
|
value=['Balance']
|
||||||
|
type=['lable']
|
||||||
|
width=[65]
|
||||||
|
else:
|
||||||
|
value=[' ','Balance']
|
||||||
|
type=['string','lable']
|
||||||
|
width=[65,65]
|
||||||
|
|
||||||
|
if value==['debit','credit','balance']:
|
||||||
|
if show==1:
|
||||||
|
if perc==1:
|
||||||
|
if pattern=='none':
|
||||||
|
value=['debit','credit','balance','balance_perc']
|
||||||
|
type=['string','string','string','string']
|
||||||
|
width=[65,65,65,65]
|
||||||
|
else:
|
||||||
|
value=[pattern,'debit','credit','balance','balance_perc']
|
||||||
|
type=['string','string','string','string','string']
|
||||||
|
width=[65,65,65,65,65]
|
||||||
|
else:
|
||||||
|
if pattern=='none':
|
||||||
|
value=['debit','credit','balance']
|
||||||
|
type=['string','string','string']
|
||||||
|
width=[65,65,65]
|
||||||
|
else:
|
||||||
|
value=[pattern,'debit','credit','balance']
|
||||||
|
type=['string','string','string','string']
|
||||||
|
width=[65,65,65,65]
|
||||||
|
|
||||||
|
else:
|
||||||
|
if perc==1:
|
||||||
|
if pattern=='none':
|
||||||
|
value=['balance','balance_perc']
|
||||||
|
type=['string','string']
|
||||||
|
width=[65,65]
|
||||||
|
else:
|
||||||
|
value=[pattern,'balance','balance_perc']
|
||||||
|
type=['string','string','string']
|
||||||
|
width=[65,65,65]
|
||||||
|
else:
|
||||||
|
if pattern=='none':
|
||||||
|
value=['balance']
|
||||||
|
type=['string']
|
||||||
|
width=[65]
|
||||||
|
else:
|
||||||
|
value=[pattern,'balance']
|
||||||
|
type=['string','string']
|
||||||
|
width=[65,65]
|
||||||
|
|
||||||
|
if value==['sum_debit','sum_credit','']:
|
||||||
|
if show==1:
|
||||||
|
if perc==1:
|
||||||
|
if pattern=='none':
|
||||||
|
width=[65,65,130]
|
||||||
|
else:
|
||||||
|
value=[' ','sum_debit','sum_credit','']
|
||||||
|
type=['string','string','string','lable']
|
||||||
|
width=[65,65,65,130]
|
||||||
|
else:
|
||||||
|
if pattern=='none':
|
||||||
|
width=[65,65,65]
|
||||||
|
else:
|
||||||
|
value=[' ','sum_debit','sum_credit','']
|
||||||
|
type=['string','string','string','lable']
|
||||||
|
width=[65,65,65,65]
|
||||||
|
else:
|
||||||
|
if perc==1:
|
||||||
|
if pattern=='none':
|
||||||
|
value=['']
|
||||||
|
type=['lable']
|
||||||
|
width=[130]
|
||||||
|
else:
|
||||||
|
value=[' ','']
|
||||||
|
type=['string','lable']
|
||||||
|
width=[65,130]
|
||||||
|
else:
|
||||||
|
if pattern=='none':
|
||||||
|
value=['']
|
||||||
|
type=['lable']
|
||||||
|
width=[65]
|
||||||
|
else:
|
||||||
|
value=[' ','']
|
||||||
|
type=['string','lable']
|
||||||
|
width=[65,65]
|
||||||
|
|
||||||
|
if not lst:
|
||||||
|
lst.append(1)
|
||||||
|
for ns in node.childNodes :
|
||||||
|
if ns and ns.nodeName!='#text' and ns.tagName=='blockTable' and td :
|
||||||
|
width_str = ns._attrs['colWidths'].nodeValue
|
||||||
|
ns.removeAttribute('colWidths')
|
||||||
|
total_td = td * len(value)
|
||||||
|
|
||||||
|
if not width:
|
||||||
|
for v in value:
|
||||||
|
width.append(30)
|
||||||
|
check1=0
|
||||||
|
for t in range(td):
|
||||||
|
for v in range(len(value)):
|
||||||
|
if type[v] in ('String','STRING','string'):
|
||||||
|
if (value[v]==" " or value[0]==pattern):
|
||||||
|
if check1==0:
|
||||||
|
check1=1
|
||||||
|
width_str +=',0.0'
|
||||||
|
else:
|
||||||
|
width_str +=',%d'%width[v]
|
||||||
|
else:
|
||||||
|
width_str +=',%d'%width[v]
|
||||||
|
else:
|
||||||
|
width_str +=',%d'%width[v]
|
||||||
|
ns.setAttribute('colWidths',width_str)
|
||||||
|
|
||||||
|
child_list = ns.childNodes
|
||||||
|
|
||||||
|
check=0
|
||||||
|
for child in child_list:
|
||||||
|
if child.nodeName=='tr':
|
||||||
|
lc = child.childNodes[1]
|
||||||
|
for t in range(td):
|
||||||
|
i=0
|
||||||
|
for v in value:
|
||||||
|
|
||||||
|
newnode = lc.cloneNode(1)
|
||||||
|
temp2="%s['status']==1 and ( setTag('para','para',{'fontName':'Times-bold'})) ]]"%(name)
|
||||||
|
#
|
||||||
|
if type[i] in ('String','STRING','string'):
|
||||||
|
if (v==" " or v==pattern) and i==0 and check==0:
|
||||||
|
check=1
|
||||||
|
newnode.childNodes[1].lastChild.data=""
|
||||||
|
else:
|
||||||
|
if v==" ":
|
||||||
|
newnode.childNodes[1].lastChild.data=""
|
||||||
|
else:
|
||||||
|
t1= "[[ %s['%s%d'] ]]"%(name,v,t)
|
||||||
|
if v=="year" or v=="sum_debit" or v=="sum_credit":
|
||||||
|
newnode.childNodes[1].lastChild.data = t1
|
||||||
|
else:
|
||||||
|
newnode.childNodes[1].lastChild.data = t1+"[["+temp2
|
||||||
|
# newnode.childNodes[1].lastChild.data=[[ a['status']==1 and ( setTag('para','para',{'fontName':'Times-bold'})) ]]
|
||||||
|
elif type[i] in ('Lable','LABLE','lable'):
|
||||||
|
|
||||||
|
newnode.childNodes[1].lastChild.data= v
|
||||||
|
|
||||||
|
child.appendChild(newnode)
|
||||||
|
|
||||||
|
newnode=False
|
||||||
|
i+=1
|
||||||
|
return super(account_balance,self).repeatIn(lst, name, nodes_parent=False)
|
||||||
|
#end
|
||||||
|
def linesForYear(self,form):
|
||||||
|
temp=0
|
||||||
|
years={}
|
||||||
|
|
||||||
|
global pattern
|
||||||
|
global show
|
||||||
|
global perc
|
||||||
|
global bal_zero
|
||||||
|
global ref_bal
|
||||||
|
|
||||||
|
pattern=form['compare_pattern']
|
||||||
|
|
||||||
|
if form['show_columns']!=1:
|
||||||
|
show=0
|
||||||
|
else:
|
||||||
|
show=form['show_columns']
|
||||||
|
|
||||||
|
if form['format_perc']!=1:
|
||||||
|
perc=0
|
||||||
|
else:
|
||||||
|
perc=form['format_perc']
|
||||||
|
|
||||||
|
if form['account_choice']=='bal_zero':
|
||||||
|
bal_zero=0
|
||||||
|
else:
|
||||||
|
bal_zero=1
|
||||||
|
|
||||||
|
ctx = self.context.copy()
|
||||||
|
|
||||||
|
if perc==1:
|
||||||
|
if form['select_account']!=False:
|
||||||
|
ref_ac=self.pool.get('account.account').browse(self.cr, self.uid,form['select_account'],ctx.copy())
|
||||||
|
if ref_ac.balance<>0.00:
|
||||||
|
ref_bal=ref_ac.balance
|
||||||
|
else:
|
||||||
|
ref_bal=1.00
|
||||||
|
else:
|
||||||
|
ref_bal='nothing'
|
||||||
|
else:
|
||||||
|
ref_bal='nothing'
|
||||||
|
|
||||||
|
|
||||||
|
total_for_perc=[]
|
||||||
|
# if perc==1:
|
||||||
|
self.done_total=1
|
||||||
|
self.total_for_perc=self.linesForTotal(form,ids={},doneAccount={},level=1)
|
||||||
|
self.done_total=0
|
||||||
|
|
||||||
|
for t1 in range(0,len(form['fiscalyear'][0][2])):
|
||||||
|
locale.setlocale(locale.LC_ALL, '')
|
||||||
|
self.result_total["sum_credit" + str(t1)]=locale.format("%.2f", self.result_total["sum_credit" + str(t1)], grouping=True)
|
||||||
|
self.result_total["sum_debit" + str(t1)]=locale.format("%.2f", self.result_total["sum_debit" + str(t1)], grouping=True)
|
||||||
|
# self.flag=1
|
||||||
|
# self.result_total = {}
|
||||||
|
|
||||||
|
for temp in range(0,len(form['fiscalyear'][0][2])):
|
||||||
|
fy=self.pool.get('account.fiscalyear').name_get(self.cr,self.uid,form['fiscalyear'][0][2][temp])
|
||||||
|
years["year"+str(temp)]=fy[0][1][12:16]
|
||||||
|
|
||||||
|
return [years]
|
||||||
|
|
||||||
|
|
||||||
|
def linesForTotal(self,form,ids={},doneAccount={},level=1):
|
||||||
|
if self.done_total==1:
|
||||||
|
self.done_total==1
|
||||||
|
else:
|
||||||
|
return [self.result_total]
|
||||||
|
accounts=[]
|
||||||
|
if not ids:
|
||||||
|
ids = self.ids
|
||||||
|
if not ids:
|
||||||
|
return []
|
||||||
|
|
||||||
|
ctx = self.context.copy()
|
||||||
|
result_total_parent=[]
|
||||||
|
|
||||||
|
for id in form['fiscalyear'][0][2]:
|
||||||
|
tmp=[]
|
||||||
|
|
||||||
|
ctx['fiscalyear'] = id
|
||||||
|
ctx['periods'] = form['periods'][0][2]
|
||||||
|
ctx['period_manner']=form['select_periods']
|
||||||
|
tmp = self.pool.get('account.account').browse(self.cr, self.uid, ids, ctx.copy())
|
||||||
|
|
||||||
|
if len(tmp):
|
||||||
|
accounts.append(tmp)
|
||||||
|
|
||||||
|
merged_accounts=zip(*accounts)
|
||||||
|
# used to check for the frst record so all sum_credit and sum_debit r set to 0.00
|
||||||
|
if level==1:
|
||||||
|
doneAccount={}
|
||||||
|
for entry in merged_accounts:
|
||||||
|
|
||||||
|
if entry[0].id in doneAccount:
|
||||||
|
continue
|
||||||
|
doneAccount[entry[0].id] = 1
|
||||||
|
|
||||||
|
for k in range(0,len(entry)):
|
||||||
|
temp_credit=0.00
|
||||||
|
temp_debit=0.00
|
||||||
|
|
||||||
|
temp_credit+=entry[k].credit
|
||||||
|
temp_debit+=entry[k].debit
|
||||||
|
|
||||||
|
if self.flag==1:
|
||||||
|
self.result_total["sum_credit" + str(k)]=0.00
|
||||||
|
self.result_total["sum_debit" + str(k)]=0.00
|
||||||
|
|
||||||
|
if form['account_choice']=='bal_zero':
|
||||||
|
if temp_credit<>temp_debit:
|
||||||
|
self.result_total["sum_credit" + str(k)]+=temp_credit
|
||||||
|
self.result_total["sum_debit" + str(k)]+=temp_debit
|
||||||
|
else:
|
||||||
|
self.result_total["sum_credit" + str(k)]+=temp_credit
|
||||||
|
self.result_total["sum_debit" + str(k)]+=temp_debit
|
||||||
|
|
||||||
|
self.flag=2
|
||||||
|
|
||||||
|
if entry[0].child_id:
|
||||||
|
ids2 = [(x.code,x.id) for x in entry[0].child_id]
|
||||||
|
ids2.sort()
|
||||||
|
|
||||||
|
result_total_parent = self.linesForTotal(form, [x[1] for x in ids2],doneAccount,level+1)
|
||||||
|
|
||||||
|
return [self.result_total]
|
||||||
|
|
||||||
|
def lines(self, form, ids={}, done={}, level=1):
|
||||||
|
accounts=[]
|
||||||
|
if not ids:
|
||||||
|
ids = self.ids
|
||||||
|
if not ids:
|
||||||
|
return []
|
||||||
|
result = []
|
||||||
|
ctx = self.context.copy()
|
||||||
|
tmp1=[]
|
||||||
|
for id in form['fiscalyear'][0][2]:
|
||||||
|
|
||||||
|
ctx['fiscalyear'] = id
|
||||||
|
ctx['periods'] = form['periods'][0][2]
|
||||||
|
ctx['period_manner']=form['select_periods']
|
||||||
|
|
||||||
|
tmp1 = self.pool.get('account.account').browse(self.cr, self.uid, ids,ctx.copy())
|
||||||
|
|
||||||
|
if len(tmp1):
|
||||||
|
accounts.append(tmp1)
|
||||||
|
|
||||||
|
if level==1: #if parent is called,done is not empty when called again.
|
||||||
|
done={}
|
||||||
|
|
||||||
|
def cmp_code(x, y):
|
||||||
|
return cmp(x.code, y.code)
|
||||||
|
for n in range(0,len(accounts)):
|
||||||
|
accounts[n].sort(cmp_code)
|
||||||
|
common={}
|
||||||
|
merged_accounts=zip(*accounts)
|
||||||
|
|
||||||
|
for entry in merged_accounts:
|
||||||
|
j=0
|
||||||
|
checked=1
|
||||||
|
|
||||||
|
if form['account_choice']!='all': # if checked,include empty a/c;not otherwise
|
||||||
|
checked=0
|
||||||
|
|
||||||
|
if entry[0].id in done:
|
||||||
|
continue
|
||||||
|
done[entry[0].id] = 1
|
||||||
|
|
||||||
|
if entry[0].child_id: # this is for parent account,dont check 0 for it
|
||||||
|
checked=4
|
||||||
|
self.status=1 # for displaying it Bold
|
||||||
|
else:
|
||||||
|
self.status=0
|
||||||
|
if checked==0:
|
||||||
|
i=0
|
||||||
|
for i in range(0,len(entry)):
|
||||||
|
if bal_zero==0:
|
||||||
|
if entry[i].balance<>0.0:
|
||||||
|
checked=4
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
checked=3
|
||||||
|
i=i+1
|
||||||
|
else:
|
||||||
|
if entry[i].credit <> 0.0 or entry[i].debit <> 0.0:
|
||||||
|
checked=4
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
checked=3
|
||||||
|
i=i+1
|
||||||
|
|
||||||
|
if checked==3:
|
||||||
|
# this is the point where we skip those accounts which are encountered as empty ones
|
||||||
|
continue
|
||||||
|
self.empty_parent=0
|
||||||
|
else:
|
||||||
|
self.empty_parent=1
|
||||||
|
res = {
|
||||||
|
'code': entry[0].code,
|
||||||
|
'name': entry[0].name,
|
||||||
|
'level': level,
|
||||||
|
'status': self.status,
|
||||||
|
}
|
||||||
|
|
||||||
|
for j in range(0,len(entry)):
|
||||||
|
|
||||||
|
locale.setlocale(locale.LC_ALL, '')
|
||||||
|
res["debit"+str(j)]=locale.format("%.2f", entry[j].debit, grouping=True)
|
||||||
|
res["credit"+str(j)]=locale.format("%.2f", entry[j].credit, grouping=True)
|
||||||
|
res["balance"+str(j)]=locale.format("%.2f", entry[j].balance, grouping=True)
|
||||||
|
|
||||||
|
|
||||||
|
if j==0:
|
||||||
|
res["bal_cash"+str(j)]="0.00"
|
||||||
|
res["bal_perc"+str(j)]="0.00%"
|
||||||
|
else:
|
||||||
|
temp_cash=entry[j].balance - entry[j-1].balance
|
||||||
|
res["bal_cash"+str(j)]=locale.format("%.2f", temp_cash, grouping=True)
|
||||||
|
if entry[j-1].balance<>0.00:
|
||||||
|
temp_perc=(entry[j].balance - entry[j-1].balance )*100/entry[j-1].balance
|
||||||
|
else:
|
||||||
|
temp_perc=(entry[j].balance) *100
|
||||||
|
|
||||||
|
res["bal_perc"+str(j)]=locale.format("%.2f", temp_perc) + "%"
|
||||||
|
|
||||||
|
|
||||||
|
if ref_bal=='nothing':
|
||||||
|
if level==1:
|
||||||
|
self.parent_bal=1
|
||||||
|
else:
|
||||||
|
self.parent_bal=0
|
||||||
|
|
||||||
|
if self.parent_bal==1:
|
||||||
|
res["balance_perc"+str(j)]="/"
|
||||||
|
else:
|
||||||
|
if entry[j].balance==0.00:
|
||||||
|
if self.baldiv["baldiv"+str(level-1)+str(j)]<>0.00:
|
||||||
|
res["balance_perc"+str(j)]="0.00%"
|
||||||
|
else:
|
||||||
|
res["balance_perc"+str(j)]="/"
|
||||||
|
else:
|
||||||
|
if self.baldiv["baldiv"+str(level-1)+str(j)]<>0.00:
|
||||||
|
temp=self.baldiv["baldiv"+str(level-1)+str(j)]
|
||||||
|
temp1=(entry[j].balance * 100 )/ float(temp)
|
||||||
|
temp1=round(temp1,2)
|
||||||
|
res["balance_perc" + str(j)]=str(temp1)+"%"
|
||||||
|
else:
|
||||||
|
res["balance_perc"+str(j)]="/"
|
||||||
|
else:
|
||||||
|
res["balance_perc"+str(j)]=str( (entry[j].balance * 100 )/ float(ref_bal)) + "%"
|
||||||
|
|
||||||
|
result.append(res)
|
||||||
|
|
||||||
|
if entry[0].child_id:
|
||||||
|
|
||||||
|
for q in range(0,len(form['fiscalyear'][0][2])):
|
||||||
|
self.baldiv["baldiv"+str(level)+str(q)]=entry[q].balance
|
||||||
|
|
||||||
|
ids2 = [(x.code,x.id) for x in entry[0].child_id]
|
||||||
|
ids2.sort()
|
||||||
|
dir=[]
|
||||||
|
dir += self.lines(form, [x[1] for x in ids2], done, level+1)
|
||||||
|
if dir==[]:
|
||||||
|
for w in range(0,len(form['fiscalyear'][0][2])):
|
||||||
|
if entry[w].credit <> 0.0 or entry[w].debit <> 0.0 or entry[w].balance<>0.00:
|
||||||
|
dont_pop=1
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
dont_pop=0
|
||||||
|
if dont_pop==1:
|
||||||
|
result +=dir
|
||||||
|
else:
|
||||||
|
result.pop(-1) # here we pop up the parent having its children as emprty accounts
|
||||||
|
else:
|
||||||
|
result +=dir
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
report_sxw.report_sxw('report.account.balance.account.balance', 'account.account', 'addons/account_balance/report/account_balance.rml', parser=account_balance, header=False)
|
||||||
|
report_sxw.report_sxw('report.account.account.balance.landscape', 'account.account', 'addons/account_balance/report/account_balance_landscape.rml', parser=account_balance, header=False)
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,179 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<document filename="test.pdf">
|
||||||
|
<template pageSize="(635.0,842.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||||
|
<pageTemplate id="first">
|
||||||
|
<frame id="first" x1="15.0" y1="15.0" width="615" height="772"/>
|
||||||
|
</pageTemplate>
|
||||||
|
</template>
|
||||||
|
<stylesheet>
|
||||||
|
<blockTableStyle id="Standard_Outline">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table1">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="0,1" stop="0,1"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="1,1" stop="1,1"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="2,1" stop="2,1"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table6">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<lineStyle kind="GRID" colorName="black"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table61">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<lineStyle kind="GRID" colorName="red"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table2">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<lineStyle kind="GRID" colorName="black"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table5">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table4">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<lineStyle kind="GRID" colorName="black"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<initialize>
|
||||||
|
<paraStyle name="all" alignment="justify"/>
|
||||||
|
</initialize>
|
||||||
|
<paraStyle name="P1" fontName="Times-Roman" fontSize="12.0" leading="18" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P2" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT" spaceBefore="0.0"/>
|
||||||
|
<paraStyle name="P3" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="RIGHT" />
|
||||||
|
<paraStyle name="P4" fontName="Times-Roman" fontSize="9.0" alignment="CENTER"/>
|
||||||
|
<paraStyle name="P5" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P6" fontName="Times-Roman" fontSize="9.0" leading="12" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P7" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="LEFT"/>
|
||||||
|
<paraStyle name="P8" fontName="Times-Roman" alignment="CENTER"/>
|
||||||
|
<paraStyle name="P9" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P10" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P11" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P12" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P13" rightIndent="17.0" leftIndent="-0.0" fontName="Times-Bold" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="1.0"/>
|
||||||
|
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||||
|
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||||
|
</stylesheet>
|
||||||
|
<story>
|
||||||
|
<blockTable colWidths="143.0,226.0,156.0" repeatRows="1" style="Table1">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="Table Contents">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P1">Account balance</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P3">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="Table Contents">[[ company.name ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P5">Currency: [[ company.currency_id.name ]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<para style="Standard">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<para style="P8">Printing date: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]]</para>
|
||||||
|
<para style="P8">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<section>
|
||||||
|
<para style="P13"> [[repeatIn(linesForYear(data['form']),'year_header',td=len(data['form']['fiscalyear'][0][2]),width=[126],value=['year'],type=['string']) ]]</para>
|
||||||
|
<blockTable colWidths="190.0" style="Table6">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P1">Account Information</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<para style="P13">[[ repeatIn([],'title',td=len(data['form']['fiscalyear'][0][2]),width=[42,42,42],value=['Debit','Credit','Balance'],type=['lable','lable','lable']) ]]</para>
|
||||||
|
<blockTable colWidths="30.0,160.0" style="Table6">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P1">Code</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P1">Account Name</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<para style="P13">[[ repeatIn([],'title',td=len(data['form']['fiscalyear'][0][2]),width=[84,42],value=['Cash','%'],type=['lable','lable']) ]]</para>
|
||||||
|
<blockTable colWidths="190.0" style="Table5">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P4"> </para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
</section>
|
||||||
|
<para style="P8">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<section>
|
||||||
|
<para style="P13">[[ repeatIn(lines(data['form']),'a',td=len(data['form']['fiscalyear'][0][2]),width=[42,42,42],value=['debit','credit','balance'],type=['string','string','string']) ]]</para>
|
||||||
|
<blockTable colWidths="0.0,28.0,162.0" style="Table5">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P3"> </para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P7">[[ a['status']==1 and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['code'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P2"><font>[['.....'*(a['level']-1) ]][[ setTag('font','font',{'color':'white'}) ]]</font><font>[[ a['status']==1 and ( setTag('font','font',{'name':'Times-bold'})) ]][[ a['name'] ]]</font></para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
</section>
|
||||||
|
<para style="P8">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<section>
|
||||||
|
<para style="P13">[[ repeatIn(linesForTotal(data['form']),'total',td=len(data['form']['fiscalyear'][0][2]),width=[42,42,42],value=['sum_debit','sum_credit',''],type=['string','string','lable'] ) ]]</para>
|
||||||
|
<blockTable colWidths="190.0" style="Table6">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P3">Total:[[ data['form']['show_columns']==0 and removeParentNode('section')]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<para style="Standard">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</story>
|
||||||
|
</document>
|
|
@ -0,0 +1,179 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<document filename="test.pdf">
|
||||||
|
<template pageSize="(1120.0,570.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||||
|
<pageTemplate id="first">
|
||||||
|
<frame id="first" x1="15.0" y1="15.0" width="1080" height="530"/>
|
||||||
|
</pageTemplate>
|
||||||
|
</template>
|
||||||
|
<stylesheet>
|
||||||
|
<blockTableStyle id="Standard_Outline">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table1">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="0,1" stop="0,1"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="1,1" stop="1,1"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="2,1" stop="2,1"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table6">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<lineStyle kind="GRID" colorName="black"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table61">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<lineStyle kind="GRID" colorName="red"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table2">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<lineStyle kind="GRID" colorName="black"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table5">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table4">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<lineStyle kind="GRID" colorName="black"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<initialize>
|
||||||
|
<paraStyle name="all" alignment="justify"/>
|
||||||
|
</initialize>
|
||||||
|
<paraStyle name="P1" fontName="Times-Roman" fontSize="12.0" leading="18" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P2" fontName="Times-Roman" fontSize="9.0" leading="11" alignment="LEFT"/>
|
||||||
|
<paraStyle name="P3" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="RIGHT"/>
|
||||||
|
<paraStyle name="P4" fontName="Times-Roman" fontSize="9.0" alignment="CENTER"/>
|
||||||
|
<paraStyle name="P5" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P6" fontName="Times-Roman" fontSize="9.0" leading="12" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P7" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="LEFT"/>
|
||||||
|
<paraStyle name="P8" fontName="Times-Roman" alignment="CENTER"/>
|
||||||
|
<paraStyle name="P9" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P10" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P11" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P12" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P13" rightIndent="17.0" leftIndent="-0.0" fontName="Times-Bold" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="1.0"/>
|
||||||
|
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||||
|
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||||
|
</stylesheet>
|
||||||
|
<story>
|
||||||
|
<blockTable colWidths="143.0,226.0,156.0" repeatRows="1" style="Table1">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="Table Contents">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P1">Account balance</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P3">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="Table Contents">[[ company.name ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P5">Currency: [[ company.currency_id.name ]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<para style="Standard">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<para style="P8">Printing date: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]]</para>
|
||||||
|
<para style="P8">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<section>
|
||||||
|
<para style="P13"> [[repeatIn(linesForYear(data['form']),'year_header',td=len(data['form']['fiscalyear'][0][2]),width=[126],value=['year'],type=['string']) ]]</para>
|
||||||
|
<blockTable colWidths="180.0" style="Table6">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P1">Account Information</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<para style="P13">[[ repeatIn([],'title',td=len(data['form']['fiscalyear'][0][2]),width=[42,42,42],value=['Debit','Credit','Balance'],type=['lable','lable','lable']) ]]</para>
|
||||||
|
<blockTable colWidths="30.0,150.0" style="Table6">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P1">Code</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P1">Account Name</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<para style="P13">[[ repeatIn([],'title',td=len(data['form']['fiscalyear'][0][2]),width=[84,42],value=['Cash','%'],type=['lable','lable']) ]]</para>
|
||||||
|
<blockTable colWidths="180.0" style="Table5">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P4"> </para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
</section>
|
||||||
|
<para style="P8">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<section>
|
||||||
|
<para style="P13">[[ repeatIn(lines(data['form']),'a',td=len(data['form']['fiscalyear'][0][2]),width=[42,42,42],value=['debit','credit','balance'],type=['string','string','string']) ]]</para>
|
||||||
|
<blockTable colWidths="0.0,28.0,152.0" style="Table5">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P3"> </para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P7">[[ a['status']==1 and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ a['code'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P2"><font>[['.....'*(a['level']-1) ]][[ setTag('font','font',{'color':'white'}) ]]</font><font>[[ a['status']==1 and ( setTag('font','font',{'name':'Times-bold'})) ]][[ a['name'] ]]</font></para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
</section>
|
||||||
|
<para style="P8">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<section>
|
||||||
|
<para style="P13">[[ repeatIn(linesForTotal(data['form']),'total',td=len(data['form']['fiscalyear'][0][2]),width=[42,42,42],value=['sum_debit','sum_credit',''],type=['string','string','lable'] ) ]]</para>
|
||||||
|
<blockTable colWidths="180.0" style="Table6">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P3">Total:[[ data['form']['show_columns']==0 and removeParentNode('section')]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<para style="Standard">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</story>
|
||||||
|
</document>
|
|
@ -0,0 +1,4 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
import wizard_account_balance_report
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,181 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting from its eventual inadequacies and bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees and support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
import wizard
|
||||||
|
import ir
|
||||||
|
import pooler
|
||||||
|
import time
|
||||||
|
import netsvc
|
||||||
|
from osv import fields, osv
|
||||||
|
import mx.DateTime
|
||||||
|
from mx.DateTime import RelativeDateTime
|
||||||
|
|
||||||
|
from tools import config
|
||||||
|
|
||||||
|
|
||||||
|
dates_form = '''<?xml version="1.0"?>
|
||||||
|
<form string="Customize Report">
|
||||||
|
<notebook tabpos="up">
|
||||||
|
<page string="Report Options">
|
||||||
|
<separator string="Select Fiscal Year(s)(Maximum Three Years)" colspan="4"/>
|
||||||
|
<field name="fiscalyear" colspan="5" nolabel="1"/>
|
||||||
|
<field name="landscape" colspan="4"/>
|
||||||
|
<field name="show_columns" colspan="4"/>
|
||||||
|
<field name="format_perc" colspan="4"/>
|
||||||
|
<field name="select_account" colspan="4"/>
|
||||||
|
<field name="account_choice" colspan="4"/>
|
||||||
|
<field name="compare_pattern" colspan="4"/>
|
||||||
|
|
||||||
|
</page>
|
||||||
|
|
||||||
|
<page string="Select Period">
|
||||||
|
<field name="select_periods" colspan="4"/>
|
||||||
|
<separator string="Select Period(s)" colspan="4"/>
|
||||||
|
<field name="periods" colspan="4" nolabel="1"/>
|
||||||
|
</page>
|
||||||
|
</notebook>
|
||||||
|
</form>'''
|
||||||
|
|
||||||
|
dates_fields = {
|
||||||
|
'fiscalyear': {'string': 'Fiscal year', 'type': 'many2many', 'relation': 'account.fiscalyear'},
|
||||||
|
'select_account': {'string': 'Select Reference Account(for % comparision)', 'type': 'many2one', 'relation': 'account.account','help': 'Keep empty for comparision to its parent'},
|
||||||
|
'account_choice': {'string': 'Show Accounts', 'type': 'selection','selection':[('all','All accounts'),('bal_zero','With balance is not equal to 0'),('moves','With movements')]},
|
||||||
|
'show_columns': {'string': 'Show Debit/Credit Information', 'type': 'boolean'},
|
||||||
|
'landscape': {'string': 'Show Report in Landscape Form', 'type': 'boolean'},
|
||||||
|
'format_perc': {'string': 'Show Comparision in %', 'type': 'boolean'},
|
||||||
|
'compare_pattern':{'string':"Compare Selected Years In Terms Of",'type':'selection','selection':[('bal_cash','Cash'),('bal_perc','Percentage'),('none','Don'+ "'" +'t Compare')]},
|
||||||
|
'select_periods':{'string':"Select Invoices Based on Their",'type':'selection','selection':[('actual','Actual Period (Duration)'),('created','Creation Date')]},
|
||||||
|
'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'}
|
||||||
|
}
|
||||||
|
|
||||||
|
back_form='''<?xml version="1.0"?>
|
||||||
|
<form string="Notification">
|
||||||
|
<separator string="You might have done following mistakes.Please correct them and try again." colspan="4"/>
|
||||||
|
<separator string="1. You have selected more than 3 years in any case." colspan="4"/>
|
||||||
|
<separator string="2. You have not selected 'Percentage' option,but you have selected more than 2 years." colspan="4"/>
|
||||||
|
<label string="You can select maximum 3 years.Please check again." colspan="4"/>
|
||||||
|
<separator string="3. You have selected 'Percentage' option with more than 2 years,but you have not selected landscape format." colspan="4"/>
|
||||||
|
<label string="You have to select 'Landscape' option.Please Check it." colspan="4"/>
|
||||||
|
</form>'''
|
||||||
|
|
||||||
|
back_fields={
|
||||||
|
}
|
||||||
|
|
||||||
|
zero_form='''<?xml version="1.0"?>
|
||||||
|
<form string="Notification">
|
||||||
|
<separator string="You have to select atleast 1 Fiscal Year. Try again." colspan="4"/>
|
||||||
|
<label string="You may have selected the compare opions with more than 1 years with credit/debit columns and % option.This can lead contents to be printed out of the paper.Please try again."/>
|
||||||
|
</form>'''
|
||||||
|
|
||||||
|
zero_fields={
|
||||||
|
}
|
||||||
|
|
||||||
|
def _check(self, cr, uid, data, context):
|
||||||
|
|
||||||
|
if (len(data['form']['fiscalyear'][0][2])==0) or (len(data['form']['fiscalyear'][0][2])>1 and (data['form']['compare_pattern']!='none') and (data['form']['format_perc']==1) and (data['form']['show_columns']==1) and (data['form']['landscape']!=1)):
|
||||||
|
return 'zero_years'
|
||||||
|
|
||||||
|
if ((len(data['form']['fiscalyear'][0][2])==3) and (data['form']['format_perc']!=1) and (data['form']['show_columns']!=1)):
|
||||||
|
if data['form']['landscape']==1:
|
||||||
|
return 'report_landscape'
|
||||||
|
else:
|
||||||
|
return 'report'
|
||||||
|
|
||||||
|
|
||||||
|
if data['form']['format_perc']==1:
|
||||||
|
if len(data['form']['fiscalyear'][0][2])<=2:
|
||||||
|
if data['form']['landscape']==1:
|
||||||
|
return 'report_landscape'
|
||||||
|
else:
|
||||||
|
return 'report'
|
||||||
|
else:
|
||||||
|
if len(data['form']['fiscalyear'][0][2])==3:
|
||||||
|
if data['form']['landscape']==1:
|
||||||
|
return 'report_landscape'
|
||||||
|
else:
|
||||||
|
return 'backtoinit'
|
||||||
|
else:
|
||||||
|
return 'backtoinit'
|
||||||
|
|
||||||
|
else:
|
||||||
|
if len(data['form']['fiscalyear'][0][2])>2:
|
||||||
|
if data['form']['landscape']==1:
|
||||||
|
return 'report_landscape'
|
||||||
|
else:
|
||||||
|
return 'backtoinit'
|
||||||
|
else:
|
||||||
|
if data['form']['landscape']==1:
|
||||||
|
return 'report_landscape'
|
||||||
|
else:
|
||||||
|
return 'report'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class wizard_report(wizard.interface):
|
||||||
|
def _get_defaults(self, cr, uid, data, context):
|
||||||
|
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
|
||||||
|
data['form']['fiscalyear']=[fiscalyear_obj.find(cr, uid)]
|
||||||
|
# p_ids=pooler.get_pool(cr.dbname).get('account.period').search(cr,uid,[('fiscalyear_id','=',fiscalyear_obj.find(cr, uid))])
|
||||||
|
# data['form']['periods']=p_ids
|
||||||
|
data['form']['compare_pattern']='none'
|
||||||
|
data['form']['account_choice']='moves'
|
||||||
|
data['form']['select_periods']='actual'
|
||||||
|
return data['form']
|
||||||
|
|
||||||
|
|
||||||
|
states = {
|
||||||
|
'init': {
|
||||||
|
'actions': [_get_defaults],
|
||||||
|
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('checkyear','Print')]}
|
||||||
|
},
|
||||||
|
'backtoinit': {
|
||||||
|
'actions': [],
|
||||||
|
'result': {'type':'form','arch':back_form,'fields':back_fields,'state':[('end','Ok')]}
|
||||||
|
},
|
||||||
|
'zero_years': {
|
||||||
|
'actions': [],
|
||||||
|
'result': {'type':'form','arch':zero_form,'fields':zero_fields,'state':[('end','Ok')]}
|
||||||
|
},
|
||||||
|
'checkyear': {
|
||||||
|
'actions': [],
|
||||||
|
'result': {'type':'choice','next_state':_check}
|
||||||
|
},
|
||||||
|
'report_landscape': {
|
||||||
|
'actions': [],
|
||||||
|
'result': {'type':'print', 'report':'account.account.balance.landscape', 'state':'end'}
|
||||||
|
},
|
||||||
|
'report': {
|
||||||
|
'actions': [],
|
||||||
|
'result': {'type':'print', 'report':'account.balance.account.balance', 'state':'end'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wizard_report('account.balance.account.balance.report')
|
||||||
|
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
import crossovered_budget
|
||||||
|
import report
|
||||||
|
import wizard
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
{
|
||||||
|
"name" : "Crossovered Budget Management",
|
||||||
|
"version" : "1.0",
|
||||||
|
"author" : "Tiny",
|
||||||
|
"website" : "http://tinyerp.com/module_crossovered_budget.html",
|
||||||
|
"category" : "Generic Modules/Accounting",
|
||||||
|
"description": """This module allow accountants to manage analytic and crossovered budgets.
|
||||||
|
|
||||||
|
Once the Master Budgets and the Budgets defined (in Financial Management/Configuration/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 greater/lower than what he planned for this Budget/Master Budget. Each list of record can also be switched to a graphical view of it.
|
||||||
|
|
||||||
|
Three reports are available:
|
||||||
|
1. The first is available from a list of Budgets. It gives the spreading, for these Budgets, of the Analytic Accounts per Master Budgets.
|
||||||
|
|
||||||
|
2. The second is a summary of the previous one, it only gives the spreading, for the selected Budgets, of the Analytic Accounts.
|
||||||
|
|
||||||
|
3. The last one is available from the Analytic Chart of Accounts. It gives the spreading, for the selected Analytic Accounts, of the Master Budgets per Budgets.
|
||||||
|
|
||||||
|
""",
|
||||||
|
"depends" : ["account"],
|
||||||
|
"init_xml" : [],
|
||||||
|
"demo_xml" : [],
|
||||||
|
"update_xml" : ["crossovered_budget_view.xml","crossovered_budget_report.xml","crossovered_budget_workflow.xml"],
|
||||||
|
"active": False,
|
||||||
|
"installable": True
|
||||||
|
}
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,196 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
from osv import osv,fields
|
||||||
|
import tools
|
||||||
|
import netsvc
|
||||||
|
from mx import DateTime
|
||||||
|
import time
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
|
||||||
|
def strToDate(dt):
|
||||||
|
dt_date=datetime.date(int(dt[0:4]),int(dt[5:7]),int(dt[8:10]))
|
||||||
|
return dt_date
|
||||||
|
|
||||||
|
class crossovered_budget(osv.osv):
|
||||||
|
_name = "crossovered.budget"
|
||||||
|
_description = "Crossovered Budget"
|
||||||
|
|
||||||
|
_columns = {
|
||||||
|
'name': fields.char('Name', size=50, required=True,states={'done':[('readonly',True)]}),
|
||||||
|
'code': fields.char('Code', size=20, required=True,states={'done':[('readonly',True)]}),
|
||||||
|
'creating_user_id': fields.many2one('res.users','Responsible User'),
|
||||||
|
'validating_user_id': fields.many2one('res.users','Validate User', readonly=True),
|
||||||
|
'date_from': fields.date('Start Date',required=True,states={'done':[('readonly',True)]}),
|
||||||
|
'date_to': fields.date('End Date',required=True,states={'done':[('readonly',True)]}),
|
||||||
|
'state' : fields.selection([('draft','Draft'),('confirm','Confirmed'),('validate','Validated'),('done','Done'),('cancel', 'Cancelled')], 'State', select=True, required=True, readonly=True),
|
||||||
|
'crossovered_budget_line': fields.one2many('crossovered.budget.lines', 'crossovered_budget_id', 'Budget Lines',states={'done':[('readonly',True)]} ),
|
||||||
|
}
|
||||||
|
|
||||||
|
_defaults = {
|
||||||
|
'state': lambda *a: 'draft',
|
||||||
|
'creating_user_id': lambda self,cr,uid,context: uid,
|
||||||
|
}
|
||||||
|
|
||||||
|
# def action_set_to_draft(self, cr, uid, ids, *args):
|
||||||
|
# self.write(cr, uid, ids, {'state': 'draft'})
|
||||||
|
# wf_service = netsvc.LocalService('workflow')
|
||||||
|
# for id in ids:
|
||||||
|
# wf_service.trg_create(uid, self._name, id, cr)
|
||||||
|
# return True
|
||||||
|
|
||||||
|
def budget_confirm(self, cr, uid, ids, *args):
|
||||||
|
self.write(cr, uid, ids, {
|
||||||
|
'state':'confirm'
|
||||||
|
})
|
||||||
|
return True
|
||||||
|
|
||||||
|
def budget_validate(self, cr, uid, ids, *args):
|
||||||
|
self.write(cr, uid, ids, {
|
||||||
|
'state':'validate',
|
||||||
|
'validating_user_id': uid,
|
||||||
|
})
|
||||||
|
return True
|
||||||
|
|
||||||
|
def budget_cancel(self, cr, uid, ids, *args):
|
||||||
|
|
||||||
|
self.write(cr, uid, ids, {
|
||||||
|
'state':'cancel'
|
||||||
|
})
|
||||||
|
return True
|
||||||
|
|
||||||
|
def budget_done(self, cr, uid, ids, *args):
|
||||||
|
self.write(cr, uid, ids, {
|
||||||
|
'state':'done'
|
||||||
|
})
|
||||||
|
return True
|
||||||
|
|
||||||
|
crossovered_budget()
|
||||||
|
|
||||||
|
class crossovered_budget_lines(osv.osv):
|
||||||
|
|
||||||
|
def _pra_amt(self, cr, uid, ids,name,args,context):
|
||||||
|
res = {}
|
||||||
|
for line in self.browse(cr, uid, ids):
|
||||||
|
acc_ids = ','.join([str(x.id) for x in line.general_budget_id.account_ids])
|
||||||
|
if not acc_ids:
|
||||||
|
raise osv.except_osv('Error!',"The General Budget '" + str(line.general_budget_id.name) + "' has no Accounts!" )
|
||||||
|
date_to = line.date_to
|
||||||
|
date_from = line.date_from
|
||||||
|
if context.has_key('wizard_date_from'):
|
||||||
|
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=%d and (date between to_date('%s','yyyy-mm-dd') and to_date('%s','yyyy-mm-dd')) and general_account_id in (%s)"%(line.analytic_account_id.id,date_from,date_to,acc_ids))
|
||||||
|
result=cr.fetchone()[0]
|
||||||
|
if result==None:
|
||||||
|
result=0.00
|
||||||
|
res[line.id]=result
|
||||||
|
return res
|
||||||
|
|
||||||
|
def _theo_amt(self, cr, uid, ids,name,args,context):
|
||||||
|
res = {}
|
||||||
|
for line in self.browse(cr, uid, ids):
|
||||||
|
today=datetime.datetime.today()
|
||||||
|
date_to = today.strftime("%Y-%m-%d")
|
||||||
|
date_from = line.date_from
|
||||||
|
if context.has_key('wizard_date_from'):
|
||||||
|
date_from = context['wizard_date_from']
|
||||||
|
if context.has_key('wizard_date_to'):
|
||||||
|
date_to = context['wizard_date_to']
|
||||||
|
|
||||||
|
if line.paid_date:
|
||||||
|
if strToDate(date_to)<=strToDate(line.paid_date):
|
||||||
|
theo_amt=0.00
|
||||||
|
else:
|
||||||
|
theo_amt=line.planned_amount
|
||||||
|
else:
|
||||||
|
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)
|
||||||
|
|
||||||
|
theo_amt=float(elapsed.days/float(total.days))*line.planned_amount
|
||||||
|
|
||||||
|
res[line.id]=theo_amt
|
||||||
|
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 / line.theoritical_amount)*100
|
||||||
|
else:
|
||||||
|
res[line.id]=0.00
|
||||||
|
return res
|
||||||
|
_name="crossovered.budget.lines"
|
||||||
|
_description = "Crossovered Budget Lines"
|
||||||
|
_columns = {
|
||||||
|
'crossovered_budget_id': fields.many2one('crossovered.budget', 'Budget Ref', ondelete='cascade', select=True, required=True),
|
||||||
|
'analytic_account_id': fields.many2one('account.analytic.account', 'Analytic Account Ref',required=True),
|
||||||
|
'general_budget_id': fields.many2one('account.budget.post', 'Master Budget Ref',required=True),
|
||||||
|
'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),
|
||||||
|
'practical_amount':fields.function(_pra_amt,method=True, string='Practical Amount',type='float'),
|
||||||
|
'theoritical_amount':fields.function(_theo_amt,method=True, string='Theoritical Amount',type='float'),
|
||||||
|
'percentage':fields.function(_perc,method=True, string='Percentage',type='float'),
|
||||||
|
}
|
||||||
|
crossovered_budget_lines()
|
||||||
|
|
||||||
|
class account_budget_post(osv.osv):
|
||||||
|
_name = 'account.budget.post'
|
||||||
|
_inherit = 'account.budget.post'
|
||||||
|
_columns = {
|
||||||
|
'crossovered_budget_line': fields.one2many('crossovered.budget.lines', 'general_budget_id', 'Budget Lines'),
|
||||||
|
}
|
||||||
|
account_budget_post()
|
||||||
|
|
||||||
|
class account_budget_post_dotation(osv.osv):
|
||||||
|
_name = 'account.budget.post.dotation'
|
||||||
|
_inherit = 'account.budget.post.dotation'
|
||||||
|
|
||||||
|
def _tot_planned(self, cr, uid, ids,name,args,context):
|
||||||
|
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= '"+ str(budget_id) + "' AND (date_from >='" +obj_period.date_start +"' and date_from <= '"+obj_period.date_stop + "') OR (date_to >='" +obj_period.date_start +"' and date_to <= '"+obj_period.date_stop + "') OR (date_from <'" +obj_period.date_start +"' and date_to > '"+obj_period.date_stop + "')"
|
||||||
|
cr.execute(query)
|
||||||
|
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
|
||||||
|
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
|
||||||
|
res[line.id]=tot_planned
|
||||||
|
else:
|
||||||
|
res[line.id]=0.00
|
||||||
|
return res
|
||||||
|
|
||||||
|
_columns = {
|
||||||
|
'tot_planned':fields.function(_tot_planned,method=True, string='Total Planned Amount',type='float',store=True),
|
||||||
|
}
|
||||||
|
|
||||||
|
account_budget_post_dotation()
|
||||||
|
|
||||||
|
class account_analytic_account(osv.osv):
|
||||||
|
_name = 'account.analytic.account'
|
||||||
|
_inherit = 'account.analytic.account'
|
||||||
|
|
||||||
|
_columns = {
|
||||||
|
'crossovered_budget_line': fields.one2many('crossovered.budget.lines', 'analytic_account_id', 'Budget Lines'),
|
||||||
|
}
|
||||||
|
|
||||||
|
account_analytic_account()
|
||||||
|
|
||||||
|
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<terp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<!-- Reports on crossovered.budget -->
|
||||||
|
<report id="report_crossovered_budget"
|
||||||
|
string="Print Budgets"
|
||||||
|
model="crossovered.budget"
|
||||||
|
name="crossovered.budget.report"
|
||||||
|
rml="account_budget_crossover/report/crossovered_budget_report.rml"
|
||||||
|
auto="False"
|
||||||
|
menu="False" />
|
||||||
|
|
||||||
|
<wizard
|
||||||
|
string="Print Budgets"
|
||||||
|
model="crossovered.budget"
|
||||||
|
name="wizard.crossovered.budget"
|
||||||
|
id="wizard_crossovered_budget_menu"
|
||||||
|
keyword="client_print_multi" />
|
||||||
|
|
||||||
|
<wizard
|
||||||
|
string="Print Summary of Budgets"
|
||||||
|
model="crossovered.budget"
|
||||||
|
name="wizard.crossovered.budget.summary"
|
||||||
|
id="wizard_crossovered_budget_menu_1"
|
||||||
|
keyword="client_print_multi" />
|
||||||
|
|
||||||
|
<!-- Reports on account.analytic.account -->
|
||||||
|
<wizard
|
||||||
|
id="account_analytic_account_budget_report"
|
||||||
|
string="Print Budgets"
|
||||||
|
model="account.analytic.account"
|
||||||
|
name="wizard.analytic.account.budget.report"
|
||||||
|
keyword="client_print_multi"/>
|
||||||
|
|
||||||
|
<report id="account_analytic_account_budget"
|
||||||
|
string="Print Budgets"
|
||||||
|
model="account.analytic.account"
|
||||||
|
name="account.analytic.account.budget"
|
||||||
|
rml="account_budget_crossover/report/analytic_account_budget_report.rml"
|
||||||
|
auto="False"
|
||||||
|
menu="False"/>
|
||||||
|
</data>
|
||||||
|
</terp>
|
|
@ -0,0 +1,256 @@
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<terp>
|
||||||
|
<data>
|
||||||
|
<record model="ir.ui.view" id="crossovered_budget_view_form">
|
||||||
|
<field name="name">crossovered.budget.view.form</field>
|
||||||
|
<field name="model">crossovered.budget</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Budget">
|
||||||
|
<field name="name" colspan="1" select="1"/>
|
||||||
|
<field name="code" colspan="1" select="1" />
|
||||||
|
<field name="creating_user_id" />
|
||||||
|
<field name="validating_user_id" readonly="True"/>
|
||||||
|
<field name="date_from" select="2"/>
|
||||||
|
<field name="date_to" select="2"/>
|
||||||
|
<field name="crossovered_budget_line" colspan="4" nolabel="1">
|
||||||
|
<tree string="Budget Lines">
|
||||||
|
<field name="analytic_account_id"/>
|
||||||
|
<field name="general_budget_id"/>
|
||||||
|
<field name="date_from"/>
|
||||||
|
<field name="date_to"/>
|
||||||
|
<field name="paid_date"/>
|
||||||
|
<field name="planned_amount"/>
|
||||||
|
<field name="practical_amount"/>
|
||||||
|
<field name="theoritical_amount"/>
|
||||||
|
<field name="percentage"/>
|
||||||
|
</tree>
|
||||||
|
<form string="Budget Lines">
|
||||||
|
<field name="analytic_account_id" select="1"/>
|
||||||
|
<field name="general_budget_id" select="1"/>
|
||||||
|
<field name="date_from"/>
|
||||||
|
<field name="date_to"/>
|
||||||
|
<field name="paid_date" select="1"/>
|
||||||
|
<field name="planned_amount" select="1"/>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
<field name="state" select="1"/>
|
||||||
|
<group col="4" colspan="2">
|
||||||
|
<button string="Confirm" name="confirm" states="draft" type="workflow" />
|
||||||
|
<button string="Validate" name="validate" states="confirm" type="workflow"/>
|
||||||
|
<button string="Done" name="done" states="validate" type="workflow"/>
|
||||||
|
<button string="Cancel" name="cancel" states="confirm,validate" type="workflow" />
|
||||||
|
<!--<button string="Set to Draft" name="action_set_to_draft" states="cancel" type="object"/>-->
|
||||||
|
</group>
|
||||||
|
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="crossovered_budget_view_tree">
|
||||||
|
<field name="name">crossovered.budget.view.tree</field>
|
||||||
|
<field name="model">crossovered.budget</field>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree string="Budget">
|
||||||
|
<field name="name" colspan="1" select="1"/>
|
||||||
|
<field name="code" colspan="1" select="1" />
|
||||||
|
<field name="state"/>
|
||||||
|
<field name="date_from"/>
|
||||||
|
<field name="date_to"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.actions.act_window" id="act_crossovered_budget_view">
|
||||||
|
<field name="name">Budget</field>
|
||||||
|
<field name="res_model">crossovered.budget</field>
|
||||||
|
<field name="view_type">form</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
<field name="view_id" ref="crossovered_budget_view_tree"/>
|
||||||
|
</record>
|
||||||
|
<menuitem parent="account.next_id_31"
|
||||||
|
id="menu_act_crossovered_budget_view"
|
||||||
|
action="act_crossovered_budget_view" />
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="view_crossovered_budget_line_tree">
|
||||||
|
<field name="name">crossovered.budget.line.tree</field>
|
||||||
|
<field name="model">crossovered.budget.lines</field>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree string="Budget Lines">
|
||||||
|
<field name="analytic_account_id"/>
|
||||||
|
<field name="general_budget_id"/>
|
||||||
|
<field name="date_from"/>
|
||||||
|
<field name="date_to"/>
|
||||||
|
<field name="paid_date"/>
|
||||||
|
<field name="planned_amount"/>
|
||||||
|
<field name="practical_amount" select="1"/>
|
||||||
|
<field name="theoritical_amount"/>
|
||||||
|
<field name="percentage"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.ui.view" id="view_crossovered_budget_line_form">
|
||||||
|
<field name="name">crossovered.budget.line.form</field>
|
||||||
|
<field name="model">crossovered.budget.lines</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Budget Lines">
|
||||||
|
<field name="crossovered_budget_id"/>
|
||||||
|
<field name="analytic_account_id" select="1"/>
|
||||||
|
<field name="general_budget_id" select="1"/>
|
||||||
|
<field name="date_from"/>
|
||||||
|
<field name="date_to"/>
|
||||||
|
<field name="paid_date" select="1"/>
|
||||||
|
<field name="planned_amount" select="1"/>
|
||||||
|
<field name="practical_amount" select="1"/>
|
||||||
|
<field name="theoritical_amount"/>
|
||||||
|
<field name="percentage"/>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.actions.act_window" id="act_crossovered_budget_lines_view">
|
||||||
|
<field name="name">Budget Lines</field>
|
||||||
|
<field name="res_model">crossovered.budget.lines</field>
|
||||||
|
<field name="view_type">form</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
<field name="view_id" ref="view_crossovered_budget_line_tree"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<menuitem name="Budgets" parent="account.menu_action_account_budget_post_tree"
|
||||||
|
id="menu_financial_reporting_budget_budget"/>
|
||||||
|
<menuitem name="Entries" parent="menu_financial_reporting_budget_budget"
|
||||||
|
id="menu_financial_reporting_budget_budget_entries"/>
|
||||||
|
<menuitem parent="menu_financial_reporting_budget_budget_entries"
|
||||||
|
id="menu_act_crossovered_budget_lines_view"
|
||||||
|
action="act_crossovered_budget_lines_view" />
|
||||||
|
|
||||||
|
<!-- Shortcuts -->
|
||||||
|
<act_window name="Budget Lines"
|
||||||
|
domain="[('analytic_account_id', '=', active_id)]"
|
||||||
|
res_model="crossovered.budget.lines"
|
||||||
|
src_model="account.analytic.account"
|
||||||
|
id="act_account_analytic_account_cb_lines"/>
|
||||||
|
|
||||||
|
<!--<record model="ir.ui.view" id="view_budget_post_dotation_form_inherit">
|
||||||
|
<field name="name">account.budget.post.dotation.form.inherit</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="model">account.budget.post.dotation</field>
|
||||||
|
<field name="inherit_id" ref="account.view_budget_post_dotation_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="period_id" position="after">
|
||||||
|
<field name="tot_planned" />
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>-->
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="view_budget_post_dotation_tree_inherit">
|
||||||
|
<field name="name">account.budget.post.dotation.tree.inherit</field>
|
||||||
|
<field name="model">account.budget.post.dotation</field>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="inherit_id" ref="account.view_budget_post_dotation_tree"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="amount" position="after">
|
||||||
|
<field name="tot_planned" />
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="account.view_budget_post_form">
|
||||||
|
<field name="name">account.budget.post.form.inherit</field>
|
||||||
|
<field name="model">account.budget.post</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Master Budget">
|
||||||
|
<notebook>
|
||||||
|
<page string="Definition">
|
||||||
|
<field name="code" select="1"/>
|
||||||
|
<field name="name" select="1"/>
|
||||||
|
</page>
|
||||||
|
<page string="Dotations">
|
||||||
|
<button string="Spread" name="%(account.wizard_budget_spread)d" type="action"/>
|
||||||
|
<field name="dotation_ids" colspan="4" nolabel="1"/>
|
||||||
|
</page>
|
||||||
|
<page string="Accounts">
|
||||||
|
<field name="account_ids" colspan="4" nolabel="1"/>
|
||||||
|
</page>
|
||||||
|
<page string="Budget Lines">
|
||||||
|
<field name="crossovered_budget_line" widget="one2many_list" colspan="4" nolabel="1" mode="tree,graph">
|
||||||
|
<graph type="bar" string="Lines">
|
||||||
|
<field name="analytic_account_id" />
|
||||||
|
<field name="general_budget_id" operator="+" />
|
||||||
|
<field name="planned_amount" operator="+"/>
|
||||||
|
<field group="True" name="general_budget_id"/>
|
||||||
|
</graph>
|
||||||
|
<tree string="Budget Lines" editable="top">
|
||||||
|
<field name="crossovered_budget_id"/>
|
||||||
|
<field name="analytic_account_id"/>
|
||||||
|
<field name="date_from"/>
|
||||||
|
<field name="date_to"/>
|
||||||
|
<field name="paid_date"/>
|
||||||
|
<field name="planned_amount"/>
|
||||||
|
<field name="practical_amount" select="1"/>
|
||||||
|
<field name="theoritical_amount"/>
|
||||||
|
<field name="percentage"/>
|
||||||
|
</tree>
|
||||||
|
<form string="Budget Lines">
|
||||||
|
<field name="crossovered_budget_id"/>
|
||||||
|
<field name="analytic_account_id"/>
|
||||||
|
<field name="date_from"/>
|
||||||
|
<field name="date_to"/>
|
||||||
|
<field name="paid_date"/>
|
||||||
|
<field name="planned_amount"/>
|
||||||
|
<field name="practical_amount" select="1"/>
|
||||||
|
<field name="theoritical_amount"/>
|
||||||
|
<field name="percentage"/>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</page>
|
||||||
|
</notebook>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="view_account_analytic_account_form_inherit_cci">
|
||||||
|
<field name="name">account.analytic.account.form.inherot.cci</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="model">account.analytic.account</field>
|
||||||
|
<field name="inherit_id" ref="account.view_account_analytic_account_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<notebook position="inside">
|
||||||
|
<page string="Budget Lines">
|
||||||
|
<field name="crossovered_budget_line" widget="one2many_list" colspan="4" nolabel="1" mode="tree,graph">
|
||||||
|
<tree string="Budget Lines" editable="top">
|
||||||
|
<field name="crossovered_budget_id"/>
|
||||||
|
<field name="general_budget_id"/>
|
||||||
|
<field name="date_from"/>
|
||||||
|
<field name="date_to"/>
|
||||||
|
<field name="paid_date"/>
|
||||||
|
<field name="planned_amount"/>
|
||||||
|
</tree>
|
||||||
|
<form string="Budget Lines">
|
||||||
|
<field name="crossovered_budget_id"/>
|
||||||
|
<field name="general_budget_id"/>
|
||||||
|
<field name="date_from"/>
|
||||||
|
<field name="date_to"/>
|
||||||
|
<field name="paid_date"/>
|
||||||
|
<field name="planned_amount"/>
|
||||||
|
</form>
|
||||||
|
<graph type="bar" string="Lines">
|
||||||
|
<field name="general_budget_id" />
|
||||||
|
<field name="analytic_account_id" operator="+"/>
|
||||||
|
<field name="planned_amount" operator="+"/>
|
||||||
|
<field group="True" name="analytic_account_id"/>
|
||||||
|
</graph>
|
||||||
|
</field>
|
||||||
|
</page>
|
||||||
|
</notebook>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</terp>
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,104 @@
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<terp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<record model="res.roles" id="crossovered_budget_role">
|
||||||
|
<field name="name">Crossovered Budget Validation</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- Workflow definition -->
|
||||||
|
|
||||||
|
<record model="workflow" id="wkf_crossovered_budget">
|
||||||
|
<field name="name">wkf.crossovered.budget</field>
|
||||||
|
<field name="osv">crossovered.budget</field>
|
||||||
|
<field name="on_create">True</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="workflow.activity" id="act_draft">
|
||||||
|
<field name="wkf_id" ref="wkf_crossovered_budget" />
|
||||||
|
<field name="flow_start">True</field>
|
||||||
|
<field name="name">draft</field>
|
||||||
|
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="workflow.activity" id="act_confirm">
|
||||||
|
<field name="wkf_id" ref="wkf_crossovered_budget" />
|
||||||
|
<field name="name">confirm</field>
|
||||||
|
<field name="kind">function</field>
|
||||||
|
<field name="action">budget_confirm()</field>
|
||||||
|
<field name="split_mode">OR</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="workflow.activity" id="act_validate">
|
||||||
|
<field name="wkf_id" ref="wkf_crossovered_budget" />
|
||||||
|
<field name="name">validate</field>
|
||||||
|
<field name="kind">function</field>
|
||||||
|
<field name="action">budget_validate()</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!--<record model="workflow.activity" id="act_set_to_draft">
|
||||||
|
<field name="wkf_id" ref="wkf_crossovered_budget" />
|
||||||
|
<field name="name">settodraft</field>
|
||||||
|
<field name="kind">function</field>
|
||||||
|
<field name="action">action_set_to_draft()</field>
|
||||||
|
</record>-->
|
||||||
|
|
||||||
|
<record model="workflow.activity" id="act_cancel">
|
||||||
|
<field name="wkf_id" ref="wkf_crossovered_budget" />
|
||||||
|
<field name="name">cancel</field>
|
||||||
|
<field name="kind">function</field>
|
||||||
|
<field name="action">budget_cancel()</field>
|
||||||
|
|
||||||
|
</record>
|
||||||
|
<record model="workflow.activity" id="act_done">
|
||||||
|
<field name="wkf_id" ref="wkf_crossovered_budget" />
|
||||||
|
<field name="name">done</field>
|
||||||
|
<field name="flow_stop">True</field>
|
||||||
|
<field name="kind">stopall</field>
|
||||||
|
<field name="action">budget_done()</field>
|
||||||
|
<field name="join_mode">XOR</field>
|
||||||
|
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="workflow.transition" id="t1">
|
||||||
|
<field name="act_from" ref="act_draft" />
|
||||||
|
<field name="act_to" ref="act_confirm" />
|
||||||
|
<field name="signal">confirm</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="workflow.transition" id="t2">
|
||||||
|
<field name="act_from" ref="act_confirm" />
|
||||||
|
<field name="act_to" ref="act_validate" />
|
||||||
|
<field name="signal">validate</field>
|
||||||
|
<field name="role_id" ref="crossovered_budget_role"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="workflow.transition" id="t3">
|
||||||
|
<field name="act_from" ref="act_confirm" />
|
||||||
|
<field name="act_to" ref="act_cancel" />
|
||||||
|
<field name="signal">cancel</field>
|
||||||
|
<field name="role_id" ref="crossovered_budget_role"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="workflow.transition" id="t4">
|
||||||
|
<field name="act_from" ref="act_validate" />
|
||||||
|
<field name="act_to" ref="act_cancel" />
|
||||||
|
<field name="signal">cancel</field>
|
||||||
|
<field name="role_id" ref="crossovered_budget_role"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="workflow.transition" id="t5">
|
||||||
|
<field name="act_from" ref="act_validate" />
|
||||||
|
<field name="act_to" ref="act_done" />
|
||||||
|
<field name="signal">done</field>
|
||||||
|
<field name="role_id" ref="crossovered_budget_role"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!--<record model="workflow.transition" id="t7">
|
||||||
|
<field name="act_from" ref="act_cancel" />
|
||||||
|
<field name="act_to" ref="act_draft" />
|
||||||
|
<field name="signal">settodraft</field>
|
||||||
|
<field name="role_id" ref="crossovered_budget_role"/>
|
||||||
|
</record>-->
|
||||||
|
</data>
|
||||||
|
</terp>
|
|
@ -0,0 +1,5 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
import crossovered_budget_report
|
||||||
|
import analytic_account_budget_report
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,177 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
import time
|
||||||
|
import pooler
|
||||||
|
from report import report_sxw
|
||||||
|
import datetime
|
||||||
|
|
||||||
|
class analytic_account_budget_report(report_sxw.rml_parse):
|
||||||
|
def __init__(self, cr, uid, name, context):
|
||||||
|
super(analytic_account_budget_report, self).__init__(cr, uid, name, context)
|
||||||
|
self.localcontext.update( {
|
||||||
|
'funct': self.funct,
|
||||||
|
'funct_total': self.funct_total,
|
||||||
|
'time': time,
|
||||||
|
})
|
||||||
|
self.context=context
|
||||||
|
|
||||||
|
|
||||||
|
def funct(self,object,form,ids={}, done=None, level=1):
|
||||||
|
|
||||||
|
if not ids:
|
||||||
|
ids = self.ids
|
||||||
|
# if not ids:
|
||||||
|
# return []
|
||||||
|
if not done:
|
||||||
|
done={}
|
||||||
|
|
||||||
|
global tot
|
||||||
|
tot={
|
||||||
|
'theo':0.00,
|
||||||
|
'pln':0.00,
|
||||||
|
'prac':0.00,
|
||||||
|
'perc':0.00
|
||||||
|
}
|
||||||
|
result=[]
|
||||||
|
accounts = self.pool.get('account.analytic.account').browse(self.cr, self.uid, [object.id], self.context.copy())
|
||||||
|
|
||||||
|
for account_id in accounts:
|
||||||
|
res={}
|
||||||
|
budget_lines=[]
|
||||||
|
b_line_ids=[]
|
||||||
|
|
||||||
|
for line in account_id.crossovered_budget_line:
|
||||||
|
b_line_ids.append(line.id)
|
||||||
|
|
||||||
|
bd_lines_ids = ','.join([str(x) for x in b_line_ids])
|
||||||
|
|
||||||
|
d_from=form['date_from']
|
||||||
|
d_to=form['date_to']
|
||||||
|
|
||||||
|
query="select id from crossovered_budget_lines where id in ("+ str(bd_lines_ids) + ")"# AND '"+ str(d_from) +"'<=date_from AND date_from<date_to AND date_to<= '"+ str(d_to) +"'"
|
||||||
|
|
||||||
|
self.cr.execute(query)
|
||||||
|
budget_line_ids=self.cr.fetchall()
|
||||||
|
|
||||||
|
if not budget_line_ids:
|
||||||
|
return []
|
||||||
|
|
||||||
|
budget_lines=[x[0] for x in budget_line_ids]
|
||||||
|
|
||||||
|
bd_ids = ','.join([str(x) for x in budget_lines])
|
||||||
|
|
||||||
|
self.cr.execute('select distinct(crossovered_budget_id) from crossovered_budget_lines where id in (%s)'%(bd_lines_ids))
|
||||||
|
budget_ids=self.cr.fetchall()
|
||||||
|
|
||||||
|
for i in range(0,len(budget_ids)):
|
||||||
|
|
||||||
|
budget_name=self.pool.get('crossovered.budget').browse(self.cr, self.uid,[budget_ids[i][0]])
|
||||||
|
res={
|
||||||
|
'b_id':'-1',
|
||||||
|
'a_id':'-1',
|
||||||
|
'name':budget_name[0].name,
|
||||||
|
'status':1,
|
||||||
|
'theo':0.00,
|
||||||
|
'pln':0.00,
|
||||||
|
'prac':0.00,
|
||||||
|
'perc':0.00
|
||||||
|
}
|
||||||
|
result.append(res)
|
||||||
|
|
||||||
|
line_ids = self.pool.get('crossovered.budget.lines').search(self.cr, self.uid, [('id', 'in', b_line_ids),('crossovered_budget_id','=',budget_ids[i][0])])
|
||||||
|
line_id = self.pool.get('crossovered.budget.lines').browse(self.cr,self.uid,line_ids)
|
||||||
|
tot_theo=tot_pln=tot_prac=tot_perc=0
|
||||||
|
|
||||||
|
done_budget=[]
|
||||||
|
for line in line_id:
|
||||||
|
|
||||||
|
if line.id in budget_lines:
|
||||||
|
theo=pract=0.00
|
||||||
|
theo=line._theo_amt(self.cr, self.uid, [line.id],"theoritical_amount",None,context={'wizard_date_from':d_from,'wizard_date_to':d_to})[line.id]
|
||||||
|
pract=line._pra_amt(self.cr, self.uid, [line.id],"practical_amount",None,context={'wizard_date_from':d_from,'wizard_date_to':d_to})[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
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
tot_theo += theo
|
||||||
|
tot_pln +=line.planned_amount
|
||||||
|
tot_prac +=pract
|
||||||
|
tot_perc +=line.percentage
|
||||||
|
result.append(res1)
|
||||||
|
done_budget.append(line.general_budget_id.id)
|
||||||
|
else:
|
||||||
|
if line.general_budget_id.id in done_budget:
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
result.append(res1)
|
||||||
|
done_budget.append(line.general_budget_id.id)
|
||||||
|
|
||||||
|
if tot_theo==0.00:
|
||||||
|
tot_perc=0.00
|
||||||
|
else:
|
||||||
|
tot_perc=float(tot_prac /tot_theo)*100
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
if tot['theo']==0.00:
|
||||||
|
tot['perc'] =0.00
|
||||||
|
else:
|
||||||
|
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.append(res)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
report_sxw.report_sxw('report.account.analytic.account.budget', 'account.analytic.account', 'addons/account_budget_crossover/report/analytic_account_budget_report.rml',parser=analytic_account_budget_report,header=False)
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,173 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<document filename="test.pdf">
|
||||||
|
<template pageSize="(612.0,792.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||||
|
<pageTemplate id="first">
|
||||||
|
<frame id="first" x1="57.0" y1="57.0" width="498" height="678"/>
|
||||||
|
</pageTemplate>
|
||||||
|
</template>
|
||||||
|
<stylesheet>
|
||||||
|
<blockTableStyle id="Standard_Outline">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table1">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table6">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table2">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table3">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<lineStyle kind="GRID" colorName="black"/>
|
||||||
|
<blockBackground colorName="#b3b3b3" start="0,0" stop="0,0"/>
|
||||||
|
<blockBackground colorName="#b3b3b3" start="1,0" stop="1,0"/>
|
||||||
|
<blockBackground colorName="#b3b3b3" start="2,0" stop="2,0"/>
|
||||||
|
<blockBackground colorName="#b3b3b3" start="3,0" stop="3,0"/>
|
||||||
|
<blockBackground colorName="#b3b3b3" start="4,0" stop="4,0"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table4">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table5">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<lineStyle kind="GRID" colorName="black"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<initialize>
|
||||||
|
<paraStyle name="all" alignment="justify"/>
|
||||||
|
</initialize>
|
||||||
|
<paraStyle name="P1" fontName="Times-Roman" fontSize="10.0" leading="10" alignment="LEFT"/>
|
||||||
|
<paraStyle name="P2" fontName="Times-Roman" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P3" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P4" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P5" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P6" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P7" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P8" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P9" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P10" fontName="Times-Bold" fontSize="14.0" leading="17" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||||
|
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||||
|
</stylesheet>
|
||||||
|
<story>
|
||||||
|
<para style="P1">[[ repeatIn(objects,'o') ]]</para>
|
||||||
|
<blockTable colWidths="499.0" repeatRows="1" style="Table1">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P10">[[ company.name ]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<blockTable colWidths="250.0,250.0" repeatRows="1" style="Table6">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P6">Currency: [[ company.currency_id.name ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P7">Printed at: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S')]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<blockTable colWidths="250.0,250.0" repeatRows="1" style="Table2">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P6">Analysis from [[ data['form']['date_from'] ]] to [[ data['form']['date_to'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P7">Analytic Account : [[ o.name ]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<para style="Standard">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<blockTable colWidths="185.0,83.0,75.0,91.0,65.0" style="Table3">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Description</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Theoretical Amount</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Planned Amount</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Practical Amount</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">%</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<section>
|
||||||
|
<para style="P2">[[ repeatIn(funct(o,data['form']),'a') ]]</para>
|
||||||
|
<blockTable colWidths="185.0,83.0,75.0,91.0,64.0" style="Table4">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P1">
|
||||||
|
<font>[['.....'*(a['status']-1) ]][[ setTag('font','font',{'color':'white'}) ]]</font><font>[[ a['status']==1 and ( setTag('font','font',{'name':'Times-bold'})) ]][[ a['name'] ]]</font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P5">[[ a['status']==1 and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ '%.2f' % a['theo'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P5">[[ a['status']==1 and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ '%.2f' % a['pln'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P5">[[ a['status']==1 and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ '%.2f' % a['prac'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P5">[[ a['status']==1 and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ '%.2f' % a['perc'] ]]%</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
</section>
|
||||||
|
<para style="Text body">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<blockTable colWidths="185.0,83.0,75.0,91.0,64.0" style="Table5">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P5">Total:</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P5">
|
||||||
|
[[ repeatIn(funct_total(data['form']),'b') ]] <font face="Times-Roman">[[ '%.2f' % b['tot_theo'] ]]</font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P5">[[ '%.2f' % b['tot_pln'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P5">[[ '%.2f' % b['tot_prac'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P5">[[ '%.2f' % b['tot_perc'] ]]%</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<para style="P2">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</story>
|
||||||
|
</document>
|
|
@ -0,0 +1,227 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting from its eventual inadequacies and bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees and support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
import time
|
||||||
|
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)
|
||||||
|
self.localcontext.update( {
|
||||||
|
'funct': self.funct,
|
||||||
|
'funct_total': self.funct_total,
|
||||||
|
'time': time,
|
||||||
|
})
|
||||||
|
self.context=context
|
||||||
|
|
||||||
|
def funct(self,object,form,ids={}, done=None, level=1):
|
||||||
|
|
||||||
|
if not ids:
|
||||||
|
ids = self.ids
|
||||||
|
# if not ids:
|
||||||
|
# return []
|
||||||
|
if not done:
|
||||||
|
done={}
|
||||||
|
|
||||||
|
global tot
|
||||||
|
tot={
|
||||||
|
'theo':0.00,
|
||||||
|
'pln':0.00,
|
||||||
|
'prac':0.00,
|
||||||
|
'perc':0.00
|
||||||
|
}
|
||||||
|
result=[]
|
||||||
|
|
||||||
|
budgets = self.pool.get('crossovered.budget').browse(self.cr, self.uid, [object.id], self.context.copy())
|
||||||
|
|
||||||
|
for budget_id in budgets:
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
b_line_ids=','.join([str(x) for x in budget_ids])
|
||||||
|
|
||||||
|
query="select id from crossovered_budget_lines where crossovered_budget_id = '"+ str(budget_id.id) + "'"# AND '"+ str(d_from) +"'<=date_from AND date_from<date_to AND date_to<= '"+ str(d_to) +"'"
|
||||||
|
self.cr.execute(query)
|
||||||
|
budget_line_ids=self.cr.fetchall()
|
||||||
|
|
||||||
|
if not budget_line_ids:
|
||||||
|
return []
|
||||||
|
|
||||||
|
budget_lines=[x[0] for x in budget_line_ids]
|
||||||
|
|
||||||
|
bd_ids = ','.join([str(x) for x in budget_lines])
|
||||||
|
|
||||||
|
self.cr.execute('select distinct(analytic_account_id) from crossovered_budget_lines where id in (%s)'%(b_line_ids))
|
||||||
|
an_ids=self.cr.fetchall()
|
||||||
|
|
||||||
|
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]])
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
result.append(res)
|
||||||
|
|
||||||
|
line_ids = self.pool.get('crossovered.budget.lines').search(self.cr, self.uid, [('id', 'in', budget_ids),('analytic_account_id','=',an_ids[i][0])])
|
||||||
|
|
||||||
|
line_id = self.pool.get('crossovered.budget.lines').browse(self.cr,self.uid,line_ids)
|
||||||
|
tot_theo=tot_pln=tot_prac=tot_perc=0.00
|
||||||
|
|
||||||
|
done_budget=[]
|
||||||
|
for line in line_id:
|
||||||
|
|
||||||
|
if line.id in budget_lines:
|
||||||
|
theo=pract=0.00
|
||||||
|
theo=line._theo_amt(self.cr, self.uid, [line.id],"theoritical_amount",None,context={'wizard_date_from':d_from,'wizard_date_to':d_to})[line.id]
|
||||||
|
pract=line._pra_amt(self.cr, self.uid, [line.id],"practical_amount",None,context={'wizard_date_from':d_from,'wizard_date_to':d_to})[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
|
||||||
|
else:
|
||||||
|
perc=0.00
|
||||||
|
record['perc'] =perc
|
||||||
|
tot_theo += theo
|
||||||
|
tot_pln +=line.planned_amount
|
||||||
|
tot_prac +=pract
|
||||||
|
tot_perc +=perc
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
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,
|
||||||
|
}
|
||||||
|
tot_theo += theo
|
||||||
|
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:
|
||||||
|
|
||||||
|
if line.general_budget_id.id in done_budget:
|
||||||
|
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':
|
||||||
|
result.append(res1)
|
||||||
|
done_budget.append(line.general_budget_id.id)
|
||||||
|
|
||||||
|
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
|
||||||
|
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
|
||||||
|
else:
|
||||||
|
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.append(res)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
report_sxw.report_sxw('report.crossovered.budget.report', 'crossovered.budget', 'addons/account_budget_crossover/report/crossovered_budget_report.rml',parser=budget_report,header=False)
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,176 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<document filename="test.pdf">
|
||||||
|
<template pageSize="(612.0,792.0)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||||
|
<pageTemplate id="first">
|
||||||
|
<frame id="first" x1="57.0" y1="57.0" width="498" height="678"/>
|
||||||
|
</pageTemplate>
|
||||||
|
</template>
|
||||||
|
<stylesheet>
|
||||||
|
<blockTableStyle id="Standard_Outline">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table1">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table6">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table2">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table3">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<lineStyle kind="GRID" colorName="black"/>
|
||||||
|
<blockBackground colorName="#b3b3b3" start="0,0" stop="0,0"/>
|
||||||
|
<blockBackground colorName="#b3b3b3" start="1,0" stop="1,0"/>
|
||||||
|
<blockBackground colorName="#b3b3b3" start="2,0" stop="2,0"/>
|
||||||
|
<blockBackground colorName="#b3b3b3" start="3,0" stop="3,0"/>
|
||||||
|
<blockBackground colorName="#b3b3b3" start="4,0" stop="4,0"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table4">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table5">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<lineStyle kind="GRID" colorName="black"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<initialize>
|
||||||
|
<paraStyle name="all" alignment="justify"/>
|
||||||
|
</initialize>
|
||||||
|
<paraStyle name="P1" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="LEFT"/>
|
||||||
|
<paraStyle name="P2" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P3" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P4" fontName="Times-Roman" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P5" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P6" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P7" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P8" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P9" fontName="Times-Roman" fontSize="12.0" leading="15" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P10" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||||
|
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||||
|
</stylesheet>
|
||||||
|
<story>
|
||||||
|
<para style="P1">[[ repeatIn(objects,'o') ]]</para>
|
||||||
|
<blockTable colWidths="499.0" repeatRows="1" style="Table1">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P2">
|
||||||
|
<font face="Times-Roman">[[ company.name ]]</font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<blockTable colWidths="250.0,250.0" repeatRows="1" style="Table6">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P7">
|
||||||
|
<font face="Times-Roman">Currency: [[ company.currency_id.name ]]</font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P8">Printed at: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S')]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<blockTable colWidths="250.0,250.0" repeatRows="1" style="Table2">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P7">Analysis from [[ data['form']['date_from'] ]] to [[ data['form']['date_to'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P8">Budget : [[ o.name ]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<para style="Standard">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<blockTable colWidths="185.0,83.0,75.0,91.0,64.0" style="Table3">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P5">Description</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P5">Theoretical Amount</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P5">Planned Amount</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P5">Practical Amount</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P5">%</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<section>
|
||||||
|
<para style="P4">[[ repeatIn(funct(o,data['form']),'a') ]]</para>
|
||||||
|
<blockTable colWidths="185.0,83.0,75.0,91.0,64.0" style="Table4">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P3">
|
||||||
|
<font>[['.....'*(a['status']-1) ]][[ setTag('font','font',{'color':'white'}) ]]</font><font>[[ a['status']==1 and ( setTag('font','font',{'name':'Times-bold'})) ]][[ a['name'] ]]</font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P6">[[ a['status']==1 and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ '%.2f' % a['theo'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P6">[[ a['status']==1 and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ '%.2f' % a['pln'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P6">[[ a['status']==1 and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ '%.2f' % a['prac'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P6">[[ a['status']==1 and ( setTag('para','para',{'fontName':'Times-bold'})) ]][[ '%.2f' % a['perc'] ]]%</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
</section>
|
||||||
|
<para style="Standard">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<blockTable colWidths="185.0,83.0,75.0,91.0,64.0" style="Table5">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P10">Total:</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P6">[[ repeatIn(funct_total(data['form']),'b') ]] <font face="Times-Roman">[[ '%.2f' % b ['tot_theo'] ]]</font></para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P6">[[ '%.2f' % b['tot_pln'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P6">[[ '%.2f' % b['tot_prac'] ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P6">[[ '%.2f' % b['tot_perc'] ]]%</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<para style="P4">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</story>
|
||||||
|
</document>
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
import wizard_crossovered_budget_report
|
||||||
|
import wizard_analytic_account_budget
|
||||||
|
import wizard_crossovered_budget_summary_report
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
import time
|
||||||
|
import wizard
|
||||||
|
|
||||||
|
dates_form = '''<?xml version="1.0"?>
|
||||||
|
<form string="Select Dates Period">
|
||||||
|
<field name="date_from"/>
|
||||||
|
<field name="date_to"/>
|
||||||
|
</form>'''
|
||||||
|
|
||||||
|
dates_fields = {
|
||||||
|
'date_from': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
|
||||||
|
'date_to': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')}
|
||||||
|
}
|
||||||
|
|
||||||
|
class wizard_report(wizard.interface):
|
||||||
|
|
||||||
|
states = {
|
||||||
|
'init': {
|
||||||
|
'actions': [],
|
||||||
|
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('report','Print')]}
|
||||||
|
},
|
||||||
|
'report': {
|
||||||
|
'actions': [],
|
||||||
|
'result': {'type':'print', 'report':'account.analytic.account.budget', 'state':'end'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wizard_report('wizard.analytic.account.budget.report')
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
import time
|
||||||
|
import wizard
|
||||||
|
|
||||||
|
dates_form = '''<?xml version="1.0"?>
|
||||||
|
<form string="Select Options">
|
||||||
|
<field name="date_from"/>
|
||||||
|
<field name="date_to"/>
|
||||||
|
</form>'''
|
||||||
|
|
||||||
|
dates_fields = {
|
||||||
|
'date_from': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
|
||||||
|
'date_to': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class wizard_report(wizard.interface):
|
||||||
|
|
||||||
|
def _default(self, cr, uid, data, context):
|
||||||
|
data['form']['report']='analytic-full'
|
||||||
|
return data['form']
|
||||||
|
|
||||||
|
states = {
|
||||||
|
'init': {
|
||||||
|
'actions': [_default],
|
||||||
|
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('report','Print')]}
|
||||||
|
},
|
||||||
|
'report': {
|
||||||
|
'actions': [],
|
||||||
|
'result': {'type':'print', 'report':'crossovered.budget.report', 'state':'end'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wizard_report('wizard.crossovered.budget')
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
import time
|
||||||
|
import wizard
|
||||||
|
|
||||||
|
dates_form = '''<?xml version="1.0"?>
|
||||||
|
<form string="Select Options">
|
||||||
|
<field name="date_from"/>
|
||||||
|
<field name="date_to"/>
|
||||||
|
</form>'''
|
||||||
|
|
||||||
|
dates_fields = {
|
||||||
|
'date_from': {'string':'Start of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-01-01')},
|
||||||
|
'date_to': {'string':'End of period', 'type':'date', 'required':True, 'default': lambda *a: time.strftime('%Y-%m-%d')},
|
||||||
|
}
|
||||||
|
|
||||||
|
class wizard_report_summary(wizard.interface):
|
||||||
|
|
||||||
|
def _default(self, cr, uid, data, context):
|
||||||
|
data['form']['report']='analytic-one'
|
||||||
|
return data['form']
|
||||||
|
|
||||||
|
states = {
|
||||||
|
'init': {
|
||||||
|
'actions': [_default],
|
||||||
|
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('report','Print')]}
|
||||||
|
},
|
||||||
|
'report': {
|
||||||
|
'actions': [],
|
||||||
|
'result': {'type':'print', 'report':'crossovered.budget.report', 'state':'end'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wizard_report_summary('wizard.crossovered.budget.summary')
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||||
|
# Fabien Pinckaers <fp@tiny.Be>
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting from its eventual inadequacies and bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees and support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
#----------------------------------------------------------
|
||||||
|
# Init Sales
|
||||||
|
#----------------------------------------------------------
|
||||||
|
|
||||||
|
import account_date_check
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
{
|
||||||
|
"name" : "Account Date check",
|
||||||
|
"version" : "1.0",
|
||||||
|
"author" : "Tiny",
|
||||||
|
"website" : "http://tinyerp.com/module_sale.html",
|
||||||
|
"depends" : ["account"],
|
||||||
|
"category" : "Generic Modules/Accounting",
|
||||||
|
"init_xml" : [],
|
||||||
|
"demo_xml" : [],
|
||||||
|
"description": """
|
||||||
|
* Adds a field on journals: "Allows date not in the period"
|
||||||
|
* By default, this field is checked.
|
||||||
|
|
||||||
|
If this field is not checked, the system control that the date is in the
|
||||||
|
period when you create an account entry. Otherwise, it generates an
|
||||||
|
error message: "The date of your account move is not in the defined
|
||||||
|
period !"
|
||||||
|
""",
|
||||||
|
"update_xml" : [
|
||||||
|
"account_date_check_view.xml",
|
||||||
|
],
|
||||||
|
"active": False,
|
||||||
|
"installable": True
|
||||||
|
}
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,88 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||||
|
#
|
||||||
|
# $Id: account.py 1005 2005-07-25 08:41:42Z nicoe $
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting from its eventual inadequacies and bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees and support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
from osv import fields
|
||||||
|
from osv import osv
|
||||||
|
import time
|
||||||
|
import netsvc
|
||||||
|
|
||||||
|
import ir
|
||||||
|
from mx import DateTime
|
||||||
|
import pooler
|
||||||
|
from tools import config
|
||||||
|
|
||||||
|
class account_journal(osv.osv):
|
||||||
|
_inherit='account.journal'
|
||||||
|
_name='account.journal'
|
||||||
|
_columns = {
|
||||||
|
'allow_date':fields.boolean('Allows date not in the period'),
|
||||||
|
}
|
||||||
|
_defaults = {
|
||||||
|
'allow_date': lambda *a: 1,
|
||||||
|
}
|
||||||
|
account_journal()
|
||||||
|
|
||||||
|
class account_move_line(osv.osv):
|
||||||
|
_inherit='account.move.line'
|
||||||
|
_name='account.move.line'
|
||||||
|
|
||||||
|
def check_date(self, cr, uid, vals, context=None, check=True):
|
||||||
|
if 'date' in vals.keys():
|
||||||
|
if 'journal_id' in vals and 'journal_id' not in context:
|
||||||
|
journal_id = vals['journal_id']
|
||||||
|
if 'period_id' in vals and 'period_id' not in context:
|
||||||
|
period_id = vals['period_id']
|
||||||
|
elif 'journal_id' not in context and 'move_id' in vals:
|
||||||
|
m = self.pool.get('account.move').browse(cr, uid, vals['move_id'])
|
||||||
|
journal_id = m.journal_id.id
|
||||||
|
period_id = m.period_id.id
|
||||||
|
else:
|
||||||
|
journal_id = context['journal_id']
|
||||||
|
period_id = context['period_id']
|
||||||
|
journal=self.pool.get('account.journal').browse(cr,uid,[journal_id])[0]
|
||||||
|
if not journal.allow_date:
|
||||||
|
period=self.pool.get('account.period').browse(cr,uid,[period_id])[0]
|
||||||
|
if not time.strptime(vals['date'],'%Y-%m-%d')>=time.strptime(period.date_start,'%Y-%m-%d') and time.strptime(vals['date'],'%Y-%m-%d')<=time.strptime(period.date_stop,'%Y-%m-%d'):
|
||||||
|
raise osv.except_osv('Error','The date of your account move is not in the defined period !')
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
|
def write(self, cr, uid, ids, vals, context=None, check=True, update_check=True):
|
||||||
|
flag=self.check_date(cr, uid, vals, context, check)
|
||||||
|
result = super(account_move_line, self).write(cr, uid, ids, vals, context, check, update_check)
|
||||||
|
return result
|
||||||
|
def create(self, cr, uid, vals, context=None, check=True):
|
||||||
|
flag=self.check_date(cr, uid, vals, context, check)
|
||||||
|
result = super(account_move_line, self).create(cr, uid, vals, context, check)
|
||||||
|
return result
|
||||||
|
account_move_line()
|
||||||
|
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<terp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="view_account_journal_form_inherit2">
|
||||||
|
<field name="name">account.journal.form.inherit2</field>
|
||||||
|
<field name="model">account.journal</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="inherit_id" ref="account.view_account_journal_form"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<field name="user_id" position="after">
|
||||||
|
<field name="allow_date" />
|
||||||
|
</field>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</terp>
|
|
@ -0,0 +1,17 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<projectDescription>
|
||||||
|
<name>account_invoice_layout</name>
|
||||||
|
<comment></comment>
|
||||||
|
<projects>
|
||||||
|
</projects>
|
||||||
|
<buildSpec>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.python.pydev.PyDevBuilder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
|
</buildSpec>
|
||||||
|
<natures>
|
||||||
|
<nature>org.python.pydev.pythonNature</nature>
|
||||||
|
</natures>
|
||||||
|
</projectDescription>
|
|
@ -0,0 +1,6 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<?eclipse-pydev version="1.0"?>
|
||||||
|
|
||||||
|
<pydev_project>
|
||||||
|
<pydev_property name="org.python.pydev.PYTHON_PROJECT_VERSION">python 2.4</pydev_property>
|
||||||
|
</pydev_project>
|
|
@ -0,0 +1,6 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
import account_invoice_layout
|
||||||
|
import report
|
||||||
|
import wizard
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
{
|
||||||
|
"name" : "account_invoice_layout",
|
||||||
|
"version" : "1.0",
|
||||||
|
"depends" : ["base", "account"],
|
||||||
|
"author" : "Tiny",
|
||||||
|
"description": """
|
||||||
|
This module provides some features to improve the layout of the invoices.
|
||||||
|
|
||||||
|
It gives you the possibility to
|
||||||
|
* order all the lines of an invoice
|
||||||
|
* add titles, comment lines, sub total lines
|
||||||
|
* draw horizontal lines and put page breaks
|
||||||
|
|
||||||
|
Moreover, there is one option which allow you to print all the selected invoices with a given special message at the bottom of it. This feature can be very useful for printing your invoices with end-of-year wishes, special punctual conditions...
|
||||||
|
|
||||||
|
""",
|
||||||
|
"website" : "http://tinyerp.com/",
|
||||||
|
"category" : "Generic Modules/Project & Services",
|
||||||
|
"init_xml" : [],
|
||||||
|
"demo_xml" : [],
|
||||||
|
"update_xml" : [
|
||||||
|
"account_invoice_layout_view.xml",
|
||||||
|
"account_invoice_layout_report.xml",
|
||||||
|
],
|
||||||
|
"active": False,
|
||||||
|
"installable": True
|
||||||
|
}
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,192 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
from osv import fields,osv
|
||||||
|
|
||||||
|
|
||||||
|
class notify_message(osv.osv):
|
||||||
|
_name = 'notify.message'
|
||||||
|
_description = 'Notify By Messages'
|
||||||
|
_columns = {
|
||||||
|
'name' : fields.char('Title',size=64,required=True),
|
||||||
|
'msg' : fields.text('Special Message',size=125,required=True,help='This notification will appear at the bottom of the Invoices when printed.',translate=True)
|
||||||
|
}
|
||||||
|
|
||||||
|
notify_message()
|
||||||
|
|
||||||
|
class account_invoice_line(osv.osv):
|
||||||
|
|
||||||
|
def move_line_get_item(self, cr, uid, line, context={}):
|
||||||
|
if line.state != 'article':
|
||||||
|
return None
|
||||||
|
return super(account_invoice_line, self).move_line_get_item(cr, uid, line, context)
|
||||||
|
|
||||||
|
def fields_get(self, cr, uid, fields=None, context=None):
|
||||||
|
article = {
|
||||||
|
'article': [('readonly', False), ('invisible', False)],
|
||||||
|
'text': [('readonly', True), ('invisible', True), ('required', False)],
|
||||||
|
'subtotal': [('readonly', True), ('invisible', True), ('required', False)],
|
||||||
|
'title': [('readonly', True), ('invisible', True), ('required', False)],
|
||||||
|
'break': [('readonly', True), ('invisible', True), ('required', False)],
|
||||||
|
'line': [('readonly', True), ('invisible', True), ('required', False)],
|
||||||
|
}
|
||||||
|
states = {
|
||||||
|
'name': {
|
||||||
|
'break': [('readonly', True),('required', False),('invisible', True)],
|
||||||
|
'line': [('readonly', True),('required', False),('invisible', True)],
|
||||||
|
},
|
||||||
|
'product_id': article,
|
||||||
|
'account_id': article,
|
||||||
|
'quantity': article,
|
||||||
|
'uos_id': article,
|
||||||
|
'price_unit': article,
|
||||||
|
'discount': article,
|
||||||
|
'invoice_line_tax_id': article,
|
||||||
|
'account_analytic_id': article,
|
||||||
|
}
|
||||||
|
res = super(account_invoice_line, self).fields_get(cr, uid, fields, context)
|
||||||
|
for field in res:
|
||||||
|
if states.has_key(field):
|
||||||
|
for key,value in states[field].items():
|
||||||
|
res[field].setdefault('states',{})
|
||||||
|
res[field]['states'][key] = value
|
||||||
|
return res
|
||||||
|
|
||||||
|
def _onchange_invoice_line_view(self, cr, uid, id, type, context={}, *args):
|
||||||
|
|
||||||
|
if (not type):
|
||||||
|
return {}
|
||||||
|
if type != 'article':
|
||||||
|
temp = {'value': {
|
||||||
|
'product_id': False,
|
||||||
|
'uos_id': False,
|
||||||
|
'account_id': False,
|
||||||
|
'price_unit': False,
|
||||||
|
'price_subtotal': False,
|
||||||
|
'quantity': 0,
|
||||||
|
'discount': False,
|
||||||
|
'invoice_line_tax_id': False,
|
||||||
|
'account_analytic_id': False,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
if type == 'line':
|
||||||
|
temp['value']['name'] = ' '
|
||||||
|
if type == 'break':
|
||||||
|
temp['value']['name'] = ' '
|
||||||
|
if type == 'subtotal':
|
||||||
|
temp['value']['name'] = 'Sub Total'
|
||||||
|
return temp
|
||||||
|
return {}
|
||||||
|
|
||||||
|
def create(self, cr, user, vals, context=None):
|
||||||
|
if vals.has_key('state'):
|
||||||
|
if vals['state'] == 'line':
|
||||||
|
vals['name'] = ' '
|
||||||
|
if vals['state'] == 'break':
|
||||||
|
vals['name'] = ' '
|
||||||
|
if vals['state'] != 'article':
|
||||||
|
vals['quantity']= 0
|
||||||
|
vals['account_id']= self._default_account(cr, user, None)
|
||||||
|
return super(account_invoice_line, self).create(cr, user, vals, context)
|
||||||
|
|
||||||
|
def write(self, cr, user, ids, vals, context=None):
|
||||||
|
if vals.has_key('state'):
|
||||||
|
if vals['state'] != 'article':
|
||||||
|
vals['product_id']= False
|
||||||
|
vals['uos_id']= False
|
||||||
|
vals['account_id']= self._default_account(cr, user, None)
|
||||||
|
vals['price_unit']= False
|
||||||
|
vals['price_subtotal']= False
|
||||||
|
vals['quantity']= 0
|
||||||
|
vals['discount']= False
|
||||||
|
vals['invoice_line_tax_id']= False
|
||||||
|
vals['account_analytic_id']= False
|
||||||
|
if vals['state'] == 'line':
|
||||||
|
vals['name'] = ' '
|
||||||
|
if vals['state'] == 'break':
|
||||||
|
vals['name'] = ' '
|
||||||
|
return super(account_invoice_line, self).write(cr, user, ids, vals, context)
|
||||||
|
|
||||||
|
def copy(self, cr, uid, id, default=None, context=None):
|
||||||
|
if default is None:
|
||||||
|
default = {}
|
||||||
|
default['state'] = self.browse(cr, uid, id).state
|
||||||
|
return super(account_invoice_line, self).copy(cr, uid, id, default, context)
|
||||||
|
|
||||||
|
def _fnct(self, cr, uid, id, name, args, context):
|
||||||
|
res = {}
|
||||||
|
for m in self.browse(cr, uid, id):
|
||||||
|
if m.state != 'article':
|
||||||
|
if m.state == 'line':
|
||||||
|
res[m.id] = '-----------------------------------------'
|
||||||
|
elif m.state == 'break':
|
||||||
|
res[m.id] = 'PAGE BREAK'
|
||||||
|
else:
|
||||||
|
res[m.id] = ' '
|
||||||
|
else:
|
||||||
|
[(temp)] = self.pool.get('account.account').name_get(cr, uid, [m.account_id.id], context=context)
|
||||||
|
res[m.id] = temp[1]
|
||||||
|
return res
|
||||||
|
|
||||||
|
_name = "account.invoice.line"
|
||||||
|
_order = "invoice_id, sequence asc"
|
||||||
|
_description = "Invoice Line"
|
||||||
|
_inherit = "account.invoice.line"
|
||||||
|
_columns = {
|
||||||
|
'state': fields.selection([
|
||||||
|
('article','Product'),
|
||||||
|
('title','Title'),
|
||||||
|
('text','Note'),
|
||||||
|
('subtotal','Sub Total'),
|
||||||
|
('line','Separator Line'),
|
||||||
|
('break','Page Break'),]
|
||||||
|
,'Type', select=True, required=True),
|
||||||
|
'sequence': fields.integer('Sequence Number'),
|
||||||
|
'functional_field': fields.function(_fnct, arg=None, fnct_inv=None, fnct_inv_arg=None, type='char', fnct_search=None, obj=None, method=True, store=False, string="Source Account"),
|
||||||
|
}
|
||||||
|
def _default_account(self, cr, uid, context=None):
|
||||||
|
cr.execute("select id from account_account where code = 0 LIMIT 1")
|
||||||
|
res=cr.fetchone()
|
||||||
|
return res[0]
|
||||||
|
_defaults = {
|
||||||
|
'state': lambda *a: 'article',
|
||||||
|
# 'account_id': _default_account
|
||||||
|
}
|
||||||
|
account_invoice_line()
|
||||||
|
|
||||||
|
|
||||||
|
class one2many_mod2(fields.one2many):
|
||||||
|
def get(self, cr, obj, ids, name, user=None, offset=0, context=None, values=None):
|
||||||
|
if not context:
|
||||||
|
context = {}
|
||||||
|
if not values:
|
||||||
|
values = {}
|
||||||
|
res = {}
|
||||||
|
for id in ids:
|
||||||
|
res[id] = []
|
||||||
|
ids2 = obj.pool.get(self._obj).search(cr, user, [(self._fields_id,'in',ids),('state','=','article')], limit=self._limit)
|
||||||
|
for r in obj.pool.get(self._obj)._read_flat(cr, user, ids2, [self._fields_id], context=context, load='_classic_write'):
|
||||||
|
res[r[self._fields_id]].append( r['id'] )
|
||||||
|
return res
|
||||||
|
|
||||||
|
# def copy(self, cr, uid, id, default=None, context=None):
|
||||||
|
# if default is None:
|
||||||
|
# default = {}
|
||||||
|
# default['line_ids'] = False
|
||||||
|
# return super(account_invoice, self).copy(cr, uid, id, default, context)
|
||||||
|
|
||||||
|
|
||||||
|
class account_invoice(osv.osv):
|
||||||
|
|
||||||
|
def copy(self, cr, uid, id, default=None, context=None):
|
||||||
|
if default is None:
|
||||||
|
default = {}
|
||||||
|
default['invoice_line'] = False
|
||||||
|
return super(account_invoice, self).copy(cr, uid, id, default, context)
|
||||||
|
|
||||||
|
_inherit = "account.invoice"
|
||||||
|
_columns = {
|
||||||
|
'abstract_line_ids': fields.one2many('account.invoice.line', 'invoice_id', 'Invoice Lines',readonly=True, states={'draft':[('readonly',False)]}),
|
||||||
|
'invoice_line': one2many_mod2('account.invoice.line', 'invoice_id', 'Invoice Lines',readonly=True, states={'draft':[('readonly',False)]}),
|
||||||
|
}
|
||||||
|
account_invoice()
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<terp>
|
||||||
|
<data>
|
||||||
|
<wizard string="Formatted Inv. + Message"
|
||||||
|
model="account.invoice"
|
||||||
|
name="wizard.notify_message"
|
||||||
|
id="wizard_notify_message"
|
||||||
|
keyword="client_print_multi"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<report id="account_invoices_1"
|
||||||
|
string="Formatted Inv."
|
||||||
|
model="account.invoice"
|
||||||
|
name="account.invoice.layout"
|
||||||
|
rml="account_invoice_layout/report/report_account_invoice_layout.rml"
|
||||||
|
auto="False"/>
|
||||||
|
</data>
|
||||||
|
</terp>
|
|
@ -0,0 +1,90 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<terp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="view_invoice_line_form_inherit_1">
|
||||||
|
<field name="name">account.invoice.line.form.inherit_1</field>
|
||||||
|
<field name="model">account.invoice.line</field>
|
||||||
|
<field name="inherit_id" ref="account.view_invoice_line_form"/>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="/form/notebook/page/field[@name='name']" position="before">
|
||||||
|
<field name="state" select="1" on_change="_onchange_invoice_line_view(state)" />
|
||||||
|
<field name="sequence"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="view_invoice_line_tree_inherit_1">
|
||||||
|
<field name="name">account.invoice.line.tree.inherit_1</field>
|
||||||
|
<field name="model">account.invoice.line</field>
|
||||||
|
<field name="inherit_id" ref="account.view_invoice_line_tree"/>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="/tree/field[@name='name']" position="before">
|
||||||
|
<field name="sequence" string="Seq."/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="view_invoice_line_tree_inherit_2">
|
||||||
|
<field name="name">account.invoice.line.tree.inherit_2</field>
|
||||||
|
<field name="model">account.invoice.line</field>
|
||||||
|
<field name="inherit_id" ref="view_invoice_line_tree_inherit_1"/>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="/tree/field[@name='account_id']" position="replace">
|
||||||
|
<field name="functional_field"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="account_invoice_form_inherit_1">
|
||||||
|
<field name="name">account.invoice.form.inherit_1</field>
|
||||||
|
<field name="model">account.invoice</field>
|
||||||
|
<field name="inherit_id" ref="account.invoice_form"/>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="/form/notebook/page/field[@name='invoice_line']" position="replace">
|
||||||
|
<field name="abstract_line_ids" colspan="4" nolabel="1"/>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- notification message views -->
|
||||||
|
<record model="ir.ui.view" id="view_notify_message_tree">
|
||||||
|
<field name="name">notify.message.tree</field>
|
||||||
|
<field name="model">notify.message</field>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree string="Messages">
|
||||||
|
<field name="name"/>
|
||||||
|
<field name="msg"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.ui.view" id="view_notify_message_form">
|
||||||
|
<field name="name">notify.message.form</field>
|
||||||
|
<field name="model">notify.message</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Messages">
|
||||||
|
<separator string="Write a notification or a wishful message." colspan="4"/>
|
||||||
|
<field name="name" select="1" colspan="2" />
|
||||||
|
<field name="msg" select="1" colspan="2"/>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window" id="notify_mesage_tree_form">
|
||||||
|
<field name="name">Write Messages</field>
|
||||||
|
<field name="res_model">notify.message</field>
|
||||||
|
<field name="view_type">form</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
</record>
|
||||||
|
<menuitem name="Notification Message" id="menu_finan_config_notify_message" parent="account.menu_finance_configuration"/>
|
||||||
|
<menuitem name="All Notification Messages" id="menu_notify_mesage_tree_form" action="notify_mesage_tree_form" parent="menu_finan_config_notify_message"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</terp>
|
|
@ -0,0 +1,5 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
import report_account_invoice_layout
|
||||||
|
import special_message_invoice
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,192 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
import time
|
||||||
|
import pooler
|
||||||
|
from report import report_sxw
|
||||||
|
|
||||||
|
parents = {
|
||||||
|
'tr':1,
|
||||||
|
'li':1,
|
||||||
|
'story': 0,
|
||||||
|
'section': 0
|
||||||
|
}
|
||||||
|
|
||||||
|
class account_invoice_1(report_sxw.rml_parse):
|
||||||
|
def __init__(self, cr, uid, name, context):
|
||||||
|
super(account_invoice_1, self).__init__(cr, uid, name, context)
|
||||||
|
self.localcontext.update({
|
||||||
|
'time': time,
|
||||||
|
'invoice_lines': self.invoice_lines,
|
||||||
|
'repeat_In':self.repeat_In,
|
||||||
|
})
|
||||||
|
self.context = context
|
||||||
|
|
||||||
|
def repeat_In(self, lst, name, nodes_parent=False,td=False,width=[],value=[],type=[]):
|
||||||
|
self._node.data = ''
|
||||||
|
node = self._find_parent(self._node, nodes_parent or parents)
|
||||||
|
ns = node.nextSibling
|
||||||
|
|
||||||
|
value=['tax_types','quantity','uos','price_unit','discount','price_subtotal','currency']
|
||||||
|
type=['string','string','string','string','string','string','string']
|
||||||
|
width=[62,42,20,62,51,50,24]
|
||||||
|
td=7
|
||||||
|
|
||||||
|
tableFlag=0
|
||||||
|
|
||||||
|
if not lst:
|
||||||
|
lst.append(1)
|
||||||
|
for ns in node.childNodes :
|
||||||
|
if tableFlag==1:
|
||||||
|
break
|
||||||
|
if ns and ns.nodeName!='#text' and ns.tagName=='blockTable' and td :
|
||||||
|
tableFlag=1
|
||||||
|
|
||||||
|
width_str = ns._attrs['colWidths'].nodeValue
|
||||||
|
ns.removeAttribute('colWidths')
|
||||||
|
total_td = td * len(value)
|
||||||
|
|
||||||
|
if not width:
|
||||||
|
for v in value:
|
||||||
|
width.append(30)
|
||||||
|
for v in range(len(value)):
|
||||||
|
width_str +=',%d'%width[v]
|
||||||
|
|
||||||
|
ns.setAttribute('colWidths',width_str)
|
||||||
|
|
||||||
|
child_list = ns.childNodes
|
||||||
|
|
||||||
|
for child in child_list:
|
||||||
|
if child.nodeName=='tr':
|
||||||
|
lc = child.childNodes[1]
|
||||||
|
# for t in range(td):
|
||||||
|
i=0
|
||||||
|
for v in value:
|
||||||
|
t2="[[%s['type']=='text' and removeParentNode('tr')]]"%(name)
|
||||||
|
t1= "[[ %s['%s'] ]]"%(name,v)
|
||||||
|
t3="[[ %s['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]]"%name
|
||||||
|
newnode = lc.cloneNode(1)
|
||||||
|
|
||||||
|
newnode.childNodes[1].lastChild.data = t1 + t2 +t3
|
||||||
|
# newnode.childNodes[1].lastChild.data=[[ a['status']==1 and ( setTag('para','para',{'fontName':'Times-bold'})) ]]
|
||||||
|
child.appendChild(newnode)
|
||||||
|
newnode=False
|
||||||
|
i+=1
|
||||||
|
|
||||||
|
|
||||||
|
return super(account_invoice_1,self).repeatIn(lst, name, nodes_parent=False)
|
||||||
|
|
||||||
|
def invoice_lines(self,invoice):
|
||||||
|
|
||||||
|
result =[]
|
||||||
|
sub_total={}
|
||||||
|
info=[]
|
||||||
|
invoice_list=[]
|
||||||
|
res={}
|
||||||
|
list_in_seq={}
|
||||||
|
ids = self.pool.get('account.invoice.line').search(self.cr, self.uid, [('invoice_id', '=', invoice.id)])
|
||||||
|
ids.sort()
|
||||||
|
for id in range(0,len(ids)):
|
||||||
|
info = self.pool.get('account.invoice.line').browse(self.cr, self.uid,ids[id], self.context.copy())
|
||||||
|
list_in_seq[info]=info.sequence
|
||||||
|
# invoice_list +=[info]
|
||||||
|
i=1
|
||||||
|
j=0
|
||||||
|
final=sorted(list_in_seq.items(), lambda x, y: cmp(x[1], y[1]))
|
||||||
|
invoice_list=[x[0] for x in final]
|
||||||
|
sum_flag={}
|
||||||
|
sum_flag[j]=-1
|
||||||
|
for entry in invoice_list:
|
||||||
|
res={}
|
||||||
|
|
||||||
|
if entry.state=='article':
|
||||||
|
self.cr.execute('select tax_id from account_invoice_line_tax where invoice_line_id=%d'%(entry.id))
|
||||||
|
tax_ids=self.cr.fetchall()
|
||||||
|
|
||||||
|
if tax_ids==[]:
|
||||||
|
res['tax_types']=''
|
||||||
|
else:
|
||||||
|
tax_names_dict={}
|
||||||
|
for item in range(0,len(tax_ids)) :
|
||||||
|
self.cr.execute('select name from account_tax where id=%d'%(tax_ids[item][0]))
|
||||||
|
type=self.cr.fetchone()
|
||||||
|
tax_names_dict[item] =type[0]
|
||||||
|
tax_names = ','.join([tax_names_dict[x] for x in range(0,len(tax_names_dict))])
|
||||||
|
res['tax_types']=tax_names
|
||||||
|
res['name']=entry.name
|
||||||
|
res['quantity']="%.2f"%(entry.quantity)
|
||||||
|
res['price_unit']="%.2f"%(entry.price_unit)
|
||||||
|
res['discount']="%.2f"%(entry.discount)
|
||||||
|
res['price_subtotal']="%.2f"%(entry.price_subtotal)
|
||||||
|
sub_total[i]=entry.price_subtotal
|
||||||
|
i=i+1
|
||||||
|
res['note']=entry.note
|
||||||
|
res['currency']=invoice.currency_id.code
|
||||||
|
res['type']=entry.state
|
||||||
|
|
||||||
|
if entry.uos_id.id==False:
|
||||||
|
res['uos']=''
|
||||||
|
else:
|
||||||
|
uos_name = self.pool.get('product.uom').read(self.cr,self.uid,entry.uos_id.id,['name'])
|
||||||
|
res['uos']=uos_name['name']
|
||||||
|
else:
|
||||||
|
|
||||||
|
res['quantity']=''
|
||||||
|
res['price_unit']=''
|
||||||
|
res['discount']=''
|
||||||
|
res['tax_types']=''
|
||||||
|
res['type']=entry.state
|
||||||
|
res['note']=entry.note
|
||||||
|
res['uos']=''
|
||||||
|
|
||||||
|
if entry.state=='subtotal':
|
||||||
|
res['name']=entry.name
|
||||||
|
sum=0
|
||||||
|
sum_id=0
|
||||||
|
if sum_flag[j]==-1:
|
||||||
|
temp=1
|
||||||
|
else:
|
||||||
|
temp=sum_flag[j]
|
||||||
|
|
||||||
|
for sum_id in range(temp,len(sub_total)+1):
|
||||||
|
sum+=sub_total[sum_id]
|
||||||
|
sum_flag[j+1]= sum_id +1
|
||||||
|
|
||||||
|
j=j+1
|
||||||
|
res['price_subtotal']="%.2f"%(sum)
|
||||||
|
res['currency']=invoice.currency_id.code
|
||||||
|
res['quantity']=''
|
||||||
|
res['price_unit']=''
|
||||||
|
res['discount']=''
|
||||||
|
res['tax_types']=''
|
||||||
|
res['uos']=''
|
||||||
|
elif entry.state=='title':
|
||||||
|
res['name']=entry.name
|
||||||
|
res['price_subtotal']=''
|
||||||
|
res['currency']=''
|
||||||
|
elif entry.state=='text':
|
||||||
|
res['name']=entry.name
|
||||||
|
res['price_subtotal']=''
|
||||||
|
res['currency']=''
|
||||||
|
elif entry.state=='line':
|
||||||
|
res['quantity']='____________'
|
||||||
|
res['price_unit']='______________'
|
||||||
|
res['discount']='____________'
|
||||||
|
res['tax_types']='_________________'
|
||||||
|
res['uos']='_____'
|
||||||
|
res['name']='________________________________________'
|
||||||
|
res['price_subtotal']='_______________________'
|
||||||
|
res['currency']='_______'
|
||||||
|
elif entry.state=='break':
|
||||||
|
res['type']=entry.state
|
||||||
|
res['name']=entry.name
|
||||||
|
res['price_subtotal']=''
|
||||||
|
res['currency']=''
|
||||||
|
else:
|
||||||
|
res['name']=entry.name
|
||||||
|
res['price_subtotal']=''
|
||||||
|
res['currency']=invoice.currency_id.code
|
||||||
|
|
||||||
|
result.append(res)
|
||||||
|
return result
|
||||||
|
report_sxw.report_sxw('report.account.invoice.layout', 'account.invoice', 'addons/account_invoice_layout/report/report_account_invoice_layout.rml', parser=account_invoice_1)
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,297 @@
|
||||||
|
<?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="34.0" y1="28.0" width="527" 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="Tableau6">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<lineStyle kind="GRID" colorName="black"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="3,0" stop="3,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="4,0" stop="4,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="5,0" stop="5,0"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Tableau7">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Tableau8">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Tableau3">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="0,1" stop="0,1"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="1,1" stop="1,1"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="2,1" stop="2,1"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Tableau4">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Tableau5">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<initialize>
|
||||||
|
<paraStyle name="all" alignment="justify"/>
|
||||||
|
</initialize>
|
||||||
|
<paraStyle name="P1" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P2" fontName="Times-Roman" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P3" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P4" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P5" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P6" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P7" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P8" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="3.0" leading="8"/>
|
||||||
|
<paraStyle name="P9" fontName="Times-Italic" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="3.0"/>
|
||||||
|
<paraStyle name="P10" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P11" fontName="Times-Bold" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P12" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P13" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P14" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="LEFT"/>
|
||||||
|
<paraStyle name="P15" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="CENTER"/>
|
||||||
|
<paraStyle name="P16" fontName="Times-Roman" fontSize="20.0" leading="25" alignment="LEFT"/>
|
||||||
|
<paraStyle name="P17" fontName="Times-Roman" fontSize="11.0" leading="14"/>
|
||||||
|
<paraStyle name="P18" fontName="Times-Roman" fontSize="11.0" leading="14"/>
|
||||||
|
<paraStyle name="P19" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT"/>
|
||||||
|
<paraStyle name="P20" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||||
|
<paraStyle name="P21" fontName="Times-Bold" fontSize="8.0" leading="8" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P22" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P23" fontName="Times-Roman" fontSize="20.0" leading="25" alignment="LEFT"/>
|
||||||
|
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||||
|
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="2.0" spaceAfter="3.0" leading="10"/>
|
||||||
|
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||||
|
</stylesheet>
|
||||||
|
<images/>
|
||||||
|
<story>
|
||||||
|
<para style="P1">[[ repeatIn(objects,'o') ]]</para>
|
||||||
|
<para style="P1">[[ setLang(o.partner_id.lang) ]]</para>
|
||||||
|
<blockTable colWidths="295.0,232.0" style="Tableau2">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P2">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="Standard">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
|
||||||
|
<para style="Standard">[[ o.address_invoice_id.title or '' ]] [[ o.address_invoice_id.name ]]</para>
|
||||||
|
<para style="Standard">[[ o.address_invoice_id.street ]]</para>
|
||||||
|
<para style="Standard">[[ o.address_invoice_id.street2 or '' ]]</para>
|
||||||
|
<para style="Standard">[[ o.address_invoice_id.zip or '' ]] [[ o.address_invoice_id.city or '' ]]</para>
|
||||||
|
<para style="Standard">[[ o.address_invoice_id.state_id and o.address_invoice_id.state_id.name or '' ]]</para>
|
||||||
|
<para style="Standard">[[ o.address_invoice_id.country_id and o.address_invoice_id.country_id.name or '' ]]</para>
|
||||||
|
<para style="Standard">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<para style="Standard">Tel. : [[ o.address_invoice_id.phone or removeParentNode('para') ]]</para>
|
||||||
|
<para style="Standard">Fax : [[ o.address_invoice_id.fax or removeParentNode('para') ]]</para>
|
||||||
|
<para style="Standard">VAT : [[ o.partner_id.vat or removeParentNode('para') ]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<para style="P14">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<para style="P23">Invoice [[ ((o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')) or removeParentNode('para')) and '' ]] [[ o.number ]]</para>
|
||||||
|
<para style="P23">PRO-FORMA [[ ((o.type == 'out_invoice' and o.state == 'proforma') or removeParentNode('para')) and '' ]]</para>
|
||||||
|
<para style="P23">Draft Invoice [[ ((o.type == 'out_invoice' and o.state == 'draft') or removeParentNode('para')) and '' ]]</para>
|
||||||
|
<para style="P23">Canceled Invoice [[ ((o.type == 'out_invoice' and o.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
|
||||||
|
<para style="P23">Refund [[ (o.type=='out_refund' or removeParentNode('para')) and '' ]] [[ o.number ]]</para>
|
||||||
|
<para style="P23">Supplier Refund [[ (o.type=='in_refund' or removeParentNode('para')) and '' ]] [[ o.number ]]</para>
|
||||||
|
<para style="P16">
|
||||||
|
<font face="Times-Roman">Supplier Invoice [[ (o.type=='in_invoice' or removeParentNode('para')) and '' ]]</font>
|
||||||
|
<font face="Times-Roman">[[ o.number ]]</font>
|
||||||
|
</para>
|
||||||
|
<para style="P15">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<para style="P17">
|
||||||
|
<font face="Times-Roman">Document</font>
|
||||||
|
<font face="Times-Roman">:</font>
|
||||||
|
<font face="Times-Roman">[[o.name]]</font>
|
||||||
|
</para>
|
||||||
|
<para style="P17">
|
||||||
|
<font face="Times-Roman">Invoice Date: </font>
|
||||||
|
<font face="Times-Roman">[[o.date_invoice]]</font>
|
||||||
|
</para>
|
||||||
|
<para style="P18">
|
||||||
|
<font face="Times-Roman">Customer Ref:</font> [[ o.address_invoice_id.partner_id.ref or '/' ]]</para>
|
||||||
|
<para style="Standard">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<blockTable colWidths="216.0,62.0,62.0,62.0,51.0,74.0" style="Tableau6">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P3">Description</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Taxes</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Quantity</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Unit Price</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Disc. (%)</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Price</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<section>
|
||||||
|
<para style="P20">[[ repeat_In(invoice_lines(o), 'a') ]]</para>
|
||||||
|
<blockTable colWidths="0.0,216.0" style="Tableau7">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P8">[[ a['type']=='text' and removeParentNode('tr')]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="Table Contents"><font>[[ a['type']=='title' and ( setTag('font','font',{'size':'11.5'})) ]][[ (a['type']=='title' or a['type']=='subtotal') and ( setTag('font','font',{'name':'Times-bold'})) ]][[ a['type']=='text' and removeParentNode('font') or a['name'] ]]</font></para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<blockTable colWidths="453.0,74.0" style="Tableau8">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="Table Contents">[[ a['type']=='text' and a['name'] or removeParentNode('table') ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P8">[[ a['type']=='text' and '' or removeParentNode('table') ]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<blockTable colWidths="28.0,499.0" style="Tableau8">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P21">[[ a['note']=='' and removeParentNode('table') ]][[ repeatIn(( a['note'] and a['note'].splitlines()) or [], 'note') ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P9">[[ note or removeParentNode('table') ]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<pageBreak>[[ a['type']!='break' and removeParentNode('pageBreak')]]</pageBreak>
|
||||||
|
<blockTable colWidths="216.0,62.0,62.0,62.0,51.0,74.0" style="Tableau6">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P3">Description [[ a['type']!='break' and removeParentNode('tr')]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Taxes</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Quantity</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Unit Price</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Disc. (%)</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Price</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
</section>
|
||||||
|
<para style="Standard">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<blockTable colWidths="215.0,313.0" style="Tableau3">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<blockTable colWidths="81.0,73.0,60.0" style="Tableau4">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P10">Tax</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P8">Base</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P8">Amount</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P5">
|
||||||
|
<font face="Times-Roman">[[ repeatIn(o.tax_line,'t') ]]</font> [[ t.name ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P11">[[ '%.2f' % t.base ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P11">[[ '%.2f' % t.amount]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<blockTable colWidths="214.0,95.0" style="Tableau5">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P7">Total (excl. taxes):</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P12">[[ '%.2f' % o.amount_untaxed ]] [[o.currency_id.code ]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P7">Taxes:</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P12">[[ '%.2f' % o.amount_tax ]] [[o.currency_id.code ]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P13">Total <font face="Times-Roman">(incl. taxes):</font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P22">[[ '%.2f' % o.amount_total ]] [[o.currency_id.code ]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<para style="Table Contents">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<para style="P19">[[ format(o.comment or '') ]]</para>
|
||||||
|
<para style="P19">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<para style="P19">[[ format((o.payment_term and o.payment_term.note) or '') ]]</para>
|
||||||
|
</story>
|
||||||
|
</document>
|
||||||
|
|
|
@ -0,0 +1,225 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting from its eventual inadequacies and bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees and support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
import time
|
||||||
|
from report import report_sxw
|
||||||
|
import pooler
|
||||||
|
parents = {
|
||||||
|
'tr':1,
|
||||||
|
'li':1,
|
||||||
|
'story': 0,
|
||||||
|
'section': 0
|
||||||
|
}
|
||||||
|
|
||||||
|
class account_invoice_with_message(report_sxw.rml_parse):
|
||||||
|
def __init__(self, cr, uid, name, context):
|
||||||
|
super(account_invoice_with_message, self).__init__(cr, uid, name, context)
|
||||||
|
self.localcontext.update({
|
||||||
|
'time': time,
|
||||||
|
'spcl_msg': self.spcl_msg,
|
||||||
|
'invoice_lines': self.invoice_lines,
|
||||||
|
'repeat_In':self.repeat_In,
|
||||||
|
|
||||||
|
})
|
||||||
|
self.context = context
|
||||||
|
|
||||||
|
def repeat_In(self, lst, name, nodes_parent=False,td=False,width=[],value=[],type=[]):
|
||||||
|
self._node.data = ''
|
||||||
|
node = self._find_parent(self._node, nodes_parent or parents)
|
||||||
|
ns = node.nextSibling
|
||||||
|
|
||||||
|
value=['tax_types','quantity','uos','price_unit','discount','price_subtotal','currency']
|
||||||
|
type=['string','string','string','string','string','string','string']
|
||||||
|
width=[62,42,20,62,51,50,24]
|
||||||
|
td=7
|
||||||
|
|
||||||
|
tableFlag=0
|
||||||
|
|
||||||
|
if not lst:
|
||||||
|
lst.append(1)
|
||||||
|
for ns in node.childNodes :
|
||||||
|
if tableFlag==1:
|
||||||
|
break
|
||||||
|
if ns and ns.nodeName!='#text' and ns.tagName=='blockTable' and td :
|
||||||
|
tableFlag=1
|
||||||
|
|
||||||
|
width_str = ns._attrs['colWidths'].nodeValue
|
||||||
|
ns.removeAttribute('colWidths')
|
||||||
|
total_td = td * len(value)
|
||||||
|
|
||||||
|
if not width:
|
||||||
|
for v in value:
|
||||||
|
width.append(30)
|
||||||
|
for v in range(len(value)):
|
||||||
|
width_str +=',%d'%width[v]
|
||||||
|
|
||||||
|
ns.setAttribute('colWidths',width_str)
|
||||||
|
|
||||||
|
child_list = ns.childNodes
|
||||||
|
|
||||||
|
for child in child_list:
|
||||||
|
if child.nodeName=='tr':
|
||||||
|
lc = child.childNodes[1]
|
||||||
|
# for t in range(td):
|
||||||
|
i=0
|
||||||
|
for v in value:
|
||||||
|
t2="[[%s['type']=='text' and removeParentNode('tr')]]"%(name)
|
||||||
|
t1= "[[ %s['%s'] ]]"%(name,v)
|
||||||
|
t3="[[ %s['type']=='subtotal' and ( setTag('para','para',{'fontName':'Times-bold'})) ]]"%name
|
||||||
|
newnode = lc.cloneNode(1)
|
||||||
|
|
||||||
|
newnode.childNodes[1].lastChild.data = t1 + t2 +t3
|
||||||
|
# newnode.childNodes[1].lastChild.data=[[ a['status']==1 and ( setTag('para','para',{'fontName':'Times-bold'})) ]]
|
||||||
|
child.appendChild(newnode)
|
||||||
|
newnode=False
|
||||||
|
i+=1
|
||||||
|
|
||||||
|
return super(account_invoice_with_message,self).repeatIn(lst, name, nodes_parent=False)
|
||||||
|
|
||||||
|
def spcl_msg(self, form):
|
||||||
|
account_msg_data = pooler.get_pool(self.cr.dbname).get('notify.message').browse(self.cr, self.uid, form['message'])
|
||||||
|
msg = account_msg_data.msg
|
||||||
|
return msg
|
||||||
|
|
||||||
|
|
||||||
|
def invoice_lines(self,invoice):
|
||||||
|
result =[]
|
||||||
|
sub_total={}
|
||||||
|
info=[]
|
||||||
|
invoice_list=[]
|
||||||
|
res={}
|
||||||
|
list_in_seq={}
|
||||||
|
ids = self.pool.get('account.invoice.line').search(self.cr, self.uid, [('invoice_id', '=', invoice.id)])
|
||||||
|
ids.sort()
|
||||||
|
for id in range(0,len(ids)):
|
||||||
|
info = self.pool.get('account.invoice.line').browse(self.cr, self.uid,ids[id], self.context.copy())
|
||||||
|
list_in_seq[info]=info.sequence
|
||||||
|
# invoice_list +=[info]
|
||||||
|
i=1
|
||||||
|
j=0
|
||||||
|
final=sorted(list_in_seq.items(), lambda x, y: cmp(x[1], y[1]))
|
||||||
|
invoice_list=[x[0] for x in final]
|
||||||
|
sum_flag={}
|
||||||
|
sum_flag[j]=-1
|
||||||
|
for entry in invoice_list:
|
||||||
|
res={}
|
||||||
|
|
||||||
|
if entry.state=='article':
|
||||||
|
self.cr.execute('select tax_id from account_invoice_line_tax where invoice_line_id=%d'%(entry.id))
|
||||||
|
tax_ids=self.cr.fetchall()
|
||||||
|
|
||||||
|
if tax_ids==[]:
|
||||||
|
res['tax_types']=''
|
||||||
|
else:
|
||||||
|
tax_names_dict={}
|
||||||
|
for item in range(0,len(tax_ids)) :
|
||||||
|
self.cr.execute('select name from account_tax where id=%d'%(tax_ids[item][0]))
|
||||||
|
type=self.cr.fetchone()
|
||||||
|
tax_names_dict[item] =type[0]
|
||||||
|
tax_names = ','.join([tax_names_dict[x] for x in range(0,len(tax_names_dict))])
|
||||||
|
res['tax_types']=tax_names
|
||||||
|
res['name']=entry.name
|
||||||
|
res['quantity']="%.2f"%(entry.quantity)
|
||||||
|
res['price_unit']="%.2f"%(entry.price_unit)
|
||||||
|
res['discount']="%.2f"%(entry.discount)
|
||||||
|
res['price_subtotal']="%.2f"%(entry.price_subtotal)
|
||||||
|
sub_total[i]=entry.price_subtotal
|
||||||
|
i=i+1
|
||||||
|
res['note']=entry.note
|
||||||
|
res['currency']=invoice.currency_id.code
|
||||||
|
res['type']=entry.state
|
||||||
|
|
||||||
|
if entry.uos_id.id==False:
|
||||||
|
res['uos']=''
|
||||||
|
else:
|
||||||
|
uos_name = self.pool.get('product.uom').read(self.cr,self.uid,entry.uos_id.id,['name'])
|
||||||
|
res['uos']=uos_name['name']
|
||||||
|
else:
|
||||||
|
|
||||||
|
res['quantity']=''
|
||||||
|
res['price_unit']=''
|
||||||
|
res['discount']=''
|
||||||
|
res['tax_types']=''
|
||||||
|
res['type']=entry.state
|
||||||
|
res['note']=entry.note
|
||||||
|
res['uos']=''
|
||||||
|
|
||||||
|
if entry.state=='subtotal':
|
||||||
|
res['name']=entry.name
|
||||||
|
sum=0
|
||||||
|
sum_id=0
|
||||||
|
if sum_flag[j]==-1:
|
||||||
|
temp=1
|
||||||
|
else:
|
||||||
|
temp=sum_flag[j]
|
||||||
|
|
||||||
|
for sum_id in range(temp,len(sub_total)+1):
|
||||||
|
sum+=sub_total[sum_id]
|
||||||
|
sum_flag[j+1]= sum_id +1
|
||||||
|
|
||||||
|
j=j+1
|
||||||
|
res['price_subtotal']="%.2f"%(sum)
|
||||||
|
res['currency']=invoice.currency_id.code
|
||||||
|
res['quantity']=''
|
||||||
|
res['price_unit']=''
|
||||||
|
res['discount']=''
|
||||||
|
res['tax_types']=''
|
||||||
|
res['uos']=''
|
||||||
|
elif entry.state=='title':
|
||||||
|
res['name']=entry.name
|
||||||
|
res['price_subtotal']=''
|
||||||
|
res['currency']=''
|
||||||
|
elif entry.state=='text':
|
||||||
|
res['name']=entry.name
|
||||||
|
res['price_subtotal']=''
|
||||||
|
res['currency']=''
|
||||||
|
elif entry.state=='line':
|
||||||
|
res['quantity']='____________'
|
||||||
|
res['price_unit']='______________'
|
||||||
|
res['discount']='____________'
|
||||||
|
res['tax_types']='_________________'
|
||||||
|
res['uos']='_____'
|
||||||
|
res['name']='________________________________________'
|
||||||
|
res['price_subtotal']='_______________________'
|
||||||
|
res['currency']='_______'
|
||||||
|
elif entry.state=='break':
|
||||||
|
res['type']=entry.state
|
||||||
|
res['name']=entry.name
|
||||||
|
res['price_subtotal']=''
|
||||||
|
res['currency']=''
|
||||||
|
else:
|
||||||
|
res['name']=entry.name
|
||||||
|
res['price_subtotal']=''
|
||||||
|
res['currency']=invoice.currency_id.code
|
||||||
|
|
||||||
|
result.append(res)
|
||||||
|
return result
|
||||||
|
|
||||||
|
report_sxw.report_sxw('report.notify_account.invoice', 'account.invoice', 'addons/account_invoice_layout/report/special_message_invoice.rml', parser=account_invoice_with_message)
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,300 @@
|
||||||
|
<?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="34.0" y1="28.0" width="527" 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="Tableau6">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<lineStyle kind="GRID" colorName="black"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="3,0" stop="3,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="4,0" stop="4,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="5,0" stop="5,0"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Tableau7">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Tableau8">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Tableau3">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="0,1" stop="0,1"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="1,1" stop="1,1"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="2,1" stop="2,1"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Tableau4">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Tableau5">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<initialize>
|
||||||
|
<paraStyle name="all" alignment="justify"/>
|
||||||
|
</initialize>
|
||||||
|
<paraStyle name="P1" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P2" fontName="Times-Roman" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P3" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P4" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P5" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P6" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P7" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P8" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="3.0" leading="8"/>
|
||||||
|
<paraStyle name="P9" fontName="Times-Italic" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="3.0"/>
|
||||||
|
<paraStyle name="P10" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P11" fontName="Times-Bold" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P12" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P13" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P14" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="LEFT"/>
|
||||||
|
<paraStyle name="P15" fontName="Times-Roman" fontSize="14.0" leading="17" alignment="CENTER"/>
|
||||||
|
<paraStyle name="P16" fontName="Times-Roman" fontSize="20.0" leading="25" alignment="LEFT"/>
|
||||||
|
<paraStyle name="P17" fontName="Times-Roman" fontSize="11.0" leading="14"/>
|
||||||
|
<paraStyle name="P18" fontName="Times-Roman" fontSize="11.0" leading="14"/>
|
||||||
|
<paraStyle name="P19" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="LEFT"/>
|
||||||
|
<paraStyle name="P20" fontName="Times-Roman" fontSize="6.0" leading="8" spaceBefore="0.0" spaceAfter="0.0"/>
|
||||||
|
<paraStyle name="P21" fontName="Times-Bold" fontSize="8.0" leading="8" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P22" fontName="Times-Roman" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P23" fontName="Times-Roman" fontSize="20.0" leading="25" alignment="LEFT"/>
|
||||||
|
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||||
|
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="2.0" spaceAfter="3.0" leading="10"/>
|
||||||
|
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||||
|
</stylesheet>
|
||||||
|
<images/>
|
||||||
|
<story>
|
||||||
|
<para style="P1">[[ repeatIn(objects,'o') ]]</para>
|
||||||
|
<para style="P1">[[ setLang(o.partner_id.lang) ]]</para>
|
||||||
|
<blockTable colWidths="295.0,232.0" style="Tableau2">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P2">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="Standard">[[ o.partner_id.title or '' ]] [[ o.partner_id.name ]]</para>
|
||||||
|
<para style="Standard">[[ o.address_invoice_id.title or '' ]] [[ o.address_invoice_id.name ]]</para>
|
||||||
|
<para style="Standard">[[ o.address_invoice_id.street ]]</para>
|
||||||
|
<para style="Standard">[[ o.address_invoice_id.street2 or '' ]]</para>
|
||||||
|
<para style="Standard">[[ o.address_invoice_id.zip or '' ]] [[ o.address_invoice_id.city or '' ]]</para>
|
||||||
|
<para style="Standard">[[ o.address_invoice_id.state_id and o.address_invoice_id.state_id.name or '' ]]</para>
|
||||||
|
<para style="Standard">[[ o.address_invoice_id.country_id and o.address_invoice_id.country_id.name or '' ]]</para>
|
||||||
|
<para style="Standard">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<para style="Standard">Tel. : [[ o.address_invoice_id.phone or removeParentNode('para') ]]</para>
|
||||||
|
<para style="Standard">Fax : [[ o.address_invoice_id.fax or removeParentNode('para') ]]</para>
|
||||||
|
<para style="Standard">VAT : [[ o.partner_id.vat or removeParentNode('para') ]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<para style="P14">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<para style="P23">Invoice [[ ((o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')) or removeParentNode('para')) and '' ]] [[ o.number ]]</para>
|
||||||
|
<para style="P23">PRO-FORMA [[ ((o.type == 'out_invoice' and o.state == 'proforma') or removeParentNode('para')) and '' ]]</para>
|
||||||
|
<para style="P23">Draft Invoice [[ ((o.type == 'out_invoice' and o.state == 'draft') or removeParentNode('para')) and '' ]]</para>
|
||||||
|
<para style="P23">Canceled Invoice [[ ((o.type == 'out_invoice' and o.state == 'cancel') or removeParentNode('para')) and '' ]]</para>
|
||||||
|
<para style="P23">Refund [[ (o.type=='out_refund' or removeParentNode('para')) and '' ]] [[ o.number ]]</para>
|
||||||
|
<para style="P23">Supplier Refund [[ (o.type=='in_refund' or removeParentNode('para')) and '' ]] [[ o.number ]]</para>
|
||||||
|
<para style="P16">
|
||||||
|
<font face="Times-Roman">Supplier Invoice [[ (o.type=='in_invoice' or removeParentNode('para')) and '' ]]</font>
|
||||||
|
<font face="Times-Roman">[[ o.number ]]</font>
|
||||||
|
</para>
|
||||||
|
<para style="P15">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<para style="P17">
|
||||||
|
<font face="Times-Roman">Document</font>
|
||||||
|
<font face="Times-Roman">:</font>
|
||||||
|
<font face="Times-Roman">[[o.name]]</font>
|
||||||
|
</para>
|
||||||
|
<para style="P17">
|
||||||
|
<font face="Times-Roman">Invoice Date: </font>
|
||||||
|
<font face="Times-Roman">[[o.date_invoice]]</font>
|
||||||
|
</para>
|
||||||
|
<para style="P18">
|
||||||
|
<font face="Times-Roman">Customer Ref:</font> [[ o.address_invoice_id.partner_id.ref or '/' ]]</para>
|
||||||
|
<para style="Standard">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<blockTable colWidths="216.0,62.0,62.0,62.0,51.0,74.0" style="Tableau6">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P3">Description</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Taxes</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Quantity</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Unit Price</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Disc. (%)</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Price</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<section>
|
||||||
|
<para style="P20">[[ repeat_In(invoice_lines(o), 'a') ]]</para>
|
||||||
|
<blockTable colWidths="0.0,216.0" style="Tableau7">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P8">[[ a['type']=='text' and removeParentNode('tr')]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="Table Contents"><font>[[ a['type']=='title' and ( setTag('font','font',{'size':'11.5'})) ]][[ (a['type']=='title' or a['type']=='subtotal') and ( setTag('font','font',{'name':'Times-bold'})) ]][[ a['type']=='text' and removeParentNode('font') or a['name'] ]]</font></para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<blockTable colWidths="453.0,74.0" style="Tableau8">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="Table Contents">[[ a['type']=='text' and a['name'] or removeParentNode('table') ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P8">[[ a['type']=='text' and '' or removeParentNode('table') ]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<blockTable colWidths="28.0,499.0" style="Tableau8">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P21">[[ a['note']=='' and removeParentNode('table') ]][[ repeatIn(( a['note'] and a['note'].splitlines()) or [], 'note') ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P9">[[ note or removeParentNode('table') ]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<pageBreak>[[ a['type']!='break' and removeParentNode('pageBreak')]]</pageBreak>
|
||||||
|
<blockTable colWidths="216.0,62.0,62.0,62.0,51.0,74.0" style="Tableau6">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P3">Description [[ a['type']!='break' and removeParentNode('tr')]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Taxes</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Quantity</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Unit Price</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Disc. (%)</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4">Price</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
</section>
|
||||||
|
<para style="Standard">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<blockTable colWidths="215.0,313.0" style="Tableau3">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<blockTable colWidths="81.0,73.0,60.0" style="Tableau4">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P10">Tax</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P8">Base</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P8">Amount</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P5">
|
||||||
|
<font face="Times-Roman">[[ repeatIn(o.tax_line,'t') ]]</font> [[ t.name ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P11">[[ '%.2f' % t.base ]]</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P11">[[ '%.2f' % t.amount]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<blockTable colWidths="214.0,95.0" style="Tableau5">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P7">Total (excl. taxes):</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P12">[[ '%.2f' % o.amount_untaxed ]] [[o.currency_id.code ]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P7">Taxes:</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P12">[[ '%.2f' % o.amount_tax ]] [[o.currency_id.code ]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P13">Total <font face="Times-Roman">(incl. taxes):</font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P22">[[ '%.2f' % o.amount_total ]] [[o.currency_id.code ]]</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<para style="Table Contents">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<para style="P19">[[ format(o.comment or '') ]]</para>
|
||||||
|
<para style="P19">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<para style="P19">[[ format((o.payment_term and o.payment_term.note) or '') ]]</para>
|
||||||
|
<para style="P19">[[ repeatIn((spcl_msg(data['form']) and spcl_msg(data['form']).splitlines()) or [], 'note') ]]</para>
|
||||||
|
<para style="P19">[[ note or removeParentNode('table') ]]</para>
|
||||||
|
|
||||||
|
</story>
|
||||||
|
</document>
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
import invoice_special_message
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
import wizard
|
||||||
|
import time
|
||||||
|
import datetime
|
||||||
|
import pooler
|
||||||
|
|
||||||
|
invoice_form = """<?xml version="1.0"?>
|
||||||
|
<form string="Select Message">
|
||||||
|
<field name="message"/>
|
||||||
|
</form>"""
|
||||||
|
|
||||||
|
invoice_fields = {
|
||||||
|
'message': {'string': 'Message', 'type': 'many2one', 'relation': 'notify.message', 'required': True},
|
||||||
|
}
|
||||||
|
|
||||||
|
class wizard_report(wizard.interface):
|
||||||
|
|
||||||
|
states = {
|
||||||
|
'init': {
|
||||||
|
'actions': [],
|
||||||
|
'result': {'type':'form', 'arch':invoice_form, 'fields':invoice_fields, 'state':[('end','Cancel'),('print','Print')]},
|
||||||
|
},
|
||||||
|
'print': {
|
||||||
|
'actions': [],
|
||||||
|
'result': {'type':'print', 'report':'notify_account.invoice', 'state':'end'},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
wizard_report('wizard.notify_message')
|
||||||
|
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,34 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||||
|
# Fabien Pinckaers <fp@tiny.Be>
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting from its eventual inadequacies and bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees and support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
import report
|
||||||
|
import account
|
||||||
|
import wizard
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
{
|
||||||
|
"name" : "Reporting of Balancesheet for accounting",
|
||||||
|
"version" : "1.0",
|
||||||
|
"depends" : ["account"],
|
||||||
|
"author" : "Tiny",
|
||||||
|
"description": """Financial and accounting reporting""",
|
||||||
|
"category" : "Generic Modules/Accounting",
|
||||||
|
"init_xml" : [ ],
|
||||||
|
"demo_xml" : [ ],
|
||||||
|
"update_xml" : [
|
||||||
|
"account_view.xml",
|
||||||
|
"account_report.xml",
|
||||||
|
"account_data.xml",
|
||||||
|
],
|
||||||
|
# "translations" : {
|
||||||
|
# "fr": "i18n/french_fr.csv"
|
||||||
|
# },
|
||||||
|
"active": False,
|
||||||
|
"installable": True
|
||||||
|
}
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,134 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||||
|
#
|
||||||
|
# $Id: account.py 1005 2005-07-25 08:41:42Z nicoe $
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting from its eventual inadequacies and bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees and support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
import time
|
||||||
|
import netsvc
|
||||||
|
from osv import fields, osv
|
||||||
|
|
||||||
|
from tools.misc import currency
|
||||||
|
|
||||||
|
import mx.DateTime
|
||||||
|
from mx.DateTime import RelativeDateTime, now, DateTime, localtime
|
||||||
|
|
||||||
|
|
||||||
|
class color_rml(osv.osv):
|
||||||
|
_name = "color.rml"
|
||||||
|
_description = "Rml Colors"
|
||||||
|
_columns = {
|
||||||
|
'name': fields.char('Name', size=64, required=True),
|
||||||
|
'code': fields.char('code',size=64,required=True),
|
||||||
|
}
|
||||||
|
|
||||||
|
color_rml()
|
||||||
|
|
||||||
|
class account_report_bs(osv.osv):
|
||||||
|
_name = "account.report.bs"
|
||||||
|
_description = "Account reporting for Balance Sheet"
|
||||||
|
_font = [
|
||||||
|
('',''),
|
||||||
|
('Courier','Courier'),
|
||||||
|
('Courier-Bold','Courier-Bold'),
|
||||||
|
('Courier-BoldOblique','Courier-BoldOblique'),
|
||||||
|
('Courier-Oblique','Courier-Oblique'),
|
||||||
|
('Helvetica','Helvetica'),
|
||||||
|
('Helvetica-Bold','Helvetica-Bold'),
|
||||||
|
('Helvetica-Oblique','Helvetica-Oblique'),
|
||||||
|
('Times-Bold','Times-Bold'),
|
||||||
|
('Times-BoldItalic','Times-BoldItalic'),
|
||||||
|
('Times-Italic','Times-Italic'),
|
||||||
|
('Times-Roman','Times-Roman'),
|
||||||
|
]
|
||||||
|
_color = [
|
||||||
|
('', ''),
|
||||||
|
('green','Green'),
|
||||||
|
('red','Red'),
|
||||||
|
('pink','Pink'),
|
||||||
|
('blue','Blue'),
|
||||||
|
('yellow','Yellow'),
|
||||||
|
('cyan','Cyan'),
|
||||||
|
('lightblue','Light Blue'),
|
||||||
|
('orange','Orange'),
|
||||||
|
]
|
||||||
|
_style = [
|
||||||
|
('', ''),
|
||||||
|
('h1','Header 1'),
|
||||||
|
('h2','Header 2'),
|
||||||
|
('h3','Header 3'),
|
||||||
|
]
|
||||||
|
|
||||||
|
def onchange_parent_id(self, cr, uid, ids, parent_id):
|
||||||
|
v={}
|
||||||
|
if parent_id:
|
||||||
|
acc=self.pool.get('account.report.report').browse(cr,uid,parent_id)
|
||||||
|
v['type']=acc.type
|
||||||
|
if int(acc.style) < 6:
|
||||||
|
v['style'] = str(int(acc.style)+1)
|
||||||
|
return {'value': v}
|
||||||
|
|
||||||
|
_columns = {
|
||||||
|
'name': fields.char('Name', size=64, required=True),
|
||||||
|
'sequence': fields.integer('Sequence'),
|
||||||
|
'code': fields.char('Code', size=64, required=True),
|
||||||
|
'account_id': fields.many2many('account.account', 'account_report_rel', 'report_id', 'account_id', 'Accounts'),
|
||||||
|
'note': fields.text('Note'),
|
||||||
|
# 'style': fields.selection(_style, 'Style'),
|
||||||
|
'color_font' : fields.many2one('color.rml','Font Color'),
|
||||||
|
'color_back' : fields.many2one('color.rml','Back Color'),
|
||||||
|
'font_style' : fields.selection(_font, 'Font'),
|
||||||
|
'parent_id': fields.many2one('account.report.bs', 'Parent'),
|
||||||
|
'child_id': fields.one2many('account.report.bs', 'parent_id', 'Childs'),
|
||||||
|
'report_type' : fields.selection([('only_obj', 'Report Objects Only'),('with_account', 'Report Objects With Accounts'),('acc_with_child', 'Report Objects With Accounts and child of Accounts')],"Report Type")
|
||||||
|
}
|
||||||
|
_defaults = {
|
||||||
|
'report_type': lambda *a :'only_obj'
|
||||||
|
}
|
||||||
|
|
||||||
|
def name_search(self, cr, user, name, args=None, operator='ilike', context=None, limit=80):
|
||||||
|
if not args:
|
||||||
|
args=[]
|
||||||
|
if not context:
|
||||||
|
context={}
|
||||||
|
ids = []
|
||||||
|
if name:
|
||||||
|
ids = self.search(cr, user, [('code','=',name)]+ args, limit=limit, context=context)
|
||||||
|
if not ids:
|
||||||
|
ids = self.search(cr, user, [('name',operator,name)]+ args, limit=limit, context=context)
|
||||||
|
else:
|
||||||
|
ids = self.search(cr, user, args, limit=limit, context=context)
|
||||||
|
return self.name_get(cr, user, ids, context=context)
|
||||||
|
|
||||||
|
_sql_constraints = [
|
||||||
|
('code_uniq', 'unique (code)', 'The code of the report entry must be unique !')
|
||||||
|
]
|
||||||
|
|
||||||
|
account_report_bs()
|
||||||
|
|
||||||
|
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,491 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<terp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c1">
|
||||||
|
<field name="name">aliceblue</field>
|
||||||
|
<field name="code">aliceblue</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c2">
|
||||||
|
<field name="name">antiquewhite</field>
|
||||||
|
<field name="code">antiquewhite</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c3">
|
||||||
|
<field name="name">aqua</field>
|
||||||
|
<field name="code">aqua</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c4">
|
||||||
|
<field name="name">aquamarine</field>
|
||||||
|
<field name="code">aquamarine</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c5">
|
||||||
|
<field name="name">azure</field>
|
||||||
|
<field name="code">azure</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c6">
|
||||||
|
<field name="name">beige</field>
|
||||||
|
<field name="code">beige</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c7">
|
||||||
|
<field name="name">bisque</field>
|
||||||
|
<field name="code">bisque</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c8">
|
||||||
|
<field name="name">black</field>
|
||||||
|
<field name="code">black</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c9">
|
||||||
|
<field name="name">blanchedalmond</field>
|
||||||
|
<field name="code">blanchedalmond</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c10">
|
||||||
|
<field name="name">blue</field>
|
||||||
|
<field name="code">blue</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c11">
|
||||||
|
<field name="name">blueviolet</field>
|
||||||
|
<field name="code">blueviolet</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c12">
|
||||||
|
<field name="name">brown</field>
|
||||||
|
<field name="code">brown</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c13">
|
||||||
|
<field name="name">burlywood</field>
|
||||||
|
<field name="code">burlywood</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c14">
|
||||||
|
<field name="name">cadetblue</field>
|
||||||
|
<field name="code">cadetblue</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c15">
|
||||||
|
<field name="name">chartreuse</field>
|
||||||
|
<field name="code">chartreuse</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c16">
|
||||||
|
<field name="name">chocolate</field>
|
||||||
|
<field name="code">chocolate</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c17">
|
||||||
|
<field name="name">coral</field>
|
||||||
|
<field name="code">coral</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c18">
|
||||||
|
<field name="name">cornflower</field>
|
||||||
|
<field name="code">cornflower</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c19">
|
||||||
|
<field name="name">cornsilk</field>
|
||||||
|
<field name="code">cornsilk</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c20">
|
||||||
|
<field name="name">crimson</field>
|
||||||
|
<field name="code">crimson</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c21">
|
||||||
|
<field name="name">cyan</field>
|
||||||
|
<field name="code">cyan</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c22">
|
||||||
|
<field name="name">darkblue</field>
|
||||||
|
<field name="code">darkblue</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c23">
|
||||||
|
<field name="name">darkcyan</field>
|
||||||
|
<field name="code">darkcyan</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c24">
|
||||||
|
<field name="name">darkgoldenrod</field>
|
||||||
|
<field name="code">darkgoldenrod</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c25">
|
||||||
|
<field name="name">darkgray</field>
|
||||||
|
<field name="code">darkgray</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c26">
|
||||||
|
<field name="name">darkgreen</field>
|
||||||
|
<field name="code">darkgreen</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c27">
|
||||||
|
<field name="name">darkkhaki</field>
|
||||||
|
<field name="code">darkkhaki</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c28">
|
||||||
|
<field name="name">darkmagenta</field>
|
||||||
|
<field name="code">darkmagenta</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c29">
|
||||||
|
<field name="name">darkolivegreen</field>
|
||||||
|
<field name="code">darkolivegreen</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c30">
|
||||||
|
<field name="name">darkorange</field>
|
||||||
|
<field name="code">darkorange</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c31">
|
||||||
|
<field name="name">darkorchid</field>
|
||||||
|
<field name="code">darkorchid</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c32">
|
||||||
|
<field name="name">darkred</field>
|
||||||
|
<field name="code">darkred</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c33">
|
||||||
|
<field name="name">darksalmon</field>
|
||||||
|
<field name="code">darksalmon</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c34">
|
||||||
|
<field name="name">darkseagreen</field>
|
||||||
|
<field name="code">darkseagreen</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c35">
|
||||||
|
<field name="name">darkslateblue</field>
|
||||||
|
<field name="code">darkslateblue</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c36">
|
||||||
|
<field name="name">darkslategray</field>
|
||||||
|
<field name="code">darkslategray</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c37">
|
||||||
|
<field name="name">darkturquoise</field>
|
||||||
|
<field name="code">darkturquoise</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c38">
|
||||||
|
<field name="name">darkviolet</field>
|
||||||
|
<field name="code">darkviolet</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c39">
|
||||||
|
<field name="name">deeppink</field>
|
||||||
|
<field name="code">deeppink</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c40">
|
||||||
|
<field name="name">deepskyblue</field>
|
||||||
|
<field name="code">deepskyblue</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c41">
|
||||||
|
<field name="name">dimgray</field>
|
||||||
|
<field name="code">dimgray</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c42">
|
||||||
|
<field name="name">dodgerblue</field>
|
||||||
|
<field name="code">dodgerblue</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c43">
|
||||||
|
<field name="name">firebrick</field>
|
||||||
|
<field name="code">firebrick</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c44">
|
||||||
|
<field name="name">floralwhite</field>
|
||||||
|
<field name="code">floralwhite</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c45">
|
||||||
|
<field name="name">forestgreen</field>
|
||||||
|
<field name="code">forestgreen</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c46">
|
||||||
|
<field name="name">fuchsia</field>
|
||||||
|
<field name="code">fuchsia</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c47">
|
||||||
|
<field name="name">gainsboro</field>
|
||||||
|
<field name="code">gainsboro</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c48">
|
||||||
|
<field name="name">ghostwhite</field>
|
||||||
|
<field name="code">ghostwhite</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c49">
|
||||||
|
<field name="name">gold</field>
|
||||||
|
<field name="code">gold</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c50">
|
||||||
|
<field name="name">goldenrod</field>
|
||||||
|
<field name="code">goldenrod</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c51">
|
||||||
|
<field name="name">gray</field>
|
||||||
|
<field name="code">gray</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c52">
|
||||||
|
<field name="name">green</field>
|
||||||
|
<field name="code">green</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c53">
|
||||||
|
<field name="name">greenyellow</field>
|
||||||
|
<field name="code">greenyellow</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c54">
|
||||||
|
<field name="name">honeydew</field>
|
||||||
|
<field name="code">honeydew</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c55">
|
||||||
|
<field name="name">hotpink</field>
|
||||||
|
<field name="code">hotpink</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c56">
|
||||||
|
<field name="name">indianred</field>
|
||||||
|
<field name="code">indianred</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c57">
|
||||||
|
<field name="name">indigo</field>
|
||||||
|
<field name="code">indigo</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c58">
|
||||||
|
<field name="name">ivory</field>
|
||||||
|
<field name="code">ivory</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c59">
|
||||||
|
<field name="name">khaki</field>
|
||||||
|
<field name="code">khaki</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c60">
|
||||||
|
<field name="name">lavender</field>
|
||||||
|
<field name="code">lavender</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c61">
|
||||||
|
<field name="name">lavenderblush</field>
|
||||||
|
<field name="code">lavenderblush</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c62">
|
||||||
|
<field name="name">lawngreen</field>
|
||||||
|
<field name="code">lawngreen</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c63">
|
||||||
|
<field name="name">lemonchiffon</field>
|
||||||
|
<field name="code">lemonchiffon</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c64">
|
||||||
|
<field name="name">lightblue</field>
|
||||||
|
<field name="code">lightblue</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c65">
|
||||||
|
<field name="name">lightcoral</field>
|
||||||
|
<field name="code">lightcoral</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c66">
|
||||||
|
<field name="name">lightcyan</field>
|
||||||
|
<field name="code">lightcyan</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c67">
|
||||||
|
<field name="name">lightgoldenrodyellow</field>
|
||||||
|
<field name="code">lightgoldenrodyellow</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c68">
|
||||||
|
<field name="name">lightgreen</field>
|
||||||
|
<field name="code">lightgreen</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c69">
|
||||||
|
<field name="name">lightpink</field>
|
||||||
|
<field name="code">lightpink</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c70">
|
||||||
|
<field name="name">lightsalmon</field>
|
||||||
|
<field name="code">lightsalmon</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c71">
|
||||||
|
<field name="name">lightseagreen</field>
|
||||||
|
<field name="code">lightseagreen</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c72">
|
||||||
|
<field name="name">lightskyblue</field>
|
||||||
|
<field name="code">lightskyblue</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c73">
|
||||||
|
<field name="name">lightslategray</field>
|
||||||
|
<field name="code">lightslategray</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c74">
|
||||||
|
<field name="name">lightsteelblue</field>
|
||||||
|
<field name="code">lightsteelblue</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c75">
|
||||||
|
<field name="name">lightyellow</field>
|
||||||
|
<field name="code">lightyellow</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c76">
|
||||||
|
<field name="name">lime</field>
|
||||||
|
<field name="code">lime</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c77">
|
||||||
|
<field name="name">limegreen</field>
|
||||||
|
<field name="code">limegreen</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c78">
|
||||||
|
<field name="name">linen</field>
|
||||||
|
<field name="code">linen</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c79">
|
||||||
|
<field name="name">magenta</field>
|
||||||
|
<field name="code">magenta</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c80">
|
||||||
|
<field name="name">maroon</field>
|
||||||
|
<field name="code">maroon</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c81">
|
||||||
|
<field name="name">mediumaquamarine</field>
|
||||||
|
<field name="code">mediumaquamarine</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c82">
|
||||||
|
<field name="name">mediumblue</field>
|
||||||
|
<field name="code">mediumblue</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c83">
|
||||||
|
<field name="name">mediumorchid</field>
|
||||||
|
<field name="code">mediumorchid</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c84">
|
||||||
|
<field name="name">mediumpurple</field>
|
||||||
|
<field name="code">mediumpurple</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c85">
|
||||||
|
<field name="name">mediumseagreen</field>
|
||||||
|
<field name="code">mediumseagreen</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c86">
|
||||||
|
<field name="name">mediumslateblue</field>
|
||||||
|
<field name="code">mediumslateblue</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c87">
|
||||||
|
<field name="name">mediumspringgreen</field>
|
||||||
|
<field name="code">mediumspringgreen</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c88">
|
||||||
|
<field name="name">mediumturquoise</field>
|
||||||
|
<field name="code">mediumturquoise</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c89">
|
||||||
|
<field name="name">mediumvioletred</field>
|
||||||
|
<field name="code">mediumvioletred</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c90">
|
||||||
|
<field name="name">midnightblue</field>
|
||||||
|
<field name="code">midnightblue</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c91">
|
||||||
|
<field name="name">mintcream</field>
|
||||||
|
<field name="code">mintcream</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c92">
|
||||||
|
<field name="name">mistyrose</field>
|
||||||
|
<field name="code">mistyrose</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c93">
|
||||||
|
<field name="name">moccasin</field>
|
||||||
|
<field name="code">moccasin</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c94">
|
||||||
|
<field name="name">navajowhite</field>
|
||||||
|
<field name="code">navajowhite</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c95">
|
||||||
|
<field name="name">navy</field>
|
||||||
|
<field name="code">navy</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c96">
|
||||||
|
<field name="name">oldlace</field>
|
||||||
|
<field name="code">oldlace</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="color.rml" id="c97">
|
||||||
|
<field name="name">olive</field>
|
||||||
|
<field name="code">olive</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</terp>
|
|
@ -0,0 +1,18 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<terp>
|
||||||
|
<data>
|
||||||
|
<!-- <report id="balancesheet_report"
|
||||||
|
string="BalanceSheet Report"
|
||||||
|
model="account.report.bs"
|
||||||
|
name="account.report.bs"
|
||||||
|
rml="addons/account_report_bs/report/account_report_bs.rml"
|
||||||
|
auto="False"/>-->
|
||||||
|
<wizard
|
||||||
|
string="Account balance"
|
||||||
|
model="account.report.bs"
|
||||||
|
name="account.account.balancesheet.report"
|
||||||
|
keyword="client_print_multi"
|
||||||
|
id="wizard_balance_report"/>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</terp>
|
|
@ -0,0 +1,65 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<terp>
|
||||||
|
<data>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="view_account_report_bs_form">
|
||||||
|
<field name="name">account.report.bs.form</field>
|
||||||
|
<field name="model">account.report.bs</field>
|
||||||
|
<field name="type">form</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<form string="Account reporting">
|
||||||
|
<notebook>
|
||||||
|
<page string="General">
|
||||||
|
<field name="name" select="1" colspan="3"/>
|
||||||
|
<field name="code" select="1"/>
|
||||||
|
<field name="parent_id" select = "1" />
|
||||||
|
<field name="sequence"/>
|
||||||
|
<field name="color_font"/>
|
||||||
|
<field name="color_back"/>
|
||||||
|
<field name="font_style" />
|
||||||
|
<field name="report_type" />
|
||||||
|
<newline/>
|
||||||
|
<separator string="Accounts" colspan="4"/>
|
||||||
|
<field name="account_id" colspan="4" nolable="1" domain="[('type','=','view')]"/>
|
||||||
|
</page><page string="Notes">
|
||||||
|
<field name="note" nolabel="1" colspan="4"/>
|
||||||
|
</page>
|
||||||
|
</notebook>
|
||||||
|
</form>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="ir.ui.view" id="view_account_report_tree_bs">
|
||||||
|
<field name="name">account.report.report.tree.bs</field>
|
||||||
|
<field name="model">account.report.bs</field>
|
||||||
|
<field name="type">tree</field>
|
||||||
|
<field name="field_parent">child_id</field>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<tree string="Account reporting">
|
||||||
|
<field name="code"/>
|
||||||
|
<field name="name"/>
|
||||||
|
</tree>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window" id="action_account_tree_bs">
|
||||||
|
<field name="type">ir.actions.act_window</field>
|
||||||
|
<field name="res_model">account.report.bs</field>
|
||||||
|
<field name="domain">[('parent_id','=',False)]</field>
|
||||||
|
<field name="view_type">tree</field>
|
||||||
|
<field name="view_id" ref="view_account_report_tree_bs"/>
|
||||||
|
</record>
|
||||||
|
<menuitem name="Balance Sheet Report" id="menu_finan_config_BSheet" parent="account.menu_finance_configuration"/>
|
||||||
|
<menuitem name="Balance Sheet Report" id="action_account_report_bs_form" action="action_account_tree_bs" parent="menu_finan_config_BSheet"/>
|
||||||
|
|
||||||
|
<record model="ir.actions.act_window" id="acc_bs_report_action_form">
|
||||||
|
<field name="type">ir.actions.act_window</field>
|
||||||
|
<field name="res_model">account.report.bs</field>
|
||||||
|
<field name="view_type">form</field>
|
||||||
|
<field name="view_id" ref="view_account_report_bs_form"/>
|
||||||
|
</record>
|
||||||
|
<menuitem name="Balance Sheet Rrport Form" id="bs_report_action_form" action="acc_bs_report_action_form" parent="menu_finan_config_BSheet"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</terp>
|
|
@ -0,0 +1,32 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||||
|
# Fabien Pinckaers <fp@tiny.Be>
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting from its eventual inadequacies and bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees and support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
import account_report_bs
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,149 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2004-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting from its eventual inadequacies and bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees and support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
import time
|
||||||
|
import pooler
|
||||||
|
import locale
|
||||||
|
from report import report_sxw
|
||||||
|
|
||||||
|
#from addons.account.wizard import wizard_account_balance_report
|
||||||
|
|
||||||
|
parents = {
|
||||||
|
'tr':1,
|
||||||
|
'li':1,
|
||||||
|
'story': 0,
|
||||||
|
'section': 0
|
||||||
|
}
|
||||||
|
|
||||||
|
class account_report_bs(report_sxw.rml_parse):
|
||||||
|
def __init__(self, cr, uid, name, context):
|
||||||
|
super(account_report_bs, self).__init__(cr, uid, name, context)
|
||||||
|
self.localcontext.update({
|
||||||
|
'time': time,
|
||||||
|
'lines': self.lines,
|
||||||
|
})
|
||||||
|
self.context = context
|
||||||
|
|
||||||
|
|
||||||
|
def line_total(self,line_id,ctx):
|
||||||
|
_total = 0
|
||||||
|
bsline= self.pool.get('account.report.bs').browse(self.cr,self.uid,[line_id])[0]
|
||||||
|
bsline_accids = bsline.account_id
|
||||||
|
res =self.pool.get('account.report.bs').read(self.cr,self.uid,[line_id],['account_id','child_id'])[0]
|
||||||
|
for acc_id in res['account_id']:
|
||||||
|
acc = self.pool.get('account.account').browse(self.cr,self.uid,[acc_id],ctx)[0]
|
||||||
|
_total += acc.balance
|
||||||
|
bsline_reportbs = res['child_id']
|
||||||
|
|
||||||
|
for report in bsline_reportbs:
|
||||||
|
_total +=self.line_total(report,ctx)
|
||||||
|
return _total
|
||||||
|
|
||||||
|
def lines(self, form, ids={}, done=None, level=1):
|
||||||
|
if not ids:
|
||||||
|
ids = self.ids
|
||||||
|
if not ids:
|
||||||
|
return []
|
||||||
|
if not done:
|
||||||
|
done={}
|
||||||
|
result = []
|
||||||
|
ctx = self.context.copy()
|
||||||
|
ctx['fiscalyear'] = form['fiscalyear']
|
||||||
|
ctx['periods'] = form['periods'][0][2]
|
||||||
|
report_objs = self.pool.get('account.report.bs').browse(self.cr, self.uid, ids)
|
||||||
|
title_name = False
|
||||||
|
if level==1:
|
||||||
|
title_name = report_objs[0].name
|
||||||
|
def cmp_code(x, y):
|
||||||
|
return cmp(x.code, y.code)
|
||||||
|
report_objs.sort(cmp_code)
|
||||||
|
|
||||||
|
for report_obj in report_objs:
|
||||||
|
if report_obj.id in done:
|
||||||
|
continue
|
||||||
|
done[report_obj.id] = 1
|
||||||
|
color_font = ''
|
||||||
|
color_back = ''
|
||||||
|
if report_obj.color_font:
|
||||||
|
color_font = report_obj.color_font.name
|
||||||
|
if report_obj.color_back:
|
||||||
|
color_back = report_obj.color_back.name
|
||||||
|
|
||||||
|
res = {
|
||||||
|
'code': report_obj.code,
|
||||||
|
'name': report_obj.name,
|
||||||
|
'level': level,
|
||||||
|
'balance': self.line_total(report_obj.id,ctx),
|
||||||
|
'color_font':color_font,
|
||||||
|
'color_back':color_back,
|
||||||
|
'font_style' : report_obj.font_style
|
||||||
|
}
|
||||||
|
result.append(res)
|
||||||
|
report_type = report_obj.report_type
|
||||||
|
if report_type != 'only_obj':
|
||||||
|
account_ids = self.pool.get('account.report.bs').read(self.cr,self.uid,[report_obj.id],['account_id'])[0]['account_id']
|
||||||
|
for account_id in account_ids:
|
||||||
|
res1 = self.check_child_id(account_id,level,ctx,report_type)
|
||||||
|
result += res1
|
||||||
|
|
||||||
|
if report_obj.child_id:
|
||||||
|
ids2 = [(x.code,x.id) for x in report_obj.child_id]
|
||||||
|
ids2.sort()
|
||||||
|
result += self.lines(form, [x[1] for x in ids2], done, level+1)
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
||||||
|
def check_child_id(self,account_id,level,ctx,report_type):
|
||||||
|
account = self.pool.get('account.account').browse(self.cr,self.uid,[account_id],ctx)[0]
|
||||||
|
result = []
|
||||||
|
res = {
|
||||||
|
'code': account.code,
|
||||||
|
'name': account.name,
|
||||||
|
'level': level+1,
|
||||||
|
'balance': account.balance,
|
||||||
|
'color_font' : 'black',
|
||||||
|
'color_back' :'pink',
|
||||||
|
'font_style' : 'Helvetica-BoldOblique',
|
||||||
|
}
|
||||||
|
result.append(res)
|
||||||
|
if report_type != 'with_account':
|
||||||
|
acc_child_id = self.pool.get('account.account').search(self.cr,self.uid,[('parent_id','=',[account_id]),('type','=','view')])
|
||||||
|
for child_id in acc_child_id :
|
||||||
|
result += self.check_child_id(child_id,level+1,ctx,report_type)
|
||||||
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# def _sum_credit(self):
|
||||||
|
# return self.sum_credit
|
||||||
|
#
|
||||||
|
# def _sum_debit(self):
|
||||||
|
# return self.sum_debit
|
||||||
|
report_sxw.report_sxw('report.account.report.bs', 'account.report.bs', 'addons/account_reporting/report/account_report_bs.rml', parser=account_report_bs)
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,133 @@
|
||||||
|
<?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="35.0" y1="35.0" width="525" height="772"/>
|
||||||
|
</pageTemplate>
|
||||||
|
</template>
|
||||||
|
<stylesheet>
|
||||||
|
<blockTableStyle id="Standard_Outline">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table1">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="0,0" stop="0,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="1,0" stop="1,0"/>
|
||||||
|
<blockBackground colorName="#e6e6e6" start="2,0" stop="2,0"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table2">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table7">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="Table4">
|
||||||
|
<blockAlignment value="LEFT"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<initialize>
|
||||||
|
<paraStyle name="all" alignment="justify"/>
|
||||||
|
</initialize>
|
||||||
|
<paraStyle name="P1" fontName="Times-Roman" fontSize="15.0" leading="25" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P2" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P3" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P4" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P5" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P6" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P7" fontName="Times-Roman" fontSize="6.0" leading="8" alignment="LEFT"/>
|
||||||
|
<paraStyle name="P8" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT"/>
|
||||||
|
<paraStyle name="P9" fontName="Times-Roman" fontSize="8.0" leading="10"/>
|
||||||
|
<paraStyle name="P10" fontName="Times-Roman" fontSize="8.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P11" fontName="Times-Roman" fontSize="8.0" leading="10" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P12" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P13" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P14" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P15" fontName="Times-Roman" fontSize="20.0" leading="25" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P16" fontName="Times-Roman" fontSize="10.0" leading="13" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P17" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="LEFT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P18" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P19" fontName="Times-Roman" fontSize="11.0" leading="14" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="P20" fontName="Times-Roman" fontSize="8.0" leading="10" alignment="RIGHT" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||||
|
<paraStyle name="Text body" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="List" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Table Contents" fontName="Times-Roman" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER" spaceBefore="0.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Caption" fontName="Times-Roman" fontSize="10.0" leading="13" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||||
|
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||||
|
</stylesheet>
|
||||||
|
<story>
|
||||||
|
<blockTable colWidths="143.0,226.0,156.0" repeatRows="1" style="Table1">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="Table Contents"><font color='blue'>[[ company.name ]]</font></para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P3">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P4"><font color='blue'>Currency: [[ company.currency_id.name ]]</font></para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<para style="P8"><font color='blue'>Printing date: [[ time.strftime('%Y-%m-%d') ]] at [[ time.strftime('%H:%M:%S') ]]</font></para>
|
||||||
|
<para style="P7">[[repeatIn(objects,'o') ]]</para>
|
||||||
|
<blockTable colWidths="143.0,226.0,156.0" repeatRows="1" style="Table2">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="Table Contents">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P1"><font>[[o.name]] [[o.font_style and (setTag('font','font',{'face':o.font_style} ) ) ]] [[ o.color_font and ( setTag('font','font',{'color':o.color_font.name})) ]] [[ o.color_back and ( setTag('para','para',{'backColor':o.color_back.name})) ]]</font></para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P2">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<blockTable colWidths="70.0,341.0,131.0" style="Table7">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P12" ><font color='blue'>Code</font></para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P12"><font color='blue'>Account name</font></para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P13"><font color='blue'>Balance</font></para>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<blockTable colWidths="75.0,341.0,131.0" style="Table4">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<para style="P10">[[ repeatIn(lines(data['form']), 'a') ]]<font> [[ a['code'] ]] [[ a['font_style'] and (setTag('font','font',{'face':a['font_style'] })) ]] [[ a['color_font'] and ( setTag('font','font',{'color':a['color_font']})) ]] [[ a['color_back'] and ( setTag('para','para',{'backColor':a['color_back']})) ]]</font></para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P17"><font>[[ '.. .. '*(a['level']-1) ]] [[ a['name'] ]] [[ a['font_style'] and (setTag('font','font',{'face':a['font_style']})) ]] [[ a['color_font'] and ( setTag('font','font',{'color':a['color_font']})) ]] [[ a['color_back'] and ( setTag('para','para',{'backColor':a['color_back']})) ]]</font></para>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<para style="P18"><font>[[ '%.2f'% a['balance'] ]] [[ a['font_style'] and (setTag('font','font', {'face':a['font_style'] })) ]] [[ a['color_font'] and ( setTag('font','font',{'color':a['color_font']})) ]] [[ a['color_back'] and ( setTag('para','para',{'backColor':a['color_back']})) ]]</font></para>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
<para style="Standard">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
<para style="Standard">
|
||||||
|
<font color="white"> </font>
|
||||||
|
</para>
|
||||||
|
</story>
|
||||||
|
</document>
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||||
|
# Fabien Pinckaers <fp@tiny.Be>
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting from its eventual inadequacies and bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees and support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
import wizard_account_balance_report
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,105 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2005-2006 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting from its eventual inadequacies and bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees and support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
import wizard
|
||||||
|
import ir
|
||||||
|
import pooler
|
||||||
|
import time
|
||||||
|
import netsvc
|
||||||
|
from osv import fields, osv
|
||||||
|
import mx.DateTime
|
||||||
|
from mx.DateTime import RelativeDateTime
|
||||||
|
|
||||||
|
from tools import config
|
||||||
|
|
||||||
|
|
||||||
|
dates_form = '''<?xml version="1.0"?>
|
||||||
|
<form string="Customize Report">
|
||||||
|
<field name="fiscalyear" colspan="4"/>
|
||||||
|
<field name="periods" colspan="4"/>
|
||||||
|
</form>'''
|
||||||
|
|
||||||
|
# <field name="report_type" colspan="4"/>
|
||||||
|
|
||||||
|
|
||||||
|
dates_fields = {
|
||||||
|
'fiscalyear': {'string': 'Fiscal year', 'type': 'many2one', 'relation': 'account.fiscalyear', 'required': True},
|
||||||
|
'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'},
|
||||||
|
# 'report_type': {'string': 'Report Type','type': 'selection','selection': [('only_obj', 'Report Objects Only'),('with_account', 'Report Objects With Accounts'),('acc_with_child', 'Report Objects With Accounts and child of Accounts'),],'required': True},
|
||||||
|
}
|
||||||
|
|
||||||
|
back_form='''<?xml version="1.0"?>
|
||||||
|
<form string="Notification">
|
||||||
|
<separator string="You might have done following mistakes.Please correct them and try again." colspan="4"/>
|
||||||
|
<separator string="1. You have selected more than 3 years in any case." colspan="4"/>
|
||||||
|
<separator string="2. You have not selected 'Percentage' option,but you have selected more than 2 years." colspan="4"/>
|
||||||
|
<label string="You can select maximum 3 years.Please check again." colspan="4"/>
|
||||||
|
</form>'''
|
||||||
|
|
||||||
|
back_fields={
|
||||||
|
}
|
||||||
|
|
||||||
|
zero_form='''<?xml version="1.0"?>
|
||||||
|
<form string="Notification">
|
||||||
|
<label string="You have to select atleast 1 Fiscal Year. Try again."/>
|
||||||
|
</form>'''
|
||||||
|
|
||||||
|
zero_fields={
|
||||||
|
}
|
||||||
|
|
||||||
|
periods_form='''<?xml version="1.0"?>
|
||||||
|
<form string="Set Periods">
|
||||||
|
<separator string="Select Period(s) (All periods if empty)" colspan="4"/>
|
||||||
|
<field name="periods" colspan="4" nolabel="1"/>
|
||||||
|
</form>'''
|
||||||
|
|
||||||
|
periods_fields={
|
||||||
|
'periods': {'string': 'Periods', 'type': 'many2many', 'relation': 'account.period', 'help': 'All periods if empty'}
|
||||||
|
}
|
||||||
|
|
||||||
|
class wizard_report(wizard.interface):
|
||||||
|
def _get_defaults(self, cr, uid, data, context):
|
||||||
|
fiscalyear_obj = pooler.get_pool(cr.dbname).get('account.fiscalyear')
|
||||||
|
data['form']['fiscalyear'] = fiscalyear_obj.find(cr, uid)
|
||||||
|
data['form']['report_type'] = 'only_obj'
|
||||||
|
return data['form']
|
||||||
|
|
||||||
|
states = {
|
||||||
|
'init': {
|
||||||
|
'actions': [_get_defaults],
|
||||||
|
'result': {'type':'form', 'arch':dates_form, 'fields':dates_fields, 'state':[('end','Cancel'),('report','Print BalanceSheet')]}
|
||||||
|
},
|
||||||
|
'report': {
|
||||||
|
'actions': [],
|
||||||
|
'result': {'type':'print', 'report':'account.report.bs', 'state':'end'}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
wizard_report('account.account.balancesheet.report')
|
||||||
|
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,6 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# Generated by the Tiny ERP module recorder !
|
||||||
|
#
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,19 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
{
|
||||||
|
"name" : "Association Verticalisation",
|
||||||
|
"version" : "Association Verticalisation",
|
||||||
|
"author" : "Tiny",
|
||||||
|
"website" : "http://tinyerp.com",
|
||||||
|
"category" : "Vertical Modules/Parametrization",
|
||||||
|
"description": """Simplification of the interface for associations.""",
|
||||||
|
"depends" : ["hr","crm_configuration","event"],
|
||||||
|
"init_xml" : [],
|
||||||
|
"demo_xml" : ["crm_fund_data.xml"],
|
||||||
|
"update_xml" : ["crm_fund_demo.xml",
|
||||||
|
"aso_data.xml",
|
||||||
|
"aso_vertical_view.xml",
|
||||||
|
],
|
||||||
|
"installable": True
|
||||||
|
}
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<terp>
|
||||||
|
<data>
|
||||||
|
<record id="noone" model="res.groups">
|
||||||
|
<field name="name">No One</field>
|
||||||
|
</record>
|
||||||
|
<record id="hr.menu_hr_root" model="ir.ui.menu">
|
||||||
|
<field eval="[(6,0,[ref('noone')])]" name="groups_id"/>
|
||||||
|
</record>
|
||||||
|
<record id="crm.menu_crm" model="ir.ui.menu">
|
||||||
|
<field eval="[(6,0,[ref('noone')])]" name="groups_id"/>
|
||||||
|
</record>
|
||||||
|
<record id="product.menu_product_pricelist_main" model="ir.ui.menu">
|
||||||
|
<field eval="[(6,0,[ref('noone')])]" name="groups_id"/>
|
||||||
|
</record>
|
||||||
|
<record id="product.menu_product_price_type_action" model="ir.ui.menu">
|
||||||
|
<field eval="[(6,0,[ref('noone')])]" name="groups_id"/>
|
||||||
|
</record>
|
||||||
|
<record id="product.menu_product_pricelist_type_action" model="ir.ui.menu">
|
||||||
|
<field eval="[(6,0,[ref('noone')])]" name="groups_id"/>
|
||||||
|
</record>
|
||||||
|
<record id="product.menu_product_variant_action" model="ir.ui.menu">
|
||||||
|
<field eval="[(6,0,[ref('noone')])]" name="groups_id"/>
|
||||||
|
</record>
|
||||||
|
<record id="product.menu_product_template_action" model="ir.ui.menu">
|
||||||
|
<field eval="[(6,0,[ref('noone')])]" name="groups_id"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</terp>
|
|
@ -0,0 +1,49 @@
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<terp>
|
||||||
|
<data>
|
||||||
|
<record id="crm_configuration.menu_crm_case_category_act_meetings" model="ir.ui.menu">
|
||||||
|
<field eval=""Calendar of Meetings"" name="name"/>
|
||||||
|
<field eval=""terp-calendar"" name="icon"/>
|
||||||
|
<field eval="False" name="parent_id"/>
|
||||||
|
</record>
|
||||||
|
<record id="association_vertical.menu_crm_case_fund_raise" model="ir.ui.menu">
|
||||||
|
<field eval=""Fund Raising"" name="name"/>
|
||||||
|
<field eval=""terp-account"" name="icon"/>
|
||||||
|
<field eval="False" name="parent_id"/>
|
||||||
|
</record>
|
||||||
|
<record id="product.menu_main_product" model="ir.ui.menu">
|
||||||
|
<field model="ir.ui.menu" name="parent_id" search="[('name','=','Configuration'),('parent_id.name','=','Financial Management')]"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- For Shortcuts menu -->
|
||||||
|
|
||||||
|
<record id="ir_ui_view_sc_mymeetings1" model="ir.ui.view_sc">
|
||||||
|
<field ref="crm_configuration.menu_crm_case_categ_meet_my" name="res_id"/>
|
||||||
|
<field eval=""ir.ui.menu"" name="resource"/>
|
||||||
|
<field eval=""My Meetings"" name="name"/>
|
||||||
|
<field name="user_id" ref="base.user_admin"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="ir_ui_view_sc_myopenprojects1" model="ir.ui.view_sc">
|
||||||
|
<field ref="project.menu_open_view_my_project_open" name="res_id"/>
|
||||||
|
<field eval=""ir.ui.menu"" name="resource"/>
|
||||||
|
<field eval=""My Open Projects"" name="name"/>
|
||||||
|
<field name="user_id" ref="base.user_admin"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="ir_ui_view_sc_products0" model="ir.ui.view_sc">
|
||||||
|
<field ref="product.menu_products" name="res_id"/>
|
||||||
|
<field eval=""ir.ui.menu"" name="resource"/>
|
||||||
|
<field eval=""Products"" name="name"/>
|
||||||
|
<field name="user_id" ref="base.user_admin"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="ir_ui_view_sc_events0" model="ir.ui.view_sc">
|
||||||
|
<field ref="event.menu_event_event" name="res_id"/>
|
||||||
|
<field eval=""ir.ui.menu"" name="resource"/>
|
||||||
|
<field eval=""Events"" name="name"/>
|
||||||
|
<field name="user_id" ref="base.user_admin"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</terp>
|
|
@ -0,0 +1,146 @@
|
||||||
|
<?xml version="1.0" ?>
|
||||||
|
<terp>
|
||||||
|
<data noupdate="1">
|
||||||
|
<record id="crm_case_helpingstreetchildren0" model="crm.case">
|
||||||
|
<field eval="0.5" name="probability"/>
|
||||||
|
<field name="partner_address_id" ref="base.res_partner_address_1"/>
|
||||||
|
<field eval="1" name="active"/>
|
||||||
|
<field name="category2_id" ref="association_vertical.categ2_fund3"/>
|
||||||
|
<field eval="3.0" name="duration"/>
|
||||||
|
<field name="partner_id" ref="base.res_partner_9"/>
|
||||||
|
<field eval=""3"" name="priority"/>
|
||||||
|
<field name="user_id" ref="base.user_demo"/>
|
||||||
|
<field eval=""open"" name="state"/>
|
||||||
|
<field eval="250000.0" name="planned_cost"/>
|
||||||
|
<field name="section_id" ref="association_vertical.section_support4"/>
|
||||||
|
<field eval="time.strftime('%Y-%m-01 10:35:50')" name="date"/>
|
||||||
|
<field name="categ_id" ref="association_vertical.categ_fund1"/>
|
||||||
|
<field eval=""Helping Street Children"" name="name"/>
|
||||||
|
<field eval=""info@opensides.be"" name="email_from"/>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
<data noupdate="1">
|
||||||
|
<record id="crm_case_helpingearthquakevictims0" model="crm.case">
|
||||||
|
<field eval="0.8" name="probability"/>
|
||||||
|
<field name="partner_address_id" ref="base.main_address"/>
|
||||||
|
<field eval="1" name="active"/>
|
||||||
|
<field name="category2_id" ref="association_vertical.categ2_fund4"/>
|
||||||
|
<field name="partner_id" ref="base.main_partner"/>
|
||||||
|
<field eval=""3"" name="priority"/>
|
||||||
|
<field name="user_id" ref="base.user_admin"/>
|
||||||
|
<field eval=""draft"" name="state"/>
|
||||||
|
<field eval="2000000.0" name="planned_cost"/>
|
||||||
|
<field name="section_id" ref="association_vertical.section_support4"/>
|
||||||
|
<field eval="time.strftime('%Y-%m-05 12:35:50')" name="date"/>
|
||||||
|
<field eval="8.0" name="duration"/>
|
||||||
|
<field name="categ_id" ref="association_vertical.categ_fund1"/>
|
||||||
|
<field eval=""Helping earthquake victims"" name="name"/>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
<data noupdate="1">
|
||||||
|
<record id="crm_case_donatingbookstoschoollibraries0" model="crm.case">
|
||||||
|
<field name="partner_address_id" ref="base.res_partner_address_zen"/>
|
||||||
|
<field eval="1" name="active"/>
|
||||||
|
<field name="category2_id" ref="association_vertical.categ2_fund1"/>
|
||||||
|
<field eval="5.0" name="duration"/>
|
||||||
|
<field name="partner_id" ref="base.res_partner_3"/>
|
||||||
|
<field eval=""3"" name="priority"/>
|
||||||
|
<field name="user_id" ref="base.user_admin"/>
|
||||||
|
<field eval=""open"" name="state"/>
|
||||||
|
<field eval="500000.0" name="planned_cost"/>
|
||||||
|
<field name="section_id" ref="association_vertical.section_support4"/>
|
||||||
|
<field eval="time.strftime('%Y-%m-07 13:50:50')" name="date"/>
|
||||||
|
<field name="categ_id" ref="association_vertical.categ_fund2"/>
|
||||||
|
<field eval=""Donating books to school libraries"" name="name"/>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
<data noupdate="1">
|
||||||
|
<record id="crm_case_renovatinggovernmentschools0" model="crm.case">
|
||||||
|
<field name="partner_address_id" ref="base.res_partner_address_7"/>
|
||||||
|
<field eval="1" name="active"/>
|
||||||
|
<field name="category2_id" ref="association_vertical.categ2_fund2"/>
|
||||||
|
<field eval="3.0" name="duration"/>
|
||||||
|
<field name="partner_id" ref="base.res_partner_4"/>
|
||||||
|
<field eval=""3"" name="priority"/>
|
||||||
|
<field name="user_id" ref="base.user_demo"/>
|
||||||
|
<field eval=""draft"" name="state"/>
|
||||||
|
<field eval="1000000.0" name="planned_cost"/>
|
||||||
|
<field name="section_id" ref="association_vertical.section_support4"/>
|
||||||
|
<field eval="time.strftime('%Y-%m-12 15:10:50')" name="date"/>
|
||||||
|
<field name="categ_id" ref="association_vertical.categ_fund2"/>
|
||||||
|
<field eval="4.3" name="duration"/>
|
||||||
|
<field eval=""Renovating government schools"" name="name"/>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
<data noupdate="1">
|
||||||
|
<record id="crm_case_donatingambulancestohospitals0" model="crm.case">
|
||||||
|
<field name="partner_address_id" ref="base.res_partner_address_13"/>
|
||||||
|
<field eval="1" name="active"/>
|
||||||
|
<field name="category2_id" ref="association_vertical.categ2_fund4"/>
|
||||||
|
<field name="partner_id" ref="base.res_partner_14"/>
|
||||||
|
<field eval=""3"" name="priority"/>
|
||||||
|
<field name="user_id" ref="base.user_admin"/>
|
||||||
|
<field eval=""open"" name="state"/>
|
||||||
|
<field eval="5000000.0" name="planned_cost"/>
|
||||||
|
<field name="section_id" ref="association_vertical.section_support4"/>
|
||||||
|
<field eval="time.strftime('%Y-%m-17 19:00:15')" name="date"/>
|
||||||
|
<field eval="3" name="duration"/>
|
||||||
|
<field name="categ_id" ref="association_vertical.categ_fund3"/>
|
||||||
|
<field eval=""Donating ambulances to hospitals"" name="name"/>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
<data noupdate="1">
|
||||||
|
<record id="crm_case_donatinghospitalequipments0" model="crm.case">
|
||||||
|
<field name="partner_address_id" ref="base.res_partner_address_2"/>
|
||||||
|
<field eval="1" name="active"/>
|
||||||
|
<field name="category2_id" ref="association_vertical.categ2_fund3"/>
|
||||||
|
<field name="partner_id" ref="base.res_partner_10"/>
|
||||||
|
<field eval=""3"" name="priority"/>
|
||||||
|
<field name="user_id" ref="base.user_admin"/>
|
||||||
|
<field eval=""done"" name="state"/>
|
||||||
|
<field eval="10000000.0" name="planned_cost"/>
|
||||||
|
<field name="section_id" ref="association_vertical.section_support4"/>
|
||||||
|
<field eval="time.strftime('%Y-%m-27 09:00:15')" name="date"/>
|
||||||
|
<field eval="12" name="duration"/>
|
||||||
|
<field name="categ_id" ref="association_vertical.categ_fund3"/>
|
||||||
|
<field eval=""Donating hospital equipments"" name="name"/>
|
||||||
|
<field eval=""contact@tecsas.fr"" name="email_from"/>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
<data noupdate="1">
|
||||||
|
<record id="crm_case_encouragingarts0" model="crm.case">
|
||||||
|
<field name="partner_address_id" ref="base.res_partner_address_14"/>
|
||||||
|
<field eval="1" name="active"/>
|
||||||
|
<field name="category2_id" ref="association_vertical.categ2_fund2"/>
|
||||||
|
<field eval="7.0" name="duration"/>
|
||||||
|
<field name="partner_id" ref="base.res_partner_15"/>
|
||||||
|
<field eval=""3"" name="priority"/>
|
||||||
|
<field name="user_id" ref="base.user_demo"/>
|
||||||
|
<field eval=""draft"" name="state"/>
|
||||||
|
<field eval="10000.0" name="planned_cost"/>
|
||||||
|
<field name="section_id" ref="association_vertical.section_support4"/>
|
||||||
|
<field eval="time.strftime('%Y-%m-01 10:00:15')" name="date"/>
|
||||||
|
<field name="categ_id" ref="association_vertical.categ_fund4"/>
|
||||||
|
<field eval=""Encouraging arts"" name="name"/>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
<data noupdate="1">
|
||||||
|
<record id="crm_case_promotingculturalprogramsandpreservingdyingartforms0" model="crm.case">
|
||||||
|
<field eval="1.0" name="probability"/>
|
||||||
|
<field name="partner_address_id" ref="base.res_partner_address_1"/>
|
||||||
|
<field eval="1" name="active"/>
|
||||||
|
<field name="category2_id" ref="association_vertical.categ2_fund1"/>
|
||||||
|
<field eval="6.0" name="duration"/>
|
||||||
|
<field name="partner_id" ref="base.res_partner_9"/>
|
||||||
|
<field eval=""3"" name="priority"/>
|
||||||
|
<field name="user_id" ref="base.user_admin"/>
|
||||||
|
<field eval=""open"" name="state"/>
|
||||||
|
<field eval="800000.0" name="planned_cost"/>
|
||||||
|
<field name="section_id" ref="association_vertical.section_support4"/>
|
||||||
|
<field eval="time.strftime('%Y-%m-24 22:00:15')" name="date"/>
|
||||||
|
<field name="categ_id" ref="association_vertical.categ_fund4"/>
|
||||||
|
<field eval=""Promoting cultural programs and preserving dying art forms"" name="name"/>
|
||||||
|
<field eval=""info@opensides.be"" name="email_from"/>
|
||||||
|
</record>
|
||||||
|
</data>
|
||||||
|
</terp>
|
|
@ -0,0 +1,242 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<terp>
|
||||||
|
<data noupdate="1">
|
||||||
|
|
||||||
|
<record model="crm.case.section" id="section_support4">
|
||||||
|
<field name="name">Fund Raising</field>
|
||||||
|
<field name="code">funds</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- CASE CATEGORY(categ_id) -->
|
||||||
|
|
||||||
|
<record model="crm.case.categ" id="categ_fund1">
|
||||||
|
<field name="name">Social Rehabilitation And Rural Upliftment</field>
|
||||||
|
<field name="section_id" ref="section_support4"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="crm.case.categ" id="categ_fund2">
|
||||||
|
<field name="name">Learning And Education</field>
|
||||||
|
<field name="section_id" ref="section_support4"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="crm.case.categ" id="categ_fund3">
|
||||||
|
<field name="name">Healthcare</field>
|
||||||
|
<field name="section_id" ref="section_support4"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="crm.case.categ" id="categ_fund4">
|
||||||
|
<field name="name">Arts And Culture</field>
|
||||||
|
<field name="section_id" ref="section_support4"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- CASE CATEGORY2(category2_id) -->
|
||||||
|
|
||||||
|
<record model="crm.case.category2" id="categ2_fund1">
|
||||||
|
<field name="name">Cash</field>
|
||||||
|
<field name="section_id" ref="section_support4"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="crm.case.category2" id="categ2_fund2">
|
||||||
|
<field name="name">Cheque</field>
|
||||||
|
<field name="section_id" ref="section_support4"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="crm.case.category2" id="categ2_fund3">
|
||||||
|
<field name="name">Credit Card</field>
|
||||||
|
<field name="section_id" ref="section_support4"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="crm.case.category2" id="categ2_fund4">
|
||||||
|
<field name="name">Demand Draft</field>
|
||||||
|
<field name="section_id" ref="section_support4"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- MENU -->
|
||||||
|
<menuitem name="CRM & SRM/Fund Raising" id="menu_crm_case_fund_raise"/>
|
||||||
|
<record model="ir.actions.act_window" id="crm_case_category_act_fund1">
|
||||||
|
<field name="name">Funds</field>
|
||||||
|
<field name="res_model">crm.case</field>
|
||||||
|
<field name="view_mode">form,graph</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_form_view_fund"/>
|
||||||
|
<field name="domain" eval="'[(\'section_id\',\'=\','+str(section_support4)+')]'"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_view_fund1">
|
||||||
|
<field name="sequence" eval="2"/>
|
||||||
|
<field name="view_mode">graph</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_graph_view_fund"/>
|
||||||
|
<field name="act_window_id" ref="crm_case_category_act_fund1"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window.view" id="action_crm_tag_form_view_fund1">
|
||||||
|
<field name="sequence" eval="1"/>
|
||||||
|
<field name="view_mode">form</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_form_view_fund"/>
|
||||||
|
<field name="act_window_id" ref="crm_case_category_act_fund1"/>
|
||||||
|
</record>
|
||||||
|
<menuitem name="CRM & SRM/Fund Raising/New Fund Opportunity" id="menu_crm_case_categ0_act_fund" action="crm_case_category_act_fund1"/>
|
||||||
|
|
||||||
|
<!-- My Funds -->
|
||||||
|
<record model="ir.actions.act_window" id="crm_case_category_act_fund_my1">
|
||||||
|
<field name="name">My Funds</field>
|
||||||
|
<field name="res_model">crm.case</field>
|
||||||
|
<field name="view_mode">tree,form</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_tree_view_fund"/>
|
||||||
|
<field name="domain" eval="'[(\'section_id\',\'=\','+str(section_support4)+'),(\'user_id\',\'=\',uid)]'"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_view_fund_my1">
|
||||||
|
<field name="sequence" eval="1"/>
|
||||||
|
<field name="view_mode">tree</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_tree_view_fund"/>
|
||||||
|
<field name="act_window_id" ref="crm_case_category_act_fund_my1"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window.view" id="action_crm_tag_graph_view_fund_my1">
|
||||||
|
<field name="sequence" eval="3"/>
|
||||||
|
<field name="view_mode">graph</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_graph_view_fund"/>
|
||||||
|
<field name="act_window_id" ref="crm_case_category_act_fund_my1"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window.view" id="action_crm_tag_form_view_fund_my1">
|
||||||
|
<field name="sequence" eval="2"/>
|
||||||
|
<field name="view_mode">form</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_form_view_fund"/>
|
||||||
|
<field name="act_window_id" ref="crm_case_category_act_fund_my1"/>
|
||||||
|
</record>
|
||||||
|
<menuitem name="CRM & SRM/Fund Raising/My Funds" id="menu_crm_case_category_act_fund_my1" action="crm_case_category_act_fund_my1"/>
|
||||||
|
|
||||||
|
<record model="ir.actions.act_window" id="crm_case_category_act_fund_my2">
|
||||||
|
<field name="name">My Funds Waiting Validation</field>
|
||||||
|
<field name="res_model">crm.case</field>
|
||||||
|
<field name="view_mode">tree,form,graph</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_tree_view_fund"/>
|
||||||
|
<field name="domain" eval="'[(\'section_id\',\'=\','+str(section_support4)+'),(\'user_id\',\'=\',uid),(\'state\',\'=\',\'draft\')]'"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_view_fund_my2">
|
||||||
|
<field name="sequence" eval="1"/>
|
||||||
|
<field name="view_mode">tree</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_tree_view_fund"/>
|
||||||
|
<field name="act_window_id" ref="crm_case_category_act_fund_my2"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window.view" id="action_crm_tag_form_view_fund_my2">
|
||||||
|
<field name="sequence" eval="2"/>
|
||||||
|
<field name="view_mode">form</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_form_view_fund"/>
|
||||||
|
<field name="act_window_id" ref="crm_case_category_act_fund_my2"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window.view" id="action_crm_tag_graph_view_fund_my2">
|
||||||
|
<field name="sequence" eval="3"/>
|
||||||
|
<field name="view_mode">graph</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_graph_view_fund"/>
|
||||||
|
<field name="act_window_id" ref="crm_case_category_act_fund_my2"/>
|
||||||
|
</record>
|
||||||
|
<menuitem name="CRM & SRM/Fund Raising/My Funds/My Funds Waiting Validation" id="menu_crm_case_categ0_act_fund_my2" action="crm_case_category_act_fund_my2"/>
|
||||||
|
|
||||||
|
<record model="ir.actions.act_window" id="crm_case_category_act_fund_my3">
|
||||||
|
<field name="name">My Funds To Be Processed</field>
|
||||||
|
<field name="res_model">crm.case</field>
|
||||||
|
<field name="view_mode">tree,form,graph</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_tree_view_fund"/>
|
||||||
|
<field name="domain" eval="'[(\'section_id\',\'=\','+str(section_support4)+'),(\'user_id\',\'=\',uid),(\'state\',\'=\',\'open\')]'"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_view_fund_my3">
|
||||||
|
<field name="sequence" eval="1"/>
|
||||||
|
<field name="view_mode">tree</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_tree_view_fund"/>
|
||||||
|
<field name="act_window_id" ref="crm_case_category_act_fund_my3"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window.view" id="action_crm_tag_form_view_fund_my3">
|
||||||
|
<field name="sequence" eval="2"/>
|
||||||
|
<field name="view_mode">form</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_form_view_fund"/>
|
||||||
|
<field name="act_window_id" ref="crm_case_category_act_fund_my3"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window.view" id="action_crm_tag_graph_view_fund_my3">
|
||||||
|
<field name="sequence" eval="3"/>
|
||||||
|
<field name="view_mode">graph</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_graph_view_fund"/>
|
||||||
|
<field name="act_window_id" ref="crm_case_category_act_fund_my3"/>
|
||||||
|
</record>
|
||||||
|
<menuitem name="CRM & SRM/Fund Raising/My Funds/My Funds To Be Processed" id="menu_crm_case_categ0_act_fund_my3" action="crm_case_category_act_fund_my3"/>
|
||||||
|
|
||||||
|
<!-- All Funds -->
|
||||||
|
<record model="ir.actions.act_window" id="crm_case_category_act_fund_all1">
|
||||||
|
<field name="name">All Funds</field>
|
||||||
|
<field name="res_model">crm.case</field>
|
||||||
|
<field name="view_mode">tree,form,graph</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_tree_view_fund"/>
|
||||||
|
<field name="domain" eval="'[(\'section_id\',\'=\','+str(section_support4)+')]'"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_view_fund_all1">
|
||||||
|
<field name="sequence" eval="1"/>
|
||||||
|
<field name="view_mode">tree</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_tree_view_fund"/>
|
||||||
|
<field name="act_window_id" ref="crm_case_category_act_fund_all1"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window.view" id="action_crm_tag_form_view_fund_all1">
|
||||||
|
<field name="sequence" eval="2"/>
|
||||||
|
<field name="view_mode">form</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_form_view_fund"/>
|
||||||
|
<field name="act_window_id" ref="crm_case_category_act_fund_all1"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window.view" id="action_crm_tag_graph_view_fund_all1">
|
||||||
|
<field name="sequence" eval="3"/>
|
||||||
|
<field name="view_mode">graph</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_graph_view_fund"/>
|
||||||
|
<field name="act_window_id" ref="crm_case_category_act_fund_all1"/>
|
||||||
|
</record>
|
||||||
|
<menuitem name="CRM & SRM/Fund Raising/All Funds" id="menu_crm_case_categ0_act_fund_all1" action="crm_case_category_act_fund_all1"/>
|
||||||
|
|
||||||
|
<record model="ir.actions.act_window" id="crm_case_category_act_fund_all2">
|
||||||
|
<field name="name">All Funds Waiting Validation</field>
|
||||||
|
<field name="res_model">crm.case</field>
|
||||||
|
<field name="view_mode">tree,form,graph</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_tree_view_fund"/>
|
||||||
|
<field name="domain" eval="'[(\'section_id\',\'=\','+str(section_support4)+'),(\'state\',\'=\',\'draft\')]'"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_view_fund_all2">
|
||||||
|
<field name="sequence" eval="1"/>
|
||||||
|
<field name="view_mode">tree</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_tree_view_fund"/>
|
||||||
|
<field name="act_window_id" ref="crm_case_category_act_fund_all2"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window.view" id="action_crm_tag_form_view_fund_all2">
|
||||||
|
<field name="sequence" eval="2"/>
|
||||||
|
<field name="view_mode">form</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_form_view_fund"/>
|
||||||
|
<field name="act_window_id" ref="crm_case_category_act_fund_all2"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window.view" id="action_crm_tag_graph_view_fund_all2">
|
||||||
|
<field name="sequence" eval="3"/>
|
||||||
|
<field name="view_mode">graph</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_graph_view_fund"/>
|
||||||
|
<field name="act_window_id" ref="crm_case_category_act_fund_all2"/>
|
||||||
|
</record>
|
||||||
|
<menuitem name="CRM & SRM/Fund Raising/All Funds/All Funds Waiting Validation" id="menu_crm_case_categ0_act_fund_all2" action="crm_case_category_act_fund_all2"/>
|
||||||
|
|
||||||
|
<record model="ir.actions.act_window" id="crm_case_category_act_fund_all3">
|
||||||
|
<field name="name">All Funds To Be Processed</field>
|
||||||
|
<field name="res_model">crm.case</field>
|
||||||
|
<field name="view_mode">tree,form,graph</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_tree_view_fund"/>
|
||||||
|
<field name="domain" eval="'[(\'section_id\',\'=\','+str(section_support4)+'),(\'state\',\'=\',\'open\')]'"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window.view" id="action_crm_tag_tree_view_fund_all3">
|
||||||
|
<field name="sequence" eval="1"/>
|
||||||
|
<field name="view_mode">tree</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_tree_view_fund"/>
|
||||||
|
<field name="act_window_id" ref="crm_case_category_act_fund_all3"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window.view" id="action_crm_tag_form_view_fund_all3">
|
||||||
|
<field name="sequence" eval="2"/>
|
||||||
|
<field name="view_mode">form</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_form_view_fund"/>
|
||||||
|
<field name="act_window_id" ref="crm_case_category_act_fund_all3"/>
|
||||||
|
</record>
|
||||||
|
<record model="ir.actions.act_window.view" id="action_crm_tag_graph_view_fund_all3">
|
||||||
|
<field name="sequence" eval="3"/>
|
||||||
|
<field name="view_mode">graph</field>
|
||||||
|
<field name="view_id" ref="crm_configuration.crm_case_graph_view_fund"/>
|
||||||
|
<field name="act_window_id" ref="crm_case_category_act_fund_all3"/>
|
||||||
|
</record>
|
||||||
|
<menuitem name="CRM & SRM/Fund Raising/All Funds/All Funds To Be Processed" id="menu_crm_case_categ0_act_fund_all3" action="crm_case_category_act_fund_all3"/>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</terp>
|
|
@ -0,0 +1,34 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||||
|
# Fabien Pinckaers <fp@tiny.Be>
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting from its eventual inadequacies and bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees and support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
import auction
|
||||||
|
import wizard
|
||||||
|
import report
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,15 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
{
|
||||||
|
"name" : "Auction module",
|
||||||
|
"version" : "1.0",
|
||||||
|
"depends" : ["base","account","l10n_be","hr"],
|
||||||
|
"update_xml" : ["auction_view.xml", "auction_report.xml", "auction_wizard.xml"],
|
||||||
|
"demo_xml" : [
|
||||||
|
"auction_demo.xml"
|
||||||
|
],
|
||||||
|
"init_xml" : ["auction_sequence.xml"],
|
||||||
|
"active": False,
|
||||||
|
"installable": True
|
||||||
|
}
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
Binary file not shown.
After Width: | Height: | Size: 3.1 KiB |
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,98 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<terp>
|
||||||
|
<data>
|
||||||
|
<record model="account.account" id="auction_income_view">
|
||||||
|
<field name="name">Auction Adjudications</field>
|
||||||
|
<field name="code">0</field>
|
||||||
|
<field name="type">view</field>
|
||||||
|
<field name="currency_id" search="[('name','=','EUR')]"/>
|
||||||
|
<field name="parent_id" type="list">
|
||||||
|
<value search="[('type','=','view'),('code','=','7')]" model="account.account"/>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="account.account" id="auction_expense_view">
|
||||||
|
<field name="name">Auction Adjudication Expenses</field>
|
||||||
|
<field name="code">0</field>
|
||||||
|
<field name="type">view</field>
|
||||||
|
<field name="currency_id" search="[('name','=','EUR')]"/>
|
||||||
|
<field name="parent_id" type="list">
|
||||||
|
<value search="[('type','=','view'),('code','=','6')]" model="account.account"/>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="account.account" id="auction_income">
|
||||||
|
<field name="name">Auction Adjudications</field>
|
||||||
|
<field name="code">7x*</field>
|
||||||
|
<field name="type">income</field>
|
||||||
|
<field name="currency_id" search="[('name','=','EUR')]"/>
|
||||||
|
<field name="parent_id" eval="[auction_income_view]"/>
|
||||||
|
</record>
|
||||||
|
<record model="account.account" id="auction_expense">
|
||||||
|
<field name="name">Auction Adjudication Expenses</field>
|
||||||
|
<field name="code">6x*</field>
|
||||||
|
<field name="type">expense</field>
|
||||||
|
<field name="currency_id" search="[('name','=','EUR')]"/>
|
||||||
|
<field name="parent_id" eval="[auction_expense_view]"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="account.account" id="auction_income_costs">
|
||||||
|
<field name="name">Auction Buyer Costs</field>
|
||||||
|
<field name="code">7x*</field>
|
||||||
|
<field name="type">tax</field>
|
||||||
|
<field name="currency_id" search="[('name','=','EUR')]"/>
|
||||||
|
<field name="parent_id" eval="[auction_income_view]"/>
|
||||||
|
</record>
|
||||||
|
<record model="account.account" id="auction_expense_costs">
|
||||||
|
<field name="name">Auction Seller Costs</field>
|
||||||
|
<field name="code">6x*</field>
|
||||||
|
<field name="type">tax</field>
|
||||||
|
<field name="currency_id" search="[('name','=','EUR')]"/>
|
||||||
|
<field name="parent_id" eval="[auction_expense_view]"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="account.tax" id="tax_buyer_author">
|
||||||
|
<field name="name">Author rights (4%)</field>
|
||||||
|
<field name="type">percent</field>
|
||||||
|
<field name="applicable_type">code</field>
|
||||||
|
<field name="amount">0.04</field>
|
||||||
|
<field name="domain">sabam</field>
|
||||||
|
<field name="account_collected_id" ref="auction_income_costs"/>
|
||||||
|
<field name="account_paid_id" ref="auction_income_costs"/>
|
||||||
|
<field name="python_applicable">result = (price_unit>=1250)</field>
|
||||||
|
</record>
|
||||||
|
<record model="account.tax" id="tax_buyer">
|
||||||
|
<field name="name">Buyer Costs (20%)</field>
|
||||||
|
<field name="type">percent</field>
|
||||||
|
<field name="amount">0.20</field>
|
||||||
|
<field name="domain">auction</field>
|
||||||
|
<field name="account_collected_id" ref="auction_income_costs"/>
|
||||||
|
<field name="account_paid_id" ref="auction_income_costs"/>
|
||||||
|
</record>
|
||||||
|
<record model="account.tax" id="tax_seller">
|
||||||
|
<field name="name">Seller Costs (12%)</field>
|
||||||
|
<field name="type">percent</field>
|
||||||
|
<field name="amount">-0.12</field>
|
||||||
|
<field name="domain">auction</field>
|
||||||
|
<field name="account_collected_id" ref="auction_expense_costs"/>
|
||||||
|
<field name="account_paid_id" ref="auction_expense_costs"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<ir_set>
|
||||||
|
<field name="keys" eval="[('meta','res.partner'),('name','auction.seller.costs')]"/>
|
||||||
|
<field name="args" eval="[]"/>
|
||||||
|
<field name="name">account.seller.costs</field>
|
||||||
|
<field name="value" eval="tax_seller"/>
|
||||||
|
<field name="meta" eval="{'type':'many2one', 'string':'Seller Costs', 'relation':'account.tax'}"/>
|
||||||
|
</ir_set>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<record id="product.product_product_pc2" model="product.product">
|
||||||
|
<field name="list_price">770.0</field>
|
||||||
|
<field name="standard_price">700.0</field>
|
||||||
|
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</terp>
|
|
@ -0,0 +1,895 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<terp>
|
||||||
|
<data noupdate="1">
|
||||||
|
|
||||||
|
|
||||||
|
<!--demo data for the partner-->
|
||||||
|
|
||||||
|
<record id="partner_record1" model="res.partner">
|
||||||
|
<field name="name">Unknown</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="res_partner_unknown_address_1" model="res.partner.address">
|
||||||
|
<field name="city">Bruxelles1</field>
|
||||||
|
<field name="name">Benoit Mortie1r1</field>
|
||||||
|
<field name="zip">1030</field>
|
||||||
|
<field name="country_id" model="res.country" search="[('name','=','Belgium')]"/>
|
||||||
|
|
||||||
|
<field name="email">info@opensides.be</field>
|
||||||
|
<field name="phone">(+32)2 211 34 83</field>
|
||||||
|
<field name="street">Rue des Palais 44, bte 33</field>
|
||||||
|
<field name="type">default</field>
|
||||||
|
<field name="partner_id" ref="partner_record1"/>
|
||||||
|
</record>
|
||||||
|
<record id="res_partner_unknown_address_2" model="res.partner.address">
|
||||||
|
<field name="city">Avignon CEDEX 091</field>
|
||||||
|
<field name="name">Laurent Jacot1</field>
|
||||||
|
<field name="zip">84911</field>
|
||||||
|
<field name="country_id" model="res.country" search="[('name','=','France')]"/>
|
||||||
|
<field name="email">contact@tecsas.fr</field>
|
||||||
|
<field name="phone">(+33)4.32.74.10.57</field>
|
||||||
|
<field name="street">85 rue du traite de Rome</field>
|
||||||
|
<field name="type">default</field>
|
||||||
|
<field name="partner_id" ref="partner_record1"/>
|
||||||
|
</record>
|
||||||
|
<record id="res_partner_unknown_address_3" model="res.partner.address">
|
||||||
|
<field name="city">Louvain-la-Neuve</field>
|
||||||
|
<field name="name">Thomas Passot</field>
|
||||||
|
<field name="zip">1348</field>
|
||||||
|
<field name="country_id" model="res.country" search="[('name','=','Belgium')]"/>
|
||||||
|
<field name="email">info@mediapole.net</field>
|
||||||
|
<field name="phone">(+32).10.45.17.73</field>
|
||||||
|
<field name="street">Rue de l'Angelique, 1</field>
|
||||||
|
<field name="partner_id" ref="partner_record1"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- demo data for the auction_artist object-->
|
||||||
|
<record model="auction.artists" id="auction_art_1">
|
||||||
|
<field name="name">Philippe Lavilier</field>
|
||||||
|
<field name="birth_death_dates">1345-1450</field>
|
||||||
|
</record>
|
||||||
|
<record model="auction.artists" id="auction_art_2">
|
||||||
|
<field name="name">POREAU OSWALD</field>
|
||||||
|
<field name="birth_death_dates">1877-1955</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- demo data for the account tax code-->
|
||||||
|
|
||||||
|
<record model="account.tax.code" id="account_tax_code_id1">
|
||||||
|
<field name="name">VAT 1%</field>
|
||||||
|
<field name="code">VAT01</field>
|
||||||
|
<field name="company_id" model="res.company" search="[]"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="account.tax.code" id="account_tax_code_id2">
|
||||||
|
<field name="name">VAT 20%</field>
|
||||||
|
<field name="code">VAT20</field>
|
||||||
|
<field name="company_id" model="res.company" search="[]"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<record model="account.tax.code" id="account_tax_code_id3">
|
||||||
|
<field name="name">VAT 10%</field>
|
||||||
|
<field name="code">VAT10</field>
|
||||||
|
<field name="company_id" model="res.company" search="[]"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="account.tax.code" id="account_tax_code_id4">
|
||||||
|
<field name="name">VAT 12%</field>
|
||||||
|
<field name="code">VAT12</field>
|
||||||
|
<field name="company_id" model="res.company" search="[]"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="account.tax.code" id="account_tax_code_id5">
|
||||||
|
<field name="name">VAT 5%</field>
|
||||||
|
<field name="code">VAT5</field>
|
||||||
|
<field name="company_id" model="res.company" search="[]"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- demo data for the auction taxes-->
|
||||||
|
|
||||||
|
<record id="auction_tax" model="account.tax">
|
||||||
|
<field name="name">Droit d'auteur</field>
|
||||||
|
<field name="amount">0.05</field>
|
||||||
|
<field name="domain">sabam</field>
|
||||||
|
<field name="base_code_id" ref="account_tax_code_id5"/>
|
||||||
|
<field name="tax_code_id" ref="account_tax_code_id5"/>
|
||||||
|
|
||||||
|
</record>
|
||||||
|
<record id="auction_tax1" model="account.tax">
|
||||||
|
<field name="name">TVA</field>
|
||||||
|
<field name="amount">0.12</field>
|
||||||
|
<field name="domain">auction</field>
|
||||||
|
<field name="base_code_id" ref="account_tax_code_id4"/>
|
||||||
|
<field name="tax_code_id" ref="account_tax_code_id4"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<record id="auction_tax2" model="account.tax">
|
||||||
|
<field name="name">TVA1</field>
|
||||||
|
<field name="amount">0.2</field>
|
||||||
|
<field name="domain">auction</field>
|
||||||
|
<field name="base_code_id" ref="account_tax_code_id2"/>
|
||||||
|
<field name="tax_code_id" ref="account_tax_code_id2"/>
|
||||||
|
|
||||||
|
</record>
|
||||||
|
<record id="auction_tax3" model="account.tax">
|
||||||
|
<field name="name">Buyer Costs</field>
|
||||||
|
<field name="amount">0.21</field>
|
||||||
|
<field name="domain">auction</field>
|
||||||
|
<field name="base_code_id" ref="account_tax_code_id1"/>
|
||||||
|
<field name="tax_code_id" ref="account_tax_code_id1"/>
|
||||||
|
|
||||||
|
</record>
|
||||||
|
<record id="auction_tax4" model="account.tax">
|
||||||
|
<field name="name">Seller Costs1</field>
|
||||||
|
<field name="amount">-0.10</field>
|
||||||
|
<field name="domain">auction</field>
|
||||||
|
<field name="base_code_id" ref="account_tax_code_id1"/>
|
||||||
|
<field name="tax_code_id" ref="account_tax_code_id1"/>
|
||||||
|
|
||||||
|
</record>
|
||||||
|
<record id="auction_tax5" model="account.tax">
|
||||||
|
<field name="name">Seller Costs</field>
|
||||||
|
<field name="amount">-0.10</field>
|
||||||
|
<field name="domain">auction</field>
|
||||||
|
<field name="base_code_id" ref="account_tax_code_id3"/>
|
||||||
|
<field name="tax_code_id" ref="account_tax_code_id3"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- example for creating a demo data for the tax with basecode and tax code-->
|
||||||
|
<record id="auction_tax6" model="account.tax">
|
||||||
|
<field name="name">Frais de vente</field>
|
||||||
|
<field name="amount">-0.15</field>
|
||||||
|
<field name="domain">auction</field>
|
||||||
|
<field name="base_code_id" ref="account_tax_code_id1"/>
|
||||||
|
<field name="tax_code_id" ref="account_tax_code_id1"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record id="auction_tax20" model="account.tax">
|
||||||
|
<field name="name">Frais de vente</field>
|
||||||
|
<field name="amount">0</field>
|
||||||
|
<field name="domain">auction</field>
|
||||||
|
<field name="base_code_id" ref="account_tax_code_id2"/>
|
||||||
|
<field name="tax_code_id" ref="account_tax_code_id2"/>
|
||||||
|
</record>
|
||||||
|
<record id="monproduit" model="product.product">
|
||||||
|
<field name="name">Oeuvres a 21%</field>
|
||||||
|
<field name="categ_id" ref="product.product_category_pc"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!--===========================================================================================-->
|
||||||
|
<!-- start == demo data for the auction_lot_Category object-->
|
||||||
|
<record model="auction.lot.category" id="auction_cat_1">
|
||||||
|
<field name="name">painting</field>
|
||||||
|
<field name="priority">1</field>
|
||||||
|
<field name="aie_categ">8</field>
|
||||||
|
</record>
|
||||||
|
<record model="auction.lot.category" id="auction_cat_2">
|
||||||
|
<field name="name">Furniture</field>
|
||||||
|
<field name="priority">2</field>
|
||||||
|
<field name="aie_categ">10</field>
|
||||||
|
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.lot.category" id="auction_cat_3">
|
||||||
|
<field name="name">glass</field>
|
||||||
|
<field name="priority">2</field>
|
||||||
|
<field name="aie_categ">25</field>
|
||||||
|
</record>
|
||||||
|
<record model="auction.lot.category" id="auction_cat_4">
|
||||||
|
<field name="name">sculpture</field>
|
||||||
|
<field name="priority">10</field>
|
||||||
|
<field name="aie_categ">18</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.lot.category" id="auction_cat_5">
|
||||||
|
<field name="name">Jawellery</field>
|
||||||
|
<field name="priority">6</field>
|
||||||
|
<field name="aie_categ">15</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- end == demo data for the auction_lot_Category-->
|
||||||
|
|
||||||
|
<!-- start== demo data for the auction_date-->
|
||||||
|
|
||||||
|
<record model="auction.dates" id="auction_date_1">
|
||||||
|
<field name="name">painting Exhibition</field>
|
||||||
|
<field name="expo1" eval="time.strftime('%Y-%m-01')" />
|
||||||
|
<field name="expo2" eval="time.strftime('%Y-%m-15')" />
|
||||||
|
<field name="auction1" eval="time.strftime('%Y-%m-20')" />
|
||||||
|
<field name="auction2" eval="time.strftime('%Y-%m-28')" />
|
||||||
|
<field name="buyer_costs" model="account.tax" search="[('name','=','Buyer Costs')]"></field>
|
||||||
|
<field name="seller_costs" model="account.tax" search="[('name','=','Seller Costs')]"></field>
|
||||||
|
<field name="acc_income" ref="account.a_sale"/>
|
||||||
|
<field name="acc_expense" ref="account.a_expense"/>
|
||||||
|
|
||||||
|
<field name="journal_id" ref="account.sales_journal"/>
|
||||||
|
<field name="journal_seller_id" ref="account.expenses_journal"/>
|
||||||
|
<field name="account_analytic_id" model="account.analytic.account" search="[('code','=','1')]"></field>
|
||||||
|
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.dates" id="auction_date_2">
|
||||||
|
<field name="name">Antique Items Exhibition</field>
|
||||||
|
<field name="expo1" eval="time.strftime('%Y-%m-01')" />
|
||||||
|
<field name="expo2" eval="time.strftime('%Y-%m-10')" />
|
||||||
|
<field name="buyer_costs" model="account.tax" search="[('name','=','Buyer Costs')]"></field>
|
||||||
|
<field name="seller_costs" model="account.tax" search="[('name','=','Seller Costs')]"></field>
|
||||||
|
|
||||||
|
<field name="auction1" eval="time.strftime('%Y-%m-14')" />
|
||||||
|
<field name="auction2" eval="time.strftime('%Y-%m-28')" />
|
||||||
|
<field name="acc_income" ref="account.a_sale"/>
|
||||||
|
<field name="acc_expense" ref="account.a_expense"/>
|
||||||
|
|
||||||
|
<field name="journal_id" ref="account.sales_journal"/>
|
||||||
|
<field name="journal_seller_id" ref="account.expenses_journal"/>
|
||||||
|
<field name="account_analytic_id" model="account.analytic.account" search="[('code','=','1')]"></field>
|
||||||
|
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- end == demo data for the auction_dates-->
|
||||||
|
|
||||||
|
|
||||||
|
<!-- start == demo data for the auction_deposit-->
|
||||||
|
|
||||||
|
|
||||||
|
<record model="auction.deposit" id="auction_deposit_1">
|
||||||
|
<field name="date_dep" eval="time.strftime('%Y')+'-04-01'"/>
|
||||||
|
<field name="partner_id" model="res.partner" search="[('name','=','Unknown')]"></field>
|
||||||
|
<field name="method">keep</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.deposit" id="auction_deposit_2">
|
||||||
|
<field name="date_dep" eval="time.strftime('%Y')+'-04-05'"/>
|
||||||
|
<field name="partner_id" model="res.partner" search="[('name','=','China Export')]"></field>
|
||||||
|
<field name="method">keep</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.deposit" id="auction_deposit_3">
|
||||||
|
<field name="date_dep" eval="time.strftime('%Y')+'-04-10'"/>
|
||||||
|
<field name="partner_id" model="res.partner" search="[('name','=','Agrolait')]"></field>
|
||||||
|
<field name="method">keep</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.deposit" id="auction_deposit_4">
|
||||||
|
<field name="date_dep" eval="time.strftime('%Y')+'-04-15'"/>
|
||||||
|
<field name="partner_id" model="res.partner" search="[('name','=','Bank Wealthy and sons')]"></field>
|
||||||
|
<field name="method">keep</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.deposit" id="auction_deposit_5">
|
||||||
|
<field name="date_dep" eval="time.strftime('%Y')+'-04-12'"/>
|
||||||
|
<field name="partner_id" model="res.partner" search="[('name','=','Unknown')]"></field>
|
||||||
|
<field name="method">keep</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.lots" id="auction_deposit_1_lot_1">
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
<field name="name">Aera Glasses</field>
|
||||||
|
<field name="lot_num">1</field>
|
||||||
|
<field name="lot_est1">500</field>
|
||||||
|
<field name="lot_est2">700</field>
|
||||||
|
<field name="obj_desc">show pices</field>
|
||||||
|
<field name="obj_ret">465.00</field>
|
||||||
|
<field name="obj_num">1</field>
|
||||||
|
<field name="obj_price">0.00</field>
|
||||||
|
<field name="bord_vnd_id" ref="auction_deposit_1" />
|
||||||
|
<field name="product_id" ref="monproduit"/>
|
||||||
|
<field name="author_right" ref="auction_tax"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.lots" id="auction_deposit_1_lot_2">
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
<field name="name">lake Photos</field>
|
||||||
|
<field name="lot_num">2</field>
|
||||||
|
<field name="lot_est1">1000</field>
|
||||||
|
<field name="lot_est2">1700</field>
|
||||||
|
<field name="obj_desc">show pices</field>
|
||||||
|
<field name="obj_ret">0.00</field>
|
||||||
|
<field name="obj_num">2</field>
|
||||||
|
<field name="obj_price">1500.00</field>
|
||||||
|
<field name="bord_vnd_id" ref="auction_deposit_1" />
|
||||||
|
<!--field name="product_id" ref="monproduit"/--> |
|
||||||
|
<field name="author_right" ref="auction_tax"/>
|
||||||
|
<field name="product_id" model="product.product" search="[]"/>
|
||||||
|
<!--<field name="tva" model="account.tax" search="[]"/>-->
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.lots" id="auction_deposit_2_lot_1">
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
<field name="name">fancy mask</field>
|
||||||
|
<field name="lot_num">3</field>
|
||||||
|
<field name="lot_est1">500</field>
|
||||||
|
<field name="lot_est2">700</field>
|
||||||
|
<field name="obj_desc">show pices</field>
|
||||||
|
<field name="obj_ret">650</field>
|
||||||
|
<field name="obj_num">4</field>
|
||||||
|
<field name="obj_price">0.00</field>
|
||||||
|
<field name="bord_vnd_id" ref="auction_deposit_2" />
|
||||||
|
<!--field name="product_id" ref="monproduit"/--> | |
|
||||||
|
<field name="author_right" ref="auction_tax"/>
|
||||||
|
<field name="product_id" model="product.product" search="[]"/>
|
||||||
|
<!--<field name="tva" model="account.tax" search="[]"/>-->
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.lots" id="auction_deposit_2_lot_2">
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
<field name="name">Dining Table</field>
|
||||||
|
<field name="lot_num">4</field>
|
||||||
|
<field name="lot_est1">200</field>
|
||||||
|
<field name="lot_est2">400</field>
|
||||||
|
<field name="obj_desc">show pices</field>
|
||||||
|
<field name="obj_ret">0.00</field>
|
||||||
|
<field name="obj_num">4</field>
|
||||||
|
<field name="obj_price">375</field>
|
||||||
|
<field name="bord_vnd_id" ref="auction_deposit_2" />
|
||||||
|
<!--field name="product_id" ref="monproduit"/--> | |
|
||||||
|
<field name="author_right" ref="auction_tax"/>
|
||||||
|
<field name="product_id" model="product.product" search="[]"/>
|
||||||
|
<!--<field name="tva" model="account.tax" search="[]"/>-->
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.lots" id="auction_deposit_3_lot_1">
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
<field name="name">Plastic glass</field>
|
||||||
|
<field name="lot_num">5</field>
|
||||||
|
<!--field name="lot_type">glass</field-->
|
||||||
|
<field name="lot_est1">300</field>
|
||||||
|
<field name="lot_est2">500</field>
|
||||||
|
<field name="obj_desc">show pices</field>
|
||||||
|
<field name="obj_ret">0.00</field>
|
||||||
|
<field name="obj_num">5</field>
|
||||||
|
<field name="obj_price">460</field>
|
||||||
|
<field name="bord_vnd_id" ref="auction_deposit_3" />
|
||||||
|
<field name="author_right" ref="auction_tax"/>
|
||||||
|
<field name="product_id" model="product.product" search="[]"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.lots" id="auction_deposit_3_lot_2">
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
<field name="name">Mountain photos</field>
|
||||||
|
<field name="lot_num">6</field>
|
||||||
|
<!--field name="lot_type">painting</field-->
|
||||||
|
<field name="lot_est1">50</field>
|
||||||
|
<field name="lot_est2">100</field>
|
||||||
|
<field name="obj_desc">show pices</field>
|
||||||
|
<field name="obj_ret">0.00</field>
|
||||||
|
<field name="obj_num">6</field>
|
||||||
|
<field name="obj_price">85</field>
|
||||||
|
<field name="bord_vnd_id" ref="auction_deposit_3" />
|
||||||
|
<field name="author_right" ref="auction_tax"/>
|
||||||
|
<field name="product_id" model="product.product" search="[]"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.lots" id="auction_deposit_4_lot_1">
|
||||||
|
<field name="name"></field>
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
<field name="name">bresslet</field>
|
||||||
|
<field name="lot_num">7</field>
|
||||||
|
<!--field name="lot_type">Jewellery</field-->
|
||||||
|
<field name="lot_est1">150</field>
|
||||||
|
<field name="lot_est2">400</field>
|
||||||
|
<field name="obj_desc">show pices</field>
|
||||||
|
<field name="obj_ret">100</field>
|
||||||
|
<field name="obj_num">1</field>
|
||||||
|
<field name="obj_price">0</field>
|
||||||
|
<field name="bord_vnd_id" ref="auction_deposit_4" />
|
||||||
|
<field name="author_right" ref="auction_tax"/>
|
||||||
|
<field name="product_id" model="product.product" search="[]"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.lots" id="auction_deposit_4_lot_2">
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
<field name="name">gold chain</field>
|
||||||
|
<field name="lot_num">11</field>
|
||||||
|
<!--field name="lot_type">Jawellery</field-->
|
||||||
|
<field name="lot_est1">400</field>
|
||||||
|
<field name="lot_est2">700</field>
|
||||||
|
<field name="obj_desc">show pices</field>
|
||||||
|
<field name="obj_ret">0.00</field>
|
||||||
|
<field name="obj_num">11</field>
|
||||||
|
<field name="obj_price">550</field>
|
||||||
|
<field name="bord_vnd_id" ref="auction_deposit_4" />
|
||||||
|
<field name="author_right" ref="auction_tax"/>
|
||||||
|
<field name="product_id" model="product.product" search="[]"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.lots" id="auction_deposit_5_lot_1">
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
<field name="name">fiber glass</field>
|
||||||
|
<field name="lot_num">8</field>
|
||||||
|
<!--field name="lot_type">glass</field-->
|
||||||
|
<field name="lot_est1">300</field>
|
||||||
|
<field name="lot_est2">500</field>
|
||||||
|
<field name="obj_desc">show pices</field>
|
||||||
|
<field name="obj_ret">0.00</field>
|
||||||
|
<field name="obj_num">8</field>
|
||||||
|
<field name="obj_price">450</field>
|
||||||
|
<field name="bord_vnd_id" ref="auction_deposit_5" />
|
||||||
|
<field name="author_right" ref="auction_tax"/>
|
||||||
|
<field name="product_id" model="product.product" search="[]"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.lots" id="auction_deposit_5_lot_2">
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
<field name="name">lake photos</field>
|
||||||
|
<field name="lot_num">9</field>
|
||||||
|
<!--field name="lot_type">painting</field-->
|
||||||
|
<field name="lot_est1">100</field>
|
||||||
|
<field name="lot_est2">200</field>
|
||||||
|
<field name="obj_desc">show pices</field>
|
||||||
|
<field name="obj_ret">150</field>
|
||||||
|
<field name="obj_num">9</field>
|
||||||
|
<field name="obj_price">0.00</field>
|
||||||
|
<field name="bord_vnd_id" ref="auction_deposit_5" />
|
||||||
|
<field name="author_right" ref="auction_tax"/>
|
||||||
|
<field name="product_id" model="product.product" search="[]"/>
|
||||||
|
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.lots" id="auction_deposit_6_lot_1">
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
<field name="name">mobile photos</field>
|
||||||
|
<field name="lot_num">10</field>
|
||||||
|
<!--field name="lot_type">mobile</field-->
|
||||||
|
<field name="lot_est1">4500</field>
|
||||||
|
<field name="lot_est2">4700</field>
|
||||||
|
<field name="obj_desc">show models</field>
|
||||||
|
<field name="obj_ret">4650</field>
|
||||||
|
<field name="obj_num">10</field>
|
||||||
|
<field name="obj_price">4800.00</field>
|
||||||
|
<field name="bord_vnd_id" ref="auction_deposit_5" />
|
||||||
|
<field name="author_right" ref="auction_tax"/>
|
||||||
|
<field name="product_id" model="product.product" search="[]"/>
|
||||||
|
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.lots" id="auction_deposit_6_lot_2">
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
<field name="name">Antique photos</field>
|
||||||
|
<field name="lot_num">11</field>
|
||||||
|
<!--field name="lot_type">common</field-->
|
||||||
|
<field name="lot_est1">1600</field>
|
||||||
|
<field name="lot_est2">2200</field>
|
||||||
|
<field name="obj_desc">show map Items</field>
|
||||||
|
<field name="obj_ret">2150</field>
|
||||||
|
<field name="obj_num">11</field>
|
||||||
|
<field name="obj_price">2050.00</field>
|
||||||
|
<field name="bord_vnd_id" ref="auction_deposit_5" />
|
||||||
|
<field name="author_right" ref="auction_tax"/>
|
||||||
|
<field name="product_id" model="product.product" search="[]"/>
|
||||||
|
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<record model="auction.lots" id="auction_deposit_7_lot_1">
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
<field name="name">Hardware photos</field>
|
||||||
|
<field name="lot_num">12</field>
|
||||||
|
<!--field name="lot_type">common</field-->
|
||||||
|
<field name="lot_est1">2600</field>
|
||||||
|
<field name="lot_est2">2800</field>
|
||||||
|
<field name="obj_desc">show map Items</field>
|
||||||
|
<field name="obj_ret">2550</field>
|
||||||
|
<field name="obj_num">12</field>
|
||||||
|
<field name="obj_price">2050.00</field>
|
||||||
|
<field name="bord_vnd_id" ref="auction_deposit_5" />
|
||||||
|
<field name="author_right" ref="auction_tax"/>
|
||||||
|
<field name="product_id" model="product.product" search="[]"/>
|
||||||
|
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<record model="auction.lots" id="auction_deposit_7_lot_2">
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
<field name="name">Home Appliance photos</field>
|
||||||
|
<field name="lot_num">12</field>
|
||||||
|
<!--field name="lot_type">common</field-->
|
||||||
|
<field name="lot_est1">1600</field>
|
||||||
|
<field name="lot_est2">2200</field>
|
||||||
|
<field name="obj_desc">show map Items</field>
|
||||||
|
<field name="obj_ret">2150</field>
|
||||||
|
<field name="obj_num">12</field>
|
||||||
|
<field name="obj_price">2050.00</field>
|
||||||
|
<field name="bord_vnd_id" ref="auction_deposit_5" />
|
||||||
|
<field name="author_right" ref="auction_tax"/>
|
||||||
|
<field name="product_id" model="product.product" search="[]"/>
|
||||||
|
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<record model="auction.lots" id="auction_deposit_8_lot_1">
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
<field name="name">mobile accesories photos</field>
|
||||||
|
<field name="lot_num">13</field>
|
||||||
|
<!--field name="lot_type">common</field-->
|
||||||
|
<field name="lot_est1">1600</field>
|
||||||
|
<field name="lot_est2">2200</field>
|
||||||
|
<field name="obj_desc">show map Items</field>
|
||||||
|
<field name="obj_ret">2150</field>
|
||||||
|
<field name="obj_num">13</field>
|
||||||
|
<field name="obj_price">2050.00</field>
|
||||||
|
<field name="bord_vnd_id" ref="auction_deposit_5" />
|
||||||
|
<field name="author_right" ref="auction_tax"/>
|
||||||
|
<field name="product_id" model="product.product" search="[]"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.lots" id="auction_deposit_8_lot_2">
|
||||||
|
<field name="auction_id" ref="auction_date_2" />
|
||||||
|
<field name="name"> piques-cierges</field>
|
||||||
|
<field name="lot_num">14</field>
|
||||||
|
<!--field name="lot_type">common</field-->
|
||||||
|
<field name="lot_est1">30</field>
|
||||||
|
<field name="lot_est2">50</field>
|
||||||
|
<field name="obj_desc">show map Items</field>
|
||||||
|
<field name="obj_ret">20</field>
|
||||||
|
<field name="obj_num">14</field>
|
||||||
|
<field name="obj_price">0</field>
|
||||||
|
<field name="bord_vnd_id" ref="auction_deposit_5" />
|
||||||
|
<field name="author_right" ref="auction_tax"/>
|
||||||
|
<field name="product_id" model="product.product" search="[]"/>
|
||||||
|
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<record model="auction.lots" id="auction_deposit_9_lot_1">
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
<field name="name">Service à café</field>
|
||||||
|
<field name="lot_num">15</field>
|
||||||
|
<!--field name="lot_type">common</field-->
|
||||||
|
<field name="lot_est1">10</field>
|
||||||
|
<field name="lot_est2">20</field>
|
||||||
|
<field name="obj_desc">show map Items</field>
|
||||||
|
<field name="obj_ret">0</field>
|
||||||
|
<field name="obj_num">15</field>
|
||||||
|
<field name="obj_price">25</field>
|
||||||
|
<field name="bord_vnd_id" ref="auction_deposit_5" />
|
||||||
|
<field name="author_right" ref="auction_tax"/>
|
||||||
|
<field name="product_id" model="product.product" search="[]"/>
|
||||||
|
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<record model="auction.lots" id="auction_deposit_9_lot_2">
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
<field name="name">Pendule</field>
|
||||||
|
<field name="lot_num">16</field>
|
||||||
|
<field name="lot_est1">100</field>
|
||||||
|
<field name="lot_est2">200</field>
|
||||||
|
<field name="obj_desc">show map Items</field>
|
||||||
|
<field name="obj_ret">0</field>
|
||||||
|
<field name="obj_num">16</field>
|
||||||
|
<field name="obj_price">150</field>
|
||||||
|
<field name="bord_vnd_id" ref="auction_deposit_5" />
|
||||||
|
<field name="author_right" ref="auction_tax"/>
|
||||||
|
<field name="product_id" model="product.product" search="[]"/>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.lots" id="auction_deposit_10_lot_1">
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
<field name="name">Cassolettes en marbre</field>
|
||||||
|
<field name="lot_num">17</field>
|
||||||
|
<field name="lot_est1">400</field>
|
||||||
|
<field name="lot_est2">500</field>
|
||||||
|
<field name="obj_desc">marbre Saint Rémi</field>
|
||||||
|
<field name="obj_ret">150</field>
|
||||||
|
<field name="obj_num">17</field>
|
||||||
|
<field name="obj_price">0</field>
|
||||||
|
<field name="bord_vnd_id" ref="auction_deposit_5" />
|
||||||
|
<field name="author_right" ref="auction_tax"/>
|
||||||
|
<field name="product_id" model="product.product" search="[]"/>
|
||||||
|
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.lots" id="auction_deposit_10_lot_2">
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
<field name="name">Tableau</field>
|
||||||
|
<field name="lot_num">18</field>
|
||||||
|
<field name="lot_est1">1600</field>
|
||||||
|
<field name="lot_est2">2200</field>
|
||||||
|
<field name="obj_desc">show map Items</field>
|
||||||
|
<field name="obj_ret">2150</field>
|
||||||
|
<field name="obj_num">18</field>
|
||||||
|
<field name="obj_price">2050.00</field>
|
||||||
|
<field name="bord_vnd_id" ref="auction_deposit_5" />
|
||||||
|
<field name="author_right" ref="auction_tax"/>
|
||||||
|
<field name="product_id" model="product.product" search="[]"/>
|
||||||
|
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<record model="auction.lots" id="auction_deposit_11_lot_1">
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
<field name="name">Vase</field>
|
||||||
|
<field name="lot_num">19</field>
|
||||||
|
<field name="lot_est1">180</field>
|
||||||
|
<field name="lot_est2">220</field>
|
||||||
|
<field name="obj_desc">Rouge</field>
|
||||||
|
<field name="obj_ret">0</field>
|
||||||
|
<field name="obj_num">19</field>
|
||||||
|
<field name="obj_price">190.00</field>
|
||||||
|
<field name="bord_vnd_id" ref="auction_deposit_5" />
|
||||||
|
<field name="author_right" ref="auction_tax"/>
|
||||||
|
<field name="product_id" model="product.product" search="[]"/>
|
||||||
|
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<record model="auction.lots" id="auction_deposit_12_lot_2">
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
<field name="name">Appareil à photos</field>
|
||||||
|
<field name="lot_num">20</field>
|
||||||
|
<field name="lot_est1">160</field>
|
||||||
|
<field name="lot_est2">340</field>
|
||||||
|
<field name="obj_desc">map Items</field>
|
||||||
|
<field name="obj_ret">0</field>
|
||||||
|
<field name="obj_num">20</field>
|
||||||
|
<field name="obj_price">150.00</field>
|
||||||
|
<field name="bord_vnd_id" ref="auction_deposit_5" />
|
||||||
|
<field name="author_right" ref="auction_tax"/>
|
||||||
|
<field name="product_id" model="product.product" search="[]"/>
|
||||||
|
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<record model="auction.bid" id="auction_date_1_bid_1">
|
||||||
|
<field name="name">bid1</field>
|
||||||
|
<field name="partner_id" model="res.partner" search="[('name','=','Unknown')]"/>
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.bid_line" id="auction_date_1_bid_1_auction_bid_line1">
|
||||||
|
<field name="bid_id" ref="auction_date_1_bid_1" />
|
||||||
|
<field name="lot_id" ref="auction_deposit_1_lot_1" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.bid" id="auction_date_1_bid_2">
|
||||||
|
<field name="name">bid2</field>
|
||||||
|
<field name="partner_id" model="res.partner" search="[('name','=','Unknown')]"/>
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.bid_line" id="auction_date_1_bid_2_auction_bid_line1">
|
||||||
|
<field name="bid_id" ref="auction_date_1_bid_2" />
|
||||||
|
<field name="lot_id" ref="auction_deposit_1_lot_2" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.bid" id="auction_date_1_bid_3">
|
||||||
|
<field name="name">bid3</field>
|
||||||
|
<field name="partner_id" model="res.partner" search="[('name','=','Unknown')]"/>
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.bid_line" id="auction_date_1_bid_3_bid_1_auction_bid_line1">
|
||||||
|
<field name="bid_id" ref="auction_date_1_bid_3" />
|
||||||
|
<field name="lot_id" ref="auction_deposit_2_lot_1" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.bid" id="auction_date_1_bid_4">
|
||||||
|
<field name="name">bid4</field>
|
||||||
|
<field name="partner_id" model="res.partner" search="[('name','=','Unknown')]"/>
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.bid_line" id="auction_date_1_bid_4_bid_1_auction_bid_line1">
|
||||||
|
<field name="bid_id" ref="auction_date_1_bid_4" />
|
||||||
|
<field name="lot_id" ref="auction_deposit_2_lot_2" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.bid" id="auction_date_1_bid_5">
|
||||||
|
<field name="name">bid5</field>
|
||||||
|
<field name="partner_id" model="res.partner" search="[('name','=','Unknown')]"/>
|
||||||
|
<field name="auction_id" ref="auction_date_1" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.bid_line" id="auction_date_1_bid_5_auction_bid_line1">
|
||||||
|
<field name="bid_id" ref="auction_date_1_bid_5" />
|
||||||
|
<field name="lot_id" ref="auction_deposit_3_lot_1" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.bid" id="auction_date_2_bid_1">
|
||||||
|
<field name="name">bid6</field>
|
||||||
|
<field name="partner_id" model="res.partner" search="[('name','=','Unknown')]"/>
|
||||||
|
<field name="auction_id" ref="auction_date_2" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.bid_line" id="auction_date_2_bid_1_auction_bid_line1">
|
||||||
|
<field name="bid_id" ref="auction_date_2_bid_1" />
|
||||||
|
<field name="lot_id" ref="auction_deposit_3_lot_2" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.bid" id="auction_date_2_bid_2">
|
||||||
|
<field name="name">bid7</field>
|
||||||
|
<field name="partner_id" model="res.partner" search="[('name','=','Unknown')]"/>
|
||||||
|
<field name="auction_id" ref="auction_date_2" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.bid_line" id="auction_date_2_bid_2_auction_bid_line1">
|
||||||
|
<field name="bid_id" ref="auction_date_2_bid_2" />
|
||||||
|
<field name="lot_id" ref="auction_deposit_4_lot_1" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.bid" id="auction_date_2_bid_3">
|
||||||
|
<field name="name">bid8</field>
|
||||||
|
<field name="partner_id" model="res.partner" search="[('name','=','Unknown')]"/>
|
||||||
|
<field name="auction_id" ref="auction_date_2" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.bid_line" id="auction_date_2_bid_3_auction_bid_line1">
|
||||||
|
<field name="bid_id" ref="auction_date_2_bid_3" />
|
||||||
|
<field name="lot_id" ref="auction_deposit_4_lot_2" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.bid" id="auction_date_2_bid_4">
|
||||||
|
<field name="name">bid9</field>
|
||||||
|
<field name="partner_id" search="[('name','=','Unknown')]"/>
|
||||||
|
<field name="auction_id" ref="auction_date_2" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.bid_line" id="auction_date_2_bid_4_auction_bid_line1">
|
||||||
|
<field name="bid_id" ref="auction_date_2_bid_4" />
|
||||||
|
<field name="lot_id" ref="auction_deposit_5_lot_1" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.bid" id="auction_date_2_bid_5">
|
||||||
|
<field name="name">bid10</field>
|
||||||
|
<field name="partner_id" model="res.partner" search="[('name','=','Unknown')]"/>
|
||||||
|
<field name="auction_id" ref="auction_date_2" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<record model="auction.bid_line" id="auction_date_2_bid_5_auction_bid_line1">
|
||||||
|
<field name="bid_id" ref="auction_date_2_bid_5" />
|
||||||
|
<field name="lot_id" ref="auction_deposit_5_lot_2" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
<!--demo data for the hr_employee-->
|
||||||
|
|
||||||
|
<record model="hr.employee" id="employee2">
|
||||||
|
<field name="name">pritesh</field>
|
||||||
|
<field name="regime">45</field>
|
||||||
|
<field name="user_id" search="[('login','=','admin')]" model="res.users"/>
|
||||||
|
<field name="holiday_max">25</field>
|
||||||
|
<fields name="workgroups" ref="timesheet_group1" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!--demo data for the hr_attendence for employee1 -->
|
||||||
|
|
||||||
|
|
||||||
|
<record model="hr.attendance" id="unknown1_emp1">
|
||||||
|
<field name="name" eval="time.strftime('%Y-%m-25 08:21')"/>
|
||||||
|
<field name="action">sign_in</field>
|
||||||
|
<field name="employee_id" ref="hr.employee1" />
|
||||||
|
</record>
|
||||||
|
<record model="hr.attendance" id="unknown1_emp2">
|
||||||
|
<field name="name" eval="time.strftime('%Y-%m-25 9:21')"/>
|
||||||
|
<field name="action">sign_out</field>
|
||||||
|
<field name="employee_id" ref="hr.employee1" />
|
||||||
|
</record>
|
||||||
|
<record model="hr.attendance" id="unknown1_emp3">
|
||||||
|
<field name="name" eval="time.strftime('%Y-%m-25 09:25')"/>
|
||||||
|
<field name="action">sign_in</field>
|
||||||
|
<field name="employee_id" ref="hr.employee1" />
|
||||||
|
</record>
|
||||||
|
<record model="hr.attendance" id="unknown1_emp4">
|
||||||
|
<field name="name" eval="time.strftime('%Y-%m-25 11:54')"/>
|
||||||
|
<field name="action">sign_out</field>
|
||||||
|
<field name="employee_id" ref="hr.employee1" />
|
||||||
|
</record>
|
||||||
|
<record model="hr.attendance" id="unknown1_emp5">
|
||||||
|
<field name="name" eval="time.strftime('%Y-%m-25 11:59')"/>
|
||||||
|
<field name="action">sign_in</field>
|
||||||
|
<field name="employee_id" ref="hr.employee1" />
|
||||||
|
</record>
|
||||||
|
<record model="hr.attendance" id="unknown1_emp6">
|
||||||
|
<field name="name" eval="time.strftime('%Y-%m-25 13:31')"/>
|
||||||
|
<field name="action">sign_out</field>
|
||||||
|
<field name="employee_id" ref="hr.employee1"/>
|
||||||
|
</record>
|
||||||
|
<record model="hr.attendance" id="unknown1_emp7">
|
||||||
|
<field name="name" eval="time.strftime('%Y-%m-25 20:10')"/>
|
||||||
|
<field name="action">sign_in</field>
|
||||||
|
<field name="employee_id" ref="hr.employee1" />
|
||||||
|
</record>
|
||||||
|
<record model="hr.attendance" id="unknown1_emp8">
|
||||||
|
<field name="name" eval="time.strftime('%Y-%m-25 21:34')"/>
|
||||||
|
<field name="action">sign_out</field>
|
||||||
|
<field name="employee_id" ref="hr.employee1" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!--demo data for the hr_attendence for employee2-->
|
||||||
|
|
||||||
|
<record model="hr.attendance" id="unknown2_emp1">
|
||||||
|
<field name="name" eval="time.strftime('%Y-%m-26 08:21')"/>
|
||||||
|
<field name="action">sign_in</field>
|
||||||
|
<field name="employee_id" ref="employee2" />
|
||||||
|
</record>
|
||||||
|
<record model="hr.attendance" id="unknown2_emp2">
|
||||||
|
<field name="name" eval="time.strftime('%Y-%m-26 9:21')"/>
|
||||||
|
<field name="action">sign_out</field>
|
||||||
|
<field name="employee_id" ref="employee2" />
|
||||||
|
</record>
|
||||||
|
<record model="hr.attendance" id="unknown2_emp3">
|
||||||
|
<field name="name" eval="time.strftime('%Y-%m-26 10:21')"/>
|
||||||
|
<field name="action">sign_in</field>
|
||||||
|
<field name="employee_id" ref="employee2" />
|
||||||
|
</record>
|
||||||
|
-<record model="hr.attendance" id="unknown2_emp4">
|
||||||
|
<field name="name" eval="time.strftime('%Y-%m-26 12:54')"/>
|
||||||
|
<field name="action">sign_out</field>
|
||||||
|
<field name="employee_id" ref="employee2" />
|
||||||
|
</record>
|
||||||
|
<record model="hr.attendance" id="unknown2_emp5">
|
||||||
|
<field name="name" eval="time.strftime('%Y-%m-26 13:32')"/>
|
||||||
|
<field name="action">sign_in</field>
|
||||||
|
<field name="employee_id" ref="employee2" />
|
||||||
|
</record>
|
||||||
|
<record model="hr.attendance" id="unknown2_emp6">
|
||||||
|
<field name="name" eval="time.strftime('%Y-%m-26 16:31')"/>
|
||||||
|
<field name="action">sign_out</field>
|
||||||
|
<field name="employee_id" ref="employee2"/>
|
||||||
|
</record>
|
||||||
|
<record model="hr.attendance" id="unknown2_emp7">
|
||||||
|
<field name="name" eval="time.strftime('%Y-%m-26 17:10')"/>
|
||||||
|
<field name="action">sign_in</field>
|
||||||
|
<field name="employee_id" ref="employee2" />
|
||||||
|
</record>
|
||||||
|
<record model="hr.attendance" id="unknown2_emp8">
|
||||||
|
<field name="name" eval="time.strftime('%Y-%m-26 22:34')"/>
|
||||||
|
<field name="action">sign_out</field>
|
||||||
|
<field name="employee_id" ref="employee2" />
|
||||||
|
</record>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</terp>
|
|
@ -0,0 +1,236 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<terp>
|
||||||
|
<data>
|
||||||
|
<!--<delete model="ir.actions.report.xml" search="[('model','like','auction.')]"/>-->
|
||||||
|
|
||||||
|
<report string="Listing Huissiers"
|
||||||
|
model="auction.lots"
|
||||||
|
name="flagey.huissier"
|
||||||
|
xsl="auction/report/huissier.xsl"
|
||||||
|
auto="False"
|
||||||
|
id="v_huissier"
|
||||||
|
multi="1"
|
||||||
|
/>
|
||||||
|
|
||||||
|
|
||||||
|
<report string="Artists Biography"
|
||||||
|
model="auction.artists"
|
||||||
|
name="report.auction.artists"
|
||||||
|
xml="auction/report/artists.xml"
|
||||||
|
xsl="auction/report/artists.xsl"
|
||||||
|
id="art2"
|
||||||
|
multi="1"/>
|
||||||
|
|
||||||
|
<!-- <report string="Artists Biography"
|
||||||
|
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.artists"
|
||||||
|
rml="auction/report/auction_artists.rml"
|
||||||
|
id="art_auction"
|
||||||
|
multi="1"/>
|
||||||
|
-->
|
||||||
|
<report string="Bids phones"
|
||||||
|
model="auction.lots"
|
||||||
|
name="bids.lots"
|
||||||
|
rml="auction/report/bids_lots.rml"
|
||||||
|
id="bid_phone"
|
||||||
|
multi="1"/>
|
||||||
|
|
||||||
|
<report string="Bids"
|
||||||
|
model="auction.bid"
|
||||||
|
name="auction.bids"
|
||||||
|
rml="auction/report/auction_bids.rml"
|
||||||
|
id="bid_auction"
|
||||||
|
multi="1"/>
|
||||||
|
|
||||||
|
|
||||||
|
<report
|
||||||
|
string="Code barres du lot"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.code_bar_lot"
|
||||||
|
rml="auction/report/report_lot_bar_code.rml"
|
||||||
|
multi="1"
|
||||||
|
id="v_report_barcode_lot"/>
|
||||||
|
|
||||||
|
|
||||||
|
<report string="Seller Labels"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.seller_labels"
|
||||||
|
auto="False"
|
||||||
|
multi="1"/>
|
||||||
|
|
||||||
|
<!-- <report string="Catalog with pictures"
|
||||||
|
model="auction.lots"
|
||||||
|
name="catelogwithpictures"
|
||||||
|
rml="auction/report/catelogwithpictures.rml"
|
||||||
|
auto="False"
|
||||||
|
multi="1"
|
||||||
|
id="1"/>
|
||||||
|
-->
|
||||||
|
<report string="Catalog"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.catelog"
|
||||||
|
rml="auction/report/auction_catelog.rml"
|
||||||
|
auto="False"
|
||||||
|
multi="1"/>
|
||||||
|
|
||||||
|
<!--<report string="Deposit Letter"
|
||||||
|
model="auction.lots"
|
||||||
|
name="deposit.seller"
|
||||||
|
rml="auction/report/deposit_seller.rml"
|
||||||
|
auto="False"
|
||||||
|
multi="1"/>-->
|
||||||
|
|
||||||
|
<report string="Lots List"
|
||||||
|
model="auction.lots"
|
||||||
|
name="lots.list"
|
||||||
|
rml="auction/report/lots_list.rml"
|
||||||
|
auto="False"
|
||||||
|
multi="1"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<report string="Lots List - Landscape"
|
||||||
|
model="auction.lots"
|
||||||
|
name="report.auction.lots.list.landscape"
|
||||||
|
xml="auction/report/lots_list_landscape.xml"
|
||||||
|
xsl="auction/report/lots_list_landscape.xsl"
|
||||||
|
id="lot_list_inv"
|
||||||
|
multi="1"/>
|
||||||
|
|
||||||
|
|
||||||
|
<report string="Lots List Inventory"
|
||||||
|
model="auction.lots"
|
||||||
|
name="lots.list.inventory"
|
||||||
|
rml="auction/report/lots_list_inventory.rml"
|
||||||
|
multi="1"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<report string="Lots List"
|
||||||
|
model="auction.lots"
|
||||||
|
name="report.auction.lots.list"
|
||||||
|
xml="auction/report/lots_list.xml"
|
||||||
|
xsl="auction/report/lots_list.xsl"
|
||||||
|
multi="1"/>
|
||||||
|
|
||||||
|
<report string="Auction Totals with lists"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.total.rml"
|
||||||
|
rml="auction/report/auction_total.rml"
|
||||||
|
auto="False"
|
||||||
|
id="total_result1"
|
||||||
|
multi="1"/>
|
||||||
|
<!-- <report string="Buyer Form"
|
||||||
|
model="auction.lots"
|
||||||
|
name="buyer_form_report"
|
||||||
|
rml="auction/report/buyer_form_report.rml"
|
||||||
|
auto="False"
|
||||||
|
multi="1"/>
|
||||||
|
-->
|
||||||
|
<!-- <report string="Seller form"
|
||||||
|
model="auction.lots"
|
||||||
|
name="seller_form_report"
|
||||||
|
rml="auction/report/seller_form_report.rml"
|
||||||
|
auto="False"
|
||||||
|
multi="1"/>-->
|
||||||
|
|
||||||
|
<report string="Buyer Form"
|
||||||
|
id="buyer_form_id"
|
||||||
|
model="auction.lots"
|
||||||
|
name="report.auction.ach_bordereau"
|
||||||
|
xml="auction/report/ach_bordereau.xml"
|
||||||
|
xsl="auction/report/ach_bordereau.xsl"
|
||||||
|
multi="0"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<report string="Deposits"
|
||||||
|
id="id_deposit"
|
||||||
|
model="auction.deposit"
|
||||||
|
name="report.auction.deposit"
|
||||||
|
xml="auction/report/deposit.xml"
|
||||||
|
xsl="auction/report/deposit.xsl"/>
|
||||||
|
|
||||||
|
<!--<report
|
||||||
|
id="report_auction_catalog"
|
||||||
|
string="Catalog flagey"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.cat_flagy"
|
||||||
|
xsl="'auction/report/catalog2.xsl"/>-->
|
||||||
|
|
||||||
|
<report string="Seller Form"
|
||||||
|
id="seller_lots_3"
|
||||||
|
model="auction.lots"
|
||||||
|
name="report.auction.vnd_bordereau"
|
||||||
|
xml="auction/report/vnd_bordereau.xml"
|
||||||
|
xsl="auction/report/vnd_bordereau.xsl"
|
||||||
|
multi="1"/>
|
||||||
|
|
||||||
|
<report string="Seller List"
|
||||||
|
model="auction.lots"
|
||||||
|
multi="1"
|
||||||
|
id="seller_form_id"
|
||||||
|
name="report.auction.seller.list"
|
||||||
|
xml="auction/report/seller_list.xml"
|
||||||
|
xsl="auction/report/seller_list.xsl"/>
|
||||||
|
|
||||||
|
|
||||||
|
<report string="Buyer List"
|
||||||
|
model="auction.lots"
|
||||||
|
name="buyer.list"
|
||||||
|
id="buy_id_list"
|
||||||
|
rml="auction/report/buyer_list.rml"
|
||||||
|
auto = "False"
|
||||||
|
multi="1"/>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <report string="Seller List"
|
||||||
|
model="auction.lots"
|
||||||
|
name="report.auction.seller.list"
|
||||||
|
xml="auction/report/seller_list.xml"
|
||||||
|
xsl="auction/report/seller_list.xsl"
|
||||||
|
menu="False"
|
||||||
|
id="v_seller_list"
|
||||||
|
multi="1"/>
|
||||||
|
-->
|
||||||
|
<report string="Bids per lot (phone)"
|
||||||
|
model="auction.lots"
|
||||||
|
name="bids.phones.details"
|
||||||
|
rml="auction/report/bids_phones_details.rml"
|
||||||
|
id="details_bids_phones"
|
||||||
|
multi="1"/>
|
||||||
|
|
||||||
|
|
||||||
|
<!--<report string="Bids per lot (phone)xsl"
|
||||||
|
model="auction.lots"
|
||||||
|
name="report.auction.lots.bids.phone"
|
||||||
|
xml="auction/report/lots_bids_phone.xml"
|
||||||
|
xsl="auction/report/lots_bids_phone.xsl"
|
||||||
|
multi="1"/>-->
|
||||||
|
|
||||||
|
<report string="Auction's results"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.result"
|
||||||
|
rml="auction/report/auction_result.rml"
|
||||||
|
multi="1"/>
|
||||||
|
|
||||||
|
<report string="Results with buyer"
|
||||||
|
model="auction.lots"
|
||||||
|
name="report.auction.buyer.result"
|
||||||
|
rml="auction/report/auction_buyer_result.rml"
|
||||||
|
multi="1"
|
||||||
|
id="res_w_buyer"/>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <wizard
|
||||||
|
id="auction_catalog_flagy"
|
||||||
|
string="Auction Catalog Flagy"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.catalog.flagey"
|
||||||
|
keyword="client_print_multi"/>-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</terp>
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<terp>
|
||||||
|
<data noupdate="1">
|
||||||
|
|
||||||
|
#
|
||||||
|
# Sequences for sale.order
|
||||||
|
#
|
||||||
|
|
||||||
|
<record model="ir.sequence.type" id="seq_type_auction_deposit">
|
||||||
|
<field name="name">Auction deposit</field>
|
||||||
|
<field name="code">auction.deposit</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.sequence" id="seq_sale_order">
|
||||||
|
<field name="name">Auction deposit</field>
|
||||||
|
<field name="code">auction.deposit</field>
|
||||||
|
<field name="prefix">AD/</field>
|
||||||
|
<field name="padding">3</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.sequence.type" id="seq_type_bid">
|
||||||
|
<field name="name">Auction bid </field>
|
||||||
|
<field name="code">auction.bid</field>
|
||||||
|
</record>
|
||||||
|
<record model="ir.sequence" id="seq_auction_bid">
|
||||||
|
<field name="name">Auction bid</field>
|
||||||
|
<field name="code">auction.bid</field>
|
||||||
|
<field name="prefix">bid/</field>
|
||||||
|
<field name="padding">3</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</terp>
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,121 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<terp>
|
||||||
|
<data>
|
||||||
|
<!--<delete model="ir.actions.wizard" search="[('wiz_name','like','auction.lots.')]"/>-->
|
||||||
|
|
||||||
|
<wizard string="Send to website"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.lots.send.aie"
|
||||||
|
id="wizard_send"/>
|
||||||
|
|
||||||
|
<wizard string="Send results to Auction-in-europe.com"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.lots.send.aie.results"
|
||||||
|
multi="1"
|
||||||
|
id="wizard_results"/>
|
||||||
|
|
||||||
|
<wizard string="Map buyer username to Partners"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.lots.buyer_map"
|
||||||
|
multi="1"
|
||||||
|
id="wizard_map_user"/>
|
||||||
|
|
||||||
|
<wizard string="Change Auction Date"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.lots.auction_move"
|
||||||
|
multi="1"
|
||||||
|
id="wizard_change_auction"/>
|
||||||
|
|
||||||
|
<!--wizard string="Pay objects of the seller"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.pay.sel"
|
||||||
|
id="wizard_lots_pay"/-->
|
||||||
|
<wizard string="Pay objects of the buyer"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.pay.buy"
|
||||||
|
id="wizard_pay"/>
|
||||||
|
|
||||||
|
<wizard
|
||||||
|
string="Gestion emporte"
|
||||||
|
model="auction.dates"
|
||||||
|
name="auction.taken"
|
||||||
|
multi="1"
|
||||||
|
id="wizard_emporte"/>
|
||||||
|
<menuitem name="Auction Management/Outils Bar Codes/Gestion des livraisons"
|
||||||
|
action="wizard_emporte"
|
||||||
|
type="wizard"
|
||||||
|
id="menu_wizard_emporte"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!--wizard string="Cancel payment"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.lots.cancel"
|
||||||
|
multi="1"
|
||||||
|
id="wizard_cancel_pay"/-->
|
||||||
|
|
||||||
|
<wizard string="Numerotation (per lot)"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.lots.numerotate"
|
||||||
|
multi="1"
|
||||||
|
id="wizard_numerotate_lot"/>
|
||||||
|
|
||||||
|
<wizard string="Numerotation (automatic)"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.lots.numerotate_cont"
|
||||||
|
multi="1"
|
||||||
|
id="wizard_numerotate_automatic"/>
|
||||||
|
|
||||||
|
<wizard string="SMS Send"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.lots.sms_send"
|
||||||
|
multi="1"
|
||||||
|
id="wizard_sms"/>
|
||||||
|
|
||||||
|
<!--wizard string="Invoice"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.lots.invoice"
|
||||||
|
multi="1"
|
||||||
|
id="wizard_invoicing"/-->
|
||||||
|
|
||||||
|
|
||||||
|
<wizard string="Invoice Seller objects"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.lots.make_invoice"
|
||||||
|
multi="1"
|
||||||
|
id="wizard_invoice"/>
|
||||||
|
|
||||||
|
<wizard string="Invoice Buyer objects"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.lots.make_invoice_buyer"
|
||||||
|
id="wizard_invoice_buyer1"/>
|
||||||
|
|
||||||
|
<wizard string="Unmark as taken away"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.lots.enable"
|
||||||
|
multi="1"
|
||||||
|
id="auction_wizard_enable_taken"/>
|
||||||
|
|
||||||
|
<wizard string="Mark as taken away"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.lots.able"
|
||||||
|
multi="1"
|
||||||
|
id="auction_wizard_able_taken"/>
|
||||||
|
|
||||||
|
<wizard
|
||||||
|
id="auction_catalog_flagy"
|
||||||
|
string="Auction Catalog Flagey"
|
||||||
|
model="auction.dates"
|
||||||
|
name="auction.catalog.flagey"
|
||||||
|
keyword="client_print_multi"/>
|
||||||
|
|
||||||
|
<wizard string="Mark as paid for seller"
|
||||||
|
model="auction.lots"
|
||||||
|
name="auction.payer.sel"
|
||||||
|
multi="1"
|
||||||
|
id="auction_wizard_payer_sel"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</data>
|
||||||
|
</terp>
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
#
|
||||||
|
# Copyright (c) 1996-2000 Tyler C. Sarna <tsarna@sarna.org>
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# 3. All advertising materials mentioning features or use of this software
|
||||||
|
# must display the following acknowledgement:
|
||||||
|
# This product includes software developed by Tyler C. Sarna.
|
||||||
|
# 4. Neither the name of the author nor the names of contributors
|
||||||
|
# may be used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
|
||||||
|
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
|
||||||
|
__version__ = '0.9'
|
|
@ -0,0 +1,321 @@
|
||||||
|
#
|
||||||
|
# Copyright (c) 2000 Tyler C. Sarna <tsarna@sarna.org>
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# 3. All advertising materials mentioning features or use of this software
|
||||||
|
# must display the following acknowledgement:
|
||||||
|
# This product includes software developed by Tyler C. Sarna.
|
||||||
|
# 4. Neither the name of the author nor the names of contributors
|
||||||
|
# may be used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
|
||||||
|
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
|
||||||
|
from reportlab.lib.units import inch
|
||||||
|
from common import MultiWidthBarcode
|
||||||
|
from string import digits
|
||||||
|
|
||||||
|
_patterns = {
|
||||||
|
0 : 'BaBbBb', 1 : 'BbBaBb', 2 : 'BbBbBa',
|
||||||
|
3 : 'AbAbBc', 4 : 'AbAcBb', 5 : 'AcAbBb',
|
||||||
|
6 : 'AbBbAc', 7 : 'AbBcAb', 8 : 'AcBbAb',
|
||||||
|
9 : 'BbAbAc', 10 : 'BbAcAb', 11 : 'BcAbAb',
|
||||||
|
12 : 'AaBbCb', 13 : 'AbBaCb', 14 : 'AbBbCa',
|
||||||
|
15 : 'AaCbBb', 16 : 'AbCaBb', 17 : 'AbCbBa',
|
||||||
|
18 : 'BbCbAa', 19 : 'BbAaCb', 20 : 'BbAbCa',
|
||||||
|
21 : 'BaCbAb', 22 : 'BbCaAb', 23 : 'CaBaCa',
|
||||||
|
24 : 'CaAbBb', 25 : 'CbAaBb', 26 : 'CbAbBa',
|
||||||
|
27 : 'CaBbAb', 28 : 'CbBaAb', 29 : 'CbBbAa',
|
||||||
|
30 : 'BaBaBc', 31 : 'BaBcBa', 32 : 'BcBaBa',
|
||||||
|
33 : 'AaAcBc', 34 : 'AcAaBc', 35 : 'AcAcBa',
|
||||||
|
36 : 'AaBcAc', 37 : 'AcBaAc', 38 : 'AcBcAa',
|
||||||
|
39 : 'BaAcAc', 40 : 'BcAaAc', 41 : 'BcAcAa',
|
||||||
|
42 : 'AaBaCc', 43 : 'AaBcCa', 44 : 'AcBaCa',
|
||||||
|
45 : 'AaCaBc', 46 : 'AaCcBa', 47 : 'AcCaBa',
|
||||||
|
48 : 'CaCaBa', 49 : 'BaAcCa', 50 : 'BcAaCa',
|
||||||
|
51 : 'BaCaAc', 52 : 'BaCcAa', 53 : 'BaCaCa',
|
||||||
|
54 : 'CaAaBc', 55 : 'CaAcBa', 56 : 'CcAaBa',
|
||||||
|
57 : 'CaBaAc', 58 : 'CaBcAa', 59 : 'CcBaAa',
|
||||||
|
60 : 'CaDaAa', 61 : 'BbAdAa', 62 : 'DcAaAa',
|
||||||
|
63 : 'AaAbBd', 64 : 'AaAdBb', 65 : 'AbAaBd',
|
||||||
|
66 : 'AbAdBa', 67 : 'AdAaBb', 68 : 'AdAbBa',
|
||||||
|
69 : 'AaBbAd', 70 : 'AaBdAb', 71 : 'AbBaAd',
|
||||||
|
72 : 'AbBdAa', 73 : 'AdBaAb', 74 : 'AdBbAa',
|
||||||
|
75 : 'BdAbAa', 76 : 'BbAaAd', 77 : 'DaCaAa',
|
||||||
|
78 : 'BdAaAb', 79 : 'AcDaAa', 80 : 'AaAbDb',
|
||||||
|
81 : 'AbAaDb', 82 : 'AbAbDa', 83 : 'AaDbAb',
|
||||||
|
84 : 'AbDaAb', 85 : 'AbDbAa', 86 : 'DaAbAb',
|
||||||
|
87 : 'DbAaAb', 88 : 'DbAbAa', 89 : 'BaBaDa',
|
||||||
|
90 : 'BaDaBa', 91 : 'DaBaBa', 92 : 'AaAaDc',
|
||||||
|
93 : 'AaAcDa', 94 : 'AcAaDa', 95 : 'AaDaAc',
|
||||||
|
96 : 'AaDcAa', 97 : 'DaAaAc', 98 : 'DaAcAa',
|
||||||
|
99 : 'AaCaDa', 100 : 'AaDaCa', 101 : 'CaAaDa',
|
||||||
|
102 : 'DaAaCa', 103 : 'BaAdAb', 104 : 'BaAbAd',
|
||||||
|
105 : 'BaAbCb', 106 : 'BcCaAaB'
|
||||||
|
}
|
||||||
|
|
||||||
|
starta, startb, startc, stop = 103, 104, 105, 106
|
||||||
|
|
||||||
|
seta = {
|
||||||
|
' ' : 0, '!' : 1, '"' : 2, '#' : 3,
|
||||||
|
'$' : 4, '%' : 5, '&' : 6, '\'' : 7,
|
||||||
|
'(' : 8, ')' : 9, '*' : 10, '+' : 11,
|
||||||
|
',' : 12, '-' : 13, '.' : 14, '/' : 15,
|
||||||
|
'0' : 16, '1' : 17, '2' : 18, '3' : 19,
|
||||||
|
'4' : 20, '5' : 21, '6' : 22, '7' : 23,
|
||||||
|
'8' : 24, '9' : 25, ':' : 26, ';' : 27,
|
||||||
|
'<' : 28, '=' : 29, '>' : 30, '?' : 31,
|
||||||
|
'@' : 32, 'A' : 33, 'B' : 34, 'C' : 35,
|
||||||
|
'D' : 36, 'E' : 37, 'F' : 38, 'G' : 39,
|
||||||
|
'H' : 40, 'I' : 41, 'J' : 42, 'K' : 43,
|
||||||
|
'L' : 44, 'M' : 45, 'N' : 46, 'O' : 47,
|
||||||
|
'P' : 48, 'Q' : 49, 'R' : 50, 'S' : 51,
|
||||||
|
'T' : 52, 'U' : 53, 'V' : 54, 'W' : 55,
|
||||||
|
'X' : 56, 'Y' : 57, 'Z' : 58, '[' : 59,
|
||||||
|
'\\' : 60, ']' : 61, '^' : 62, '_' : 63,
|
||||||
|
'\x00' : 64, '\x01' : 65, '\x02' : 66, '\x03' : 67,
|
||||||
|
'\x04' : 68, '\x05' : 69, '\x06' : 70, '\x07' : 71,
|
||||||
|
'\x08' : 72, '\x09' : 73, '\x0a' : 74, '\x0b' : 75,
|
||||||
|
'\x0c' : 76, '\x0d' : 77, '\x0e' : 78, '\x0f' : 79,
|
||||||
|
'\x10' : 80, '\x11' : 81, '\x12' : 82, '\x13' : 83,
|
||||||
|
'\x14' : 84, '\x15' : 85, '\x16' : 86, '\x17' : 87,
|
||||||
|
'\x18' : 88, '\x19' : 89, '\x1a' : 90, '\x1b' : 91,
|
||||||
|
'\x1c' : 92, '\x1d' : 93, '\x1e' : 94, '\x1f' : 95,
|
||||||
|
'\xf3' : 96, '\xf2' : 97, 'SHIFT' : 98, 'TO_C' : 99,
|
||||||
|
'TO_B' : 100, '\xf4' : 101, '\xf1' : 102
|
||||||
|
}
|
||||||
|
|
||||||
|
setb = {
|
||||||
|
' ' : 0, '!' : 1, '"' : 2, '#' : 3,
|
||||||
|
'$' : 4, '%' : 5, '&' : 6, '\'' : 7,
|
||||||
|
'(' : 8, ')' : 9, '*' : 10, '+' : 11,
|
||||||
|
',' : 12, '-' : 13, '.' : 14, '/' : 15,
|
||||||
|
'0' : 16, '1' : 17, '2' : 18, '3' : 19,
|
||||||
|
'4' : 20, '5' : 21, '6' : 22, '7' : 23,
|
||||||
|
'8' : 24, '9' : 25, ':' : 26, ';' : 27,
|
||||||
|
'<' : 28, '=' : 29, '>' : 30, '?' : 31,
|
||||||
|
'@' : 32, 'A' : 33, 'B' : 34, 'C' : 35,
|
||||||
|
'D' : 36, 'E' : 37, 'F' : 38, 'G' : 39,
|
||||||
|
'H' : 40, 'I' : 41, 'J' : 42, 'K' : 43,
|
||||||
|
'L' : 44, 'M' : 45, 'N' : 46, 'O' : 47,
|
||||||
|
'P' : 48, 'Q' : 49, 'R' : 50, 'S' : 51,
|
||||||
|
'T' : 52, 'U' : 53, 'V' : 54, 'W' : 55,
|
||||||
|
'X' : 56, 'Y' : 57, 'Z' : 58, '[' : 59,
|
||||||
|
'\\' : 60, ']' : 61, '^' : 62, '_' : 63,
|
||||||
|
'`' : 64, 'a' : 65, 'b' : 66, 'c' : 67,
|
||||||
|
'd' : 68, 'e' : 69, 'f' : 70, 'g' : 71,
|
||||||
|
'h' : 72, 'i' : 73, 'j' : 74, 'k' : 75,
|
||||||
|
'l' : 76, 'm' : 77, 'n' : 78, 'o' : 79,
|
||||||
|
'p' : 80, 'q' : 81, 'r' : 82, 's' : 83,
|
||||||
|
't' : 84, 'u' : 85, 'v' : 86, 'w' : 87,
|
||||||
|
'x' : 88, 'y' : 89, 'z' : 90, '{' : 91,
|
||||||
|
'|' : 92, '}' : 93, '~' : 94, '\x7f' : 95,
|
||||||
|
'\xf3' : 96, '\xf2' : 97, 'SHIFT' : 98, 'TO_C' : 99,
|
||||||
|
'\xf4' : 100, 'TO_A' : 101, '\xf1' : 102
|
||||||
|
}
|
||||||
|
|
||||||
|
setc = {
|
||||||
|
'00': 0, '01': 1, '02': 2, '03': 3, '04': 4,
|
||||||
|
'05': 5, '06': 6, '07': 7, '08': 8, '09': 9,
|
||||||
|
'10':10, '11':11, '12':12, '13':13, '14':14,
|
||||||
|
'15':15, '16':16, '17':17, '18':18, '19':19,
|
||||||
|
'20':20, '21':21, '22':22, '23':23, '24':24,
|
||||||
|
'25':25, '26':26, '27':27, '28':28, '29':29,
|
||||||
|
'30':30, '31':31, '32':32, '33':33, '34':34,
|
||||||
|
'35':35, '36':36, '37':37, '38':38, '39':39,
|
||||||
|
'40':40, '41':41, '42':42, '43':43, '44':44,
|
||||||
|
'45':45, '46':46, '47':47, '48':48, '49':49,
|
||||||
|
'50':50, '51':51, '52':52, '53':53, '54':54,
|
||||||
|
'55':55, '56':56, '57':57, '58':58, '59':59,
|
||||||
|
'60':60, '61':61, '62':62, '63':63, '64':64,
|
||||||
|
'65':65, '66':66, '67':67, '68':68, '69':69,
|
||||||
|
'70':70, '71':71, '72':72, '73':73, '74':74,
|
||||||
|
'75':75, '76':76, '77':77, '78':78, '79':79,
|
||||||
|
'80':80, '81':81, '82':82, '83':83, '84':84,
|
||||||
|
'85':85, '86':86, '87':87, '88':88, '89':89,
|
||||||
|
'90':90, '91':91, '92':92, '93':93, '94':94,
|
||||||
|
'95':95, '96':96, '97':97, '98':98, '99':99,
|
||||||
|
|
||||||
|
'TO_B' : 100, 'TO_A' : 101, '\xf1' : 102
|
||||||
|
}
|
||||||
|
|
||||||
|
setmap = {
|
||||||
|
'TO_A' : (seta, setb),
|
||||||
|
'TO_B' : (setb, seta),
|
||||||
|
'TO_C' : (setc, None),
|
||||||
|
'START_A' : (starta, seta, setb),
|
||||||
|
'START_B' : (startb, setb, seta),
|
||||||
|
'START_C' : (startc, setc, None),
|
||||||
|
}
|
||||||
|
tos = setmap.keys()
|
||||||
|
|
||||||
|
class Code128(MultiWidthBarcode):
|
||||||
|
"""
|
||||||
|
Code 128 is a very compact symbology that can encode the entire
|
||||||
|
128 character ASCII set, plus 4 special control codes,
|
||||||
|
(FNC1-FNC4, expressed in the input string as \xf1 to \xf4).
|
||||||
|
Code 128 can also encode digits at double density (2 per byte)
|
||||||
|
and has a mandatory checksum. Code 128 is well supported and
|
||||||
|
commonly used -- for example, by UPS for tracking labels.
|
||||||
|
|
||||||
|
Because of these qualities, Code 128 is probably the best choice
|
||||||
|
for a linear symbology today (assuming you have a choice).
|
||||||
|
|
||||||
|
Options that may be passed to constructor:
|
||||||
|
|
||||||
|
value (int, or numeric string. required.):
|
||||||
|
The value to encode.
|
||||||
|
|
||||||
|
xdim (float, default .0075):
|
||||||
|
X-Dimension, or width of the smallest element
|
||||||
|
Minumum is .0075 inch (7.5 mils).
|
||||||
|
|
||||||
|
height (float, see default below):
|
||||||
|
Height of the symbol. Default is the height of the two
|
||||||
|
bearer bars (if they exist) plus the greater of .25 inch
|
||||||
|
or .15 times the symbol's length.
|
||||||
|
|
||||||
|
quiet (bool, default 1):
|
||||||
|
Wether to include quiet zones in the symbol.
|
||||||
|
|
||||||
|
lquiet (float, see default below):
|
||||||
|
Quiet zone size to left of code, if quiet is true.
|
||||||
|
Default is the greater of .25 inch, or 10 xdim
|
||||||
|
|
||||||
|
rquiet (float, defaults as above):
|
||||||
|
Quiet zone size to right left of code, if quiet is true.
|
||||||
|
|
||||||
|
Sources of Information on Code 128:
|
||||||
|
|
||||||
|
http://www.semiconductor.agilent.com/barcode/sg/Misc/code_128.html
|
||||||
|
http://www.adams1.com/pub/russadam/128code.html
|
||||||
|
http://www.barcodeman.com/c128.html
|
||||||
|
|
||||||
|
Official Spec, "ANSI/AIM BC4-1999, ISS" is available for US$45 from
|
||||||
|
http://www.aimglobal.org/aimstore/
|
||||||
|
"""
|
||||||
|
def __init__(self, value='', **args):
|
||||||
|
self.xdim = inch * 0.0075
|
||||||
|
self.lquiet = None
|
||||||
|
self.rquiet = None
|
||||||
|
self.quiet = 1
|
||||||
|
self.height = None
|
||||||
|
|
||||||
|
if type(value) is type(1):
|
||||||
|
value = str(value)
|
||||||
|
|
||||||
|
for (k, v) in args.items():
|
||||||
|
setattr(self, k, v)
|
||||||
|
|
||||||
|
if self.quiet:
|
||||||
|
if self.lquiet is None:
|
||||||
|
self.lquiet = max(inch * 0.25, self.xdim * 10.0)
|
||||||
|
self.rquiet = max(inch * 0.25, self.xdim * 10.0)
|
||||||
|
else:
|
||||||
|
self.lquiet = self.rquiet = 0.0
|
||||||
|
|
||||||
|
MultiWidthBarcode.__init__(self, value)
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
vval = ""
|
||||||
|
self.valid = 1
|
||||||
|
for c in self.value:
|
||||||
|
if ord(c) > 127 and c not in '\xf1\xf2\xf3\xf4':
|
||||||
|
self.valid = 0
|
||||||
|
continue
|
||||||
|
vval = vval + c
|
||||||
|
self.validated = vval
|
||||||
|
return vval
|
||||||
|
|
||||||
|
def _trailingDigitsToC(self, l):
|
||||||
|
# Optimization: trailing digits -> set C double-digits
|
||||||
|
c = 1
|
||||||
|
savings = -1 # the TO_C costs one character
|
||||||
|
rl = ['STOP']
|
||||||
|
while c < len(l):
|
||||||
|
i = (-c - 1)
|
||||||
|
if l[i] == '\xf1':
|
||||||
|
c = c + 1
|
||||||
|
rl.insert(0, '\xf1')
|
||||||
|
continue
|
||||||
|
elif len(l[i]) == 1 and l[i] in digits \
|
||||||
|
and len(l[i-1]) == 1 and l[i-1] in digits:
|
||||||
|
c = c + 2
|
||||||
|
savings = savings + 1
|
||||||
|
rl.insert(0, l[i-1] + l[i])
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
if savings > 0:
|
||||||
|
return l[:-c] + ['TO_C'] + rl
|
||||||
|
else:
|
||||||
|
return l
|
||||||
|
|
||||||
|
def encode(self):
|
||||||
|
# First, encode using only B
|
||||||
|
s = self.validated
|
||||||
|
l = ['START_B']
|
||||||
|
for c in s:
|
||||||
|
if not setb.has_key(c):
|
||||||
|
l = l + ['TO_A', c, 'TO_B']
|
||||||
|
else:
|
||||||
|
l.append(c)
|
||||||
|
l.append('STOP')
|
||||||
|
|
||||||
|
l = self._trailingDigitsToC(l)
|
||||||
|
|
||||||
|
# Finally, replace START_X,TO_Y with START_Y
|
||||||
|
if l[1] in tos:
|
||||||
|
l[:2] = ['START_' + l[1][-1]]
|
||||||
|
|
||||||
|
# print `l`
|
||||||
|
|
||||||
|
# encode into numbers
|
||||||
|
start, set, shset = setmap[l[0]]
|
||||||
|
e = [start]
|
||||||
|
|
||||||
|
l = l[1:-1]
|
||||||
|
while l:
|
||||||
|
c = l[0]
|
||||||
|
if c == 'SHIFT':
|
||||||
|
e = e + [set[c], shset[l[1]]]
|
||||||
|
l = l[2:]
|
||||||
|
elif c in tos:
|
||||||
|
e.append(set[c])
|
||||||
|
set, shset = setmap[c]
|
||||||
|
l = l[1:]
|
||||||
|
else:
|
||||||
|
e.append(set[c])
|
||||||
|
l = l[1:]
|
||||||
|
|
||||||
|
c = e[0]
|
||||||
|
for i in range(1, len(e)):
|
||||||
|
c = c + i * e[i]
|
||||||
|
self.encoded = e + [c % 103, stop]
|
||||||
|
return self.encoded
|
||||||
|
|
||||||
|
def decompose(self):
|
||||||
|
dval = ''
|
||||||
|
for c in self.encoded:
|
||||||
|
dval = dval + _patterns[c]
|
||||||
|
self.decomposed = dval
|
||||||
|
return self.decomposed
|
|
@ -0,0 +1,255 @@
|
||||||
|
#
|
||||||
|
# Copyright (c) 1996-2000 Tyler C. Sarna <tsarna@sarna.org>
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# 3. All advertising materials mentioning features or use of this software
|
||||||
|
# must display the following acknowledgement:
|
||||||
|
# This product includes software developed by Tyler C. Sarna.
|
||||||
|
# 4. Neither the name of the author nor the names of contributors
|
||||||
|
# may be used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
|
||||||
|
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
|
||||||
|
from reportlab.lib.units import inch
|
||||||
|
from common import Barcode
|
||||||
|
import string
|
||||||
|
|
||||||
|
_patterns = {
|
||||||
|
'0': ("bsbSBsBsb", 0), '1': ("BsbSbsbsB", 1),
|
||||||
|
'2': ("bsBSbsbsB", 2), '3': ("BsBSbsbsb", 3),
|
||||||
|
'4': ("bsbSBsbsB", 4), '5': ("BsbSBsbsb", 5),
|
||||||
|
'6': ("bsBSBsbsb", 6), '7': ("bsbSbsBsB", 7),
|
||||||
|
'8': ("BsbSbsBsb", 8), '9': ("bsBSbsBsb", 9),
|
||||||
|
'A': ("BsbsbSbsB", 10), 'B': ("bsBsbSbsB", 11),
|
||||||
|
'C': ("BsBsbSbsb", 12), 'D': ("bsbsBSbsB", 13),
|
||||||
|
'E': ("BsbsBSbsb", 14), 'F': ("bsBsBSbsb", 15),
|
||||||
|
'G': ("bsbsbSBsB", 16), 'H': ("BsbsbSBsb", 17),
|
||||||
|
'I': ("bsBsbSBsb", 18), 'J': ("bsbsBSBsb", 19),
|
||||||
|
'K': ("BsbsbsbSB", 20), 'L': ("bsBsbsbSB", 21),
|
||||||
|
'M': ("BsBsbsbSb", 22), 'N': ("bsbsBsbSB", 23),
|
||||||
|
'O': ("BsbsBsbSb", 24), 'P': ("bsBsBsbSb", 25),
|
||||||
|
'Q': ("bsbsbsBSB", 26), 'R': ("BsbsbsBSb", 27),
|
||||||
|
'S': ("bsBsbsBSb", 28), 'T': ("bsbsBsBSb", 29),
|
||||||
|
'U': ("BSbsbsbsB", 30), 'V': ("bSBsbsbsB", 31),
|
||||||
|
'W': ("BSBsbsbsb", 32), 'X': ("bSbsBsbsB", 33),
|
||||||
|
'Y': ("BSbsBsbsb", 34), 'Z': ("bSBsBsbsb", 35),
|
||||||
|
'-': ("bSbsbsBsB", 36), '.': ("BSbsbsBsb", 37),
|
||||||
|
' ': ("bSBsbsBsb", 38), '*': ("bSbsBsBsb", 39),
|
||||||
|
'$': ("bSbSbSbsb", 40), '/': ("bSbSbsbSb", 41),
|
||||||
|
'+': ("bSbsbSbSb", 42), '%': ("bsbSbSbSb", 43)
|
||||||
|
}
|
||||||
|
|
||||||
|
_valchars = [
|
||||||
|
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A',
|
||||||
|
'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
|
||||||
|
'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W',
|
||||||
|
'X', 'Y', 'Z', '-', '.', ' ', '*', '$', '/', '+', '%'
|
||||||
|
]
|
||||||
|
|
||||||
|
_extended = {
|
||||||
|
'\0': "%U", '\01': "$A", '\02': "$B", '\03': "$C",
|
||||||
|
'\04': "$D", '\05': "$E", '\06': "$F", '\07': "$G",
|
||||||
|
'\010': "$H", '\011': "$I", '\012': "$J", '\013': "$K",
|
||||||
|
'\014': "$L", '\015': "$M", '\016': "$N", '\017': "$O",
|
||||||
|
'\020': "$P", '\021': "$Q", '\022': "$R", '\023': "$S",
|
||||||
|
'\024': "$T", '\025': "$U", '\026': "$V", '\027': "$W",
|
||||||
|
'\030': "$X", '\031': "$Y", '\032': "$Z", '\033': "%A",
|
||||||
|
'\034': "%B", '\035': "%C", '\036': "%D", '\037': "%E",
|
||||||
|
'!': "/A", '"': "/B", '#': "/C", '$': "/D",
|
||||||
|
'%': "/E", '&': "/F", '\'': "/G", '(': "/H",
|
||||||
|
')': "/I", '*': "/J", '+': "/K", ',': "/L",
|
||||||
|
'/': "/O", ':': "/Z", ';': "%F", '<': "%G",
|
||||||
|
'=': "%H", '>': "%I", '?': "%J", '@': "%V",
|
||||||
|
'[': "%K", '\\': "%L", ']': "%M", '^': "%N",
|
||||||
|
'_': "%O", '`': "%W", 'a': "+A", 'b': "+B",
|
||||||
|
'c': "+C", 'd': "+D", 'e': "+E", 'f': "+F",
|
||||||
|
'g': "+G", 'h': "+H", 'i': "+I", 'j': "+J",
|
||||||
|
'k': "+K", 'l': "+L", 'm': "+M", 'n': "+N",
|
||||||
|
'o': "+O", 'p': "+P", 'q': "+Q", 'r': "+R",
|
||||||
|
's': "+S", 't': "+T", 'u': "+U", 'v': "+V",
|
||||||
|
'w': "+W", 'x': "+X", 'y': "+Y", 'z': "+Z",
|
||||||
|
'{': "%P", '|': "%Q", '}': "%R", '~': "%S",
|
||||||
|
'\177': "%T"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
_stdchrs = string.digits + string.uppercase + "-. *$/+%"
|
||||||
|
_extchrs = _stdchrs + string.lowercase + \
|
||||||
|
"\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017" + \
|
||||||
|
"\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" + \
|
||||||
|
"!'#&\"(),:;<=>?@[\\]^_`{|}~\177"
|
||||||
|
|
||||||
|
|
||||||
|
def _encode39(str, cksum):
|
||||||
|
newval = "*"
|
||||||
|
v = 0
|
||||||
|
for c in str:
|
||||||
|
v = v + _patterns[c][1]
|
||||||
|
newval = newval + c
|
||||||
|
v = v % 43
|
||||||
|
if cksum:
|
||||||
|
newval = newval + _valchars[v]
|
||||||
|
return newval + '*'
|
||||||
|
|
||||||
|
|
||||||
|
class _Code39Base(Barcode):
|
||||||
|
def __init__(self, value = "", **args):
|
||||||
|
self.xdim = inch * 0.0075
|
||||||
|
self.lquiet = None
|
||||||
|
self.rquiet = None
|
||||||
|
self.quiet = 1
|
||||||
|
self.gap = None
|
||||||
|
self.height = None
|
||||||
|
self.ratio = 2.2
|
||||||
|
self.checksum = 0
|
||||||
|
self.bearers = 0.0
|
||||||
|
|
||||||
|
for (k, v) in args.items():
|
||||||
|
setattr(self, k, v)
|
||||||
|
|
||||||
|
if self.quiet:
|
||||||
|
if self.lquiet is None:
|
||||||
|
self.lquiet = max(inch * 0.25, self.xdim * 10.0)
|
||||||
|
self.rquiet = max(inch * 0.25, self.xdim * 10.0)
|
||||||
|
else:
|
||||||
|
self.lquiet = self.rquiet = 0.0
|
||||||
|
|
||||||
|
Barcode.__init__(self, value)
|
||||||
|
|
||||||
|
def decompose(self):
|
||||||
|
dval = ""
|
||||||
|
for c in self.encoded:
|
||||||
|
dval = dval + _patterns[c][0] + 'i'
|
||||||
|
self.decomposed = dval[:-1]
|
||||||
|
return self.decomposed
|
||||||
|
|
||||||
|
|
||||||
|
class Standard39(_Code39Base):
|
||||||
|
"""
|
||||||
|
Interleaved 2 of 5 is a numeric-only barcode. It encodes an even
|
||||||
|
number of digits; if an odd number is given, a 0 is prepended.
|
||||||
|
|
||||||
|
Options that may be passed to constructor:
|
||||||
|
|
||||||
|
value (int, or numeric string. required.):
|
||||||
|
The value to encode.
|
||||||
|
|
||||||
|
xdim (float, default .0075):
|
||||||
|
X-Dimension, or width of the smallest element
|
||||||
|
Minumum is .0075 inch (7.5 mils).
|
||||||
|
|
||||||
|
ratio (float, default 2.2):
|
||||||
|
The ratio of wide elements to narrow elements.
|
||||||
|
Must be between 2.0 and 3.0 (or 2.2 and 3.0 if the
|
||||||
|
xdim is greater than 20 mils (.02 inch))
|
||||||
|
|
||||||
|
gap (float or None, default None):
|
||||||
|
width of intercharacter gap. None means "use xdim".
|
||||||
|
|
||||||
|
height (float, see default below):
|
||||||
|
Height of the symbol. Default is the height of the two
|
||||||
|
bearer bars (if they exist) plus the greater of .25 inch
|
||||||
|
or .15 times the symbol's length.
|
||||||
|
|
||||||
|
checksum (bool, default 0):
|
||||||
|
Wether to compute and include the check digit
|
||||||
|
|
||||||
|
bearers (float, in units of xdim. default 0):
|
||||||
|
Height of bearer bars (horizontal bars along the top and
|
||||||
|
bottom of the barcode). Default is 0 (no bearers).
|
||||||
|
|
||||||
|
quiet (bool, default 1):
|
||||||
|
Wether to include quiet zones in the symbol.
|
||||||
|
|
||||||
|
lquiet (float, see default below):
|
||||||
|
Quiet zone size to left of code, if quiet is true.
|
||||||
|
Default is the greater of .25 inch, or .15 times the symbol's
|
||||||
|
length.
|
||||||
|
|
||||||
|
rquiet (float, defaults as above):
|
||||||
|
Quiet zone size to right left of code, if quiet is true.
|
||||||
|
|
||||||
|
Sources of Information on Code 39:
|
||||||
|
|
||||||
|
http://www.semiconductor.agilent.com/barcode/sg/Misc/code_39.html
|
||||||
|
http://www.adams1.com/pub/russadam/39code.html
|
||||||
|
http://www.barcodeman.com/c39_1.html
|
||||||
|
|
||||||
|
Official Spec, "ANSI/AIM BC1-1995, USS" is available for US$45 from
|
||||||
|
http://www.aimglobal.org/aimstore/
|
||||||
|
"""
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
vval = ""
|
||||||
|
self.valid = 1
|
||||||
|
for c in self.value:
|
||||||
|
if c in string.lowercase:
|
||||||
|
c = string.upper(c)
|
||||||
|
if c not in _stdchrs:
|
||||||
|
self.valid = 0
|
||||||
|
continue
|
||||||
|
vval = vval + c
|
||||||
|
self.validated = vval
|
||||||
|
return vval
|
||||||
|
|
||||||
|
def encode(self):
|
||||||
|
self.encoded = _encode39(self.validated, self.checksum)
|
||||||
|
return self.encoded
|
||||||
|
|
||||||
|
|
||||||
|
class Extended39(_Code39Base):
|
||||||
|
"""
|
||||||
|
Extended Code 39 is a convention for encoding additional characters
|
||||||
|
not present in stanmdard Code 39 by using pairs of characters to
|
||||||
|
represent the characters missing in Standard Code 39.
|
||||||
|
|
||||||
|
See Standard39 for arguments.
|
||||||
|
|
||||||
|
Sources of Information on Extended Code 39:
|
||||||
|
|
||||||
|
http://www.semiconductor.agilent.com/barcode/sg/Misc/xcode_39.html
|
||||||
|
http://www.barcodeman.com/c39_ext.html
|
||||||
|
"""
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
vval = ""
|
||||||
|
self.valid = 1
|
||||||
|
for c in self.value:
|
||||||
|
if c not in _extchrs:
|
||||||
|
self.valid = 0
|
||||||
|
continue
|
||||||
|
vval = vval + c
|
||||||
|
self.validated = vval
|
||||||
|
return vval
|
||||||
|
|
||||||
|
def encode(self):
|
||||||
|
self.encoded = ""
|
||||||
|
for c in self.validated:
|
||||||
|
if _extended.has_key(c):
|
||||||
|
self.encoded = self.encoded + _extended[c]
|
||||||
|
elif c in _stdchrs:
|
||||||
|
self.encoded = self.encoded + c
|
||||||
|
else:
|
||||||
|
raise ValueError
|
||||||
|
self.encoded = _encode39(self.encoded, self.checksum)
|
||||||
|
return self.encoded
|
|
@ -0,0 +1,232 @@
|
||||||
|
#
|
||||||
|
# Copyright (c) 2000 Tyler C. Sarna <tsarna@sarna.org>
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# 3. All advertising materials mentioning features or use of this software
|
||||||
|
# must display the following acknowledgement:
|
||||||
|
# This product includes software developed by Tyler C. Sarna.
|
||||||
|
# 4. Neither the name of the author nor the names of contributors
|
||||||
|
# may be used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
|
||||||
|
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
|
||||||
|
from reportlab.lib.units import inch
|
||||||
|
from common import MultiWidthBarcode
|
||||||
|
import string
|
||||||
|
|
||||||
|
_patterns = {
|
||||||
|
'0' : ('AcAaAb', 0), '1' : ('AaAbAc', 1), '2' : ('AaAcAb', 2),
|
||||||
|
'3' : ('AaAdAa', 3), '4' : ('AbAaAc', 4), '5' : ('AbAbAb', 5),
|
||||||
|
'6' : ('AbAcAa', 6), '7' : ('AaAaAd', 7), '8' : ('AcAbAa', 8),
|
||||||
|
'9' : ('AdAaAa', 9), 'A' : ('BaAaAc', 10), 'B' : ('BaAbAb', 11),
|
||||||
|
'C' : ('BaAcAa', 12), 'D' : ('BbAaAb', 13), 'E' : ('BbAbAa', 14),
|
||||||
|
'F' : ('BcAaAa', 15), 'G' : ('AaBaAc', 16), 'H' : ('AaBbAb', 17),
|
||||||
|
'I' : ('AaBcAa', 18), 'J' : ('AbBaAb', 19), 'K' : ('AcBaAa', 20),
|
||||||
|
'L' : ('AaAaBc', 21), 'M' : ('AaAbBb', 22), 'N' : ('AaAcBa', 23),
|
||||||
|
'O' : ('AbAaBb', 24), 'P' : ('AcAaBa', 25), 'Q' : ('BaBaAb', 26),
|
||||||
|
'R' : ('BaBbAa', 27), 'S' : ('BaAaBb', 28), 'T' : ('BaAbBa', 29),
|
||||||
|
'U' : ('BbAaBa', 30), 'V' : ('BbBaAa', 31), 'W' : ('AaBaBb', 32),
|
||||||
|
'X' : ('AaBbBa', 33), 'Y' : ('AbBaBa', 34), 'Z' : ('AbCaAa', 35),
|
||||||
|
'-' : ('AbAaCa', 36), '.' : ('CaAaAb', 37), ' ' : ('CaAbAa', 38),
|
||||||
|
'$' : ('CbAaAa', 39), '/' : ('AaBaCa', 40), '+' : ('AaCaBa', 41),
|
||||||
|
'%' : ('BaAaCa', 42), '#' : ('AbAbBa', 43), '!' : ('CaBaAa', 44),
|
||||||
|
'=' : ('CaAaBa', 45), '&' : ('AbBbAa', 46),
|
||||||
|
'start' : ('AaAaDa', -1), 'stop' : ('AaAaDaA', -2)
|
||||||
|
}
|
||||||
|
|
||||||
|
_charsbyval = {}
|
||||||
|
for k, v in _patterns.items():
|
||||||
|
_charsbyval[v[1]] = k
|
||||||
|
|
||||||
|
_extended = {
|
||||||
|
'\x00' : '!U', '\x01' : '#A', '\x02' : '#B', '\x03' : '#C',
|
||||||
|
'\x04' : '#D', '\x05' : '#E', '\x06' : '#F', '\x07' : '#G',
|
||||||
|
'\x08' : '#H', '\x09' : '#I', '\x0a' : '#J', '\x0b' : '#K',
|
||||||
|
'\x0c' : '#L', '\x0d' : '#M', '\x0e' : '#N', '\x0f' : '#O',
|
||||||
|
'\x10' : '#P', '\x11' : '#Q', '\x12' : '#R', '\x13' : '#S',
|
||||||
|
'\x14' : '#T', '\x15' : '#U', '\x16' : '#V', '\x17' : '#W',
|
||||||
|
'\x18' : '#X', '\x19' : '#Y', '\x1a' : '#Z', '\x1b' : '!A',
|
||||||
|
'\x1c' : '!B', '\x1d' : '!C', '\x1e' : '!D', '\x1f' : '!E',
|
||||||
|
'!' : '=A', '"' : '=B', '#' : '=C', '$' : '=D',
|
||||||
|
'%' : '=E', '&' : '=F', '\'' : '=G', '(' : '=H',
|
||||||
|
')' : '=I', '*' : '=J', '+' : '=K', ',' : '=L',
|
||||||
|
'/' : '=O', ':' : '=Z', ';' : '!F', '<' : '!G',
|
||||||
|
'=' : '!H', '>' : '!I', '?' : '!J', '@' : '!V',
|
||||||
|
'[' : '!K', '\\' : '!L', ']' : '!M', '^' : '!N',
|
||||||
|
'_' : '!O', '`' : '!W', 'a' : '&A', 'b' : '&B',
|
||||||
|
'c' : '&C', 'd' : '&D', 'e' : '&E', 'f' : '&F',
|
||||||
|
'g' : '&G', 'h' : '&H', 'i' : '&I', 'j' : '&J',
|
||||||
|
'k' : '&K', 'l' : '&L', 'm' : '&M', 'n' : '&N',
|
||||||
|
'o' : '&O', 'p' : '&P', 'q' : '&Q', 'r' : '&R',
|
||||||
|
's' : '&S', 't' : '&T', 'u' : '&U', 'v' : '&V',
|
||||||
|
'w' : '&W', 'x' : '&X', 'y' : '&Y', 'z' : '&Z',
|
||||||
|
'{' : '!P', '|' : '!Q', '}' : '!R', '~' : '!S',
|
||||||
|
'\x7f' : '!T'
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def _encode93(str):
|
||||||
|
s = map(None, str)
|
||||||
|
s.reverse()
|
||||||
|
|
||||||
|
# compute 'C' checksum
|
||||||
|
i = 0; v = 1; c = 0
|
||||||
|
while i < len(s):
|
||||||
|
c = c + v * _patterns[s[i]][1]
|
||||||
|
i = i + 1; v = v + 1
|
||||||
|
if v > 20:
|
||||||
|
v = 1
|
||||||
|
s.insert(0, _charsbyval[c % 47])
|
||||||
|
|
||||||
|
# compute 'K' checksum
|
||||||
|
i = 0; v = 1; c = 0
|
||||||
|
while i < len(s):
|
||||||
|
c = c + v * _patterns[s[i]][1]
|
||||||
|
i = i + 1; v = v + 1
|
||||||
|
if v > 15:
|
||||||
|
v = 1
|
||||||
|
s.insert(0, _charsbyval[c % 47])
|
||||||
|
|
||||||
|
s.reverse()
|
||||||
|
|
||||||
|
return string.join(s, '')
|
||||||
|
|
||||||
|
|
||||||
|
class _Code93Base(MultiWidthBarcode):
|
||||||
|
def __init__(self, value='', **args):
|
||||||
|
self.xdim = inch * 0.0075
|
||||||
|
self.lquiet = None
|
||||||
|
self.rquiet = None
|
||||||
|
self.quiet = 1
|
||||||
|
self.height = None
|
||||||
|
|
||||||
|
if type(value) is type(1):
|
||||||
|
value = str(value)
|
||||||
|
|
||||||
|
for (k, v) in args.items():
|
||||||
|
setattr(self, k, v)
|
||||||
|
|
||||||
|
if self.quiet:
|
||||||
|
if self.lquiet is None:
|
||||||
|
self.lquiet = max(inch * 0.25, self.xdim * 10.0)
|
||||||
|
self.rquiet = max(inch * 0.25, self.xdim * 10.0)
|
||||||
|
else:
|
||||||
|
self.lquiet = self.rquiet = 0.0
|
||||||
|
|
||||||
|
MultiWidthBarcode.__init__(self, value)
|
||||||
|
|
||||||
|
def decompose(self):
|
||||||
|
dval = _patterns['start'][0]
|
||||||
|
for c in self.encoded:
|
||||||
|
dval = dval + _patterns[c][0]
|
||||||
|
self.decomposed = dval + _patterns['stop'][0]
|
||||||
|
return self.decomposed
|
||||||
|
|
||||||
|
|
||||||
|
class Standard93(_Code93Base):
|
||||||
|
"""
|
||||||
|
Code 93 is a Uppercase alphanumeric symbology with some punctuation.
|
||||||
|
See Extended Code 93 for a variant that can represent the entire
|
||||||
|
128 characrter ASCII set.
|
||||||
|
|
||||||
|
Options that may be passed to constructor:
|
||||||
|
|
||||||
|
value (int, or numeric string. required.):
|
||||||
|
The value to encode.
|
||||||
|
|
||||||
|
xdim (float, default .0075):
|
||||||
|
X-Dimension, or width of the smallest element
|
||||||
|
Minumum is .0075 inch (7.5 mils).
|
||||||
|
|
||||||
|
height (float, see default below):
|
||||||
|
Height of the symbol. Default is the height of the two
|
||||||
|
bearer bars (if they exist) plus the greater of .25 inch
|
||||||
|
or .15 times the symbol's length.
|
||||||
|
|
||||||
|
quiet (bool, default 1):
|
||||||
|
Wether to include quiet zones in the symbol.
|
||||||
|
|
||||||
|
lquiet (float, see default below):
|
||||||
|
Quiet zone size to left of code, if quiet is true.
|
||||||
|
Default is the greater of .25 inch, or 10 xdim
|
||||||
|
|
||||||
|
rquiet (float, defaults as above):
|
||||||
|
Quiet zone size to right left of code, if quiet is true.
|
||||||
|
|
||||||
|
Sources of Information on Code 93:
|
||||||
|
|
||||||
|
http://www.semiconductor.agilent.com/barcode/sg/Misc/code_93.html
|
||||||
|
|
||||||
|
Official Spec, "NSI/AIM BC5-1995, USS" is available for US$45 from
|
||||||
|
http://www.aimglobal.org/aimstore/
|
||||||
|
"""
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
vval = ""
|
||||||
|
self.valid = 1
|
||||||
|
for c in self.value:
|
||||||
|
if c in string.lowercase:
|
||||||
|
c = string.upper(c)
|
||||||
|
if not _patterns.has_key(c):
|
||||||
|
self.valid = 0
|
||||||
|
continue
|
||||||
|
vval = vval + c
|
||||||
|
self.validated = vval
|
||||||
|
return vval
|
||||||
|
|
||||||
|
def encode(self):
|
||||||
|
self.encoded = _encode93(self.validated)
|
||||||
|
return self.encoded
|
||||||
|
|
||||||
|
|
||||||
|
class Extended93(_Code93Base):
|
||||||
|
"""
|
||||||
|
Extended Code 93 is a convention for encoding the entire 128 character
|
||||||
|
set using pairs of characters to represent the characters missing in
|
||||||
|
Standard Code 93. It is very much like Extended Code 39 in that way.
|
||||||
|
|
||||||
|
See Standard93 for arguments.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
vval = ""
|
||||||
|
self.valid = 1
|
||||||
|
for c in self.value:
|
||||||
|
if not _patterns.has_key(c) and not _extended.has_key(c):
|
||||||
|
self.valid = 0
|
||||||
|
continue
|
||||||
|
vval = vval + c
|
||||||
|
self.validated = vval
|
||||||
|
return vval
|
||||||
|
|
||||||
|
def encode(self):
|
||||||
|
self.encoded = ""
|
||||||
|
for c in self.validated:
|
||||||
|
if _patterns.has_key(c):
|
||||||
|
self.encoded = self.encoded + c
|
||||||
|
elif _extended.has_key(c):
|
||||||
|
self.encoded = self.encoded + _extended[c]
|
||||||
|
else:
|
||||||
|
raise ValueError
|
||||||
|
self.encoded = _encode93(self.encoded)
|
||||||
|
return self.encoded
|
|
@ -0,0 +1,705 @@
|
||||||
|
#
|
||||||
|
# Copyright (c) 1996-2000 Tyler C. Sarna <tsarna@sarna.org>
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# 3. All advertising materials mentioning features or use of this software
|
||||||
|
# must display the following acknowledgement:
|
||||||
|
# This product includes software developed by Tyler C. Sarna.
|
||||||
|
# 4. Neither the name of the author nor the names of contributors
|
||||||
|
# may be used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
|
||||||
|
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
|
||||||
|
from reportlab.platypus.flowables import Flowable
|
||||||
|
from reportlab.lib.units import inch
|
||||||
|
import string
|
||||||
|
|
||||||
|
class Barcode(Flowable):
|
||||||
|
"""Abstract Base for barcodes. Includes implementations of
|
||||||
|
some methods suitable for the more primitive barcode types"""
|
||||||
|
|
||||||
|
def __init__(self, value = ''):
|
||||||
|
self.value = value
|
||||||
|
|
||||||
|
if not hasattr(self, 'gap'):
|
||||||
|
self.gap = None
|
||||||
|
|
||||||
|
self.validate()
|
||||||
|
self.encode()
|
||||||
|
#print self.encoded
|
||||||
|
self.decompose()
|
||||||
|
#print self.decomposed
|
||||||
|
self.computeSize()
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
self.valid = 1
|
||||||
|
self.validated = self.value
|
||||||
|
|
||||||
|
def encode(self):
|
||||||
|
self.encoded = self.validated
|
||||||
|
|
||||||
|
def decompose(self):
|
||||||
|
self.decomposed = self.encoded
|
||||||
|
|
||||||
|
def computeSize(self, *args):
|
||||||
|
xdim = self.xdim
|
||||||
|
wx = xdim * self.ratio
|
||||||
|
|
||||||
|
if self.gap == None:
|
||||||
|
self.gap = xdim
|
||||||
|
|
||||||
|
w = 0.0
|
||||||
|
|
||||||
|
for c in self.decomposed:
|
||||||
|
if c in 'sb':
|
||||||
|
w = w + xdim
|
||||||
|
elif c in 'SB':
|
||||||
|
w = w + wx
|
||||||
|
else: # 'i'
|
||||||
|
w = w + self.gap
|
||||||
|
|
||||||
|
if self.height is None:
|
||||||
|
self.height = w * 0.15
|
||||||
|
self.height = max(0.25 * inch, self.height)
|
||||||
|
if self.bearers:
|
||||||
|
self.height = self.height + self.bearers * 2.0 * xdim
|
||||||
|
|
||||||
|
if self.quiet:
|
||||||
|
w = w + self.lquiet + self.rquiet
|
||||||
|
self.xo = self.lquiet
|
||||||
|
else:
|
||||||
|
self.xo = 0.0
|
||||||
|
|
||||||
|
self.width = w
|
||||||
|
|
||||||
|
def draw(self):
|
||||||
|
xdim = self.xdim
|
||||||
|
wx = xdim * self.ratio
|
||||||
|
|
||||||
|
left = self.xo
|
||||||
|
b = self.bearers * xdim
|
||||||
|
bb = b * 0.5
|
||||||
|
tb = self.height - (b * 1.5)
|
||||||
|
|
||||||
|
for c in self.decomposed:
|
||||||
|
if c == 'i':
|
||||||
|
left = left + self.gap
|
||||||
|
elif c == 's':
|
||||||
|
left = left + xdim
|
||||||
|
elif c == 'S':
|
||||||
|
left = left + wx
|
||||||
|
elif c == 'b':
|
||||||
|
self.rect(left, bb, xdim, tb)
|
||||||
|
left = left + xdim
|
||||||
|
elif c == 'B':
|
||||||
|
self.rect(left, bb, wx, tb)
|
||||||
|
left = left + wx
|
||||||
|
|
||||||
|
if self.bearers:
|
||||||
|
self.rect(self.lquiet, 0.0, \
|
||||||
|
self.width - (self.lquiet + self.rquiet), b)
|
||||||
|
self.rect(self.lquiet, self.height - b, \
|
||||||
|
self.width - (self.lquiet + self.rquiet), b)
|
||||||
|
|
||||||
|
def rect(self, x, y, w, h):
|
||||||
|
self.canv.rect(x, y, w, h, stroke=0, fill=1)
|
||||||
|
|
||||||
|
|
||||||
|
class MultiWidthBarcode(Barcode):
|
||||||
|
"""Base for variable-bar-width codes like Code93 and Code128"""
|
||||||
|
|
||||||
|
def computeSize(self, *args):
|
||||||
|
xdim = self.xdim
|
||||||
|
oa, oA = ord('a') - 1, ord('A') - 1
|
||||||
|
|
||||||
|
w = 0.0
|
||||||
|
|
||||||
|
for c in self.decomposed:
|
||||||
|
oc = ord(c)
|
||||||
|
if c in string.lowercase:
|
||||||
|
w = w + xdim * (oc - oa)
|
||||||
|
elif c in string.uppercase:
|
||||||
|
w = w + xdim * (oc - oA)
|
||||||
|
|
||||||
|
if self.height is None:
|
||||||
|
self.height = w * 0.15
|
||||||
|
self.height = max(0.25 * inch, self.height)
|
||||||
|
|
||||||
|
if self.quiet:
|
||||||
|
w = w + self.lquiet + self.rquiet
|
||||||
|
self.xo = self.lquiet
|
||||||
|
else:
|
||||||
|
self.xo = 0.0
|
||||||
|
|
||||||
|
self.width = w
|
||||||
|
|
||||||
|
def draw(self):
|
||||||
|
oa, oA = ord('a') - 1, ord('A') - 1
|
||||||
|
xdim = self.xdim
|
||||||
|
left = self.xo
|
||||||
|
|
||||||
|
for c in self.decomposed:
|
||||||
|
oc = ord(c)
|
||||||
|
if c in string.lowercase:
|
||||||
|
left = left + (oc - oa) * xdim
|
||||||
|
elif c in string.uppercase:
|
||||||
|
w = (oc - oA) * xdim
|
||||||
|
self.rect(left, 0.0, w, self.height)
|
||||||
|
left = left + w
|
||||||
|
|
||||||
|
|
||||||
|
class I2of5(Barcode):
|
||||||
|
"""
|
||||||
|
Interleaved 2 of 5 is a numeric-only barcode. It encodes an even
|
||||||
|
number of digits; if an odd number is given, a 0 is prepended.
|
||||||
|
|
||||||
|
Options that may be passed to constructor:
|
||||||
|
|
||||||
|
value (int, or numeric string. required.):
|
||||||
|
The value to encode.
|
||||||
|
|
||||||
|
xdim (float, default .0075):
|
||||||
|
X-Dimension, or width of the smallest element
|
||||||
|
Minumum is .0075 inch (7.5 mils).
|
||||||
|
|
||||||
|
ratio (float, default 2.2):
|
||||||
|
The ratio of wide elements to narrow elements.
|
||||||
|
Must be between 2.0 and 3.0 (or 2.2 and 3.0 if the
|
||||||
|
xdim is greater than 20 mils (.02 inch))
|
||||||
|
|
||||||
|
gap (float or None, default None):
|
||||||
|
width of intercharacter gap. None means "use xdim".
|
||||||
|
|
||||||
|
height (float, see default below):
|
||||||
|
Height of the symbol. Default is the height of the two
|
||||||
|
bearer bars (if they exist) plus the greater of .25 inch
|
||||||
|
or .15 times the symbol's length.
|
||||||
|
|
||||||
|
checksum (bool, default 1):
|
||||||
|
Wether to compute and include the check digit
|
||||||
|
|
||||||
|
bearers (float, in units of xdim. default 3.0):
|
||||||
|
Height of bearer bars (horizontal bars along the top and
|
||||||
|
bottom of the barcode). Default is 3 x-dimensions.
|
||||||
|
Set to zero for no bearer bars. (Bearer bars help detect
|
||||||
|
misscans, so it is suggested to leave them on).
|
||||||
|
|
||||||
|
quiet (bool, default 1):
|
||||||
|
Wether to include quiet zones in the symbol.
|
||||||
|
|
||||||
|
lquiet (float, see default below):
|
||||||
|
Quiet zone size to left of code, if quiet is true.
|
||||||
|
Default is the greater of .25 inch, or .15 times the symbol's
|
||||||
|
length.
|
||||||
|
|
||||||
|
rquiet (float, defaults as above):
|
||||||
|
Quiet zone size to right left of code, if quiet is true.
|
||||||
|
|
||||||
|
Sources of Information on Interleaved 2 of 5:
|
||||||
|
|
||||||
|
http://www.semiconductor.agilent.com/barcode/sg/Misc/i_25.html
|
||||||
|
http://www.adams1.com/pub/russadam/i25code.html
|
||||||
|
|
||||||
|
Official Spec, "ANSI/AIM BC2-1995, USS" is available for US$45 from
|
||||||
|
http://www.aimglobal.org/aimstore/
|
||||||
|
"""
|
||||||
|
|
||||||
|
patterns = {
|
||||||
|
'start' : 'bsbs',
|
||||||
|
'stop' : 'Bsb',
|
||||||
|
|
||||||
|
'B0' : 'bbBBb', 'S0' : 'ssSSs',
|
||||||
|
'B1' : 'BbbbB', 'S1' : 'SsssS',
|
||||||
|
'B2' : 'bBbbB', 'S2' : 'sSssS',
|
||||||
|
'B3' : 'BBbbb', 'S3' : 'SSsss',
|
||||||
|
'B4' : 'bbBbB', 'S4' : 'ssSsS',
|
||||||
|
'B5' : 'BbBbb', 'S5' : 'SsSss',
|
||||||
|
'B6' : 'bBBbb', 'S6' : 'sSSss',
|
||||||
|
'B7' : 'bbbBB', 'S7' : 'sssSS',
|
||||||
|
'B8' : 'BbbBb', 'S8' : 'SssSs',
|
||||||
|
'B9' : 'bBbBb', 'S9' : 'sSsSs'
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(self, value='', **args):
|
||||||
|
self.height = None
|
||||||
|
self.xdim = inch * 0.0075
|
||||||
|
self.ratio = 2.2
|
||||||
|
self.checksum = 1
|
||||||
|
self.bearers = 3.0
|
||||||
|
self.quiet = 1
|
||||||
|
self.lquiet = self.rquiet = None
|
||||||
|
|
||||||
|
if type(value) == type(1):
|
||||||
|
value = str(value)
|
||||||
|
|
||||||
|
for (k, v) in args.items():
|
||||||
|
setattr(self, k, v)
|
||||||
|
|
||||||
|
if self.quiet:
|
||||||
|
if self.lquiet is None:
|
||||||
|
self.lquiet = min(inch * 0.25, self.xdim * 10.0)
|
||||||
|
self.rquiet = min(inch * 0.25, self.xdim * 10.0)
|
||||||
|
else:
|
||||||
|
self.lquiet = self.rquiet = 0.0
|
||||||
|
|
||||||
|
Barcode.__init__(self, value)
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
vval = ""
|
||||||
|
self.valid = 1
|
||||||
|
for c in string.strip(self.value):
|
||||||
|
if c not in string.digits:
|
||||||
|
self.valid = 0
|
||||||
|
continue
|
||||||
|
vval = vval + c
|
||||||
|
self.validated = vval
|
||||||
|
return vval
|
||||||
|
|
||||||
|
def encode(self):
|
||||||
|
s = self.validated
|
||||||
|
|
||||||
|
# make sure result will be a multiple of 2 digits long,
|
||||||
|
# checksum included
|
||||||
|
if ((len(self.validated) % 2 == 0) and self.checksum) \
|
||||||
|
or ((len(self.validated) % 2 == 1) and not self.checksum):
|
||||||
|
s = '0' + s
|
||||||
|
|
||||||
|
if self.checksum:
|
||||||
|
c = 0
|
||||||
|
cm = 3
|
||||||
|
|
||||||
|
for d in s:
|
||||||
|
c = c + cm * int(d)
|
||||||
|
if cm == 3:
|
||||||
|
cm = 1
|
||||||
|
else:
|
||||||
|
cm = 3
|
||||||
|
|
||||||
|
d = 10 - (int(d) % 10)
|
||||||
|
s = s + `d`
|
||||||
|
|
||||||
|
self.encoded = s
|
||||||
|
|
||||||
|
def decompose(self):
|
||||||
|
dval = self.patterns['start']
|
||||||
|
|
||||||
|
for i in range(0, len(self.encoded), 2):
|
||||||
|
b = self.patterns['B' + self.encoded[i]]
|
||||||
|
s = self.patterns['S' + self.encoded[i+1]]
|
||||||
|
|
||||||
|
for i in range(0, len(b)):
|
||||||
|
dval = dval + b[i] + s[i]
|
||||||
|
|
||||||
|
self.decomposed = dval + self.patterns['stop']
|
||||||
|
return self.decomposed
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class MSI(Barcode):
|
||||||
|
"""
|
||||||
|
MSI is a numeric-only barcode.
|
||||||
|
|
||||||
|
Options that may be passed to constructor:
|
||||||
|
|
||||||
|
value (int, or numeric string. required.):
|
||||||
|
The value to encode.
|
||||||
|
|
||||||
|
xdim (float, default .0075):
|
||||||
|
X-Dimension, or width of the smallest element
|
||||||
|
|
||||||
|
ratio (float, default 2.2):
|
||||||
|
The ratio of wide elements to narrow elements.
|
||||||
|
|
||||||
|
gap (float or None, default None):
|
||||||
|
width of intercharacter gap. None means "use xdim".
|
||||||
|
|
||||||
|
height (float, see default below):
|
||||||
|
Height of the symbol. Default is the height of the two
|
||||||
|
bearer bars (if they exist) plus the greater of .25 inch
|
||||||
|
or .15 times the symbol's length.
|
||||||
|
|
||||||
|
checksum (bool, default 1):
|
||||||
|
Wether to compute and include the check digit
|
||||||
|
|
||||||
|
bearers (float, in units of xdim. default 0):
|
||||||
|
Height of bearer bars (horizontal bars along the top and
|
||||||
|
bottom of the barcode). Default is 0 (no bearers).
|
||||||
|
|
||||||
|
lquiet (float, see default below):
|
||||||
|
Quiet zone size to left of code, if quiet is true.
|
||||||
|
Default is the greater of .25 inch, or 10 xdims.
|
||||||
|
|
||||||
|
rquiet (float, defaults as above):
|
||||||
|
Quiet zone size to right left of code, if quiet is true.
|
||||||
|
|
||||||
|
Sources of Information on MSI Bar Code:
|
||||||
|
|
||||||
|
http://www.semiconductor.agilent.com/barcode/sg/Misc/msi_code.html
|
||||||
|
http://www.adams1.com/pub/russadam/plessy.html
|
||||||
|
"""
|
||||||
|
|
||||||
|
patterns = {
|
||||||
|
'start' : 'Bs', 'stop' : 'bSb',
|
||||||
|
|
||||||
|
'0' : 'bSbSbSbS', '1' : 'bSbSbSBs',
|
||||||
|
'2' : 'bSbSBsbS', '3' : 'bSbSBsBs',
|
||||||
|
'4' : 'bSBsbSbS', '5' : 'bSBsbSBs',
|
||||||
|
'6' : 'bSBsBsbS', '7' : 'bSBsBsBs',
|
||||||
|
'8' : 'BsbSbSbS', '9' : 'BsbSbSBs'
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(self, value="", **args):
|
||||||
|
self.height = None
|
||||||
|
self.xdim = inch * 0.0075
|
||||||
|
self.ratio = 2.2
|
||||||
|
self.checksum = 1
|
||||||
|
self.bearers = 0.0
|
||||||
|
self.quiet = 1
|
||||||
|
self.lquiet = self.rquiet = None
|
||||||
|
|
||||||
|
if type(value) == type(1):
|
||||||
|
value = str(value)
|
||||||
|
|
||||||
|
for (k, v) in args.items():
|
||||||
|
setattr(self, k, v)
|
||||||
|
|
||||||
|
if self.quiet:
|
||||||
|
if self.lquiet is None:
|
||||||
|
self.lquiet = max(inch * 0.25, self.xdim * 10.0)
|
||||||
|
self.rquiet = max(inch * 0.25, self.xdim * 10.0)
|
||||||
|
else:
|
||||||
|
self.lquiet = self.rquiet = 0.0
|
||||||
|
|
||||||
|
Barcode.__init__(self, value)
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
vval = ""
|
||||||
|
self.valid = 1
|
||||||
|
for c in string.strip(self.value):
|
||||||
|
if c not in string.digits:
|
||||||
|
self.valid = 0
|
||||||
|
continue
|
||||||
|
vval = vval + c
|
||||||
|
self.validated = vval
|
||||||
|
return vval
|
||||||
|
|
||||||
|
def encode(self):
|
||||||
|
s = self.validated
|
||||||
|
|
||||||
|
if self.checksum:
|
||||||
|
c = ''
|
||||||
|
for i in range(1, len(s), 2):
|
||||||
|
c = c + s[i]
|
||||||
|
d = str(int(c) * 2)
|
||||||
|
t = 0
|
||||||
|
for c in d:
|
||||||
|
t = t + int(c)
|
||||||
|
for i in range(0, len(s), 2):
|
||||||
|
t = t + int(s[i])
|
||||||
|
c = 10 - (t % 10)
|
||||||
|
|
||||||
|
s = s + str(c)
|
||||||
|
|
||||||
|
self.encoded = s
|
||||||
|
|
||||||
|
def decompose(self):
|
||||||
|
dval = self.patterns['start']
|
||||||
|
|
||||||
|
for c in self.encoded:
|
||||||
|
dval = dval + self.patterns[c]
|
||||||
|
|
||||||
|
self.decomposed = dval + self.patterns['stop']
|
||||||
|
return self.decomposed
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Codabar(Barcode):
|
||||||
|
"""
|
||||||
|
Codabar is a numeric plus some puntuation ("-$:/.+") barcode
|
||||||
|
with four start/stop characters (A, B, C, and D).
|
||||||
|
|
||||||
|
Options that may be passed to constructor:
|
||||||
|
|
||||||
|
value (string. required.):
|
||||||
|
The value to encode.
|
||||||
|
|
||||||
|
xdim (float, default .0065):
|
||||||
|
X-Dimension, or width of the smallest element
|
||||||
|
minimum is 6.5 mils (.0065 inch)
|
||||||
|
|
||||||
|
ratio (float, default 2.0):
|
||||||
|
The ratio of wide elements to narrow elements.
|
||||||
|
|
||||||
|
gap (float or None, default None):
|
||||||
|
width of intercharacter gap. None means "use xdim".
|
||||||
|
|
||||||
|
height (float, see default below):
|
||||||
|
Height of the symbol. Default is the height of the two
|
||||||
|
bearer bars (if they exist) plus the greater of .25 inch
|
||||||
|
or .15 times the symbol's length.
|
||||||
|
|
||||||
|
checksum (bool, default 0):
|
||||||
|
Wether to compute and include the check digit
|
||||||
|
|
||||||
|
bearers (float, in units of xdim. default 0):
|
||||||
|
Height of bearer bars (horizontal bars along the top and
|
||||||
|
bottom of the barcode). Default is 0 (no bearers).
|
||||||
|
|
||||||
|
quiet (bool, default 1):
|
||||||
|
Wether to include quiet zones in the symbol.
|
||||||
|
|
||||||
|
lquiet (float, see default below):
|
||||||
|
Quiet zone size to left of code, if quiet is true.
|
||||||
|
Default is the greater of .25 inch, or 10 xdim
|
||||||
|
|
||||||
|
rquiet (float, defaults as above):
|
||||||
|
Quiet zone size to right left of code, if quiet is true.
|
||||||
|
|
||||||
|
Sources of Information on Codabar
|
||||||
|
|
||||||
|
http://www.semiconductor.agilent.com/barcode/sg/Misc/codabar.html
|
||||||
|
http://www.barcodeman.com/codabar.html
|
||||||
|
|
||||||
|
Official Spec, "ANSI/AIM BC3-1995, USS" is available for US$45 from
|
||||||
|
http://www.aimglobal.org/aimstore/
|
||||||
|
"""
|
||||||
|
|
||||||
|
patterns = {
|
||||||
|
'0': 'bsbsbSB', '1': 'bsbsBSb', '2': 'bsbSbsB',
|
||||||
|
'3': 'BSbsbsb', '4': 'bsBsbSb', '5': 'BsbsbSb',
|
||||||
|
'6': 'bSbsbsB', '7': 'bSbsBsb', '8': 'bSBsbsb',
|
||||||
|
'9': 'BsbSbsb', '-': 'bsbSBsb', '$': 'bsBSbsb',
|
||||||
|
':': 'BsbsBsB', '/': 'BsBsbsB', '.': 'BsBsBsb',
|
||||||
|
'+': 'bsBsBsB', 'A': 'bsBSbSb', 'B': 'bSbSbsB',
|
||||||
|
'C': 'bsbSbSB', 'D': 'bsbSBSb'
|
||||||
|
}
|
||||||
|
|
||||||
|
values = {
|
||||||
|
'0' : 0, '1' : 1, '2' : 2, '3' : 3, '4' : 4,
|
||||||
|
'5' : 5, '6' : 6, '7' : 7, '8' : 8, '9' : 9,
|
||||||
|
'-' : 10, '$' : 11, ':' : 12, '/' : 13, '.' : 14,
|
||||||
|
'+' : 15, 'A' : 16, 'B' : 17, 'C' : 18, 'D' : 19
|
||||||
|
}
|
||||||
|
|
||||||
|
chars = string.digits + "-$:/.+"
|
||||||
|
|
||||||
|
def __init__(self, value='', **args):
|
||||||
|
self.height = None
|
||||||
|
self.xdim = inch * 0.0065
|
||||||
|
self.ratio = 2.0 # XXX ?
|
||||||
|
self.checksum = 0
|
||||||
|
self.bearers = 0.0
|
||||||
|
self.quiet = 1
|
||||||
|
self.lquiet = self.rquiet = None
|
||||||
|
|
||||||
|
if type(value) == type(1):
|
||||||
|
value = str(value)
|
||||||
|
|
||||||
|
for (k, v) in args.items():
|
||||||
|
setattr(self, k, v)
|
||||||
|
|
||||||
|
if self.quiet:
|
||||||
|
if self.lquiet is None:
|
||||||
|
self.lquiet = min(inch * 0.25, self.xdim * 10.0)
|
||||||
|
self.rquiet = min(inch * 0.25, self.xdim * 10.0)
|
||||||
|
else:
|
||||||
|
self.lquiet = self.rquiet = 0.0
|
||||||
|
|
||||||
|
Barcode.__init__(self, value)
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
vval = ""
|
||||||
|
self.valid = 1
|
||||||
|
s = string.strip(self.value)
|
||||||
|
for i in range(0, len(s)):
|
||||||
|
c = s[i]
|
||||||
|
if c not in self.chars:
|
||||||
|
if ((i != 0) and (i != len(s) - 1)) or (c not in 'ABCD'):
|
||||||
|
self.Valid = 0
|
||||||
|
continue
|
||||||
|
vval = vval + c
|
||||||
|
|
||||||
|
if vval[0] not in 'ABCD':
|
||||||
|
vval = 'A' + vval
|
||||||
|
if vval[-1] not in 'ABCD':
|
||||||
|
vval = vval + vval[0]
|
||||||
|
|
||||||
|
self.validated = vval
|
||||||
|
return vval
|
||||||
|
|
||||||
|
def encode(self):
|
||||||
|
s = self.validated
|
||||||
|
|
||||||
|
if self.checksum:
|
||||||
|
v = 0
|
||||||
|
for c in s:
|
||||||
|
v = v + self.values[v]
|
||||||
|
v = 16 - (v % 16)
|
||||||
|
s = s + self.chars[v]
|
||||||
|
|
||||||
|
self.encoded = s
|
||||||
|
|
||||||
|
def decompose(self):
|
||||||
|
dval = ""
|
||||||
|
for c in self.encoded:
|
||||||
|
dval = dval + self.patterns[c] + 'i'
|
||||||
|
self.decomposed = dval[:-1]
|
||||||
|
return self.decomposed
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Code11(Barcode):
|
||||||
|
"""
|
||||||
|
Code 11 is an almost-numeric barcode. It encodes the digits 0-9 plus
|
||||||
|
dash ("-"). 11 characters total, hence the name.
|
||||||
|
|
||||||
|
value (int or string. required.):
|
||||||
|
The value to encode.
|
||||||
|
|
||||||
|
xdim (float, default .0075):
|
||||||
|
X-Dimension, or width of the smallest element
|
||||||
|
|
||||||
|
ratio (float, default 2.2):
|
||||||
|
The ratio of wide elements to narrow elements.
|
||||||
|
|
||||||
|
gap (float or None, default None):
|
||||||
|
width of intercharacter gap. None means "use xdim".
|
||||||
|
|
||||||
|
height (float, see default below):
|
||||||
|
Height of the symbol. Default is the height of the two
|
||||||
|
bearer bars (if they exist) plus the greater of .25 inch
|
||||||
|
or .15 times the symbol's length.
|
||||||
|
|
||||||
|
checksum (0 none, 1 1-digit, 2 2-digit, -1 auto, default -1):
|
||||||
|
How many checksum digits to include. -1 ("auto") means
|
||||||
|
1 if the number of digits is 10 or less, else 2.
|
||||||
|
|
||||||
|
bearers (float, in units of xdim. default 0):
|
||||||
|
Height of bearer bars (horizontal bars along the top and
|
||||||
|
bottom of the barcode). Default is 0 (no bearers).
|
||||||
|
|
||||||
|
quiet (bool, default 1):
|
||||||
|
Wether to include quiet zones in the symbol.
|
||||||
|
|
||||||
|
lquiet (float, see default below):
|
||||||
|
Quiet zone size to left of code, if quiet is true.
|
||||||
|
Default is the greater of .25 inch, or 10 xdim
|
||||||
|
|
||||||
|
rquiet (float, defaults as above):
|
||||||
|
Quiet zone size to right left of code, if quiet is true.
|
||||||
|
|
||||||
|
Sources of Information on Code 11:
|
||||||
|
|
||||||
|
http://www.cwi.nl/people/dik/english/codes/barcodes.html
|
||||||
|
"""
|
||||||
|
|
||||||
|
chars = string.digits + '-'
|
||||||
|
|
||||||
|
patterns = {
|
||||||
|
'0' : 'bsbsB', '1' : 'BsbsB', '2' : 'bSbsB',
|
||||||
|
'3' : 'BSbsb', '4' : 'bsBsB', '5' : 'BsBsb',
|
||||||
|
'6' : 'bSBsb', '7' : 'bsbSB', '8' : 'BsbSb',
|
||||||
|
'9' : 'Bsbsb', '-' : 'bsBsb', 'S' : 'bsBSb' # Start/Stop
|
||||||
|
}
|
||||||
|
|
||||||
|
values = {
|
||||||
|
'0' : 0, '1' : 1, '2' : 2, '3' : 3, '4' : 4,
|
||||||
|
'5' : 5, '6' : 6, '7' : 7, '8' : 8, '9' : 9,
|
||||||
|
'-' : 10,
|
||||||
|
}
|
||||||
|
|
||||||
|
def __init__(self, value='', **args):
|
||||||
|
self.height = None
|
||||||
|
self.xdim = inch * 0.0075
|
||||||
|
self.ratio = 2.2 # XXX ?
|
||||||
|
self.checksum = -1 # Auto
|
||||||
|
self.bearers = 0.0
|
||||||
|
self.quiet = 1
|
||||||
|
self.lquiet = self.rquiet = None
|
||||||
|
|
||||||
|
if type(value) == type(1):
|
||||||
|
value = str(value)
|
||||||
|
|
||||||
|
for (k, v) in args.items():
|
||||||
|
setattr(self, k, v)
|
||||||
|
|
||||||
|
if self.quiet:
|
||||||
|
if self.lquiet is None:
|
||||||
|
self.lquiet = min(inch * 0.25, self.xdim * 10.0)
|
||||||
|
self.rquiet = min(inch * 0.25, self.xdim * 10.0)
|
||||||
|
else:
|
||||||
|
self.lquiet = self.rquiet = 0.0
|
||||||
|
|
||||||
|
Barcode.__init__(self, value)
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
vval = ""
|
||||||
|
self.valid = 1
|
||||||
|
s = string.strip(self.value)
|
||||||
|
for i in range(0, len(s)):
|
||||||
|
c = s[i]
|
||||||
|
if c not in self.chars:
|
||||||
|
self.Valid = 0
|
||||||
|
continue
|
||||||
|
vval = vval + c
|
||||||
|
|
||||||
|
self.validated = vval
|
||||||
|
return vval
|
||||||
|
|
||||||
|
def encode(self):
|
||||||
|
s = self.validated
|
||||||
|
|
||||||
|
if self.checksum == -1:
|
||||||
|
if len(s) <= 10:
|
||||||
|
self.checksum = 1
|
||||||
|
else:
|
||||||
|
self.checksum = 2
|
||||||
|
|
||||||
|
if self.checksum > 0:
|
||||||
|
# compute first checksum
|
||||||
|
i = 0; v = 1; c = 0
|
||||||
|
while i < len(s):
|
||||||
|
c = c + v * string.index(self.chars, s[-(i+1)])
|
||||||
|
i = i + 1; v = v + 1
|
||||||
|
if v > 10:
|
||||||
|
v = 1
|
||||||
|
s = s + self.chars[c % 11]
|
||||||
|
|
||||||
|
if self.checksum > 1:
|
||||||
|
# compute second checksum
|
||||||
|
i = 0; v = 1; c = 0
|
||||||
|
while i < len(s):
|
||||||
|
c = c + v * string.index(self.chars, s[-(i+1)])
|
||||||
|
i = i + 1; v = v + 1
|
||||||
|
if v > 9:
|
||||||
|
v = 1
|
||||||
|
s = s + self.chars[c % 10]
|
||||||
|
|
||||||
|
self.encoded = 'S' + s + 'S'
|
||||||
|
|
||||||
|
def decompose(self):
|
||||||
|
dval = ""
|
||||||
|
for c in self.encoded:
|
||||||
|
dval = dval + self.patterns[c] + 'i'
|
||||||
|
self.decomposed = dval[:-1]
|
||||||
|
return self.decomposed
|
|
@ -0,0 +1,81 @@
|
||||||
|
#
|
||||||
|
# Copyright (c) 2000 Tyler C. Sarna <tsarna@sarna.org>
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# 3. All advertising materials mentioning features or use of this software
|
||||||
|
# must display the following acknowledgement:
|
||||||
|
# This product includes software developed by Tyler C. Sarna.
|
||||||
|
# 4. Neither the name of the author nor the names of contributors
|
||||||
|
# may be used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
|
||||||
|
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
|
||||||
|
from reportlab.lib.units import inch
|
||||||
|
from common import Barcode
|
||||||
|
import string
|
||||||
|
|
||||||
|
# . 3 T Tracker
|
||||||
|
# , 2 D Descender
|
||||||
|
# ' 1 A Ascender
|
||||||
|
# | 0 H Ascender/Descender
|
||||||
|
|
||||||
|
_rm_patterns = {
|
||||||
|
"0" : "--||", "1" : "-',|", "2" : "-'|,", "3" : "'-,|",
|
||||||
|
"4" : "'-|,", "5" : "'',,", "6" : "-,'|", "7" : "-|-|",
|
||||||
|
"8" : "-|',", "9" : "',-|", "A" : "',',", "B" : "'|-,",
|
||||||
|
"C" : "-,|'", "D" : "-|,'", "E" : "-||-", "F" : "',,'",
|
||||||
|
"G" : "',|-", "H" : "'|,-", "I" : ",-'|", "J" : ",'-|",
|
||||||
|
"K" : ",'',", "L" : "|--|", "M" : "|-',", "N" : "|'-,",
|
||||||
|
"O" : ",-|'", "P" : ",','", "Q" : ",'|-", "R" : "|-,'",
|
||||||
|
"S" : "|-|-", "T" : "|',-", "U" : ",,''", "V" : ",|-'",
|
||||||
|
"W" : ",|'-", "X" : "|,-'", "Y" : "|,'-", "Z" : "||--",
|
||||||
|
|
||||||
|
# start, stop
|
||||||
|
"(" : "'-,'", ")" : "'|,|"
|
||||||
|
}
|
||||||
|
|
||||||
|
_ozN_patterns = {
|
||||||
|
"0" : "||", "1" : "|'", "2" : "|,", "3" : "'|", "4" : "''",
|
||||||
|
"5" : "',", "6" : ",|", "7" : ",'", "8" : ",,", "9" : ".|"
|
||||||
|
}
|
||||||
|
|
||||||
|
_ozC_patterns = {
|
||||||
|
"A" : "|||", "B" : "||'", "C" : "||,", "D" : "|'|",
|
||||||
|
"E" : "|''", "F" : "|',", "G" : "|,|", "H" : "|,'",
|
||||||
|
"I" : "|,,", "J" : "'||", "K" : "'|'", "L" : "'|,",
|
||||||
|
"M" : "''|", "N" : "'''", "O" : "'',", "P" : "',|",
|
||||||
|
"Q" : "','", "R" : "',,", "S" : ",||", "T" : ",|'",
|
||||||
|
"U" : ",|,", "V" : ",'|", "W" : ",''", "X" : ",',",
|
||||||
|
"Y" : ",,|", "Z" : ",,'", "a" : "|,.", "b" : "|.|",
|
||||||
|
"c" : "|.'", "d" : "|.,", "e" : "|..", "f" : "'|.",
|
||||||
|
"g" : "''.", "h" : "',.", "i" : "'.|", "j" : "'.'",
|
||||||
|
"k" : "'.,", "l" : "'..", "m" : ",|.", "n" : ",'.",
|
||||||
|
"o" : ",,.", "p" : ",.|", "q" : ",.'", "r" : ",.,",
|
||||||
|
"s" : ",..", "t" : ".|.", "u" : ".'.", "v" : ".,.",
|
||||||
|
"w" : "..|", "x" : "..'", "y" : "..,", "z" : "...",
|
||||||
|
"0" : ",,,", "1" : ".||", "2" : ".|'", "3" : ".|,",
|
||||||
|
"4" : ".'|", "5" : ".''", "6" : ".',", "7" : ".,|",
|
||||||
|
"8" : ".,'", "9" : ".,,", " " : "||.", "#" : "|'.",
|
||||||
|
}
|
||||||
|
|
||||||
|
#http://www.auspost.com.au/futurepost/
|
Binary file not shown.
|
@ -0,0 +1,55 @@
|
||||||
|
#!/usr/pkg/bin/python
|
||||||
|
from common import *
|
||||||
|
from code39 import *
|
||||||
|
from code93 import *
|
||||||
|
from code128 import *
|
||||||
|
from usps import *
|
||||||
|
|
||||||
|
from reportlab.pdfgen.canvas import Canvas
|
||||||
|
from reportlab.lib.styles import getSampleStyleSheet
|
||||||
|
from reportlab.platypus import Paragraph, Frame
|
||||||
|
from reportlab.platypus.flowables import XBox
|
||||||
|
def run():
|
||||||
|
styles = getSampleStyleSheet()
|
||||||
|
styleN = styles['Normal']
|
||||||
|
styleH = styles['Heading1']
|
||||||
|
story = []
|
||||||
|
|
||||||
|
story.append(Paragraph('I2of5', styleN))
|
||||||
|
story.append(I2of5(1234, xdim = inch*0.02, checksum=0))
|
||||||
|
story.append(Paragraph('MSI', styleN))
|
||||||
|
story.append(MSI(1234, xdim = inch*0.02))
|
||||||
|
story.append(Paragraph('Codabar', styleN))
|
||||||
|
story.append(Codabar("A012345B", xdim = inch*0.02))
|
||||||
|
story.append(Paragraph('Code 11', styleN))
|
||||||
|
story.append(Code11("01234545634563"))
|
||||||
|
story.append(Paragraph('Code 39', styleN))
|
||||||
|
story.append(Standard39("A012345B%R"))
|
||||||
|
story.append(Paragraph('Extended Code 39', styleN))
|
||||||
|
story.append(Extended39("A012345B}"))
|
||||||
|
story.append(Paragraph('Code93', styleN))
|
||||||
|
story.append(Standard93("CODE 93"))
|
||||||
|
story.append(Paragraph('Extended Code93', styleN))
|
||||||
|
story.append(Extended93("L@@K! Code 93 :-)")) #, xdim=0.005 * inch))
|
||||||
|
story.append(Paragraph('Code 128', styleN))
|
||||||
|
c=Code128("AB-12345678") #, xdim=0.005 * inch)
|
||||||
|
#print 'WIDTH =', (c.width / inch), 'XDIM =', (c.xdim / inch)
|
||||||
|
#print 'LQ =', (c.lquiet / inch), 'RQ =', (c.rquiet / inch)
|
||||||
|
story.append(c)
|
||||||
|
story.append(Paragraph('USPS FIM', styleN))
|
||||||
|
story.append(FIM("A"))
|
||||||
|
story.append(Paragraph('USPS POSTNET', styleN))
|
||||||
|
story.append(POSTNET('78247-1043'))
|
||||||
|
story.append(Paragraph('Label Size', styleN))
|
||||||
|
story.append(XBox((2.0 + 5.0/8.0)*inch, 1 * inch, '1x2-5/8"'))
|
||||||
|
story.append(Paragraph('Label Size', styleN))
|
||||||
|
story.append(XBox((1.75)*inch, .5 * inch, '1/2x1-3/4"'))
|
||||||
|
c = Canvas('out.pdf')
|
||||||
|
f = Frame(inch, inch, 6*inch, 9*inch, showBoundary=1)
|
||||||
|
f.addFromList(story, c)
|
||||||
|
c.save()
|
||||||
|
|
||||||
|
if __name__=='__main__':
|
||||||
|
run()
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,231 @@
|
||||||
|
#
|
||||||
|
# Copyright (c) 1996-2000 Tyler C. Sarna <tsarna@sarna.org>
|
||||||
|
# All rights reserved.
|
||||||
|
#
|
||||||
|
# Redistribution and use in source and binary forms, with or without
|
||||||
|
# modification, are permitted provided that the following conditions
|
||||||
|
# are met:
|
||||||
|
# 1. Redistributions of source code must retain the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer.
|
||||||
|
# 2. Redistributions in binary form must reproduce the above copyright
|
||||||
|
# notice, this list of conditions and the following disclaimer in the
|
||||||
|
# documentation and/or other materials provided with the distribution.
|
||||||
|
# 3. All advertising materials mentioning features or use of this software
|
||||||
|
# must display the following acknowledgement:
|
||||||
|
# This product includes software developed by Tyler C. Sarna.
|
||||||
|
# 4. Neither the name of the author nor the names of contributors
|
||||||
|
# may be used to endorse or promote products derived from this software
|
||||||
|
# without specific prior written permission.
|
||||||
|
#
|
||||||
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||||
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
||||||
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS
|
||||||
|
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
# POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
#
|
||||||
|
|
||||||
|
from reportlab.lib.units import inch
|
||||||
|
from common import Barcode
|
||||||
|
import string
|
||||||
|
|
||||||
|
_fim_patterns = {
|
||||||
|
'A' : "|| | ||",
|
||||||
|
'B' : "| || || |",
|
||||||
|
'C' : "|| | | ||",
|
||||||
|
'D' : "||| | |||",
|
||||||
|
# XXX There is an E.
|
||||||
|
# The below has been seen, but dunno if it is E or not:
|
||||||
|
# 'E' : '|||| ||||'
|
||||||
|
}
|
||||||
|
|
||||||
|
_postnet_patterns = {
|
||||||
|
'1' : "...||", '2' : "..|.|", '3' : "..||.", '4' : ".|..|",
|
||||||
|
'5' : ".|.|.", '6' : ".||..", '7' : "|...|", '8' : "|..|.",
|
||||||
|
'9' : "|.|..", '0' : "||...", 'S' : "|",
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class FIM(Barcode):
|
||||||
|
""""
|
||||||
|
FIM (Facing ID Marks) encode only one letter.
|
||||||
|
There are currently four defined:
|
||||||
|
|
||||||
|
A Courtesy reply mail with pre-printed POSTNET
|
||||||
|
B Business reply mail without pre-printed POSTNET
|
||||||
|
C Business reply mail with pre-printed POSTNET
|
||||||
|
D OCR Readable mail without pre-printed POSTNET
|
||||||
|
|
||||||
|
Interleaved 2 of 5 is a numeric-only barcode. It encodes an even
|
||||||
|
number of digits; if an odd number is given, a 0 is prepended.
|
||||||
|
|
||||||
|
Options that may be passed to constructor:
|
||||||
|
|
||||||
|
value (single character string from the set A - D. required.):
|
||||||
|
The value to encode.
|
||||||
|
|
||||||
|
quiet (bool, default 1):
|
||||||
|
Wether to include quiet zones in the symbol.
|
||||||
|
|
||||||
|
The following may also be passed, but doing so will generate nonstandard
|
||||||
|
symbols which should not be used. This is mainly documented here to
|
||||||
|
show the defaults:
|
||||||
|
|
||||||
|
height (float, default 5/8 inch):
|
||||||
|
Height of the code. This might legitimately be overriden to make
|
||||||
|
a taller symbol that will 'bleed' off the edge of the paper,
|
||||||
|
leaving 5/8 inch remaining.
|
||||||
|
|
||||||
|
lquiet (float, default 1/4 inch):
|
||||||
|
Quiet zone size to left of code, if quiet is true.
|
||||||
|
Default is the greater of .25 inch, or .15 times the symbol's
|
||||||
|
length.
|
||||||
|
|
||||||
|
rquiet (float, default 15/32 inch):
|
||||||
|
Quiet zone size to right left of code, if quiet is true.
|
||||||
|
|
||||||
|
Sources of information on FIM:
|
||||||
|
|
||||||
|
USPS Publication 25, A Guide to Business Mail Preparation
|
||||||
|
http://new.usps.com/cpim/ftp/pubs/pub25.pdf
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, value='', **args):
|
||||||
|
self.barwidth = inch * (1.0/32.0)
|
||||||
|
self.barspace = inch * (1.0/16.0)
|
||||||
|
self.height = inch * (5.0/8.0)
|
||||||
|
self.rquiet = inch * (0.25)
|
||||||
|
self.lquiet = inch * (15.0/32.0)
|
||||||
|
self.quiet = 0
|
||||||
|
|
||||||
|
for (k, v) in args.items():
|
||||||
|
setattr(self, k, v)
|
||||||
|
|
||||||
|
Barcode.__init__(self, value)
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
self.valid = 1
|
||||||
|
self.validated = ''
|
||||||
|
for c in self.value:
|
||||||
|
if c in string.whitespace:
|
||||||
|
continue
|
||||||
|
elif c in "abcdABCD":
|
||||||
|
self.validated = self.validated + string.upper(c)
|
||||||
|
else:
|
||||||
|
self.valid = 0
|
||||||
|
|
||||||
|
if len(self.validated) != 1:
|
||||||
|
raise ValueError, "Input must be exactly one character"
|
||||||
|
|
||||||
|
return self.validated
|
||||||
|
|
||||||
|
def decompose(self):
|
||||||
|
self.decomposed = ''
|
||||||
|
for c in self.encoded:
|
||||||
|
self.decomposed = self.decomposed + _fim_patterns[c]
|
||||||
|
|
||||||
|
return self.decomposed
|
||||||
|
|
||||||
|
def computeSize(self):
|
||||||
|
self.width = (len(self.decomposed) - 1) * self.barspace + self.barwidth
|
||||||
|
if self.quiet:
|
||||||
|
self.xo = self.lquiet
|
||||||
|
self.width = self.lquiet + self.width + self.rquiet
|
||||||
|
else:
|
||||||
|
self.xo = 0.0
|
||||||
|
|
||||||
|
def draw(self):
|
||||||
|
left = self.xo
|
||||||
|
for c in self.decomposed:
|
||||||
|
if c == '|':
|
||||||
|
self.rect(left, 0.0, self.barwidth, self.height)
|
||||||
|
left = left + self.barspace
|
||||||
|
|
||||||
|
|
||||||
|
class POSTNET(Barcode):
|
||||||
|
""""
|
||||||
|
POSTNET is used in the US to encode "zip codes" (postal codes) on
|
||||||
|
mail. It can encode 5, 9, or 11 digit codes. I've read that it's
|
||||||
|
pointless to do 5 digits, since USPS will just have to re-print
|
||||||
|
them with 9 or 11 digits.
|
||||||
|
|
||||||
|
Sources of information on POSTNET:
|
||||||
|
|
||||||
|
USPS Publication 25, A Guide to Business Mail Preparation
|
||||||
|
http://new.usps.com/cpim/ftp/pubs/pub25.pdf
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self, value='', **args):
|
||||||
|
self.sbarheight = inch * 0.050
|
||||||
|
self.fbarheight = inch * 0.125
|
||||||
|
self.barwide = inch * 0.018
|
||||||
|
self.spacewide = inch * 0.0275
|
||||||
|
|
||||||
|
for (k, v) in args.items():
|
||||||
|
setattr(self, k, v)
|
||||||
|
|
||||||
|
Barcode.__init__(self, value)
|
||||||
|
|
||||||
|
def validate(self):
|
||||||
|
self.validated = ''
|
||||||
|
self.valid = 1
|
||||||
|
count = 0
|
||||||
|
for c in self.value:
|
||||||
|
if c in (string.whitespace + '-'):
|
||||||
|
pass
|
||||||
|
elif c in string.digits:
|
||||||
|
count = count + 1
|
||||||
|
if count == 6:
|
||||||
|
self.validated = self.validated + '-'
|
||||||
|
self.validated = self.validated + c
|
||||||
|
else:
|
||||||
|
self.valid = 0
|
||||||
|
|
||||||
|
if len(self.validated) not in [5, 10, 12]:
|
||||||
|
self.valid = 0
|
||||||
|
|
||||||
|
return self.validated
|
||||||
|
|
||||||
|
def encode(self):
|
||||||
|
self.encoded = "S"
|
||||||
|
check = 0
|
||||||
|
for c in self.validated:
|
||||||
|
if c in string.digits:
|
||||||
|
self.encoded = self.encoded + c
|
||||||
|
check = check + string.atoi(c)
|
||||||
|
elif c == '-':
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
raise ValueError, "Invalid character in input"
|
||||||
|
check = (10 - (check % 10)) % 10
|
||||||
|
self.encoded = self.encoded + `check` + 'S'
|
||||||
|
return self.encoded
|
||||||
|
|
||||||
|
def decompose(self):
|
||||||
|
self.decomposed = ''
|
||||||
|
for c in self.encoded:
|
||||||
|
self.decomposed = self.decomposed + _postnet_patterns[c]
|
||||||
|
return self.decomposed
|
||||||
|
|
||||||
|
def computeSize(self):
|
||||||
|
self.width = len(self.decomposed) * self.barwide
|
||||||
|
self.width = self.width + (len(self.decomposed) - 1) * self.spacewide
|
||||||
|
self.height = self.fbarheight
|
||||||
|
self.xo = 0.0
|
||||||
|
|
||||||
|
def draw(self):
|
||||||
|
sdown = self.fbarheight - self.sbarheight
|
||||||
|
left = self.xo
|
||||||
|
|
||||||
|
for c in self.decomposed:
|
||||||
|
if c == '.':
|
||||||
|
h = self.sbarheight
|
||||||
|
else:
|
||||||
|
h = self.fbarheight
|
||||||
|
self.rect(left, 0.0, self.barwide, h)
|
||||||
|
left = left + self.barwide + self.spacewide
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,386 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
|
||||||
|
import psycopg
|
||||||
|
import csv
|
||||||
|
|
||||||
|
db_old = "in"
|
||||||
|
print 'Extracting data from db '+db_old
|
||||||
|
|
||||||
|
def import_sql(cr, fname, query, fields=None, trigger=None):
|
||||||
|
cr.execute(query)
|
||||||
|
if not fields:
|
||||||
|
fields = map(lambda x: x[0], cr.description)
|
||||||
|
fp = file(fname,'wb')
|
||||||
|
result = cr.fetchall()
|
||||||
|
if trigger:
|
||||||
|
result = map(lambda x: tuple(trigger(cr, list(x))), result)
|
||||||
|
writer = csv.writer(fp,lineterminator='\n')
|
||||||
|
writer.writerow(fields)
|
||||||
|
writer.writerows(result)
|
||||||
|
fp.close()
|
||||||
|
|
||||||
|
|
||||||
|
db = psycopg.connect("dbname="+db_old)
|
||||||
|
cr = db.cursor()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cr.execute("update auction_lots set state='draft' where state is null or state = '' ")
|
||||||
|
cr.execute("update auction_lots set state='sold' where state='invoiced'")
|
||||||
|
|
||||||
|
|
||||||
|
cr.execute('select id,name from res_partner')
|
||||||
|
res= cr.fetchall()
|
||||||
|
names=[]
|
||||||
|
for r in res:
|
||||||
|
if r[1] in names:
|
||||||
|
cr.execute("update res_partner set name= %s where id=%d",(r[1]+str(r[0]),r[0]))
|
||||||
|
else:
|
||||||
|
names.append(r[1])
|
||||||
|
|
||||||
|
# cr.execute('select id,name from res_country')
|
||||||
|
# res= cr.fetchall()
|
||||||
|
# names=[]
|
||||||
|
# for r in res:
|
||||||
|
# if r[1] in names:
|
||||||
|
# cr.execute("update res_country set name= %s where id=%d",(str(r[1])+str(r[0]),r[0]))
|
||||||
|
# else:
|
||||||
|
# names.append(r[1])
|
||||||
|
|
||||||
|
# cr.execute('select id,code from res_country')
|
||||||
|
# res= cr.fetchall()
|
||||||
|
# names=[]
|
||||||
|
# for r in res:
|
||||||
|
# if r[1] in names:
|
||||||
|
# cr.execute("update res_country set code= %s where id=%d",(str(r[1])+str(r[0]),r[0]))
|
||||||
|
# else:
|
||||||
|
# names.append(r[1])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
def _account_trigger(cr, x):
|
||||||
|
x = list(x)
|
||||||
|
if x[5] not in ('receivable','payable','view','income','expense','tax','cash','asset','equity','closed'):
|
||||||
|
x[5] = {'stock_inventory':'asset','stock_income':'income','stock_expense':'expense'}.get(x[5], 'asset')
|
||||||
|
return tuple(x)
|
||||||
|
# account.account
|
||||||
|
import_sql(cr,
|
||||||
|
'account.account.csv',
|
||||||
|
"select 'account' || id as id, code, name, 'EUR' as currency_id, True as active, type from account_account",
|
||||||
|
trigger = _account_trigger
|
||||||
|
)
|
||||||
|
|
||||||
|
#account.tax
|
||||||
|
import_sql(cr,
|
||||||
|
'account.tax.csv',
|
||||||
|
"""select
|
||||||
|
'tax' || id as id,
|
||||||
|
domain,
|
||||||
|
name,
|
||||||
|
'account'||account_collected_id as "account_collected_id:id",
|
||||||
|
'account'||account_paid_id as "account_paid_id:id",
|
||||||
|
amount,
|
||||||
|
child_depend,
|
||||||
|
type
|
||||||
|
from
|
||||||
|
account_tax
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
#res.country
|
||||||
|
# import_sql(cr,
|
||||||
|
# 'res.country.csv',
|
||||||
|
# """
|
||||||
|
# select
|
||||||
|
# 'country'||id as id,
|
||||||
|
# coalesce(name,id::char(10)) as "name",
|
||||||
|
# coalesce(code,id::char(10)) as "code"
|
||||||
|
# from
|
||||||
|
# res_country
|
||||||
|
# """
|
||||||
|
# )
|
||||||
|
#clients category
|
||||||
|
import_sql(cr,
|
||||||
|
'res.partner.category.csv',
|
||||||
|
"""
|
||||||
|
select
|
||||||
|
name,
|
||||||
|
active
|
||||||
|
from
|
||||||
|
res_partner_category
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
##res.partner.category.rel
|
||||||
|
#import_sql(cr,
|
||||||
|
# 'res.partner.category.rel.csv',
|
||||||
|
# """
|
||||||
|
# select
|
||||||
|
# 'partner'||rel.partner_id as "partner_id:id",
|
||||||
|
# 'categ'||rel.category_id as "category_id:id"
|
||||||
|
# from
|
||||||
|
# res_partner_category_rel rel, res_partner r
|
||||||
|
# where rel.partner_id=r.id
|
||||||
|
# """
|
||||||
|
#)
|
||||||
|
#res.partner
|
||||||
|
import_sql(cr,
|
||||||
|
'res.partner.csv',
|
||||||
|
"""
|
||||||
|
select
|
||||||
|
'partner'||r.id as id,
|
||||||
|
r.lang,
|
||||||
|
r.website,
|
||||||
|
r.name,
|
||||||
|
r.comment,
|
||||||
|
|
||||||
|
r.active
|
||||||
|
from
|
||||||
|
res_partner r
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
# (select cat.name||'\N' from res_partner r1, res_partner_category cat,res_partner_category_rel rel where r1.id=rel.partner_id and rel.category_id=cat.id) as "category_id",
|
||||||
|
# title,
|
||||||
|
|
||||||
|
#res.partner.address
|
||||||
|
import_sql(cr,
|
||||||
|
'res.partner.address.csv',
|
||||||
|
"""
|
||||||
|
select
|
||||||
|
'address'||id as id,
|
||||||
|
coalesce('partner'||partner_id,'partner_unknown') as "partner_id:id",
|
||||||
|
name,
|
||||||
|
street,
|
||||||
|
zip,
|
||||||
|
city,
|
||||||
|
email,
|
||||||
|
phone,
|
||||||
|
type,
|
||||||
|
mobile,
|
||||||
|
fax
|
||||||
|
from
|
||||||
|
res_partner_address
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
# 'country'||country as "country_id:id",
|
||||||
|
|
||||||
|
|
||||||
|
#auction.lot.category
|
||||||
|
|
||||||
|
import_sql(cr,
|
||||||
|
'auction.lot.category.csv',
|
||||||
|
"""
|
||||||
|
select
|
||||||
|
'cat'||id as "id",
|
||||||
|
name,
|
||||||
|
active
|
||||||
|
from
|
||||||
|
auction_lot_category
|
||||||
|
order by
|
||||||
|
id
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
#auction.dates.csv
|
||||||
|
|
||||||
|
import_sql(cr,
|
||||||
|
'auction.dates.csv',
|
||||||
|
"""
|
||||||
|
select
|
||||||
|
|
||||||
|
'date'||id as "id",
|
||||||
|
'Auction'||id as "name",
|
||||||
|
expo1,
|
||||||
|
expo2,
|
||||||
|
'auction_db.account'||acc_expense as "acc_expense:id",
|
||||||
|
'auction_db.account'||acc_income as "acc_income:id",
|
||||||
|
coalesce(state,'draft') as "state",
|
||||||
|
auction1,
|
||||||
|
auction2,
|
||||||
|
'account.expenses_journal' as "journal_seller_id:id",
|
||||||
|
'account.sales_journal' as "journal_id:id",
|
||||||
|
'auction_db.aaa_un' as "account_analytic_id:id"
|
||||||
|
|
||||||
|
from
|
||||||
|
auction_dates
|
||||||
|
order by
|
||||||
|
id
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
# auction.artist.csv
|
||||||
|
|
||||||
|
import_sql(cr,
|
||||||
|
'auction.artists.csv',
|
||||||
|
"""
|
||||||
|
select
|
||||||
|
'artist'||id as "id",
|
||||||
|
name,
|
||||||
|
biography,
|
||||||
|
birth_death_dates
|
||||||
|
|
||||||
|
from
|
||||||
|
auction_artists
|
||||||
|
order by
|
||||||
|
id
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# auction.deposit.csv
|
||||||
|
|
||||||
|
import_sql(cr,
|
||||||
|
'auction.deposit.csv',
|
||||||
|
"""
|
||||||
|
select
|
||||||
|
'deposit'||id as "id",
|
||||||
|
name,
|
||||||
|
date_dep,
|
||||||
|
coalesce('auction_db.partner'||partner_id,'auction_db.partner_unknown') as "partner_id:id",
|
||||||
|
method,
|
||||||
|
'auction_db.tax'||tax_id as "tax_id:id",
|
||||||
|
total_neg
|
||||||
|
|
||||||
|
from
|
||||||
|
auction_deposit
|
||||||
|
order by
|
||||||
|
id
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
#lot
|
||||||
|
import_sql(cr,
|
||||||
|
'auction.lots.csv',
|
||||||
|
"""
|
||||||
|
select
|
||||||
|
'lot'||l.id as id,
|
||||||
|
'auction_db2.date'||l.auction_id as "auction_id:id",
|
||||||
|
'auction_db2.deposit'||l.bord_vnd_id as "bord_vnd_id:id",
|
||||||
|
l.name,
|
||||||
|
l.name2,
|
||||||
|
l.author_right,
|
||||||
|
l.lot_est1,
|
||||||
|
l.lot_est1,
|
||||||
|
l.lot_local,
|
||||||
|
l.artist_id,
|
||||||
|
l.artist2_id,
|
||||||
|
l.important,
|
||||||
|
l.obj_desc,
|
||||||
|
l.obj_num,
|
||||||
|
l.obj_ret,
|
||||||
|
l.obj_comm,
|
||||||
|
l.obj_price,
|
||||||
|
l.ach_avance,
|
||||||
|
l.ach_login,
|
||||||
|
'auction_db.partner'||l.ach_uid as "ach_uid:id",
|
||||||
|
l.ach_emp,
|
||||||
|
l.vnd_lim,
|
||||||
|
l.vnd_lim_net,
|
||||||
|
coalesce(l.state,'draft') as "state",
|
||||||
|
'auction_db.product_product_unknown' as "product_id:id"
|
||||||
|
from
|
||||||
|
auction_lots l join auction_dates d on (l.auction_id=d.id) join auction_deposit o on (l.bord_vnd_id=o.id) where d.expo2 like '2007%'
|
||||||
|
order by
|
||||||
|
l.id
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# 'auction_db.invoice'||ach_inv_id as "ach_inv_id:id",
|
||||||
|
# 'auction_db.invoice'||ach_inv_id as "sel_inv_id:id",
|
||||||
|
|
||||||
|
def _deposit(cr, rec):
|
||||||
|
if not rec[3]:
|
||||||
|
rec[3] = '6025'
|
||||||
|
return rec
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 'invoice'||invoice_id as "invoice_id:id",
|
||||||
|
import_sql(cr,
|
||||||
|
'account.invoice.csv',
|
||||||
|
"""
|
||||||
|
select
|
||||||
|
'invoice'||id as "id",
|
||||||
|
comment,
|
||||||
|
date_due,
|
||||||
|
number,
|
||||||
|
'base.main_company' as "company_id:id",
|
||||||
|
'auction_db.address'||address_invoice_id as "address_invoice_id:id",
|
||||||
|
'auction_db.partner'||partner_id as "partner_id:id",
|
||||||
|
state,
|
||||||
|
type,
|
||||||
|
'auction_db.account'||account_id as "account_id:id",
|
||||||
|
date_invoice,
|
||||||
|
name,
|
||||||
|
'auction_db.address'||address_contact_id as "address_contact_id:id"
|
||||||
|
from
|
||||||
|
account_invoice
|
||||||
|
order by
|
||||||
|
id
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
import_sql(cr,
|
||||||
|
'account.invoice.line.csv',
|
||||||
|
"""
|
||||||
|
select
|
||||||
|
name,
|
||||||
|
'invoice'||invoice_id as "invoice_id:id",
|
||||||
|
price_unit,
|
||||||
|
'auction_db.account'||account_id as "account_id:id",
|
||||||
|
quantity
|
||||||
|
from
|
||||||
|
account_invoice_line
|
||||||
|
order by
|
||||||
|
id
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
#auction.bid.csv
|
||||||
|
|
||||||
|
import_sql(cr,
|
||||||
|
'auction.bid.csv',
|
||||||
|
"""
|
||||||
|
select
|
||||||
|
'bid'||b.id as "id",
|
||||||
|
'date'||b.auction_id as "auction_id:id",
|
||||||
|
coalesce('auction_db.partner'||b.partner_id,'auction_db.partner_unknown') as "partner_id:id",
|
||||||
|
b.name,
|
||||||
|
b.contact_tel
|
||||||
|
from
|
||||||
|
auction_bid b join auction_dates d on (b.auction_id=d.id) where d.expo2 like '2007%'
|
||||||
|
order by
|
||||||
|
b.id
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
#auction.bid_line.csv
|
||||||
|
import_sql(cr,
|
||||||
|
'auction.bid_line.csv',
|
||||||
|
"""
|
||||||
|
select
|
||||||
|
line.name,
|
||||||
|
'auction_db2.bid'||line.bid_id as "bid_id:id",
|
||||||
|
'auction_db3.lot'||line.lot_id as "lot_id:id",
|
||||||
|
line.price,
|
||||||
|
line.call
|
||||||
|
|
||||||
|
from
|
||||||
|
auction_bid_line line join auction_bid b on (b.id=line.bid_id) join auction_lots lot on (lot.id=line.lot_id) join auction_deposit o on (lot.bord_vnd_id=o.id) join auction_dates d on (lot.auction_id=d.id) where d.expo2 like '2007%' and o.date_dep like '2007%'
|
||||||
|
order by
|
||||||
|
line.id
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
cr.close()
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,120 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
|
||||||
|
import psycopg
|
||||||
|
import csv
|
||||||
|
|
||||||
|
db_old = "in"
|
||||||
|
print 'Extracting data from db '+db_old
|
||||||
|
#
|
||||||
|
#def import_sql(cr, fname, query, fields=None, trigger=None):
|
||||||
|
# cr.execute(query)
|
||||||
|
# fp = file(fname,'wb')
|
||||||
|
# result = cr.fetchall()
|
||||||
|
# if trigger:
|
||||||
|
# result = map(lambda x: tuple(trigger(cr, list(x))), result)
|
||||||
|
# writer = csv.writer(fp,lineterminator='\n')
|
||||||
|
# writer.writerow(["id","lang","website","name","comment","active","category_id"])
|
||||||
|
# for line in result:
|
||||||
|
# cr.execute("SELECT c.name from res_partner_category_rel r join res_partner p on (p.id=r.partner_id) join res_partner_category c on (r.category_id=c.id) where p.name=%s",(line[3],))
|
||||||
|
# cats= ",".join([l[0] for l in cr.fetchall()])
|
||||||
|
# print "cats",cats
|
||||||
|
# line=line + (cats,)
|
||||||
|
# writer.writerow(line)
|
||||||
|
# fp.close()
|
||||||
|
#
|
||||||
|
#db = psycopg.connect("dbname="+db_old)
|
||||||
|
#cr = db.cursor()
|
||||||
|
def import_sql(cr, fname, query, fields=None, trigger=None):
|
||||||
|
cr.execute(query)
|
||||||
|
fp = file(fname,'wb')
|
||||||
|
result = cr.fetchall()
|
||||||
|
if trigger:
|
||||||
|
result = map(lambda x: tuple(trigger(cr, list(x))), result)
|
||||||
|
writer = csv.writer(fp,lineterminator='\n')
|
||||||
|
writer.writerow(["id","lang","website","name","comment","active","category_id"])
|
||||||
|
for line in result:
|
||||||
|
cr.execute("SELECT c.name from res_partner_category_rel r join res_partner p on (p.id=r.partner_id) join res_partner_category c on (r.category_id=c.id) where p.name=%s",(line[3],))
|
||||||
|
l = ''
|
||||||
|
for x in cr.fetchall():
|
||||||
|
if not l:
|
||||||
|
l = x[0]
|
||||||
|
else:
|
||||||
|
l += ',' + x[0]
|
||||||
|
writer.writerow(line + (l,))
|
||||||
|
|
||||||
|
|
||||||
|
# print l
|
||||||
|
# head,tail= l[:1], l[1:]
|
||||||
|
# if not head: head= [None]
|
||||||
|
# writer.writerow(line+tuple(head))
|
||||||
|
# for t in tail:
|
||||||
|
# writer.writerow((None,None,None,None,None,None)+(t,))
|
||||||
|
|
||||||
|
|
||||||
|
# for l in cr.fetchall():
|
||||||
|
# a=0
|
||||||
|
# lenght=len(l)
|
||||||
|
# line=line + (l[a],)
|
||||||
|
# print "l[0]",a,l[a]
|
||||||
|
# print line
|
||||||
|
# writer.writerow(line)
|
||||||
|
# a=a+1
|
||||||
|
# while a< lenght:
|
||||||
|
# line2=(None,None,None,None,None,None,) +(l[a],)
|
||||||
|
# writer.writerow(line2)
|
||||||
|
# a=a+1
|
||||||
|
fp.close()
|
||||||
|
|
||||||
|
# if l[0] != cats:
|
||||||
|
# line2=",,,,,"+(l[0][1:],)
|
||||||
|
# print "line2",line2
|
||||||
|
db = psycopg.connect("dbname="+db_old)
|
||||||
|
cr = db.cursor()
|
||||||
|
|
||||||
|
cr.execute("update auction_lots set state='draft' where state is null or state = '' ")
|
||||||
|
cr.execute("update auction_lots set state='sold' where state='invoiced'")
|
||||||
|
|
||||||
|
|
||||||
|
cr.execute('select id,name from res_partner')
|
||||||
|
res= cr.fetchall()
|
||||||
|
names=[]
|
||||||
|
for r in res:
|
||||||
|
if r[1] in names:
|
||||||
|
cr.execute("update res_partner set name= %s where id=%d",(r[1]+str(r[0]),r[0]))
|
||||||
|
else:
|
||||||
|
names.append(r[1])
|
||||||
|
|
||||||
|
|
||||||
|
##clients category
|
||||||
|
#import_sql(cr,
|
||||||
|
# 'res.partner.category.csv',
|
||||||
|
# """
|
||||||
|
# select
|
||||||
|
# name,
|
||||||
|
# active
|
||||||
|
# from
|
||||||
|
# res_partner_category
|
||||||
|
# """
|
||||||
|
#)
|
||||||
|
|
||||||
|
#res.partner
|
||||||
|
import_sql(cr,
|
||||||
|
'res.partner.csv',
|
||||||
|
"""
|
||||||
|
select
|
||||||
|
'partner'||r.id as id,
|
||||||
|
r.lang,
|
||||||
|
r.website,
|
||||||
|
r.name,
|
||||||
|
r.comment,
|
||||||
|
r.active
|
||||||
|
from
|
||||||
|
res_partner r --limit 10
|
||||||
|
"""
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# (select cat.name||'\N' from res_partner r1, res_partner_category cat,res_partner_category_rel rel where r1.id=rel.partner_id and rel.category_id=cat.id) as "category_id",
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
# -*- encoding: utf-8 -*-
|
||||||
|
##############################################################################
|
||||||
|
#
|
||||||
|
# Copyright (c) 2004 TINY SPRL. (http://tiny.be) All Rights Reserved.
|
||||||
|
# Fabien Pinckaers <fp@tiny.Be>
|
||||||
|
#
|
||||||
|
# WARNING: This program as such is intended to be used by professional
|
||||||
|
# programmers who take the whole responsability of assessing all potential
|
||||||
|
# consequences resulting from its eventual inadequacies and bugs
|
||||||
|
# End users who are looking for a ready-to-use solution with commercial
|
||||||
|
# garantees and support are strongly adviced to contract a Free Software
|
||||||
|
# Service Company
|
||||||
|
#
|
||||||
|
# This program is Free Software; you can redistribute it and/or
|
||||||
|
# modify it under the terms of the GNU General Public License
|
||||||
|
# as published by the Free Software Foundation; either version 2
|
||||||
|
# of the License, or (at your option) any later version.
|
||||||
|
#
|
||||||
|
# This program is distributed in the hope that it will be useful,
|
||||||
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
# GNU General Public License for more details.
|
||||||
|
#
|
||||||
|
# You should have received a copy of the GNU General Public License
|
||||||
|
# along with this program; if not, write to the Free Software
|
||||||
|
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
#
|
||||||
|
##############################################################################
|
||||||
|
|
||||||
|
#import flagey_huissier
|
||||||
|
import total
|
||||||
|
import auction_invoice
|
||||||
|
import seller_address
|
||||||
|
import artists_lots
|
||||||
|
import lots_list
|
||||||
|
import lots_list_inventory
|
||||||
|
import auction_result
|
||||||
|
import catelogwithpictures
|
||||||
|
import auction_objects
|
||||||
|
import buyer_form_report
|
||||||
|
import seller_form_report
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import buyer_list
|
||||||
|
|
||||||
|
import auction_catelog
|
||||||
|
import auction_buyer_result
|
||||||
|
#import auction_total_rml
|
||||||
|
#import auction_report
|
||||||
|
import auction_total_rml
|
||||||
|
import deposit_seller
|
||||||
|
import auction_artists
|
||||||
|
import bids_lots
|
||||||
|
import bids_phones_details
|
||||||
|
import auction_bids
|
||||||
|
import catalog2
|
||||||
|
import report_lot_bar_code
|
||||||
|
import huissier
|
||||||
|
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<borderform-list>
|
||||||
|
<city type="data" name="city"/>
|
||||||
|
<date type="function" name="today"/>
|
||||||
|
|
||||||
|
<borderform type="fields" name="ach_login,auction_id,ach_uid">
|
||||||
|
<title type="field" name="auction_id.name"/>
|
||||||
|
<login type="field" name="ach_login"/>
|
||||||
|
<client_info type="zoom" name="ach_uid">
|
||||||
|
<name type="field" name="name"/>
|
||||||
|
<ref type="field" name="ref"/>
|
||||||
|
<title type="field" name="title"/>
|
||||||
|
<street type="field" name="address.street"/>
|
||||||
|
<street2 type="field" name="address.street2"/>
|
||||||
|
<zip type="field" name="address.zip"/>
|
||||||
|
<city type="field" name="address.city"/>
|
||||||
|
<!--<country type="field" name="address.country.name"/>-->
|
||||||
|
<phone type="field" name="address.phone"/>
|
||||||
|
<mobile type="field" name="address.mobile"/>
|
||||||
|
</client_info>
|
||||||
|
<objects>
|
||||||
|
<cost type="call" name="compute_buyer_costs" args="">
|
||||||
|
<!--<name value="name"/>-->
|
||||||
|
<amount value="amount"/>
|
||||||
|
</cost>
|
||||||
|
|
||||||
|
<!--<cost type="field" name="auction_id.buyer_costs"/>
|
||||||
|
<name value="name"/>
|
||||||
|
<amount value="amount"/>
|
||||||
|
</cost>-->
|
||||||
|
|
||||||
|
|
||||||
|
<!--<cost type="call" name="compute_buyer_costs" args="">
|
||||||
|
<name value="name"/>
|
||||||
|
<amount value="amount"/>
|
||||||
|
</cost>-->
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<object type="fields" name="obj_num,id">
|
||||||
|
<id type="field" name="id"/>
|
||||||
|
<barcode type="field" name="id" addchecksum="false" print-text="true"/>
|
||||||
|
<!--<barcode value="id" addchecksum="false" print-text="true"/>
|
||||||
|
-->
|
||||||
|
<cost type="call" name="compute_buyer_costs" args="">
|
||||||
|
<!--<id value="id"/>-->
|
||||||
|
<amount value="amount"/>
|
||||||
|
</cost>
|
||||||
|
<barcode type="field" name="id"/>
|
||||||
|
<ref type="field" name="obj_num"/>
|
||||||
|
<title type="field" name="name"/>
|
||||||
|
<desc type="field" name="obj_desc"/>
|
||||||
|
<price type="field" name="obj_price"/>
|
||||||
|
<avance type="field" name="ach_avance"/>
|
||||||
|
<state type="field" name="state"/>
|
||||||
|
</object>
|
||||||
|
</objects>
|
||||||
|
</borderform>
|
||||||
|
</borderform-list>
|
|
@ -0,0 +1,176 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
|
||||||
|
|
||||||
|
<xsl:import href="../../custom/corporate_defaults.xsl"/>
|
||||||
|
<xsl:import href="../../base/report/rml_template.xsl"/>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<xsl:template name="first_page_frames">
|
||||||
|
<xsl:if test="$page_format='a4_normal'">
|
||||||
|
<frame id="main" x1="1cm" y1="2.5cm" width="19.0cm" height="22.0cm"/>
|
||||||
|
</xsl:if>
|
||||||
|
|
||||||
|
<xsl:if test="$page_format='a4_letter'">
|
||||||
|
<frame id="address" x1="11cm" y1="21.5cm" width="6cm" height="1cm"/>
|
||||||
|
<frame id="main" x1="1cm" y1="2.5cm" width="19.0cm" height="21.0cm"/>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
<xsl:template match="/">
|
||||||
|
<xsl:call-template name="rml"/>
|
||||||
|
</xsl:template>
|
||||||
|
<xsl:template name="stylesheet">
|
||||||
|
<paraStyle name="login-title" fontName="Helvetica" fontSize="12"/>
|
||||||
|
<paraStyle name="login" fontName="Helvetica-Bold" fontSize="16"/>
|
||||||
|
<paraStyle name="style1" leftIndent="10cm" fontName="Helvetica-Bold" />
|
||||||
|
<paraStyle name="cost-name" fontName="Helvetica-BoldOblique" fontSize="10" alignment="RIGHT"/>
|
||||||
|
<blockTableStyle id="objects">
|
||||||
|
<blockFont name="Helvetica-BoldOblique" size="12" start="0,0" stop="-1,0"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<blockAlignment value="RIGHT" start="2,1" stop="-1,-1"/>
|
||||||
|
<lineStyle kind="LINEBELOW" start="0,0" stop="-1,0"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
<blockTableStyle id="object-totals">
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<blockAlignment value="RIGHT" start="2,0" stop="-1,-1"/>
|
||||||
|
<lineStyle kind="LINEABOVE" start="-1,0" stop="-1,0"/>
|
||||||
|
<lineStyle kind="LINEABOVE" start="-1,-1" stop="-1,-1"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="story">
|
||||||
|
<xsl:apply-templates select="borderform-list"/>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="borderform-list">
|
||||||
|
<xsl:apply-templates select="borderform">
|
||||||
|
<xsl:sort order="ascending" select="client_info/name"/>
|
||||||
|
</xsl:apply-templates>
|
||||||
|
</xsl:template>
|
||||||
|
<xsl:template match="client_info">
|
||||||
|
<para style="style1">
|
||||||
|
<xsl:value-of select="title"/>
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
<xsl:value-of select="name"/>
|
||||||
|
|
||||||
|
</para>
|
||||||
|
<para style="style1"><xsl:value-of select="street"/></para>
|
||||||
|
<para style="style1"><xsl:value-of select="street2" /></para>
|
||||||
|
<para style="style1">
|
||||||
|
<xsl:value-of select="zip"/>
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
<xsl:value-of select="city"/>
|
||||||
|
</para>
|
||||||
|
<para style="style1"><xsl:value-of select="country"/></para>
|
||||||
|
<spacer length="0.4cm" width="1mm"/>
|
||||||
|
<spacer length="0.8cm"/>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="borderform">
|
||||||
|
<setNextTemplate name="other_pages"/>
|
||||||
|
<nextFrame/>
|
||||||
|
<xsl:apply-templates select="client_info"/>
|
||||||
|
<spacer length="0.8cm"/>
|
||||||
|
<!-- <setNextTemplate name="other_pages"/>-->
|
||||||
|
<!-- <nextFrame/>-->
|
||||||
|
<para style="login-title" t="1">Plate Number:</para>
|
||||||
|
<para style="login"><xsl:value-of select="login"/></para>
|
||||||
|
|
||||||
|
<spacer length="1cm"/>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
<b t="1">Document</b>: <xsl:text t="1">Buyer form</xsl:text>
|
||||||
|
</para><para>
|
||||||
|
<b t="1">Auction</b>: <xsl:value-of select="title"/>
|
||||||
|
</para>
|
||||||
|
<xsl:if test="client_info">
|
||||||
|
<para>
|
||||||
|
<b t="1">Customer Contact</b>:
|
||||||
|
<xsl:value-of select="client_info/phone"/>
|
||||||
|
<xsl:if test="number(string-length(client_info/mobile) > 0) + number(string-length(client_info/phone) > 0) = 2">
|
||||||
|
<xsl:text> - </xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:value-of select="client_info/mobile"/>
|
||||||
|
</para><para>
|
||||||
|
<b t="1">Customer Reference</b>: <xsl:value-of select="client_info/ref"/>
|
||||||
|
</para>
|
||||||
|
</xsl:if>
|
||||||
|
<spacer length="1cm"/>
|
||||||
|
<xsl:apply-templates select="objects"/>
|
||||||
|
<!-- <setNextTemplate name="first_page"/>-->
|
||||||
|
<!--<pageBreak/>-->
|
||||||
|
</xsl:template>
|
||||||
|
<xsl:template match="objects">
|
||||||
|
<blockTable colWidths="0.2cm,1.4cm,9.0cm,1.5cm,2.3cm,2.0cm" style="objects">
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td t="1"></td>
|
||||||
|
<td t="1">Cat</td>
|
||||||
|
<td t="1">Description</td>
|
||||||
|
<td t="1">Paid</td>
|
||||||
|
<td t="1">Adj.(EUR)</td>
|
||||||
|
<td t="1">Total</td>
|
||||||
|
</tr>
|
||||||
|
<xsl:apply-templates select="object"/>
|
||||||
|
</blockTable>
|
||||||
|
<condPageBreak height="1.2cm"/>
|
||||||
|
<blockTable colWidths="0.2cm,1.4cm,9.0cm,1.5cm,2.3cm,2.0cm" style="object-totals">
|
||||||
|
<tr>
|
||||||
|
<td/>
|
||||||
|
<td/>
|
||||||
|
<td/>
|
||||||
|
|
||||||
|
<td/>
|
||||||
|
<td t="1">Subtotal:</td>
|
||||||
|
<td><xsl:value-of select="format-number(sum(object[price != '']/price), '#,##0.00')"/></td>
|
||||||
|
</tr>
|
||||||
|
<!-- <xsl:apply-templates select="cost"/>-->
|
||||||
|
<tr>
|
||||||
|
<td/>
|
||||||
|
<td/>
|
||||||
|
<td/>
|
||||||
|
|
||||||
|
<td/>
|
||||||
|
<td t="1">Buyer Cost:</td>
|
||||||
|
<td><xsl:value-of select="format-number(sum(object/cost/amount), '#,##0.00')"/></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td/>
|
||||||
|
<td/>
|
||||||
|
<td/>
|
||||||
|
|
||||||
|
<td/>
|
||||||
|
<td t="1">Total:</td>
|
||||||
|
<td><xsl:value-of select="format-number(sum(object[price != '']/price) + sum(object/cost/amount), '#,##0.00')"/></td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<xsl:template match="object">
|
||||||
|
<tr>
|
||||||
|
<td></td>
|
||||||
|
<td><xsl:value-of select="ref"/></td>
|
||||||
|
<td>
|
||||||
|
<para>
|
||||||
|
<b><xsl:value-of select="title"/><xsl:text>. </xsl:text></b>
|
||||||
|
<xsl:value-of select="desc"/>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
<td><xsl:if test="state='paid'"><xsl:text>X</xsl:text></xsl:if></td>
|
||||||
|
<td>
|
||||||
|
<xsl:if test="price!=''">
|
||||||
|
<xsl:value-of select="format-number(price, '#,##0.00')"/>
|
||||||
|
</xsl:if>
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<td>
|
||||||
|
<xsl:if test="price!=''">
|
||||||
|
<xsl:value-of select="format-number(price + sum(cost/amount), '#,##0.00')"/>
|
||||||
|
</xsl:if>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
|
@ -0,0 +1,37 @@
|
||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<borderform-list>
|
||||||
|
<city type="data" name="city"/>
|
||||||
|
<date type="function" name="today"/>
|
||||||
|
|
||||||
|
<borderform type="fields" name="ach_login,auction_id,ach_uid">
|
||||||
|
<title type="field" name="auction_id.name"/>
|
||||||
|
<login type="field" name="ach_login"/>
|
||||||
|
<client_info type="zoom" name="ach_uid">
|
||||||
|
<name type="field" name="name"/>
|
||||||
|
<ref type="field" name="ref"/>
|
||||||
|
<title type="field" name="title"/>
|
||||||
|
<street type="field" name="address.street"/>
|
||||||
|
<street2 type="field" name="address.street2"/>
|
||||||
|
<zip type="field" name="address.zip"/>
|
||||||
|
<city type="field" name="address.city"/>
|
||||||
|
<!--<country type="field" name="address.country.name"/>-->
|
||||||
|
<phone type="field" name="address.phone"/>
|
||||||
|
<mobile type="field" name="address.mobile"/>
|
||||||
|
</client_info>
|
||||||
|
<objects>
|
||||||
|
<!-- <cost type="call" name="compute_buyer_costs" args="">-->-->
|
||||||
|
<name value="name"/>
|
||||||
|
<amount value="amount"/>
|
||||||
|
<!-- </cost>-->
|
||||||
|
<object type="fields" name="obj_num,id">
|
||||||
|
<ref type="field" name="obj_num"/>
|
||||||
|
<title type="field" name="name"/>
|
||||||
|
<desc type="field" name="obj_desc"/>
|
||||||
|
<price type="field" name="obj_price"/>
|
||||||
|
<avance type="field" name="ach_avance"/>
|
||||||
|
<state type="field" name="state"/>
|
||||||
|
<image type="attachment" name="id"/>
|
||||||
|
</object>
|
||||||
|
</objects>
|
||||||
|
</borderform>
|
||||||
|
</borderform-list>
|
|
@ -0,0 +1,162 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
|
||||||
|
|
||||||
|
<xsl:import href="../../custom/corporate_defaults.xsl"/>
|
||||||
|
<xsl:import href="../../base/report/rml_template.xsl"/>
|
||||||
|
|
||||||
|
<xsl:template match="/">
|
||||||
|
<xsl:call-template name="rml"/>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="stylesheet">
|
||||||
|
<paraStyle name="login-title" fontName="Helvetica" fontSize="12"/>
|
||||||
|
<paraStyle name="login" fontName="Helvetica-Bold" fontSize="16"/>
|
||||||
|
|
||||||
|
<blockTableStyle id="objects">
|
||||||
|
<blockFont name="Helvetica-BoldOblique" size="12" start="0,0" stop="-1,0"/>
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<blockAlignment value="RIGHT" start="-1,0" stop="-1,-1"/>
|
||||||
|
<lineStyle kind="LINEBELOW" start="0,0" stop="-1,0"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
|
||||||
|
<blockTableStyle id="object-totals">
|
||||||
|
<blockValign value="TOP"/>
|
||||||
|
<blockAlignment value="RIGHT"/>
|
||||||
|
<lineStyle kind="LINEABOVE" start="-1,0" stop="-1,0"/>
|
||||||
|
<lineStyle kind="LINEABOVE" start="-1,-1" stop="-1,-1"/>
|
||||||
|
</blockTableStyle>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template name="story">
|
||||||
|
<xsl:apply-templates select="borderform-list"/>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="borderform-list">
|
||||||
|
<xsl:apply-templates select="borderform">
|
||||||
|
<xsl:sort order="ascending" select="client_info/name"/>
|
||||||
|
</xsl:apply-templates>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="client_info">
|
||||||
|
<para>
|
||||||
|
<b>
|
||||||
|
<xsl:value-of select="title" />
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
<xsl:value-of select="name"/>
|
||||||
|
</b>
|
||||||
|
</para>
|
||||||
|
<para><xsl:value-of select="street"/></para>
|
||||||
|
<para><xsl:value-of select="street2"/></para>
|
||||||
|
<para>
|
||||||
|
<xsl:value-of select="zip"/>
|
||||||
|
<xsl:text> </xsl:text>
|
||||||
|
<xsl:value-of select="city"/>
|
||||||
|
</para>
|
||||||
|
<!-- <para><xsl:value-of select="country"/></para>-->
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="borderform">
|
||||||
|
<xsl:apply-templates select="client_info"/>
|
||||||
|
|
||||||
|
<setNextTemplate name="other_pages"/>
|
||||||
|
<nextFrame/>
|
||||||
|
|
||||||
|
<para style="login-title" t="1">Plate Number:</para>
|
||||||
|
<para style="login"><xsl:value-of select="login"/></para>
|
||||||
|
|
||||||
|
<spacer length="1cm"/>
|
||||||
|
|
||||||
|
<para>
|
||||||
|
<b t="1">Document</b>: <xsl:text t="1">Buyer form</xsl:text>
|
||||||
|
</para><para>
|
||||||
|
<b t="1">Auction</b>: <xsl:value-of select="title"/>
|
||||||
|
</para>
|
||||||
|
|
||||||
|
<xsl:if test="client_info">
|
||||||
|
<para>
|
||||||
|
<b t="1">Customer Contact</b>:
|
||||||
|
<xsl:value-of select="client_info/phone"/>
|
||||||
|
<xsl:if test="number(string-length(client_info/mobile) > 0) + number(string-length(client_info/phone) > 0) = 2">
|
||||||
|
<xsl:text> - </xsl:text>
|
||||||
|
</xsl:if>
|
||||||
|
<xsl:value-of select="client_info/mobile"/>
|
||||||
|
</para><para>
|
||||||
|
<b t="1">Customer Reference</b>: <xsl:value-of select="client_info/ref"/>
|
||||||
|
</para>
|
||||||
|
</xsl:if>
|
||||||
|
|
||||||
|
<spacer length="1cm"/>
|
||||||
|
|
||||||
|
<xsl:apply-templates select="objects"/>
|
||||||
|
|
||||||
|
<setNextTemplate name="first_page"/>
|
||||||
|
<pageBreak/>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="objects">
|
||||||
|
<blockTable colWidths="3.1cm,1.8cm,9.6cm,1.5cm,2.2cm" style="objects">
|
||||||
|
<tr>
|
||||||
|
<td/>
|
||||||
|
<td t="1">Cat. N.</td>
|
||||||
|
<td t="1">Description</td>
|
||||||
|
<td t="1">Paid</td>
|
||||||
|
<td t="1">Adj.(EUR)</td>
|
||||||
|
</tr>
|
||||||
|
<xsl:apply-templates select="object"/>
|
||||||
|
</blockTable>
|
||||||
|
<condPageBreak height="3.2cm"/>
|
||||||
|
<blockTable colWidths="3.1cm,1.8cm,9.6cm,1.5cm,2.2cm" style="object-totals">
|
||||||
|
<tr>
|
||||||
|
<td/>
|
||||||
|
<td/>
|
||||||
|
<td/>
|
||||||
|
<td t="1">Subtotal:</td>
|
||||||
|
<td><xsl:value-of select="format-number(sum(object[price != '']/price), '#,##0.00')"/></td>
|
||||||
|
</tr>
|
||||||
|
<xsl:apply-templates select="cost"/>
|
||||||
|
<tr>
|
||||||
|
<td/>
|
||||||
|
<td/>
|
||||||
|
<td/>
|
||||||
|
<td t="1">Total:</td>
|
||||||
|
<td><xsl:value-of select="format-number(sum(object[price != '']/price) + sum(cost/amount), '#,##0.00')"/></td>
|
||||||
|
</tr>
|
||||||
|
</blockTable>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="cost">
|
||||||
|
<tr>
|
||||||
|
<td/>
|
||||||
|
<td/>
|
||||||
|
<td/>
|
||||||
|
<td><xsl:value-of select="name"/>:</td>
|
||||||
|
<td><xsl:value-of select="format-number(amount, '#,##0.00')"/></td>
|
||||||
|
</tr>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<xsl:template match="object">
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<xsl:if test="image">
|
||||||
|
<image width="2.5cm" height="2.2cm">
|
||||||
|
<xsl:attribute name="name"><xsl:value-of select="image"/></xsl:attribute>
|
||||||
|
</image>
|
||||||
|
</xsl:if>
|
||||||
|
</td>
|
||||||
|
<td><xsl:value-of select="ref"/></td>
|
||||||
|
<td>
|
||||||
|
<para>
|
||||||
|
<b><xsl:value-of select="title"/><xsl:text>. </xsl:text></b>
|
||||||
|
<xsl:value-of select="desc"/>
|
||||||
|
</para>
|
||||||
|
</td>
|
||||||
|
<td><xsl:if test="state='paid'"><xsl:text>X</xsl:text></xsl:if></td>
|
||||||
|
<td>
|
||||||
|
<xsl:if test="price!=''">
|
||||||
|
<xsl:value-of select="format-number(price, '#,##0.00')"/>
|
||||||
|
</xsl:if>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue