Skip to content

Commit

Permalink
[INIT]
Browse files Browse the repository at this point in the history
  • Loading branch information
kittiu committed Jan 15, 2017
1 parent c84ac46 commit 7e24ab8
Show file tree
Hide file tree
Showing 1,547 changed files with 193,075 additions and 0 deletions.
74 changes: 74 additions & 0 deletions ac_report_font_thai/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2009 Gábor Dukai
# Modified by Almacom (Thailand) Ltd.
#
# 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 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################

from tools.config import config
import report
import os

def wrap_trml2pdf(method):
"""We have to wrap the original parseString() to modify the rml data
before it generates the pdf."""
def convert2TrueType(*args, **argv):
"""This function replaces the type1 font names with their truetype
substitutes and puts a font registration section at the beginning
of the rml file. The rml file is acually a string (data)."""
odata = args[0]
fontmap = {
'Times-Roman': 'Garuda',
'Times-BoldItalic': 'Garuda-BoldOblique',
'Times-Bold': 'Garuda-Bold',
'Times-Italic': 'Garuda-Oblique',

'Helvetica': 'Garuda',
'Helvetica-BoldItalic': 'Garuda-BoldOblique',
'Helvetica-Bold': 'Garuda-Bold',
'Helvetica-Italic': 'Garuda-Oblique',

'Courier': 'TlwgTypist',
'Courier-Bold': 'TlwgTypist-Bold',
'Courier-BoldItalic': 'TlwgTypist-BoldOblique',
'Courier-Italic': 'TlwgTypist-Oblique',
}
i = odata.find('<docinit>')
if i == -1:
i = odata.find('<document')
i = odata.find('>', i)
i += 1
starttag = '\n<docinit>\n'
endtag = '</docinit>'
else:
i = i + len('<docinit>')
starttag = ''
endtag = ''
data = odata[:i] + starttag
adp = os.path.abspath(config['thai_font_path']) #KTU
for new in fontmap.itervalues():
fntp = os.path.normcase(os.path.join(adp, new)) #KTU
data += ' <registerFont fontName="' + new + '" fontFile="' + fntp + '.ttf"/>\n'
data += endtag + odata[i:]
for old, new in fontmap.iteritems():
data = data.replace(old, new)
return method(data, args[1:] if len(args) > 2 else args[1], **argv)
return convert2TrueType

report.render.rml2pdf.parseString = wrap_trml2pdf(report.render.rml2pdf.parseString)

report.render.rml2pdf.parseNode = wrap_trml2pdf(report.render.rml2pdf.parseNode)
39 changes: 39 additions & 0 deletions ac_report_font_thai/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2009 Gábor Dukai
# Modified by Almacom (Thailand) Ltd.
#
# 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 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
{
"name" : "Reports with Thai fonts",
"version" : "1.1",
"author" : "Almacom (Thailand) Ltd.",
"website" : "http://almacom.co.th/",
"description": """
This module replaces default RML fonts by Thai fonts.
Without this module, Thai characters are not shown properly in PDF reports.
""",
"depends" : ["base", ],
"category" : "Generic Modules/Base",
"demo_xml" : [],
"update_xml" : [],
"license": "GPL-3",
"installable": True
}

# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:

Binary file added ac_report_font_thai/fonts/Garuda-Bold.ttf
Binary file not shown.
Binary file not shown.
Binary file added ac_report_font_thai/fonts/Garuda-Oblique.ttf
Binary file not shown.
Binary file added ac_report_font_thai/fonts/Garuda.ttf
Binary file not shown.
Binary file added ac_report_font_thai/fonts/Kinnari-Bold.ttf
Binary file not shown.
Binary file added ac_report_font_thai/fonts/Kinnari-BoldItalic.ttf
Binary file not shown.
Binary file added ac_report_font_thai/fonts/Kinnari-Italic.ttf
Binary file not shown.
Binary file added ac_report_font_thai/fonts/Kinnari.ttf
Binary file not shown.
Binary file added ac_report_font_thai/fonts/TlwgTypist-Bold.ttf
Binary file not shown.
Binary file not shown.
Binary file added ac_report_font_thai/fonts/TlwgTypist-Oblique.ttf
Binary file not shown.
Binary file added ac_report_font_thai/fonts/TlwgTypist.ttf
Binary file not shown.
28 changes: 28 additions & 0 deletions account_aged_partner_balance_vw/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
#
# Copyright (c) 2011 Vauxoo - http://www.vauxoo.com/
# All Rights Reserved.
# info Vauxoo ([email protected])
############################################################################
# Coded by: moylop260 ([email protected])
############################################################################
#
# 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 model
import wizard
52 changes: 52 additions & 0 deletions account_aged_partner_balance_vw/__openerp__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# -*- encoding: utf-8 -*-
###########################################################################
# Module Writen to OpenERP, Open Source Management Solution
#
# Copyright (c) 2011 Vauxoo - http://www.vauxoo.com/
# All Rights Reserved.
# info Vauxoo ([email protected])
############################################################################
# Coded by: moylop260 ([email protected])
############################################################################
#
# 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/>.
#
##############################################################################

