[MERGE] merge from trunk addons3
bzr revid: pso@tinyerp.com-20101228064546-62qu8zlthbkk3w4j
This commit is contained in:
@@ -94,7 +94,7 @@
|
||||
<field name="product_id"/>
|
||||
<field name="partner_id"/>
|
||||
<separator orientation="vertical" groups="base.group_multi_company"/>
|
||||
<field name="company_id" widget="selection" groups="base.group_multi_company"/>
|
||||
<field name="company_id" groups="base.group_multi_company"/>
|
||||
<newline/>
|
||||
<field name="date_created"/>
|
||||
<field name="date"/>
|
||||
|
||||
@@ -179,20 +179,14 @@ class general_ledger(report_sxw.rml_parse, common_report_header):
|
||||
if res_lines and self.init_balance:
|
||||
#FIXME: replace the label of lname with a string translatable
|
||||
sql = """
|
||||
SELECT 0 AS lid, '' AS ldate, '' AS lcode, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, '' AS lperiod_id, '' AS lpartner_id,
|
||||
SELECT 0 AS lid, '' AS ldate, '' AS lcode, COALESCE(SUM(l.amount_currency),0.0) AS amount_currency, '' AS lref, 'Initial Balance' AS lname, COALESCE(SUM(l.debit),0.0) AS debit, COALESCE(SUM(l.credit),0.0) AS credit, '' AS lperiod_id, '' AS lpartner_id,
|
||||
'' AS move_name, '' AS mmove_id, '' AS period_code,
|
||||
sum(case when a.currency_id is not null then
|
||||
l.amount_currency
|
||||
else
|
||||
0.0
|
||||
end) as amount_currency,
|
||||
'' AS currency_code,
|
||||
NULL AS currency_id,
|
||||
'' AS invoice_id, '' AS invoice_type, '' AS invoice_number,
|
||||
'' AS partner_name
|
||||
FROM account_move_line l
|
||||
LEFT JOIN account_move m on (l.move_id=m.id)
|
||||
LEFT JOIN account_account a ON (l.account_id=a.id)
|
||||
LEFT JOIN res_currency c on (l.currency_id=c.id)
|
||||
LEFT JOIN res_partner p on (l.partner_id=p.id)
|
||||
LEFT JOIN account_invoice i on (m.id =i.move_id)
|
||||
@@ -215,8 +209,6 @@ class general_ledger(report_sxw.rml_parse, common_report_header):
|
||||
l['amount_currency'] = abs(l['amount_currency']) * -1
|
||||
if l['amount_currency'] != None:
|
||||
self.tot_currency = self.tot_currency + l['amount_currency']
|
||||
self.cr.execute("select distinct currency_id from account_invoice")
|
||||
l['cur_id']=self.cr.fetchall()
|
||||
return res
|
||||
|
||||
def _sum_debit_account(self, account):
|
||||
|
||||
@@ -518,7 +518,7 @@
|
||||
<para style="terp_default_Right_8">[[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_8"><font>[[ (len(line['cur_id'])==1 and o.currency_id.id==line['currency_id'] and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[ line['currency_code'] or '']]</font></para>
|
||||
<para style="terp_default_Right_8"><font>[[ (line.has_key('currency_id') and line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'])]] [[ line['currency_code'] or '']]</font></para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
||||
@@ -508,7 +508,7 @@
|
||||
<para style="terp_default_Bold_8_Right">[[ formatLang(sum_balance_account(o), digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Bold_8_Right">[[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.symbol or '' ]]</para>
|
||||
<para style="terp_default_Bold_8_Right">[[ o.currency_id and formatLang(sum_currency_amount_account(o), digits=get_digits(dp='Account')) + o.currency_id.code or '' ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
@@ -550,7 +550,7 @@
|
||||
<para style="terp_default_Right_7">[[ formatLang(line['progress'], digits=get_digits(dp='Account')) ]] [[ company.currency_id.symbol ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_7"><font>[[ (len(line['cur_id'])==1 and o.currency_id.id==line['currency_id'] and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[ line['currency_code'] or '']]</font></para>
|
||||
<para style="terp_default_Right_7">[[ (line.has_key('currency_id') and line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'])]] [[ line['currency_code'] or '']]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
|
||||
@@ -37,7 +37,6 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header):
|
||||
# 'sum_debit': self._sum_debit,
|
||||
# 'sum_credit': self._sum_credit,
|
||||
'get_currency': self._get_currency,
|
||||
'sum_currency_amount_account': self._sum_currency_amount_account,
|
||||
'comma_me': self.comma_me,
|
||||
'get_start_period': self.get_start_period,
|
||||
'get_end_period': self.get_end_period,
|
||||
@@ -161,10 +160,6 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header):
|
||||
r['progress'] = sum
|
||||
full_account.append(r)
|
||||
return full_account
|
||||
|
||||
def _get_currency(self):
|
||||
self.cr.execute("select distinct currency_id from account_invoice")
|
||||
return self.cr.fetchall()
|
||||
|
||||
def _get_intial_balance(self, partner):
|
||||
move_state = ['draft','posted']
|
||||
@@ -395,10 +390,16 @@ class third_party_ledger(report_sxw.rml_parse, common_report_header):
|
||||
return 'Receivable and Payable Accounts'
|
||||
return ''
|
||||
|
||||
def _sum_currency_amount_account(self, account):
|
||||
self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %s" %(account.id))
|
||||
def _sum_currency_amount_account(self, account, form):
|
||||
self._set_get_account_currency_code(account.id)
|
||||
self.cr.execute("SELECT sum(aml.amount_currency) FROM account_move_line as aml,res_currency as rc WHERE aml.currency_id = rc.id AND aml.account_id= %s ", (account.id,))
|
||||
total = self.cr.fetchone()
|
||||
return total[0] or 0.0
|
||||
if self.account_currency:
|
||||
return_field = str(total[0]) + self.account_currency
|
||||
return return_field
|
||||
else:
|
||||
currency_total = self.tot_currency = 0.0
|
||||
return currency_total
|
||||
|
||||
def _display_initial_balance(self, data):
|
||||
if self.initial_balance:
|
||||
|
||||
@@ -470,7 +470,7 @@
|
||||
<font face="Helvetica" color="white">[[ display_currency(data) == False or removeParentNode('section') ]]</font>
|
||||
</para>
|
||||
|
||||
<blockTable rowHeights="0.55cm" colWidths="262.0,64.0,64.0,79.0,70.0" style="Table3">
|
||||
<blockTable rowHeights="0.55cm" colWidths="332.0,64.0,64.0,79.0" style="Table3">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_Bold_9">[[ p.ref ]] - [[ p.name ]]</para>
|
||||
@@ -484,16 +484,13 @@
|
||||
<td>
|
||||
<para style="terp_default_Bold_9_Right">[[ formatLang((sum_debit_partner(p) - sum_credit_partner(p))) ]] [[ company.currency_id.symbol ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Bold_9_Right">[[ p.property_account_receivable.currency_id and formatLang(sum_currency_amount_account(p.property_account_receivable), digits=get_digits(dp='Account')) + p.property_account_receivable.currency_id.symbol or '' ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<section>
|
||||
<para style="terp_default_2">
|
||||
<font face="Helvetica" color="white">[[data['form']['initial_balance']==True or removeParentNode('section') ]]</font>
|
||||
</para>
|
||||
<blockTable rowHeights="0.55cm" colWidths="262.0,64.0,64.0,79.0,70.0" style="Table5">
|
||||
<blockTable rowHeights="0.55cm" colWidths="332.0,64.0,64.0,79.0" style="Table5">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="terp_default_9">Initial Balance</para>
|
||||
@@ -507,9 +504,6 @@
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ formatLang(get_intial_balance(p)[0][2]) ]] [[ company.currency_id.symbol ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_9">[[ len(get_currency())==1 and p.property_account_receivable.currency_id and formatLang(sum_currency_amount_account(p.property_account_receivable), digits=get_digits(dp='Account')) + p.property_account_receivable.currency_id.symbol or '' ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
</section>
|
||||
@@ -659,7 +653,7 @@
|
||||
</td>
|
||||
<td>
|
||||
<para style="terp_default_Right_8">
|
||||
<font face="Helvetica" size="8.0">[[ (len(get_currency())==1 and p.property_account_receivable.currency_id and formatLang(line['amount_currency'])) or removeParentNode('font') ]] [[ line['currency_code'] or '']] </font>
|
||||
<font face="Helvetica" size="8.0">[[ (line['currency_id']==None or line['amount_currency']==None) and removeParentNode('font') ]] [[ formatLang(line['amount_currency'] ) ]] [[ line['currency_code'] or '' ]]</font>
|
||||
</para>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -32,17 +32,6 @@ class account_balance_report(osv.osv_memory):
|
||||
'journal_ids': [],
|
||||
}
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
res = super(account_balance_report, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
|
||||
doc = etree.XML(res['arch'])
|
||||
nodes = doc.xpath("//field[@name='journal_ids']")
|
||||
for node in nodes:
|
||||
node.set('readonly', '1')
|
||||
node.set('required', '0')
|
||||
res['arch'] = etree.tostring(doc)
|
||||
return res
|
||||
|
||||
def _print_report(self, cr, uid, ids, data, context=None):
|
||||
data = self.pre_print_report(cr, uid, ids, data, context=context)
|
||||
return {'type': 'ir.actions.report.xml', 'report_name': 'account.account.balance', 'datas': data}
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
<field name="inherit_id" ref="account_common_report_view" />
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//field[@name='journal_ids']" position="replace">
|
||||
<field name="journal_ids" colspan="4" nolabel="1" required="0" readonly="1"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/label[@string='']" position="replace">
|
||||
<separator string="Trial Balance" colspan="4"/>
|
||||
<label nolabel="1" colspan="4" string="This report allows you to print or generate a pdf of your trial balance allowing you to quickly check the balance of each of your accounts in a single report"/>
|
||||
|
||||
@@ -44,16 +44,6 @@ class account_aged_trial_balance(osv.osv_memory):
|
||||
'direction_selection': 'past',
|
||||
}
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
res = super(account_aged_trial_balance, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
|
||||
doc = etree.XML(res['arch'])
|
||||
nodes = doc.xpath("//field[@name='journal_ids']")
|
||||
for node in nodes:
|
||||
node.set('invisible', '1')
|
||||
node.set('required', '0')
|
||||
res['arch'] = etree.tostring(doc)
|
||||
return res
|
||||
|
||||
def _print_report(self, cr, uid, ids, data, context=None):
|
||||
res = {}
|
||||
if context is None:
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<newline/>
|
||||
<field name="result_selection"/>
|
||||
<field name="direction_selection"/>
|
||||
<field name="journal_ids"/>
|
||||
<field name="journal_ids" required="0" invisible="1"/>
|
||||
<newline/>
|
||||
<separator colspan="4"/>
|
||||
<group col="4" colspan="4">
|
||||
|
||||
@@ -32,36 +32,45 @@ class account_bs_report(osv.osv_memory):
|
||||
_inherit = "account.common.account.report"
|
||||
_description = 'Account Balance Sheet Report'
|
||||
|
||||
def _get_def_reserve_account(self, cr, uid, context=None):
|
||||
chart_id = self._get_account(cr, uid, context=context)
|
||||
res = self.onchange_chart_id(cr, uid, [], chart_id, context=context)
|
||||
if not res:
|
||||
return False
|
||||
return res['value']['reserve_account_id']
|
||||
|
||||
_columns = {
|
||||
'display_type': fields.boolean("Landscape Mode"),
|
||||
'reserve_account_id': fields.many2one('account.account', 'Reserve & Profit/Loss Account',required = True,
|
||||
help='This Account is used for transferring Profit/Loss(If It is Profit: Amount will be added, Loss : Amount will be duducted.), Which is calculated from Profilt & Loss Report', domain = [('type','=','payable')]),
|
||||
'reserve_account_id': fields.many2one('account.account', 'Reserve & Profit/Loss Account',
|
||||
required=True,
|
||||
help='This Account is used for transfering Profit/Loss ' \
|
||||
'(Profit: Amount will be added, Loss: Amount will be duducted), ' \
|
||||
'which is calculated from Profilt & Loss Report',
|
||||
domain = [('type','=','payable')]),
|
||||
}
|
||||
|
||||
_defaults={
|
||||
'display_type': True,
|
||||
'journal_ids': [],
|
||||
'reserve_account_id': _get_def_reserve_account,
|
||||
}
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
res = super(account_bs_report, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
|
||||
doc = etree.XML(res['arch'])
|
||||
nodes = doc.xpath("//field[@name='journal_ids']")
|
||||
for node in nodes:
|
||||
node.set('readonly', '1')
|
||||
node.set('required', '0')
|
||||
res['arch'] = etree.tostring(doc)
|
||||
return res
|
||||
def onchange_chart_id(self, cr, uid, ids, chart_id, context=None):
|
||||
if not chart_id:
|
||||
return {}
|
||||
account = self.pool.get('account.account').browse(cr, uid, chart_id , context=context)
|
||||
if not account.company_id.property_reserve_and_surplus_account:
|
||||
return {'value': {'reserve_account_id': False}}
|
||||
return {'value': {'reserve_account_id': account.company_id.property_reserve_and_surplus_account.id}}
|
||||
|
||||
|
||||
def _print_report(self, cr, uid, ids, data, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
data = self.pre_print_report(cr, uid, ids, data, context=context)
|
||||
account = self.pool.get('account.account').browse(cr, uid, data['form']['chart_account_id'], context=context)
|
||||
if not account.company_id.property_reserve_and_surplus_account:
|
||||
data['form'].update(self.read(cr, uid, ids, ['display_type','reserve_account_id'])[0])
|
||||
if not data['form']['reserve_account_id']:
|
||||
raise osv.except_osv(_('Warning'),_('Please define the Reserve and Profit/Loss account for current user company !'))
|
||||
data['form']['reserve_account_id'] = account.company_id.property_reserve_and_surplus_account.id
|
||||
data['form'].update(self.read(cr, uid, ids, ['display_type'])[0])
|
||||
data = self.pre_print_report(cr, uid, ids, data, context=context)
|
||||
if data['form']['display_type']:
|
||||
return {
|
||||
'type': 'ir.actions.report.xml',
|
||||
@@ -77,4 +86,4 @@ class account_bs_report(osv.osv_memory):
|
||||
|
||||
account_bs_report()
|
||||
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
|
||||
@@ -9,14 +9,20 @@
|
||||
<field name="inherit_id" ref="account.account_common_report_view" />
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//field[@name='chart_account_id']" position="replace">
|
||||
<field name="chart_account_id" widget="selection" on_change="onchange_chart_id(chart_account_id)"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='journal_ids']" position="replace">
|
||||
<field name="journal_ids" colspan="4" nolabel="1" required="0" readonly="1"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/label[@string='']" position="replace">
|
||||
<separator string="Balance Sheet" colspan="4"/>
|
||||
<label nolabel="1" colspan="4" string="This report allows you to print or generate a pdf of your trial balance allowing you to quickly check the balance of each of your accounts in a single report"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='target_move']" position="after">
|
||||
<field name="display_account"/>
|
||||
<field name="reserve_account_id" required="1"/>
|
||||
<field name="display_type"/>
|
||||
<field name="reserve_account_id" required="0" invisible="1"/>
|
||||
<newline/>
|
||||
</xpath>
|
||||
</data>
|
||||
|
||||
@@ -40,21 +40,6 @@ class account_pl_report(osv.osv_memory):
|
||||
'target_move': False
|
||||
}
|
||||
|
||||
def fields_view_get(self, cr, uid, view_id=None, view_type='form', context=None, toolbar=False, submenu=False):
|
||||
mod_obj = self.pool.get('ir.model.data')
|
||||
res = super(account_pl_report, self).fields_view_get(cr, uid, view_id=view_id, view_type=view_type, context=context, toolbar=toolbar, submenu=False)
|
||||
doc = etree.XML(res['arch'])
|
||||
nodes = doc.xpath("//field[@name='journal_ids']")
|
||||
for node in nodes:
|
||||
node.set('readonly', '1')
|
||||
node.set('required', '0')
|
||||
nodes = doc.xpath("//field[@name='target_move']")
|
||||
for node in nodes:
|
||||
node.set('readonly', '1')
|
||||
node.set('required', '0')
|
||||
res['arch'] = etree.tostring(doc)
|
||||
return res
|
||||
|
||||
def _print_report(self, cr, uid, ids, data, context=None):
|
||||
if context is None:
|
||||
context = {}
|
||||
|
||||
@@ -9,6 +9,12 @@
|
||||
<field name="inherit_id" ref="account.account_common_report_view" />
|
||||
<field name="arch" type="xml">
|
||||
<data>
|
||||
<xpath expr="//field[@name='target_move']" position="replace">
|
||||
<field name="target_move" required="0" readonly="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='journal_ids']" position="replace">
|
||||
<field name="journal_ids" required="0" colspan="4" nolabel="1" readonly="1"/>
|
||||
</xpath>
|
||||
<xpath expr="/form/label[@string='']" position="replace">
|
||||
<separator string="Profit And Loss" colspan="4"/>
|
||||
<label nolabel="1" colspan="4" string="The Profit and Loss report gives you an overview of your company profit and loss in a single document"/>
|
||||
|
||||
@@ -847,7 +847,7 @@ class account_voucher_line(osv.osv):
|
||||
'move_line_id': fields.many2one('account.move.line', 'Journal Item'),
|
||||
'date_original': fields.related('move_line_id','date', type='date', relation='account.move.line', string='Date', readonly=1),
|
||||
'date_due': fields.related('move_line_id','date_maturity', type='date', relation='account.move.line', string='Due Date', readonly=1),
|
||||
'amount_original': fields.function(_compute_balance, method=True, multi='dc', type='float', string='Originial Amount', store=True),
|
||||
'amount_original': fields.function(_compute_balance, method=True, multi='dc', type='float', string='Original Amount', store=True),
|
||||
'amount_unreconciled': fields.function(_compute_balance, method=True, multi='dc', type='float', string='Open Balance', store=True),
|
||||
'company_id': fields.related('voucher_id','company_id', relation='res.company', type='many2one', string='Company', store=True),
|
||||
}
|
||||
|
||||
@@ -53,7 +53,14 @@
|
||||
<field name="restart">always</field>
|
||||
</record>
|
||||
|
||||
<menuitem name="Association" id="base.menu_association" icon="terp-calendar" sequence="9" groups="base.group_extended"/>
|
||||
<menuitem
|
||||
name="Association"
|
||||
id="base.menu_association"
|
||||
icon="terp-calendar"
|
||||
sequence="9"
|
||||
groups="base.group_extended"
|
||||
web_icon="images/association.png"
|
||||
web_icon_hover="images/association-hover.png"/>
|
||||
<menuitem name="Configuration" id="base.menu_event_config" parent="base.menu_association" sequence="30" groups="base.group_extended"/>
|
||||
<menuitem name="Reporting" id="base.menu_report_association" parent="base.menu_association" sequence="20"/>
|
||||
</data>
|
||||
|
||||
@@ -74,7 +74,7 @@
|
||||
<field name="date" required="1"/>
|
||||
<field name="user_id"/>
|
||||
<field name="section_id" colspan="1" widget="selection" />
|
||||
<button string="aaaaaaaaaConvert to Opportunity"
|
||||
<button string="Convert to Opportunity"
|
||||
name="%(phonecall2opportunity_act)d"
|
||||
icon="gtk-index" type="action"
|
||||
attrs="{'invisible':[('opportunity_id','!=',False)]}" />
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
import libroIVA_credito
|
||||
import libroIVA_debito
|
||||
@@ -0,0 +1,79 @@
|
||||
import datetime
|
||||
import time
|
||||
from report import report_sxw
|
||||
from osv import osv
|
||||
import pooler
|
||||
|
||||
|
||||
class l10n_chart_it_report_libroIVA_credito(report_sxw.rml_parse):
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(l10n_chart_it_report_libroIVA_credito,self).__init__(cr,uid,name,context)
|
||||
self.localcontext.update({
|
||||
'time' : time,
|
||||
'get_company' : self.get_company,
|
||||
'get_periods' : self.get_periods,
|
||||
'get_lines' : self.get_lines,
|
||||
})
|
||||
|
||||
|
||||
def get_company(self,fiscal_year):
|
||||
#print 'COMP = ',fiscal_year
|
||||
return ""
|
||||
|
||||
def get_periods(self,fiscal_year):
|
||||
#print 'Fiscal year id:',fiscal_year.id
|
||||
obj=pooler.get_pool(self.cr.dbname).get('account.fiscalyear')
|
||||
fy=obj.browse(self.cr,self.uid,fiscal_year.id)
|
||||
#print 'Periods = ',fy.period_ids
|
||||
res=[rec for rec in fy.period_ids]
|
||||
#return fy.periods => non funziona?!? bool object !?!?
|
||||
return res
|
||||
|
||||
def get_invoices(self,period):
|
||||
#print 'PERIOD = ',period.name
|
||||
obj=pooler.get_pool(self.cr.dbname).get('account.invoice')
|
||||
# Selezione tutte le fatture emesse nel periodo
|
||||
self.cr.execute( """
|
||||
SELECT id FROM account_invoice
|
||||
WHERE (state='open' OR state='paid') AND
|
||||
period_id="""+str(period.id)+"""
|
||||
AND (type='out_invoice' OR type='out_refund')
|
||||
""")
|
||||
ids=self.cr.fetchall()
|
||||
#print 'IDS = ',
|
||||
if ids:
|
||||
ids=[id[0] for id in ids ]
|
||||
invoices=obj.browse(self.cr,self.uid,ids)
|
||||
#print 'INVOICES = ',invoices
|
||||
return invoices
|
||||
|
||||
def get_lines(self,fiscal_year):
|
||||
res=[]
|
||||
obj_fy=pooler.get_pool(self.cr.dbname).get('account.fiscalyear')
|
||||
fy=obj_fy.browse(self.cr,self.uid,fiscal_year.id)
|
||||
for period in fy.period_ids:
|
||||
invoices=self.get_invoices(period)
|
||||
for invoice in invoices:
|
||||
d={'periodo': period.name}
|
||||
d['protocollo']=invoice.number
|
||||
#print 'PARTNER ',invoice.partner_id.name
|
||||
causale=invoice.partner_id.name
|
||||
#print 'CAUSALE = ',causale
|
||||
d['causale']=causale
|
||||
d['numero']=invoice.reference
|
||||
d['data_doc']=invoice.date_invoice
|
||||
for tax in invoice.tax_line:
|
||||
#print '\tTAX: ',tax
|
||||
d['aliquota']=tax.tax_code_id.name
|
||||
d['imponibile']=tax.base
|
||||
d['imposta']=tax.amount
|
||||
res.append(d)
|
||||
d={'periodo':'', 'protocollo':'', 'causale':'', 'numero':'', 'data_doc':'', }
|
||||
return res
|
||||
|
||||
|
||||
|
||||
report_sxw.report_sxw('report.l10n_it.report.libroIVA_credito','account.report_libroiva',
|
||||
'l10n_it/report/libroIVA_credito.rml',
|
||||
parser=l10n_chart_it_report_libroIVA_credito,header=False)
|
||||
@@ -0,0 +1,203 @@
|
||||
<?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"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table2">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="2,0" stop="2,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="3,0" stop="3,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="4,0" stop="4,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="5,0" stop="5,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="6,0" stop="6,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="6,0" stop="6,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="7,0" stop="7,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#000000" start="7,0" stop="7,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="7,0" stop="7,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="7,-1" stop="7,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="0,1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="1,1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="2,1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="3,1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="4,1" stop="4,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="5,1" stop="5,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="6,1" stop="6,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="7,1" stop="7,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#000000" start="7,1" stop="7,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="7,-1" stop="7,-1"/>
|
||||
<blockBackground colorName="#ffcc99" start="0,0" stop="0,-1"/>
|
||||
<blockBackground colorName="#ffcc99" start="1,0" stop="1,-1"/>
|
||||
<blockBackground colorName="#ffcc99" start="2,0" stop="2,-1"/>
|
||||
<blockBackground colorName="#ffcc99" start="3,0" stop="3,-1"/>
|
||||
<blockBackground colorName="#ffcc99" start="4,0" stop="4,-1"/>
|
||||
<blockBackground colorName="#ffcc99" start="5,0" stop="5,-1"/>
|
||||
<blockBackground colorName="#ffcc99" start="6,0" stop="6,-1"/>
|
||||
<blockBackground colorName="#ffcc99" start="7,0" stop="7,-1"/>
|
||||
<blockBackground colorName="#ffffff" start="0,1" stop="0,-1"/>
|
||||
<blockBackground colorName="#ffffff" start="1,1" stop="1,-1"/>
|
||||
<blockBackground colorName="#ffffff" start="2,1" stop="2,-1"/>
|
||||
<blockBackground colorName="#ffffff" start="3,1" stop="3,-1"/>
|
||||
<blockBackground colorName="#ffffff" start="4,1" stop="4,-1"/>
|
||||
<blockBackground colorName="#ffffff" start="5,1" stop="5,-1"/>
|
||||
<blockBackground colorName="#ffffff" start="6,1" stop="6,-1"/>
|
||||
<blockBackground colorName="#ffffff" start="7,1" stop="7,-1"/>
|
||||
</blockTableStyle>
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" fontName="Times-Roman" alignment="RIGHT"/>
|
||||
<paraStyle name="P2" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT"/>
|
||||
<paraStyle name="P3" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER"/>
|
||||
<paraStyle name="P4" fontName="Helvetica" fontSize="12.0" leading="15" alignment="CENTER"/>
|
||||
<paraStyle name="P5" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT"/>
|
||||
<paraStyle name="P6" rightIndent="0.0" leftIndent="71.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="RIGHT"/>
|
||||
<paraStyle name="P7" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER"/>
|
||||
<paraStyle name="P8" fontName="Helvetica" fontSize="12.0" leading="15" alignment="CENTER"/>
|
||||
<paraStyle name="P9" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
|
||||
<paraStyle name="P10" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
|
||||
<paraStyle name="P11" fontName="Helvetica" fontSize="12.0" leading="15" alignment="CENTER"/>
|
||||
<paraStyle name="P12" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT"/>
|
||||
<paraStyle name="P13" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER"/>
|
||||
<paraStyle name="P14" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT"/>
|
||||
<paraStyle name="P15" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT"/>
|
||||
<paraStyle name="P16" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="RIGHT"/>
|
||||
<paraStyle name="P17" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<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="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||
<paraStyle name="Table Contents" fontName="Times-Roman"/>
|
||||
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
|
||||
<paraStyle name="Footer" fontName="Times-Roman"/>
|
||||
<paraStyle name="MP1" fontName="Times-Roman" alignment="RIGHT"/>
|
||||
</stylesheet>
|
||||
<images/>
|
||||
<story>
|
||||
<para style="P2">[[ repeatIn(objects, 'o') ]]</para>
|
||||
<blockTable colWidths="249.0,249.0" style="Table1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P10">
|
||||
<font face="Times-Roman" size="10.0">[[ get_company(o) ]]</font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P16">
|
||||
<font face="Times-Roman">REGISTRO IVA </font>
|
||||
</para>
|
||||
<para style="P16">
|
||||
<font face="Times-Roman">VENDITE </font>
|
||||
</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P11">[[ o.name ]] </para>
|
||||
<para style="P2">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="39.0,50.0,92.0,45.0,54.0,76.0,69.0,74.0" repeatRows="1" style="Table2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P7">Periodo</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">Protocollo</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">Cliente</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">Numero</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">Data fattura</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">Aliquota</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">Imponibile</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P7">Imposta</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P3">[[ repeatIn(get_lines(o), 'line') ]]</para>
|
||||
<para style="P3">[[ line['periodo'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['protocollo'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['causale'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['numero'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['data_doc'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P14">[[ line['aliquota'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P15">[[ line['imponibile'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P15">[[ line['imposta'] ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P9">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P4">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P4">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</story>
|
||||
</document>
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
import datetime
|
||||
import time
|
||||
from report import report_sxw
|
||||
from osv import osv
|
||||
import pooler
|
||||
|
||||
|
||||
class l10n_chart_it_report_libroIVA_debito(report_sxw.rml_parse):
|
||||
|
||||
def __init__(self, cr, uid, name, context):
|
||||
super(l10n_chart_it_report_libroIVA_debito,self).__init__(cr,uid,name,context)
|
||||
self.localcontext.update({
|
||||
'time' : time,
|
||||
'get_company' : self.get_company,
|
||||
'get_periods' : self.get_periods,
|
||||
'get_lines' : self.get_lines,
|
||||
})
|
||||
|
||||
|
||||
def get_company(self,fiscal_year):
|
||||
#print 'COMP = ',fiscal_year
|
||||
return ""
|
||||
|
||||
|
||||
def get_periods(self,fiscal_year):
|
||||
#print 'Fiscal year id:',fiscal_year.id
|
||||
obj=pooler.get_pool(self.cr.dbname).get('account.fiscalyear')
|
||||
fy=obj.browse(self.cr,self.uid,fiscal_year.id)
|
||||
#print 'Periods = ',fy.period_ids
|
||||
res=[rec for rec in fy.period_ids]
|
||||
#return fy.periods => non funziona?!? bool object !?!?
|
||||
return res
|
||||
|
||||
def get_invoices(self,period):
|
||||
#print 'PERIOD = ',period.name
|
||||
obj=pooler.get_pool(self.cr.dbname).get('account.invoice')
|
||||
# Selezione tutte le fatture emesse nel periodo
|
||||
self.cr.execute( """
|
||||
SELECT id FROM account_invoice
|
||||
WHERE (state='open' OR state='paid') AND
|
||||
period_id="""+str(period.id)+"""
|
||||
AND (type='in_invoice' OR type='in_refund')
|
||||
""")
|
||||
ids=self.cr.fetchall()
|
||||
#print 'IDS = ',
|
||||
if ids:
|
||||
ids=[id[0] for id in ids ]
|
||||
invoices=obj.browse(self.cr,self.uid,ids)
|
||||
#print 'INVOICES = ',invoices
|
||||
return invoices
|
||||
|
||||
def get_lines(self,fiscal_year):
|
||||
res=[]
|
||||
obj_fy=pooler.get_pool(self.cr.dbname).get('account.fiscalyear')
|
||||
fy=obj_fy.browse(self.cr,self.uid,fiscal_year.id)
|
||||
for period in fy.period_ids:
|
||||
invoices=self.get_invoices(period)
|
||||
for invoice in invoices:
|
||||
d={'periodo': period.name}
|
||||
d['protocollo']=invoice.number
|
||||
#print 'PARTNER ',invoice.partner_id.name
|
||||
causale=invoice.partner_id.name
|
||||
#print 'CAUSALE = ',causale
|
||||
d['causale']=causale
|
||||
d['numero']=invoice.reference
|
||||
d['data_doc']=invoice.date_invoice
|
||||
for tax in invoice.tax_line:
|
||||
#print '\tTAX: ',tax
|
||||
d['aliquota']=tax.tax_code_id.name
|
||||
d['imponibile']=tax.base
|
||||
d['imposta']=tax.amount
|
||||
res.append(d)
|
||||
d={'periodo':'', 'protocollo':'', 'causale':'', 'numero':'', 'data_doc':'', }
|
||||
return res
|
||||
|
||||
|
||||
|
||||
report_sxw.report_sxw('report.l10n_it.report.libroIVA_debito','account.report_libroiva',
|
||||
'l10n_it/report/libroIVA_debito.rml',
|
||||
parser=l10n_chart_it_report_libroIVA_debito,header=False)
|
||||
@@ -0,0 +1,195 @@
|
||||
<?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="Table2">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<blockTableStyle id="Table1">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="0,0" stop="0,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="0,0" stop="0,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="1,0" stop="1,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="1,0" stop="1,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="2,0" stop="2,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="2,0" stop="2,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="3,0" stop="3,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="3,0" stop="3,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="4,0" stop="4,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="4,0" stop="4,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="5,0" stop="5,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="5,0" stop="5,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="6,0" stop="6,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="6,0" stop="6,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="7,0" stop="7,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#000000" start="7,0" stop="7,-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#000000" start="7,0" stop="7,0"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="7,-1" stop="7,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="0,1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="0,-1" stop="0,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="1,1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="1,-1" stop="1,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="2,1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="2,-1" stop="2,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="3,1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="3,-1" stop="3,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="4,1" stop="4,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="4,-1" stop="4,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="5,1" stop="5,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="5,-1" stop="5,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="6,1" stop="6,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="6,-1" stop="6,-1"/>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#000000" start="7,1" stop="7,-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#000000" start="7,1" stop="7,-1"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#000000" start="7,-1" stop="7,-1"/>
|
||||
<blockBackground colorName="#ffcc99" start="0,0" stop="0,-1"/>
|
||||
<blockBackground colorName="#ffcc99" start="1,0" stop="1,-1"/>
|
||||
<blockBackground colorName="#ffcc99" start="2,0" stop="2,-1"/>
|
||||
<blockBackground colorName="#ffcc99" start="3,0" stop="3,-1"/>
|
||||
<blockBackground colorName="#ffcc99" start="4,0" stop="4,-1"/>
|
||||
<blockBackground colorName="#ffcc99" start="5,0" stop="5,-1"/>
|
||||
<blockBackground colorName="#ffcc99" start="6,0" stop="6,-1"/>
|
||||
<blockBackground colorName="#ffcc99" start="7,0" stop="7,-1"/>
|
||||
<blockBackground colorName="#ffffff" start="0,1" stop="0,-1"/>
|
||||
<blockBackground colorName="#ffffff" start="1,1" stop="1,-1"/>
|
||||
<blockBackground colorName="#ffffff" start="2,1" stop="2,-1"/>
|
||||
<blockBackground colorName="#ffffff" start="3,1" stop="3,-1"/>
|
||||
<blockBackground colorName="#ffffff" start="4,1" stop="4,-1"/>
|
||||
<blockBackground colorName="#ffffff" start="5,1" stop="5,-1"/>
|
||||
<blockBackground colorName="#ffffff" start="6,1" stop="6,-1"/>
|
||||
<blockBackground colorName="#ffffff" start="7,1" stop="7,-1"/>
|
||||
</blockTableStyle>
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify"/>
|
||||
</initialize>
|
||||
<paraStyle name="P1" fontName="Times-Roman" alignment="RIGHT"/>
|
||||
<paraStyle name="P2" fontName="Helvetica" fontSize="8.0" leading="10" alignment="CENTER"/>
|
||||
<paraStyle name="P3" fontName="Helvetica" fontSize="8.0" leading="10" alignment="LEFT"/>
|
||||
<paraStyle name="P4" fontName="Helvetica" fontSize="8.0" leading="10" alignment="RIGHT"/>
|
||||
<paraStyle name="P5" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
|
||||
<paraStyle name="P6" fontName="Helvetica" fontSize="12.0" leading="15" alignment="CENTER"/>
|
||||
<paraStyle name="P7" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT"/>
|
||||
<paraStyle name="P8" fontName="Helvetica-Bold" fontSize="8.0" leading="10" alignment="CENTER"/>
|
||||
<paraStyle name="P9" fontName="Helvetica" fontSize="10.0" leading="13" alignment="LEFT"/>
|
||||
<paraStyle name="P10" fontName="Helvetica" fontSize="12.0" leading="15" alignment="LEFT"/>
|
||||
<paraStyle name="P11" fontName="Helvetica" fontSize="12.0" leading="15" alignment="CENTER"/>
|
||||
<paraStyle name="P12" rightIndent="0.0" leftIndent="0.0" fontName="Helvetica" fontSize="10.0" leading="13" alignment="RIGHT"/>
|
||||
<paraStyle name="Standard" fontName="Times-Roman"/>
|
||||
<paraStyle name="Heading" fontName="Helvetica" fontSize="14.0" leading="17" spaceBefore="12.0" spaceAfter="6.0"/>
|
||||
<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="Caption" fontName="Times-Roman" fontSize="12.0" leading="15" spaceBefore="6.0" spaceAfter="6.0"/>
|
||||
<paraStyle name="Index" fontName="Times-Roman"/>
|
||||
<paraStyle name="Table Contents" fontName="Times-Roman"/>
|
||||
<paraStyle name="Table Heading" fontName="Times-Roman" alignment="CENTER"/>
|
||||
<paraStyle name="Footer" fontName="Times-Roman"/>
|
||||
<paraStyle name="MP1" fontName="Times-Roman" alignment="RIGHT"/>
|
||||
</stylesheet>
|
||||
<images/>
|
||||
<story>
|
||||
<para style="P7">[[ repeatIn(objects, 'o') ]]</para>
|
||||
<blockTable colWidths="249.0,249.0" style="Table2">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P10">
|
||||
<font face="Times-Roman" size="10.0">[[ get_company(o) ]]</font>
|
||||
</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P12">
|
||||
<font face="Times-Roman">REGISTRO IVA</font>
|
||||
</para>
|
||||
<para style="P12">
|
||||
<font face="Times-Roman">ACQUISTI</font>
|
||||
</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P7">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P11">[[ o.name ]] </para>
|
||||
<para style="P7">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<blockTable colWidths="39.0,50.0,92.0,45.0,54.0,76.0,69.0,74.0" repeatRows="1" style="Table1">
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P8">Periodo</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">Protocollo</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">Fornitore</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">Numero</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">Data fattura</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">Aliquota</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">Imponibile</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P8">Imposta</para>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<para style="P2">[[ repeatIn(get_lines(o), 'line') ]]</para>
|
||||
<para style="P2">[[ line['periodo'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2">[[ line['protocollo'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2">[[ line['causale'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2">[[ line['numero'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P2">[[ line['data_doc'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P3">[[ line['aliquota'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ line['imponibile'] ]]</para>
|
||||
</td>
|
||||
<td>
|
||||
<para style="P4">[[ line['imposta'] ]]</para>
|
||||
</td>
|
||||
</tr>
|
||||
</blockTable>
|
||||
<para style="P5">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
<para style="P6">
|
||||
<font color="white"> </font>
|
||||
</para>
|
||||
</story>
|
||||
</document>
|
||||
|
||||
@@ -0,0 +1,696 @@
|
||||
<?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"
|
||||
xmlns:office="http://openoffice.org/2000/office"
|
||||
xmlns:style="http://openoffice.org/2000/style"
|
||||
xmlns:text="http://openoffice.org/2000/text"
|
||||
xmlns:table="http://openoffice.org/2000/table"
|
||||
xmlns:draw="http://openoffice.org/2000/drawing"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:number="http://openoffice.org/2000/datastyle"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:chart="http://openoffice.org/2000/chart"
|
||||
xmlns:dr3d="http://openoffice.org/2000/dr3d"
|
||||
xmlns:math="http://www.w3.org/1998/Math/MathML"
|
||||
xmlns:form="http://openoffice.org/2000/form"
|
||||
xmlns:script="http://openoffice.org/2000/script"
|
||||
office:class="text" office:version="1.0"
|
||||
exclude-result-prefixes = "xsl fo office style text table draw xlink number svg chart dr3d math form script">
|
||||
|
||||
<!--TODO's: indent, picture cache (trml2pdf) -->
|
||||
|
||||
<xsl:output method="xml" indent="yes" />
|
||||
<xsl:strip-space elements="*"/>
|
||||
|
||||
<xsl:key name="text_style" match="style:style[@style:family='text']" use="@style:name" />
|
||||
<xsl:key name="page_break_before" match="style:style[@style:family='paragraph' and ./style:properties/@fo:break-before='page']" use="@style:name" />
|
||||
<xsl:key name="page_break_after" match="style:style[@style:family='paragraph' and ./style:properties/@fo:break-after='page']" use="@style:name" />
|
||||
<xsl:key name="table_column_style" match="style:style[@style:family='table-column']" use="@style:name" />
|
||||
<xsl:key name="table_cell_style" match="style:style[@style:family='table-cell']" use="@style:name" />
|
||||
<xsl:key name="paragraph_style" match="style:style[@style:family='paragraph']" use="@style:name" />
|
||||
|
||||
<xsl:template match="office:document-content">
|
||||
<document filename="test.pdf">
|
||||
<xsl:apply-templates select="office:automatic-styles" />
|
||||
<xsl:apply-templates select="office:body" />
|
||||
</document>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="page_size">
|
||||
<xsl:attribute name="pageSize">
|
||||
<xsl:text>(</xsl:text>
|
||||
<xsl:value-of select="//transferredfromstylesxml/style:page-master[1]/style:properties/@fo:page-width" />
|
||||
<xsl:text>,</xsl:text>
|
||||
<xsl:value-of select="//transferredfromstylesxml/style:page-master[1]/style:properties/@fo:page-height" />
|
||||
<xsl:text>)</xsl:text>
|
||||
</xsl:attribute>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="fixed_frame">
|
||||
<xsl:for-each select="//draw:text-box">
|
||||
<frame>
|
||||
<xsl:attribute name="id"><xsl:value-of select="./@draw:name" /></xsl:attribute>
|
||||
<xsl:attribute name="x1"><xsl:value-of select="./@svg:x" /></xsl:attribute>
|
||||
<xsl:attribute name="y1">
|
||||
<xsl:value-of
|
||||
select="//transferredfromstylesxml/style:page-master[1]/style:properties/@fo:page-height - ./@svg:y - ./@fo:min-height" />
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="width">
|
||||
<xsl:value-of select="./@svg:width" />
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="height">
|
||||
<xsl:value-of select="./@fo:min-height" />
|
||||
</xsl:attribute>
|
||||
</frame>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="margin_sizes">
|
||||
<xsl:variable name="margin_left" select="//transferredfromstylesxml/style:page-master[1]/style:properties/@fo:margin-left" />
|
||||
<xsl:variable name="margin_right" select="//transferredfromstylesxml/style:page-master[1]/style:properties/@fo:margin-right" />
|
||||
<xsl:variable name="margin_top" select="//transferredfromstylesxml/style:page-master[1]/style:properties/@fo:margin-top" />
|
||||
<xsl:variable name="margin_bottom" select="//transferredfromstylesxml/style:page-master[1]/style:properties/@fo:margin-bottom" />
|
||||
<xsl:variable name="page_width" select="//transferredfromstylesxml/style:page-master[1]/style:properties/@fo:page-width" />
|
||||
<xsl:variable name="page_height" select="//transferredfromstylesxml/style:page-master[1]/style:properties/@fo:page-height" />
|
||||
<xsl:attribute name="x1"><xsl:value-of select="$margin_left" /></xsl:attribute>
|
||||
<xsl:attribute name="y1"><xsl:value-of select="$margin_bottom" /></xsl:attribute>
|
||||
<xsl:attribute name="width"><xsl:value-of select="$page_width - $margin_left - $margin_right"/></xsl:attribute>
|
||||
<xsl:attribute name="height"><xsl:value-of select="$page_height - $margin_bottom - $margin_top"/></xsl:attribute>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="text_width">
|
||||
<!-- You need this for the workaround to make primitive outlines-->
|
||||
<xsl:variable name="margin_left" select="//transferredfromstylesxml/style:page-master[1]/style:properties/@fo:margin-left" />
|
||||
<xsl:variable name="margin_right" select="//transferredfromstylesxml/style:page-master[1]/style:properties/@fo:margin-right" />
|
||||
<xsl:variable name="page_width" select="//transferredfromstylesxml/style:page-master[1]/style:properties/@fo:page-width" />
|
||||
<xsl:value-of select="$page_width - $margin_left - $margin_right - 18"/>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
|
||||
<xsl:template match="office:automatic-styles">
|
||||
<!--<template pageSize="(21cm, 29.7cm)" leftMargin="1.0cm" rightMargin="2.0cm" topMargin="1.0cm" bottomMargin="1.0cm" title="Test" author="Martin Simon" allowSplitting="20">-->
|
||||
<template pageSize="(21cm, 29.7cm)" title="Test" author="Martin Simon" allowSplitting="20">
|
||||
<xsl:call-template name="page_size" />
|
||||
<pageTemplate id="first">
|
||||
<xsl:call-template name="fixed_frame" />
|
||||
<frame id="first" x1="2cm" y1="2cm" width="17cm" height="26cm">
|
||||
<xsl:call-template name="margin_sizes" />
|
||||
</frame>
|
||||
</pageTemplate>
|
||||
</template>
|
||||
<stylesheet>
|
||||
<!--A table style to simulate primitive outlines -till the <addOutline> tag is implemented in trml2pdf -->
|
||||
<blockTableStyle id="Standard_Outline">
|
||||
<blockAlignment value="LEFT"/>
|
||||
<blockValign value="TOP"/>
|
||||
</blockTableStyle>
|
||||
<!--use two standard table grid styles like PyOpenOffice "Old Way": with and without a grid-->
|
||||
<!--TODO insert table cell colors here, not within the <td> tag - otherwise
|
||||
it will not work with flowables as cell content-->
|
||||
<xsl:call-template name="make_blocktablestyle" />
|
||||
<initialize>
|
||||
<paraStyle name="all" alignment="justify" />
|
||||
</initialize>
|
||||
<xsl:apply-templates select="style:style" />
|
||||
</stylesheet>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="make_blocktablestyle">
|
||||
<xsl:for-each select="//table:table">
|
||||
<xsl:variable name="test">
|
||||
<xsl:value-of select="./@table:name" />
|
||||
</xsl:variable>
|
||||
<xsl:if test="not(boolean(count(preceding-sibling::table:table[@table:name=$test])))">
|
||||
<!--Test if this is the first table with this style, nested tables not counted-->
|
||||
<blockTableStyle id="{@table:name}">
|
||||
<xsl:if test=".//draw:image">
|
||||
<blockTopPadding value="0"/>
|
||||
<blockBottomPadding value="0"/>
|
||||
</xsl:if>
|
||||
<blockAlignment value="LEFT" />
|
||||
<blockValign value="TOP" />
|
||||
<xsl:call-template name="make_linestyle" />
|
||||
<xsl:call-template name="make_tablebackground" />
|
||||
</blockTableStyle>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="make_linestyle">
|
||||
<xsl:for-each select=".//table:table-row">
|
||||
<xsl:variable name="row" select="position() - 1"/>
|
||||
<xsl:for-each select=".//table:table-cell">
|
||||
<xsl:variable name="col" select="position() - 1"/>
|
||||
<xsl:variable name="linebefore">
|
||||
<xsl:value-of select="key('table_cell_style',@table:style-name)/style:properties/@fo:border-left"/>
|
||||
</xsl:variable>
|
||||
<xsl:if test="not($linebefore='') and not($linebefore='none')">
|
||||
<xsl:variable name="colorname">
|
||||
<xsl:value-of select="substring-after($linebefore,'#')"/>
|
||||
</xsl:variable>
|
||||
<lineStyle kind="LINEBEFORE" colorName="#{$colorname}" start="{$col},{$row}" stop="{$col},-1"/>
|
||||
</xsl:if>
|
||||
<xsl:variable name="lineafter">
|
||||
<xsl:value-of select="key('table_cell_style',@table:style-name)/style:properties/@fo:border-right"/>
|
||||
</xsl:variable>
|
||||
<xsl:if test="not($lineafter='') and not($lineafter='none')">
|
||||
<xsl:variable name="colorname">
|
||||
<xsl:value-of select="substring-after($lineafter,'#')"/>
|
||||
</xsl:variable>
|
||||
<lineStyle kind="LINEAFTER" colorName="#{$colorname}" start="{$col},{$row}" stop="{$col},-1"/>
|
||||
</xsl:if>
|
||||
<xsl:variable name="lineabove">
|
||||
<xsl:value-of select="key('table_cell_style',@table:style-name)/style:properties/@fo:border-top"/>
|
||||
</xsl:variable>
|
||||
<xsl:if test="not($lineabove='') and not($lineabove='none')">
|
||||
<xsl:variable name="colorname">
|
||||
<xsl:value-of select="substring-after($lineabove,'#')"/>
|
||||
</xsl:variable>
|
||||
<lineStyle kind="LINEABOVE" colorName="#{$colorname}" start="{$col},{$row}" stop="{$col},{$row}"/>
|
||||
</xsl:if>
|
||||
<xsl:variable name="linebelow">
|
||||
<xsl:value-of select="key('table_cell_style',@table:style-name)/style:properties/@fo:border-bottom"/>
|
||||
</xsl:variable>
|
||||
<xsl:if test="not($linebelow='') and not($linebelow='none')">
|
||||
<xsl:variable name="colorname">
|
||||
<xsl:value-of select="substring-after($linebelow,'#')"/>
|
||||
</xsl:variable>
|
||||
<lineStyle kind="LINEBELOW" colorName="#{$colorname}" start="{$col},{-1}" stop="{$col},{-1}"/>
|
||||
</xsl:if>
|
||||
<xsl:variable name="grid">
|
||||
<xsl:value-of select="key('table_cell_style',@table:style-name)/style:properties/@fo:border"/>
|
||||
</xsl:variable>
|
||||
<xsl:if test="not($grid='') and not($grid='none')">
|
||||
<xsl:variable name="colorname">
|
||||
<xsl:value-of select="substring-after($grid,'#')"/>
|
||||
</xsl:variable>
|
||||
<!-- Don't use grid because we don't need a line between each rows -->
|
||||
<lineStyle kind="LINEBEFORE" colorName="#{$colorname}" start="{$col},{$row}" stop="{$col},-1"/>
|
||||
<lineStyle kind="LINEAFTER" colorName="#{$colorname}" start="{$col},{$row}" stop="{$col},-1"/>
|
||||
<lineStyle kind="LINEABOVE" colorName="#{$colorname}" start="{$col},{$row}" stop="{$col},{$row}"/>
|
||||
<lineStyle kind="LINEBELOW" colorName="#{$colorname}" start="{$col},{-1}" stop="{$col},{-1}"/>
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Was needed to simulate bulleted lists:
|
||||
<xsl:template match="text:ordered-list|text:unordered-list">
|
||||
<xsl:variable name = "text_width">
|
||||
<xsl:call-template name="text_width" />
|
||||
</xsl:variable>
|
||||
<blockTable style="Standard_Outline" colWidths="18,{$text_width}">
|
||||
<xsl:apply-templates match="text:list-item" />
|
||||
</blockTable>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="text:list-item">
|
||||
<tr>
|
||||
<td><para><font face="Helvetica-Bold" size="10">*</font></para></td>
|
||||
<td>
|
||||
<xsl:apply-templates />
|
||||
</td>
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
-->
|
||||
|
||||
|
||||
<xsl:template match="office:body">
|
||||
<story>
|
||||
<xsl:apply-templates />
|
||||
<xsl:for-each select="//draw:text-box">
|
||||
<currentFrame>
|
||||
<xsl:attribute name="name">
|
||||
<xsl:value-of select="./@draw:name" />
|
||||
</xsl:attribute>
|
||||
</currentFrame>
|
||||
<xsl:apply-templates>
|
||||
<xsl:with-param name="skip_draw" select="0" />
|
||||
</xsl:apply-templates>
|
||||
<frameEnd />
|
||||
</xsl:for-each>
|
||||
<xsl:for-each select="//text:ordered-list">
|
||||
<para><seqReset id="{//text:ordered-list/@text:style-name}"/></para>
|
||||
</xsl:for-each>
|
||||
</story>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="table:table">
|
||||
<blockTable>
|
||||
<xsl:attribute name="colWidths">
|
||||
<xsl:call-template name="make_columns" />
|
||||
</xsl:attribute>
|
||||
<xsl:call-template name="make_tableheaders" />
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="@table:name" />
|
||||
</xsl:attribute>
|
||||
<xsl:apply-templates />
|
||||
</blockTable>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="make_tableheaders">
|
||||
<xsl:if test="boolean(count(table:table-header-rows))">
|
||||
<xsl:attribute name="repeatRows">1</xsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="make_tablebackground">
|
||||
<xsl:for-each select=".//table:table-row">
|
||||
<!--Be careful when there are table:table-header-rows as
|
||||
parent node of table:table-row -->
|
||||
<xsl:variable name="row" select="position() - 1" />
|
||||
<xsl:for-each select="./table:table-cell">
|
||||
<xsl:variable name="col" select="position() - 1" />
|
||||
<xsl:variable name="background">
|
||||
<xsl:value-of select="key('table_cell_style',@table:style-name)/style:properties/@fo:background-color" />
|
||||
</xsl:variable>
|
||||
<xsl:if test="not($background='') and boolean(key('table_cell_style',@table:style-name)/style:properties/@fo:background-color) and starts-with($background,'#')">
|
||||
<!--only RGB hexcolors are accepted -->
|
||||
<blockBackground colorName="{$background}" start="{$col},{$row}" stop="{$col},-1" />
|
||||
</xsl:if>
|
||||
</xsl:for-each>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="make_columns">
|
||||
<xsl:variable name="columns" >
|
||||
<xsl:for-each select="table:table-column">
|
||||
<xsl:value-of select="key('table_column_style',@table:style-name)/style:properties/@style:column-width" />
|
||||
<xsl:text>,</xsl:text>
|
||||
</xsl:for-each>
|
||||
</xsl:variable>
|
||||
<xsl:value-of select="substring($columns,1,string-length($columns) - 1)" />
|
||||
<!--strip the last comma-->
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="table:table-row">
|
||||
<tr>
|
||||
<xsl:apply-templates />
|
||||
</tr>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="table:table-cell">
|
||||
<td>
|
||||
<xsl:apply-templates />
|
||||
</td>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="text:section">
|
||||
<section>
|
||||
<xsl:apply-templates />
|
||||
</section>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="text:span">
|
||||
<font>
|
||||
<xsl:call-template name="make_fontnames_span" />
|
||||
<xsl:call-template name="make_fontsize_span" />
|
||||
<xsl:apply-templates />
|
||||
</font>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="make_fontsize_span">
|
||||
<xsl:variable name ="fontsize">
|
||||
<xsl:value-of select="key('text_style',@text:style-name)/style:properties/@fo:font-size" />
|
||||
</xsl:variable>
|
||||
<xsl:if test="not($fontsize='') and boolean(key('text_style',@text:style-name)/style:properties/@fo:font-size)" >
|
||||
<xsl:attribute name="size">
|
||||
<xsl:value-of select="$fontsize" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="make_fontnames_span">
|
||||
<xsl:attribute name="face">
|
||||
<xsl:call-template name="make_fontnames">
|
||||
<xsl:with-param name="fontName" select="key('text_style',@text:style-name)/style:properties/@style:font-name" />
|
||||
<xsl:with-param name="fontWeight" select="key('text_style',@text:style-name)/style:properties/@fo:font-weight" />
|
||||
<xsl:with-param name="fontStyle" select="key('text_style',@text:style-name)/style:properties/@fo:font-style" />
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="make_image">
|
||||
<illustration height="{.//draw:image/@svg:height}" width="{.//draw:image/@svg:width}">
|
||||
<image x="0" y="0" file="{substring-after(.//draw:image/@xlink:href,'#Pictures/')}" height="{.//draw:image/@svg:height}" width="{.//draw:image/@svg:width}" />
|
||||
</illustration>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="empty_paragraph">
|
||||
<xsl:if test="not(boolean(count(descendant::node())))">
|
||||
<xsl:call-template name="distance_point">
|
||||
<xsl:with-param name="background" select="key('paragraph_style',@text:style-name)/style:properties/@fo:background-color" />
|
||||
</xsl:call-template>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="distance_point">
|
||||
<xsl:param name="background" />
|
||||
<xsl:param name="tab_stop"></xsl:param>
|
||||
<xsl:variable name="local_back">
|
||||
<xsl:choose>
|
||||
<xsl:when test="not(boolean($background)) or not(contains($background,'#'))">
|
||||
<!-- Do not accept OO colors like "transparent", only hex-colors -->
|
||||
<xsl:text>white</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$background" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<font color="{$local_back}">
|
||||
<xsl:text> </xsl:text>
|
||||
<xsl:if test="boolean($tab_stop)">
|
||||
<!-- simulate a tabstop with white/background-color points -->
|
||||
<xsl:text>.........</xsl:text>
|
||||
</xsl:if>
|
||||
</font>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="text:ordered-list">
|
||||
<xsl:apply-templates />
|
||||
|
||||
<!-- Reset the counter. seqreset is not a trml2pdf tag, but a Platypus Intra Paragraph Markup,
|
||||
so it needs a dummy paragraph to enclose it -->
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="make_listitem">
|
||||
<xsl:if test="(name(..)='text:list-item')">
|
||||
<xsl:attribute name="leftIndent">15</xsl:attribute>
|
||||
<xsl:attribute name="bulletIndent">0</xsl:attribute>
|
||||
<xsl:choose>
|
||||
<xsl:when test="(name(../..)='text:unordered-list')">
|
||||
<xsl:variable name="fontsize">
|
||||
<xsl:value-of select="number(key('paragraph_style',@text:style-name)/style:properties/@fo:font-size)" />
|
||||
</xsl:variable>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$fontsize='NaN'">
|
||||
<!-- you should exclude non-numerical values for bulletFontSize. <== Sometimes the preprocessing went wrong.-->
|
||||
<!--use a default bullet font size-->
|
||||
<xsl:attribute name="bulletFontSize">6</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:attribute name="bulletFontSize"><xsl:value-of select="floor(($fontsize div 2) + 1)" /></xsl:attribute>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:attribute name="bulletFontName">ZapfDingbats</xsl:attribute>
|
||||
<xsl:attribute name="bulletText">l</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- Generate the numbers for an ordered list -->
|
||||
<xsl:variable name="size">
|
||||
<xsl:value-of select="key('paragraph_style',@text:style-name)/style:properties/@fo:font-size" />
|
||||
</xsl:variable>
|
||||
<!-- For ordered lists we use the bullet tag from Platypus Intra Paragraph Markup -->
|
||||
<bullet>
|
||||
<xsl:if test="not($size='') and boolean(key('paragraph_style',@text:style-name)/style:properties/@fo:font-size)">
|
||||
<xsl:attribute name="size">
|
||||
<!-- adapt the fontsize to the fontsize of the current paragraph -->
|
||||
<xsl:value-of select="$size" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<seq id="{../../@text:style-name}"/>.</bullet>
|
||||
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="text:drop-down">
|
||||
<xsl:value-of select="text:label[2]/@text:value" />
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<xsl:template match="text:p|text:h">
|
||||
<xsl:param name="skip_draw" select="1" />
|
||||
<xsl:if test="boolean(key('page_break_before',@text:style-name))" >
|
||||
<pageBreak />
|
||||
</xsl:if>
|
||||
<xsl:choose>
|
||||
<xsl:when test="boolean(.//draw:image)">
|
||||
<xsl:call-template name="make_image" />
|
||||
</xsl:when>
|
||||
<xsl:when test="boolean(name(..) = 'draw:text-box') and boolean($skip_draw)">
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<para>
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="@text:style-name" />
|
||||
</xsl:attribute>
|
||||
<xsl:call-template name="make_listitem" />
|
||||
<xsl:apply-templates />
|
||||
<xsl:call-template name="empty_paragraph" />
|
||||
</para>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:if test="boolean(key('page_break_after',@text:style-name))" >
|
||||
<pageBreak />
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="text:p/text:tab-stop">
|
||||
<!-- simulate a tabstop -->
|
||||
<xsl:call-template name="distance_point">
|
||||
<xsl:with-param name="background" select="key('paragraph_style',@text:style-name)/style:properties/@fo:background-color" />
|
||||
<xsl:with-param name="tab_stop">yes</xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<!-- experimental - switched off
|
||||
<xsl:template match="text:h">
|
||||
<para>
|
||||
<xsl:attribute name="style">
|
||||
<xsl:value-of select="@text:style-name" />
|
||||
</xsl:attribute>
|
||||
<xsl:call-template name="make_number" />
|
||||
<xsl:apply-templates />
|
||||
<xsl:call-template name="empty_paragraph" />
|
||||
</para>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="make_number">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@text:level='1'">
|
||||
<xsl:number format="1. " />
|
||||
</xsl:when>
|
||||
<xsl:when test="@text:level='2'">
|
||||
<xsl:number count="text:h[@text:level='1']|text:h[text:level='2']" level="any" format="1.1." />
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
-->
|
||||
|
||||
<xsl:template match="style:style[@style:family='paragraph']">
|
||||
<paraStyle>
|
||||
<xsl:attribute name="name">
|
||||
<xsl:value-of select="@style:name" />
|
||||
</xsl:attribute>
|
||||
<xsl:call-template name="make_indent_paragraph" />
|
||||
<xsl:call-template name="make_fontnames_paragraph" />
|
||||
<xsl:call-template name="make_fontsize" />
|
||||
<!--<xsl:call-template name="make_parent" /> not necessary -
|
||||
parent styles processed by PyOpenOffice -->
|
||||
<xsl:call-template name="make_alignment" />
|
||||
<xsl:call-template name="make_background" />
|
||||
<xsl:call-template name="make_space_beforeafter" />
|
||||
<xsl:call-template name="make_fontcolor" />
|
||||
</paraStyle>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="make_indent_paragraph">
|
||||
<xsl:variable name="right_indent"><xsl:value-of select="style:properties/@fo:margin-right" /></xsl:variable>
|
||||
<xsl:variable name="left_indent"><xsl:value-of select="style:properties/@fo:margin-left" /></xsl:variable>
|
||||
<xsl:if test="not($right_indent='') and boolean(style:properties/@fo:margin-right)">
|
||||
<xsl:attribute name="rightIndent">
|
||||
<xsl:value-of select="$right_indent" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="not($left_indent='') and boolean(style:properties/@fo:margin-left)">
|
||||
<xsl:attribute name="leftIndent">
|
||||
<xsl:value-of select="$left_indent" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="make_background">
|
||||
<xsl:variable name="background">
|
||||
<xsl:value-of select="style:properties/@fo:background-color" />
|
||||
</xsl:variable>
|
||||
<xsl:if test="not($background='') and boolean(style:properties/@fo:background-color) and starts-with($background,'#')" >
|
||||
<xsl:attribute name="backColor">
|
||||
<xsl:value-of select="$background" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="make_space_beforeafter">
|
||||
<xsl:variable name="before">
|
||||
<xsl:value-of select="style:properties/@fo:margin-top" />
|
||||
</xsl:variable>
|
||||
<xsl:variable name="after">
|
||||
<xsl:value-of select="style:properties/@fo:margin-bottom" />
|
||||
</xsl:variable>
|
||||
<xsl:if test="not($before='') and boolean(style:properties/@fo:margin-top)" >
|
||||
<xsl:attribute name="spaceBefore">
|
||||
<xsl:value-of select="$before" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:if test="not($after='') and boolean(style:properties/@fo:margin-bottom)" >
|
||||
<xsl:attribute name="spaceAfter">
|
||||
<xsl:value-of select="$after" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="make_fontsize">
|
||||
<xsl:variable name="fontSize">
|
||||
<xsl:value-of select="style:properties/@fo:font-size" />
|
||||
</xsl:variable>
|
||||
<xsl:if test="not($fontSize='') and boolean(style:properties/@fo:font-size)">
|
||||
<xsl:attribute name="fontSize">
|
||||
<xsl:value-of select="$fontSize" />
|
||||
</xsl:attribute>
|
||||
<xsl:attribute name="leading">
|
||||
<xsl:value-of select="$fontSize + floor($fontSize div 5) + 1" />
|
||||
<!--use a standard leading related to the font size -->
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!--this template is not needed anymore for "normalized" sxw files -->
|
||||
<xsl:template name="make_parent">
|
||||
<xsl:variable name="parent">
|
||||
<xsl:value-of select="@style:parent-style-name" />
|
||||
</xsl:variable>
|
||||
<xsl:if test="not($parent='') and boolean(@style:parent-style-name)">
|
||||
<xsl:attribute name="parent">
|
||||
<xsl:value-of select="$parent" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="make_alignment">
|
||||
<xsl:variable name="alignment">
|
||||
<xsl:value-of select="style:properties/@fo:text-align" />
|
||||
</xsl:variable>
|
||||
<xsl:if test="not($alignment='') and boolean(style:properties/@fo:text-align)">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$alignment='start'">
|
||||
<xsl:attribute name="alignment">LEFT</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$alignment='center'">
|
||||
<xsl:attribute name="alignment">CENTER</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$alignment='end'">
|
||||
<xsl:attribute name="alignment">RIGHT</xsl:attribute>
|
||||
</xsl:when>
|
||||
<xsl:when test="$alignment='justify'">
|
||||
<xsl:attribute name="alignment">JUSTIFY</xsl:attribute>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="make_fontnames_paragraph">
|
||||
<xsl:attribute name="fontName">
|
||||
<xsl:call-template name="make_fontnames">
|
||||
<xsl:with-param name="fontName" select="style:properties/@style:font-name" />
|
||||
<xsl:with-param name="fontWeight" select="style:properties/@fo:font-weight" />
|
||||
<xsl:with-param name="fontStyle" select="style:properties/@fo:font-style" />
|
||||
</xsl:call-template>
|
||||
</xsl:attribute>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="make_fontnames">
|
||||
<!--much too verbose, needs improvement-->
|
||||
<xsl:param name="fontName" />
|
||||
<xsl:param name="fontWeight" />
|
||||
<xsl:param name="fontStyle" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="not($fontName='') and boolean($fontName)">
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($fontName,'Courier')">
|
||||
<xsl:choose>
|
||||
<xsl:when test="($fontWeight='bold') and ($fontStyle='italic')">
|
||||
<xsl:text>Courier-BoldOblique</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="($fontWeight='bold') and not ($fontStyle='italic')">
|
||||
<xsl:text>Courier-Bold</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="not($fontWeight='bold') and ($fontStyle='italic')">
|
||||
<xsl:text>Courier-Oblique</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>Courier</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains($fontName,'Helvetica') or contains($fontName,'Arial') or contains($fontName,'Sans')">
|
||||
<xsl:choose>
|
||||
<xsl:when test="($fontWeight='bold') and ($fontStyle='italic')">
|
||||
<xsl:text>Helvetica-BoldOblique</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="($fontWeight='bold') and not ($fontStyle='italic')">
|
||||
<xsl:text>Helvetica-Bold</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="not($fontWeight='bold') and ($fontStyle='italic')">
|
||||
<xsl:text>Helvetica-Oblique</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>Helvetica</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:choose>
|
||||
<xsl:when test="($fontWeight='bold') and ($fontStyle='italic')">
|
||||
<xsl:text>Times-BoldItalic</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="($fontWeight='bold') and not ($fontStyle='italic')">
|
||||
<xsl:text>Times-Bold</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:when test="not($fontWeight='bold') and ($fontStyle='italic')">
|
||||
<xsl:text>Times-Italic</xsl:text>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:text>Times-Roman</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!--Use this as default -->
|
||||
<xsl:text>Times-Roman</xsl:text>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<xsl:template name="make_fontcolor">
|
||||
<xsl:variable name="textColor">
|
||||
<xsl:value-of select="style:properties/@fo:color"/>
|
||||
</xsl:variable>
|
||||
<xsl:if test="not($textColor='') and boolean(style:properties/@fo:color)">
|
||||
<xsl:attribute name="textColor">
|
||||
<xsl:value-of select="$textColor" />
|
||||
</xsl:attribute>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!--
|
||||
This stylesheet is part of:
|
||||
PyOpenOffice Version 0.4
|
||||
Copyright (C) 2005: Martin Simon
|
||||
Homepage: www.bezirksreiter.de
|
||||
|
||||
GNU LESSER GENERAL PUBLIC LICENSE Version 2.1, February 1999
|
||||
-->
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
||||
|
||||
@@ -2,7 +2,15 @@
|
||||
<openerp>
|
||||
<data>
|
||||
|
||||
<menuitem name="Marketing" icon="terp-crm" id="base.marketing_menu" sequence="17" groups="marketing.group_marketing_user,marketing.group_marketing_manager"/>
|
||||
<menuitem
|
||||
name="Marketing"
|
||||
icon="terp-crm"
|
||||
id="base.marketing_menu"
|
||||
sequence="17"
|
||||
groups="marketing.group_marketing_user,marketing.group_marketing_manager"
|
||||
web_icon="images/marketing.png"
|
||||
web_icon_hover="images/marketing-hover.png"/>
|
||||
|
||||
|
||||
<record id="view_marketing_installer" model="ir.ui.view">
|
||||
<field name="name">marketing.installer.view</field>
|
||||
|
||||
Reference in New Issue
Block a user