Port to v8

Convert webkit report to qweb
This commit is contained in:
Alexis Delattre
2014-10-09 23:45:29 +02:00
committed by Sébastien BEAU
parent 3d7c64e011
commit 346dd04302
7 changed files with 120 additions and 168 deletions

View File

@@ -47,12 +47,14 @@ check deposits.
'report_webkit',
],
'data': [
'account_deposit_view.xml',
'account_deposit_sequence.xml',
'company_view.xml',
'security/ir.model.access.csv',
'security/check_deposit_security.xml',
'account_data.xml',
'account_deposit_view.xml',
'account_deposit_sequence.xml',
'company_view.xml',
'security/ir.model.access.csv',
'security/check_deposit_security.xml',
'account_data.xml',
'report.xml',
'report/report_checkdeposit.xml',
],
'installable': False,
'application': True,

View File

@@ -10,14 +10,6 @@
<openerp>
<data>
<report
auto="False"
file="account_check_deposit/report/check_deposit.mako"
id="check_deposit_webkit"
model="account.check.deposit"
name="check.deposit.webkit"
report_type="webkit"
string="Checks Deposit"/>
<record id="account_check_deposit_view_form" model="ir.ui.view">
<field name="name">account.check.deposit.form</field>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 Akretion (http://www.akretion.com/)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
-->
<openerp>
<data>
<report id="report_account_check_deposit"
model="account.check.deposit"
string="Check Deposit"
report_type="qweb-pdf"
name="account_check_deposit.report_checkdeposit"
file="account_check_deposit.report_checkdeposit"
/>
</data>
</openerp>

View File

@@ -1,22 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# account_check_deposit for Odoo/OpenERP
# Copyright (C) 2012-2014 Akretion (http://www.akretion.com/)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
from . import report_webkit_html

View File

@@ -1,90 +0,0 @@
# -*- coding: utf-8 -*-
<html>
<head>
<style type="text/css">
table {
width: 100%;
page-break-after:auto;
border-collapse: collapse;
cellspacing="0";
font-size:14px;
}
td { margin: 0px; padding: 3px; border: 1px solid lightgrey; vertical-align: top; }
.valign_up1, .valign_up2, .halign, .vtrait1, .vtrait2{
position:absolute;
}
.valign_up1 { left:200px; font-weight: lighter; color:MediumSlateBlue ;
}
.valign_up2 { left:650px; font-weight: lighter; color:MediumSlateBlue ;
}
.halign { left:500px}
.vtrait1 { left:185px; font-weight: lighter; color:MediumSlateBlue ; }
.vtrait2 { left:630px; font-weight: lighter; color:MediumSlateBlue ; }
.entete_tab {text-align:center; white-space:nowrap; border-bottom:1px solid;}
.cellule_tab {white-space:nowrap; text-align:center;}
.amount {white-space:nowrap; text-align:right;}
.total {border-top:2px solid;}
.titre {text-align:center; font-family:helvetica; font-size:35px; background:lightgrey}
pre {font-family:helvetica; font-size:12px;}
h1 {font-family:helvetica; font-size:18px;}
h2 {font-family:helvetica; font-size:25px; border-bottom:1px solid}
h3 {font-family:helvetica; font-size:22px; color: MediumSlateBlue ; margin-bottom: auto;}
</style>
</head>
<body>
%for deposit in objects :
<% setLang(deposit.company_id.partner_id.lang) %>
<b><span class="titre">${_("Deposit Slip of Checks in ")} ${deposit.currency_id.name}</span></b>
<table class="basic_table" width="100%">
<tr>
<th class="date">${_("Deposit Date")}</th>
<th class="text-align:center;">${_("Deposit Ref")}</th>
<th class="text-align:center;">${_("Beneficiary")}</th>
<th class="text-align:center;">${_("Bank Account Number")}</th>
</tr>
<tr>
<td class="date">${formatLang(deposit.deposit_date, date=True)}</td>
<td class="text-align:center;">${deposit.name}</td>
<td class="text-align:center;">${deposit.company_id.partner_id.name}</td>
<td class="text-align:center;">${deposit.partner_bank_id.acc_number}</td>
</tr>
</table>
<h3>${_("Check Payments")}</h3>
<table style="width:100%">
<thead>
<tr>
<th class="entete_tab">${_("Payment Date")}</th>
<th class="entete_tab">${_("Reference")}</th>
<th class="entete_tab">${_("Debtor")}</th>
<th class="entete_tab">${_("Amount")}</th>
</thead>
</tr>
%for move_line in deposit.check_payment_ids :
<tbody>
<tr>
<td class="cellule_tab">${move_line.date or ''}</td>
<td class="cellule_tab">${move_line.ref or ''}</td>
<td class="cellule_tab">${move_line.partner_id.name or ''}</td>
<td class="amount">${deposit.currency_id == deposit.company_id.currency_id and move_line.debit or move_line.amount_currency} ${deposit.currency_id.name}</td>
</tr>
</tbody>
%endfor
%endfor
<tfoot>
<tr>
<td colspan="3" class="amount total"><b>${_("Total:")}</b></td>
<td class="amount total"><b>${deposit.total_amount or '0'} ${deposit.currency_id.name}</b></td>
</tr>
</tfoot>
</table>
</body>
</html>

View File

@@ -0,0 +1,91 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2014 Akretion (www.akretion.com)
@author: Alexis de Lattre <alexis.delattre@akretion.com>
The licence is in the file __openerp__.py
-->
<openerp>
<data>
<template id="report_checkdeposit">
<t t-call="report.html_container">
<t t-foreach="docs" t-as="o">
<t t-call="report.internal_layout">
<div class="page">
<h1>Check Deposit n°<span t-field="o.name"/></h1>
<h3>Bank:</h3>
<p><span t-field="o.partner_bank_id.bank.name"/><br/>
<span t-field="o.partner_bank_id.bank.street"/><br/>
<span t-field="o.partner_bank_id.bank.zip"/> <span t-field="o.partner_bank_id.bank.city"/></p>
<h3>Beneficiary:</h3>
<div t-field="o.company_id.partner_id"
t-field-options='{"widget": "contact", "fields": ["address", "name", "phone", "fax"], "no_marker": true}'/>
<p><b>Bank Account Number to Credit:</b> <span t-field="o.partner_bank_id.acc_number"/></p>
<p><b>Check Currency:</b> <span t-field="o.currency_id.name"/></p>
<p><b>Transfer Date:</b> <span t-field="o.deposit_date"/></p>
<p><b>Number of checks:</b> <span t-field="o.check_count"/></p>
<h3>List of checks:</h3>
<table class="table table-condensed">
<thead>
<tr>
<th>Date</th>
<th>Reference</th>
<th>Debtor</th>
<th>Amount</th>
</tr>
</thead>
<tbody>
<t t-foreach="o.check_payment_ids" t-as="move_line">
<tr>
<td><span t-field="move_line.date"/></td>
<td><span t-field="move_line.ref"/></td>
<td><span t-field="move_line.partner_id.name"/></td>
<td>
<t t-if="o.currency_id == o.company_id.currency_id">
<span t-field="move_line.debit"
t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
</t>
<t t-if="o.currency_id != o.company_id.currency_id">
<span t-field="move_line.amount_currency"
t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/>
</t>
</td>
</tr>
</t>
<tr>
<td></td>
<td></td>
<td><b>Total:</b></td>
<td><b><span t-field="o.total_amount" t-field-options='{"widget": "monetary", "display_currency": "o.currency_id"}'/></b></td>
</tr>
</tbody>
</table>
</div>
</t>
</t>
</t>
</template>
</data>
</openerp>

View File

@@ -1,42 +0,0 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# account_check_deposit for Odoo/OpenERP
# Copyright (C) 2012-2014 Akretion (http://www.akretion.com/)
# @author: Benoît GUILLOT <benoit.guillot@akretion.com>
# @author: Chafique DELLI <chafique.delli@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
###############################################################################
import time
from report import report_sxw
class report_webkit_html(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(report_webkit_html, self).__init__(
cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'cr': cr,
'uid': uid,
})
report_sxw.report_sxw('report.account.check.deposit',
'account.check.deposit',
'addons/account_check_deposit/report/check_deposit.mako',
parser=report_webkit_html)