{
"name" : "Report Account Aged Partner Balance view",
"version" : "2.0",
"author" : "Vauxoo",
"category" : "Localization/Mexico",
"description" : """This module creates a sql view for Account Aged Partner Balance today.""",
"website" : "http://www.vauxoo.com/",
"license" : "AGPL-3",
"depends" : [
"account",
'board',
'report_webkit',
],
"init_xml" : [],
"demo_xml" : [],
"update_xml" : [
"view/wizard.xml",
"view/view.xml",
'view/action_menues.xml',
'view/wizard_print_report_view.xml',
"data/data.xml",
'report/report.xml',
],
"installable" : True,
"active" : True,
}
184 changes: 184 additions & 0 deletions account_aged_partner_balance_vw/data/data.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,184 @@
<?xml version="1.0" ?>
<openerp>
<data noupdate="0">
<record id="ir_header_webkit_account_aged_partner_balance_report" model="ir.header_webkit">
<field name="footer_html"><![CDATA[<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
<script>
function subst() {
var vars={};
var x=document.location.search.substring(1).split('&');
for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
for(var i in x) {
var y = document.getElementsByClassName(x[i]);
for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
}
}
</script>
</head>
<body style="border:0; margin: 0;" onload="subst()">
<table style="border-top: 1px solid black; width: 100%">
<tr >
<td style="float:right;text-align:left;font-size:12;" width="30%">
<script type="text/javascript">
var date = new Date();
var d = date.getDate();
var day = (d < 10) ? '0' + d : d;
var m = date.getMonth() + 1;
var month = (m < 10) ? '0' + m : m;
var yy = date.getYear();
var year = (yy < 1000) ? yy + 1900 : yy;
var h = date.getHours();
var hours = (h < 10) ? '0' + h : h;
var mm = date.getMinutes();
var minutes = (mm < 10) ? '0' + mm : mm;
document.write(day + "/" + month + "/" + year +
"\t\t" + hours+":" + minutes );
</script>
</td>
<td style="text-align:right;font-size:12;" width="65%">Page <span class="page"/></td><td style="text-align:left;font-size:12;"> of <span class="topage"/></td>
</tr>
</table>
</body>
</html>]]></field>
<field name="orientation">Landscape</field>
<field name="format">Letter</field>
<field name="html">
<![CDATA[<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="content-type"/>
<script>
function subst() {
var vars={};
var x=document.location.search.substring(1).split('&');
for(var i in x) {var z=x[i].split('=',2);vars[z[0]] = unescape(z[1]);}
var x=['frompage','topage','page','webpage','section','subsection','subsubsection'];
for(var i in x) {
var y = document.getElementsByClassName(x[i]);
for(var j=0; j<y.length; ++j) y[j].textContent = vars[x[i]];
}
}
</script>
<style type="text/css">
${css}
</style>
</head>
<body style="border:0; margin: 0;" onload="subst()">
${_debug or ''|n} </body>
</html>]]>
</field>
<field name="css">
<![CDATA[
table.basic_table{
text-align:left;
border:1px solid lightGrey;
border-collapse: collapse;
}
.dest_address { font-size:12pt;
margin-left:0;
text-align:left; l
ine-height:80%;
padding-top:0px
}
.prueba{
color:black;
background-color:#dcdcdc;
}
.celdaTotalTitulo{
font-size:11pt;
text-align:left;
font-weight:bold;
font-family:Arial,Helvetica,sans-serif;
background-color:#dcdcdc;
}
.celdaBoxUp{
font-size:9pt;
font-family:Arial,Helvetica,sans-serif;
text-align:right;
background-color:#F5F5F5;
}
.celdaTotal{
font-size:7pt;
font-family: monospace;
text-align:right;
font-weight:bold;
background-color:#EAEAEA;
}
.celdaTotalTotales{
font-size:7pt;
font-family: monospace;
text-align:right;
font-weight:bold;
background-color:#EAEAEA;
}
.celdaLineDataTitulo{
font-style:italic;
font-size:7pt;
text-align:left;
font-family:Arial,Helvetica,sans-serif;
background-color:#F5F5F5;
}
.celdaLineData{
font-size:7pt;
font-family: monospace;
text-align:right;
background-color:#F5F5F5;
}
.celdaTituloTabla{
font-size:8pt;
text-align:left;
font-family:Arial,Helvetica,sans-serif;
background-color:#620400;
font-weight:bold;
color:#FFFFFF;
}
.celdaTituloPartner{
font-size:8pt;
text-align:left;
font-family:Arial,Helvetica,sans-serif;
background-color:#CDCDCD;
font-weight:bold;
}
.celdaTituloTablaCompany{
font-size:11pt;
text-align:left;
font-family:Arial,Helvetica,sans-serif;
background-color:#620400;
color:#FFFFFF;
}
.celdaTituloTablaUser{
font-size:10pt;
text-align:left;
font-family:Arial,Helvetica,sans-serif;
color:#FFFFFF;
}
.celdaGrandTotal{
font-size:7pt;
font-family: monospace;
text-align:right;
font-weight:bold;
color:#FFFFFF;
background-color:#000000;
}
]]>
</field>
<field name="name">Report Account Aged Partner Balance VW</field>
</record>

</data>
</openerp>
Loading

0 comments on commit 7e24ab8

Please sign in to comment.