openerp-community-reviewer team mailing list archive
-
openerp-community-reviewer team
-
Mailing list archive
-
Message #00404
[Merge] lp:~serpentcs/webkit-utils/utils-serpentcs into lp:webkit-utils
Nishant Jogi has proposed merging lp:~serpentcs/webkit-utils/utils-serpentcs into lp:webkit-utils.
Requested reviews:
Webkit Utils Core Editors (webkit-utils-core-editors)
For more details, see:
https://code.launchpad.net/~serpentcs/webkit-utils/utils-serpentcs/+merge/190327
--
The attached diff has been truncated due to its size.
https://code.launchpad.net/~serpentcs/webkit-utils/utils-serpentcs/+merge/190327
Your team Webkit Utils Core Editors is requested to review the proposed merge of lp:~serpentcs/webkit-utils/utils-serpentcs into lp:webkit-utils.
=== modified file 'base_headers_webkit/__openerp__.py'
--- base_headers_webkit/__openerp__.py 2011-12-20 11:27:12 +0000
+++ base_headers_webkit/__openerp__.py 2013-10-10 09:59:30 +0000
@@ -26,21 +26,21 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
-
-{
- 'name': 'Base wekbit headers and CSS for standard reports (sale, purchase, invoices, ...)',
- 'version': '1.0',
- 'category': 'Reports/Webkit',
- 'description': """
-Contains data headers and css to design standard reports, used by common modules like sale_order_wekbit, purchase_order_webkit, ...
+{'name': 'Base wekbit headers and CSS for standard reports (sale, purchase, invoices, ...)',
+ 'version': '1.0',
+ 'category': 'Reports/Webkit',
+ 'description': """
+ Contains data headers and css to design standard reports, used by common modules like:
+ - sale_order_wekbit,
+ - purchase_order_webkit, ...
""",
- 'author': 'Camptocamp',
- 'website': 'http://www.openerp.com',
- 'depends': ['base', 'report_webkit'],
- 'init_xml': [],
- 'update_xml': ['base_headers_data.xml'],
- 'demo_xml': [],
- 'test': [],
- 'installable': True,
- 'active': False,
+ 'author': 'Camptocamp',
+ 'website': 'http://www.camptocamp.com',
+ 'depends': ['base', 'report_webkit'],
+ 'init_xml': [],
+ 'update_xml': ['base_headers_data.xml'],
+ 'demo_xml': [],
+ 'test': [],
+ 'installable': True,
+ 'active': False,
}
=== modified file 'base_headers_webkit/base_headers_data.xml'
--- base_headers_webkit/base_headers_data.xml 2012-08-02 14:02:17 +0000
+++ base_headers_webkit/base_headers_data.xml 2013-10-10 09:59:30 +0000
@@ -65,15 +65,15 @@
<td/>
</tr>
<tr>
- <td >${company.partner_id.address and company.partner_id.address[0].street or ''|entity}</td>
- <td/>
- </tr>
- <tr>
- <td>Phone: ${company.partner_id.address and company.partner_id.address[0].phone or ''|entity} </td>
- <td/>
- </tr>
- <tr>
- <td>Mail: ${company.partner_id.address and company.partner_id.address[0].email or ''|entity}<br/></td>
+ <td >${company.partner_id.street or ''|entity}</td>
+ <td/>
+ </tr>
+ <tr>
+ <td>Phone: ${company.partner_id.phone or ''|entity} </td>
+ <td/>
+ </tr>
+ <tr>
+ <td>Mail: ${company.partner_id.email or ''|entity}<br/></td>
</tr>
</table> ${_debug or ''|n} </body>
</html>]]>
@@ -201,7 +201,6 @@
</field>
<field name="name">Base Reports Portrait Header</field>
</record>
-
<!-- ...................................MINIMALIST.......................................... -->
<record id="base_minimum_reports_portrait_header" model="ir.header_webkit">
<field name="footer_html"><![CDATA[
@@ -755,7 +754,7 @@
.account_level_consol {
font-weight: normal;
- font-style: italic;
+ font-style: italic;
}
.overflow_ellipsis {
=== added directory 'hr_attendance_webkit'
=== added file 'hr_attendance_webkit/__init__.py'
--- hr_attendance_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_attendance_webkit/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 wizard
+import report
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
=== added file 'hr_attendance_webkit/__openerp__.py'
--- hr_attendance_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ hr_attendance_webkit/__openerp__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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/>.
+#
+############################################################################
+
+{
+ 'name' : 'HR Attendance Reports',
+ 'version' : '1.1',
+ 'author' : 'Serpent Consulting Services',
+ 'category' : 'Accounting & Finance',
+ 'description' : """
+HR Attendace Reports
+====================================
+ It is conversion of rml report to Webkit Report.
+ """,
+ 'website': 'http://www.serpentcs.com',
+ 'depends' : [
+ 'hr_attendance',
+ 'report_webkit'],
+ 'update_xml': [
+ 'attendance_report_xml_view.xml',
+ ],
+ 'installable': True,
+ 'auto_install': False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_attendance_webkit/attendance_report_xml_view.xml'
--- hr_attendance_webkit/attendance_report_xml_view.xml 1970-01-01 00:00:00 +0000
+++ hr_attendance_webkit/attendance_report_xml_view.xml 2013-10-10 09:59:30 +0000
@@ -0,0 +1,454 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="hr_webkit_header" model="ir.header_webkit">
+ <field name="footer_html"><![CDATA[]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</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: 15;" onload="subst()">
+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:left;font-size:12;" width="20%">${time.strftime('%m/%d/%Y %I:%M')}</td>
+ <td style="text-align:center;font-size:16;" width="83%"><b>${company.partner_id.name |entity}</b></td>
+ <td style="text-align:left;font-size:12;" width="3%"><span class="page"/> </td>
+ <td style="text-align:left;font-size:12;" width="1%"> /</td>
+ <td style="text-align:right;font-size:12;" width="3%"><span class="topage"/></td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+</html>]]>
+ </field>
+ <field eval="0.0" name="margin_top"/>
+ <field eval="5.0" name="margin_bottom"/>
+ <field name="css"><![CDATA[
+
+body {
+font-family:Verdana;
+font-size:12;
+
+}
+
+
+.dest_address {
+margin-right:60%;
+font-size:12;
+}
+.header {
+margin-right:0;
+text-align:right;
+width:300px;
+font-size:12;
+}
+
+.title {
+font-size:16;
+font-weight: bold;
+
+}
+
+
+.basic_table{
+text-align:center;
+border:1px solid lightGrey;
+border-collapse: collapse;
+}
+.basic_table td {
+border:1px solid lightGrey;
+font-size:12;
+
+
+}
+
+.list_table {
+border-color:black;
+text-align:center;
+border-collapse: collapse;
+
+}
+.list_table td {
+border-color:gray;
+border-top:1px solid #ccc;
+text-align:right;
+font-size:11px;
+padding-left:3px;
+padding-right:3px;
+padding-top:3px;
+padding-bottom:3px;
+}
+
+.list_table th {
+border-bottom:1px solid black;
+text-align:right;
+font-size:11px;
+font-weight:bold;
+padding-left:3px;
+padding-right:3px;
+}
+
+.list_tabe thead {
+ display:table-header-group;
+}
+
+
+.total {
+width:100%;
+}
+.lib {
+width:10.3%;
+}
+.tot {
+text-align:left;
+width:15%;
+}
+.righttot {
+width:74%;
+}
+.tax {
+width:50%;
+}
+table {
+ display: table;
+ width: 100%;
+ }
+
+ table thead {
+ display: table-header-group;
+ }
+
+ table tbody {
+ display: table-row-group;
+ }
+
+ table tfoot {
+ display: table-footer-group;
+ }
+
+ table tr {
+ display: table-row;
+ height: auto;
+ }
+
+ table th,
+ table td {
+ display: table-cell;
+ overflow: visible;
+ }
+
+ table th,
+ table td {
+ height: 1px; /* Do the trick to make div.nobrk fill td height */
+ }
+
+ table tr.singlecell td,
+ table tr.singlecell th {
+ height: auto; /* Reset trick for a full row td */
+ }
+
+ .nobrk {
+ page-break-inside: avoid;
+ orphans: 10;
+ widows: 10;
+ position: relative;
+ margin: -1px 0 0 -1px;
+ min-height: 14px;
+ line-height: 14px;
+ height: 100%;
+ }
+
+ table tbody td .nobrk {
+ min-height: 5px;
+ }
+]]>
+ </field>
+ <field name="name">HR Webkit Header</field>
+ </record>
+ <record id="attendance_bymonth_header_landscape" model="ir.header_webkit">
+ <field name="footer_html"><![CDATA[]]></field>
+ <field name="orientation">Landscape</field>
+ <field name="format">A4</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]);}
+ if(vars['page']!=1){
+ document.getElementById('inner_head').innerHTML=document.getElementById('actual_header').innerHTML;
+ }
+ 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()">
+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:right;font-size:12;" width="15%">${time.strftime('%m/%d/%Y %I:%M')}</td>
+ <td style="text-align:center;font-size:16;" width="80%"><b>${company.partner_id.name |entity}</b></td>
+ <td style="text-align:left;font-size:12;" width="2%"><span class="page"/></td>
+ <td style="text-align:left;font-size:12;" width="1%">/</td>
+ <td style="text-align:right;font-size:12;" width="2%"><span class="topage"/></td>
+ </tr>
+ </table> ${_debug or ''|n}
+ <table id="inner_head" style="width: 98%;margin-left:1%;margin-right:1%;">
+
+ </table>${_debug or ''|n}
+ </body>
+</html>]]>
+ </field>
+ <field eval="15.0" name="margin_top"/>
+ <field eval="5.0" name="margin_bottom"/>
+ <field name="css"><![CDATA[
+
+body {
+font-family:Verdana;
+font-size:12;
+}
+
+.header {
+ margin-left:0;
+ text-align:left;
+ width:300px;
+ font-size:12;
+}
+
+.cell{
+ border-spacing: 0;
+ border-collapse: collapse;
+ border-style:solid;
+ border: 1px solid grey;
+ font-size:10px;
+ text-align:center;
+}
+.tbl_header{
+ width:100%;
+ font-size:10px;
+}
+.tr_bottom_line{
+ border-bottom: thin solid black;
+ width:100%;
+}
+.tr_bottom_line_dark_grey{
+ border-bottom: thin solid grey;
+ width:100%;
+}
+.tr_bottom_line_light_grey{
+ border-bottom: thin solid #CCCCCC;
+ width:100%;
+}
+.td_f12{
+ font-size:12px;
+}
+.td_f10{
+ font-size:10px;
+}
+.td_f10_right{
+ font-size:10px;
+ text-align:right;
+}
+.td_f12{
+ font-size:12px;
+}
+.td_f12_right{
+ font-size:12px;
+ text-align:right;
+}
+.dest_address {
+margin-right:60%;
+font-size:12;
+}
+.title {
+font-size:16;
+font-weight: bold;
+
+}
+.basic_table{
+text-align:center;
+border:1px solid lightGrey;
+border-collapse: collapse;
+}
+.month_table{
+text-align:center;
+border:1px solid black;
+border-collapse: collapse;
+ }
+.basic_table td {
+border:1px solid lightGrey;
+font-size:12;
+}
+
+.list_table {
+border-color:black;
+text-align:center;
+border-collapse: collapse;
+
+}
+.list_table td {
+border-color:black;
+border-top:1px solid black;
+border-bottom:1px solid black;
+border-left:1px solid black;
+border-right:1px solid black;
+text-align:left;
+background-color:c0c0c0;
+font-size:12px;
+padding-left:5px;
+padding-right:20px;
+padding-top:5px;
+padding-bottom:5px;
+}
+
+.list_table th {
+border-bottom:2px solid black;
+text-align:left;
+font-size:12pxpx;
+font-weight:bold;
+padding-left:3px;
+padding-right:3px;
+}
+
+.list_tabe thead {
+ display:table-header-group;
+}
+
+
+.total {
+width:100%;
+}
+.lib {
+width:10.3%;
+}
+.tot {
+text-align:left;
+width:15%;
+}
+.righttot {
+width:74%;
+}
+.tax {
+width:50%;
+}
+table {
+ display: table;
+ width: 100%;
+ }
+
+ table thead {
+ display: table-header-group;
+ }
+
+ table tbody {
+ display: table-row-group;
+ }
+
+ table tfoot {
+ display: table-footer-group;
+ }
+
+ table tr {
+ display: table-row;
+ height: auto;
+ }
+
+ table th,
+ table td {
+ display: table-cell;
+ overflow: visible;
+ }
+
+ table th,
+ table td {
+ height: 1px; /* Do the trick to make div.nobrk fill td height */
+ }
+
+ table tr.singlecell td,
+ table tr.singlecell th {
+ height: auto; /* Reset trick for a full row td */
+ }
+
+ .nobrk {
+ page-break-inside: avoid;
+ orphans: 10;
+ widows: 10;
+ position: relative;
+ margin: -1px 0 0 -1px;
+ min-height: 14px;
+ line-height: 14px;
+ height: 100%;
+ }
+
+ table tbody td .nobrk {
+ min-height: 5px;
+ }
+ ]]>
+ </field>
+ <field name="name">Attendance By Month Header Landscape</field>
+ </record>
+
+ </data>
+ <data>
+ <report auto="False"
+ id="attendance_error_report_webkit"
+ keyword="client_print_multi"
+ menu="False"
+ model="hr.employee"
+ multi="True"
+ name="hr.attendance.error.webkit"
+ file="hr_attendance_webkit/report/attendance_errors.mako"
+ string="Attendance Error Report"
+ report_type="webkit"
+ webkit_header="hr_webkit_header"/>
+
+ <report auto="False"
+ id="attendance_by_month_webkit"
+ keyword="client_print_multi"
+ menu="False"
+ model="hr.employee"
+ multi="True"
+ name="hr.attendance.bymonth.webkit"
+ file="hr_attendance_webkit/report/attendance_by_month.mako"
+ string="Attendance By Month"
+ report_type="webkit"
+ webkit_header="attendance_bymonth_header_landscape"/>
+
+ <report auto="False"
+ id="attendance_by_week_webkit"
+ keyword="client_print_multi"
+ menu="False"
+ model="hr.employee"
+ multi="True"
+ name="hr.attendance.allweeks.webkit"
+ file="hr_attendance_webkit/report/timesheet.mako"
+ string="Attendance By week"
+ report_type="webkit"
+ webkit_header="attendance_bymonth_header_landscape"/>
+ </data>
+</openerp>
=== added directory 'hr_attendance_webkit/report'
=== added file 'hr_attendance_webkit/report/__init__.py'
--- hr_attendance_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_attendance_webkit/report/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 attendance_errors
+import attendance_by_month
+import timesheet
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_attendance_webkit/report/attendance_by_month.mako'
--- hr_attendance_webkit/report/attendance_by_month.mako 1970-01-01 00:00:00 +0000
+++ hr_attendance_webkit/report/attendance_by_month.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,38 @@
+<html>
+<head>
+ <style type="text/css">
+ ${css}
+ </style>
+</head>
+<body >
+ <br/>
+ <center><h2> Attendances by Month </h2></center>
+ <br/><br/><br/>
+ <table class="list_table" width="100%">
+ <tr>
+ <td width="15%" style="font-size:18px;"><b>${data['form']['year']}</b></td>
+ <%month =1%>
+ %for month in range(lengthmonth(data['form']['year'],data['form']['month'])):
+ <td width="2.5%" ><b>${get_day_name(data['form']['year'],data['form']['month'],month+1)}</b></td>
+ %endfor
+ <td><b>${_("Total")}</b></td>
+ </tr>
+ <tr>
+ <td style="font-size:12px;">${get_month_year(data['form']['year'],data['form']['month'])}</td>
+ %for month in range(lengthmonth(data['form']['year'],data['form']['month'])):
+ <td width="2.5%" >${month +1 }</td>
+ %endfor
+ <td ><b></b></td>
+ </tr>
+ %for emp_data in get_emp_ids(data):
+ <tr>
+ <td style="text-align:left;background-color:FFFFFF;color:169111;font-size:18px;">${get_emp_data(emp_data,data)[1][0]}</td>
+ %for emp in range(len(get_emp_data(emp_data,data)[0])):
+ <td td width="2.5%" style="text-align:right; background-color:FFFFFF;padding-right:3px;">${get_emp_data(emp_data,data)[0][emp]}</td>
+ %endfor
+ <td><b>${get_emp_data(emp_data,data)[2]}</b></td>
+ </tr>
+ %endfor
+ </table>
+</body>
+</html>
\ No newline at end of file
=== added file 'hr_attendance_webkit/report/attendance_by_month.py'
--- hr_attendance_webkit/report/attendance_by_month.py 1970-01-01 00:00:00 +0000
+++ hr_attendance_webkit/report/attendance_by_month.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,129 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 datetime import datetime, timedelta
+from dateutil.relativedelta import relativedelta
+import time
+
+from openerp import pooler
+from openerp.report import report_sxw
+
+one_day = relativedelta(days=1)
+month2name = [0, 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
+
+def hour2str(h):
+ hours = int(h)
+ minutes = int(round((h - hours) * 60, 0))
+ return '%02dh%02d' % (hours, minutes)
+
+class attendance_by_month(report_sxw.rml_parse):
+
+ def __init__(self, cr, uid, name, context):
+ super(attendance_by_month, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({
+ 'time': time,
+ 'lengthmonth':self.lengthmonth,
+ 'get_month_year':self.get_month_year,
+ 'get_day_name':self.get_day_name,
+ 'get_emp_data':self.get_emp_data,
+ 'get_emp_ids':self.get_emp_ids,
+ })
+
+ def get_month_year(self, year, month):
+ month = datetime(year, month, 1)
+ print (month)
+ return month2name[month.month]
+
+ def lengthmonth(self, year,month):
+
+ if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))):
+ return 29
+ return [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]
+
+ def get_day_name(self, year, month, day):
+ days =[]
+ name_of_day = datetime.weekday(datetime(year,month,day))
+ if name_of_day == 0:
+ return "Mon"
+ elif name_of_day == 1:
+ return "Tue"
+ elif name_of_day == 2:
+ return "Wed"
+ elif name_of_day == 3:
+ return "Thus"
+ elif name_of_day == 4:
+ return "Fri"
+ elif name_of_day == 5:
+ return "Sat"
+ elif name_of_day == 6:
+ return "Sun"
+
+ def get_emp_ids(self,datas,context=None):
+ emp_ids = datas['active_ids']
+ return emp_ids
+
+ def get_emp_data(self, ids, datas,context=None):
+ obj_emp = pooler.get_pool(self.cr.dbname).get('hr.employee')
+ emp_ids = ids
+ month = datetime(datas['form']['year'], datas['form']['month'], 1)
+ if emp_ids:
+ for emp in obj_emp.read(self.cr, self.uid, [emp_ids], ['name']):
+ wh_list=[]
+ wh_name=[]
+ total_wh = 0.0
+ wh_name.append(emp['name'])
+ today, tomor = month, month + one_day
+ while today.month == month.month:
+ sql = '''
+ select action, att.name
+ from hr_employee as emp inner join hr_attendance as att
+ on emp.id = att.employee_id
+ where att.name between %s and %s and emp.id = %s
+ order by att.name
+ '''
+ self.cr.execute(sql, (today.strftime('%Y-%m-%d %H:%M:%S'), tomor.strftime('%Y-%m-%d %H:%M:%S'), emp['id']))
+ attendences = self.cr.dictfetchall()
+ wh = 0.0
+ # Fake sign ins/outs at week ends, to take attendances across week ends into account
+ if attendences and attendences[0]['action'] == 'sign_out':
+ attendences.insert(0, {'name': today.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_in'})
+ if attendences and attendences[-1]['action'] == 'sign_in':
+ attendences.append({'name': tomor.strftime('%Y-%m-%d %H:%M:%S'), 'action':'sign_out'})
+ # sum up the attendances' durations
+ ldt = None
+ for att in attendences:
+ dt = datetime.strptime(att['name'], '%Y-%m-%d %H:%M:%S')
+ if ldt and att['action'] == 'sign_out':
+ if dt.date() > ldt.date():
+ dt = ldt
+ wh += (float((dt - ldt).seconds)/60/60)
+ else:
+ ldt = dt
+ total_wh += wh
+ wh = hour2str(wh)
+ wh_list.append(wh)
+ today, tomor = tomor, tomor + one_day
+ return wh_list,wh_name, hour2str(total_wh)
+
+report_sxw.report_sxw('report.hr.attendance.bymonth.webkit', 'hr.employee', 'addons/hr_attendance_webkit/report/attendance_by_month.mako', parser=attendance_by_month, header='internal')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'hr_attendance_webkit/report/attendance_errors.mako'
--- hr_attendance_webkit/report/attendance_errors.mako 1970-01-01 00:00:00 +0000
+++ hr_attendance_webkit/report/attendance_errors.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,66 @@
+<html>
+<head>
+ <style type="text/css">
+ ${css}
+ </style>
+</head>
+<body >
+ %for employee in get_employees(data['form']['emp_ids']) :
+ <br/>
+ <br/>
+ <center><h2>Attendance Errors</h2></center>
+ <h4>${employee.name}
+ <br/>
+ <br/>
+ <table class="list_table" width="100%" align="center">
+ <thead>
+ <tr>
+ <th style="text-align:left;" width="25%">${_("Operation")}</th>
+ <th style="text-align:center;" width="15%">${_("Date Signed")}</th>
+ <th style="text-align:center;" width="15%">${_("Date Recorded")}</th>
+ <th style="text-align:center;" width="20%">${_("Delay")}</th>
+ <th style="text-align:center;" width="25%">${_("Min Delay")}</th>
+ </tr>
+ </thead>
+ %for att in (lst(employee.id,data['form']['init_date'], data['form']['end_date'], data['form']['max_delay'])):
+ <tbody>
+ <tr>
+ <td style="text-align:left;">
+ ${att['action'] or '' |entity}
+ </td>
+ <td style="text-align:center;">
+ ${formatLang(att['date'],date_time=True) or '' |entity}
+ </td>
+ <td style="text-align:center;">
+ ${formatLang(att['create_date'],date_time=True) or '' |entity}
+ </td>
+ <td style="text-align:center;">
+ ${att['delay'] or '' |entity}
+ </td>
+ <td style="text-align:center;">
+ ${att['delay2'] or '' |entity}
+ </td>
+ </tr>
+ </tbody>
+ %endfor
+ <table class="list_table" width="100%" style="border-top:2px solid black">
+ <thead>
+ <tr>
+ %for t in total(employee.id,data['form']['init_date'], data['form']['end_date'], data['form']['max_delay']):
+ <td style="text-align:left;" width="25%"><b>${_("Total period:")}</b></td>
+ <td style="text-align:center;" width="15%"></td>
+ <td style="text-align:center;" width="15%"></td>
+ <td style="text-align:center;" width="20%">${t['total']}</td>
+ <td style="text-align:center;" width="25%">${t['total2']}</td>
+ %endfor
+ </tr>
+ </thead>
+ </table>
+ </table>
+ <br/><br/>
+ ${_("(*) A positive delay means that the employee worked less than recorded.")}<br/>
+ ${_("(*) A negative delay means that the employee worked more than encoded.")}
+ <p style="page-break-after:always"></p>
+ %endfor
+</body>
+</html>
\ No newline at end of file
=== added file 'hr_attendance_webkit/report/attendance_errors.py'
--- hr_attendance_webkit/report/attendance_errors.py 1970-01-01 00:00:00 +0000
+++ hr_attendance_webkit/report/attendance_errors.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,82 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 datetime
+import time
+
+from openerp import pooler
+from openerp.report import report_sxw
+
+class attendance_print(report_sxw.rml_parse):
+
+ def __init__(self, cr, uid, name, context):
+ super(attendance_print, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({
+ 'time': time,
+ 'lst': self._lst,
+ 'total': self._lst_total,
+ 'get_employees':self._get_employees,
+ })
+
+ def _get_employees(self, emp_ids):
+ emp_obj_list = self.pool.get('hr.employee').browse(self.cr, self.uid, emp_ids)
+ return emp_obj_list
+
+
+ def _lst(self, employee_id, dt_from, dt_to, max, *args):
+ self.cr.execute("select name as date, create_date, action, create_date-name as delay from hr_attendance where employee_id=%s and to_char(name,'YYYY-mm-dd')<=%s and to_char(name,'YYYY-mm-dd')>=%s and action IN (%s,%s) order by name", (employee_id, dt_to, dt_from, 'sign_in', 'sign_out'))
+ res = self.cr.dictfetchall()
+ for r in res:
+ if r['action'] == 'sign_out':
+ r['delay'] = -r['delay']
+ temp = r['delay'].seconds
+
+ r['delay'] = str(r['delay']).split('.')[0]
+ if abs(temp) < max*60:
+ r['delay2'] = r['delay']
+ else:
+ r['delay2'] = '/'
+ return res
+
+ def _lst_total(self, employee_id, dt_from, dt_to, max, *args):
+ self.cr.execute("select name as date, create_date, action, create_date-name as delay from hr_attendance where employee_id=%s and to_char(name,'YYYY-mm-dd')<=%s and to_char(name,'YYYY-mm-dd')>=%s and action IN (%s,%s) order by name", (employee_id, dt_to, dt_from, 'sign_in', 'sign_out'))
+ res = self.cr.dictfetchall()
+ if not res:
+ return ('/','/')
+ total2 = datetime.timedelta(seconds = 0, minutes = 0, hours = 0)
+ total = datetime.timedelta(seconds = 0, minutes = 0, hours = 0)
+ for r in res:
+ if r['action'] == 'sign_out':
+ r['delay'] = -r['delay']
+ total += r['delay']
+ if abs(r['delay'].seconds) < max*60:
+ total2 += r['delay']
+
+ result_dict = {
+ 'total': total and str(total).split('.')[0],
+ 'total2': total2 and str(total2).split('.')[0]
+ }
+ return [result_dict]
+
+report_sxw.report_sxw('report.hr.attendance.error.webkit', 'hr.employee', 'addons/hr_attendance_webkit/report/attendance_errors.mako', parser=attendance_print, header='internal')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'hr_attendance_webkit/report/timesheet.mako'
--- hr_attendance_webkit/report/timesheet.mako 1970-01-01 00:00:00 +0000
+++ hr_attendance_webkit/report/timesheet.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,80 @@
+<html>
+<head>
+ <style type="text/css">
+ ${css}
+ </style>
+</head>
+<body >
+
+% for emp_data in get_emp_ids(data):
+ <br/><br/>
+ <center><h2> Attendances by Week </h2></center>
+ <br/><br/>
+ <b>${_("Employee")} :</b>${get_emp_name(emp_data)}
+ <br/><br/>
+ %for day in range(len(get_week(data)[0])):
+ <table class="list_table">
+ <tr>
+ <td style="background-color:FFFFFF;" width="30%">
+ <%
+ from dateutil.relativedelta import relativedelta
+ first_date = ''
+ last_date = ''
+ first_date = get_week(data)[0][day].strftime('%Y-%m-%d')
+ last_date = (get_week(data)[2][day] - relativedelta(days=1)).strftime('%Y-%m-%d')
+ %>
+
+ <b>${"From"} ${first_date} ${"to"} ${last_date}</b>
+ </td>
+ <td>
+ ${_("Mon")}
+ </td>
+ <td>
+ ${_("Tue")}
+ </td>
+ <td>
+ ${_("Wed")}
+ </td>
+ <td>
+ ${_("Thus")}
+ </td>
+ <td>
+ ${_("Fri")}
+ </td>
+ <td>
+ ${_("Sat")}
+ </td>
+ <td>
+ ${_("sun")}
+ </td>
+ <td>
+ ${_("Total")}
+ </td>
+ </tr>
+ <tr>
+ <td style="background-color:FFFFFF;" width="30%">
+ ${"Worked Hours"}
+ </td>
+ <% total=0.0 %>
+ %for emp in range(7):
+ <%
+ dayhr=0.0
+ if emp in (get_attandance(emp_data, get_week(data)[0][day], get_week(data)[1][day])):
+
+ dayhr = get_attandance(emp_data, get_week(data)[0][day], get_week(data)[1][day])[emp]
+ total=total +dayhr
+ %>
+ <td style="background-color:FFFFFF;" width="9%">
+ ${hour2str(dayhr)}
+ </td>
+ %endfor
+ <td style="background-color:FFFFFF;">
+ ${hour2str(total)}
+ </td>
+ </tr>
+ </table>
+ %endfor
+<p style="page-break-after:always"></p>
+%endfor
+</body>
+</html>
\ No newline at end of file
=== added file 'hr_attendance_webkit/report/timesheet.py'
--- hr_attendance_webkit/report/timesheet.py 1970-01-01 00:00:00 +0000
+++ hr_attendance_webkit/report/timesheet.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,119 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 datetime import datetime
+from dateutil.relativedelta import relativedelta
+import time
+
+from openerp import pooler, tools
+from openerp.report import report_sxw
+from openerp.tools.translate import _
+
+one_week = relativedelta(days=7)
+num2day = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
+
+def to_hour(h):
+ return int(h), int(round((h - int(h)) * 60, 0))
+
+class attendance_by_week(report_sxw.rml_parse):
+
+ def __init__(self, cr, uid, name, context):
+ super(attendance_by_week, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({
+ 'time': time,
+ 'get_emp_ids': self.get_emp_ids,
+ 'hour2str':self.hour2str,
+ 'get_week':self.get_week,
+ 'get_attandance':self.get_attandance,
+ 'get_emp_name':self.get_emp_name,
+ })
+
+ def hour2str(self, h):
+ hours = int(h)
+ minutes = int(round((h - hours) * 60, 0))
+ return '%02dh%02d' % (hours, minutes)
+
+ def get_emp_ids(self,datas,context=None):
+ emp_ids = datas['active_ids']
+ return emp_ids
+
+ def get_emp_name(self, ids):
+ obj_emp = pooler.get_pool(self.cr.dbname).get('hr.employee')
+ emp_ids =ids
+ if emp_ids:
+ emp_name = obj_emp.read(self.cr, self.uid, emp_ids,['name'])
+ return emp_name['name']
+
+ def get_week(self,datas,context=None):
+ start_date = datetime.strptime(datas['form']['init_date'], '%Y-%m-%d')
+ end_date = datetime.strptime(datas['form']['end_date'], '%Y-%m-%d')
+ first_monday = start_date - relativedelta(days=start_date.date().weekday())
+ last_monday = end_date + relativedelta(days=7 - end_date.date().weekday())
+ monday, n_monday = first_monday, first_monday + one_week
+
+ week_first=[]
+ week_last =[]
+ week_end = []
+ while monday != last_monday:
+ if last_monday < first_monday:
+ first_monday, last_monday = last_monday, first_monday
+ week_end.append(monday + relativedelta(days=7 - monday.date().weekday()))
+ week_first.append(monday)
+ week_last.append(last_monday)
+ monday, n_monday = n_monday, n_monday + one_week
+ return week_first, week_last, week_end
+
+ def get_attandance(self, ids, week_first,week_last):
+ start = week_first
+ end = week_first + relativedelta(days=7 - week_first.date().weekday())
+
+ obj_emp = pooler.get_pool(self.cr.dbname).get('hr.employee')
+ emp_ids = ids
+ if emp_ids:
+ emp = obj_emp.read(self.cr, self.uid, [emp_ids], ['id', 'name'])
+ sql = '''
+ select action, att.name
+ from hr_employee as emp inner join hr_attendance as att
+ on emp.id = att.employee_id
+ where att.name between %s and %s and emp.id = %s
+ order by att.name
+ '''
+ for idx in range(7):
+ self.cr.execute(sql, (start.strftime('%Y-%m-%d %H:%M:%S'), (start + relativedelta(days=idx+1)).strftime('%Y-%m-%d %H:%M:%S'), emp_ids))
+ attendances = self.cr.dictfetchall()
+ week_wh = {}
+ # Fake sign ins/outs at week ends, to take attendances across week ends into account
+ # XXX this is wrong for the first sign-in ever and the last sign out to this date
+ if attendances and attendances[0]['action'] == 'sign_out':
+ attendances.insert(0, {'name': start.strftime('%Y-%m-%d %H:%M:%S'), 'action': 'sign_in'})
+ if attendances and attendances[-1]['action'] == 'sign_in':
+ attendances.append({'name': end.strftime('%Y-%m-%d %H:%M:%S'), 'action': 'sign_out'})
+ # sum up the attendances' durations
+ ldt = None
+ for att in attendances:
+ dt = datetime.strptime(att['name'], '%Y-%m-%d %H:%M:%S')
+ if ldt and att['action'] == 'sign_out':
+ week_wh[ldt.date().weekday()] = week_wh.get(ldt.date().weekday(), 0) + (float((dt - ldt).seconds)/3600)
+ else:
+ ldt = dt
+ return week_wh
+
+report_sxw.report_sxw('report.hr.attendance.allweeks.webkit', 'hr.employee', 'addons/hr_attendance_webkit/report/timesheet.mako', parser=attendance_by_week, header='internal')
+# vim:noexpandtab:tw=0
=== added directory 'hr_attendance_webkit/wizard'
=== added file 'hr_attendance_webkit/wizard/__init__.py'
--- hr_attendance_webkit/wizard/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_attendance_webkit/wizard/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 hr_attendance_error
+import hr_attendance_bymonth
+import hr_attendance_byweek
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_attendance_webkit/wizard/hr_attendance_bymonth.py'
--- hr_attendance_webkit/wizard/hr_attendance_bymonth.py 1970-01-01 00:00:00 +0000
+++ hr_attendance_webkit/wizard/hr_attendance_bymonth.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp.osv import osv, fields
+
+class hr_attendance_bymonth(osv.osv_memory):
+ _inherit = 'hr.attendance.month'
+ def print_report(self, cr, uid, ids, context=None):
+ datas = {
+ 'ids': [],
+ 'active_ids': context['active_ids'],
+ 'model': 'hr.employee',
+ 'form': self.read(cr, uid, ids)[0]
+ }
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'hr.attendance.bymonth.webkit',
+ 'datas': datas,
+ }
+
+hr_attendance_bymonth()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_attendance_webkit/wizard/hr_attendance_byweek.py'
--- hr_attendance_webkit/wizard/hr_attendance_byweek.py 1970-01-01 00:00:00 +0000
+++ hr_attendance_webkit/wizard/hr_attendance_byweek.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 datetime import datetime
+from dateutil.relativedelta import relativedelta
+
+from openerp.osv import fields, osv
+
+class hr_attendance_byweek(osv.osv_memory):
+ _inherit = 'hr.attendance.week'
+
+ def print_report(self, cr, uid, ids, context=None):
+ datas = {
+ 'ids': [],
+ 'active_ids': context['active_ids'],
+ 'model': 'hr.employee',
+ 'form': self.read(cr, uid, ids)[0]
+ }
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'hr.attendance.allweeks.webkit',
+ 'datas': datas,
+ }
+
+hr_attendance_byweek()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_attendance_webkit/wizard/hr_attendance_error.py'
--- hr_attendance_webkit/wizard/hr_attendance_error.py 1970-01-01 00:00:00 +0000
+++ hr_attendance_webkit/wizard/hr_attendance_error.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp.osv import fields, osv
+from openerp.tools.translate import _
+
+class hr_attendance_error(osv.osv_memory):
+
+ _inherit = 'hr.attendance.error'
+
+ def print_report(self, cr, uid, ids, context=None):
+ emp_ids = []
+ data_error = self.read(cr, uid, ids, context=context)[0]
+ date_from = data_error['init_date']
+ date_to = data_error['end_date']
+ cr.execute("SELECT id FROM hr_attendance WHERE employee_id IN %s AND to_char(name,'YYYY-mm-dd')<=%s AND to_char(name,'YYYY-mm-dd')>=%s AND action IN %s ORDER BY name" ,(tuple(context['active_ids']), date_to, date_from, tuple(['sign_in','sign_out'])))
+ attendance_ids = [x[0] for x in cr.fetchall()]
+ if not attendance_ids:
+ raise osv.except_osv(_('No Data Available !'), _('No records are found for your selection!'))
+ attendance_records = self.pool.get('hr.attendance').browse(cr, uid, attendance_ids, context=context)
+
+ for rec in attendance_records:
+ if rec.employee_id.id not in emp_ids:
+ emp_ids.append(rec.employee_id.id)
+ data_error['emp_ids'] = emp_ids
+ datas = {
+ 'ids': ids,
+ 'model': 'hr.employee',
+ 'form': data_error
+ }
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'hr.attendance.error.webkit',
+ 'datas': datas,
+ }
+
+hr_attendance_error()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added directory 'hr_expense_webkit'
=== added file 'hr_expense_webkit/__init__.py'
--- hr_expense_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_expense_webkit/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_expense_webkit/__openerp__.py'
--- hr_expense_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ hr_expense_webkit/__openerp__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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/>.
+#
+############################################################################
+
+{
+ 'name' : 'HR Expense Reports',
+ 'version' : '1.1',
+ 'author' : 'Serpent Consulting Services',
+ 'category' : 'Human resources',
+ 'description' : """
+HR Expense.
+====================================
+ It is conversion of rml report to Webkit Report.
+ """,
+ 'website': 'http://www.serpentcs.com',
+ 'depends' : ['report_webkit','hr_expense'],
+ 'init_xml': [],
+ 'update_xml': [
+ "hr_expense_report.xml",
+ ],
+ 'test': [
+ ],
+ 'installable': True,
+ 'auto_install': False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_expense_webkit/hr_expense_report.xml'
--- hr_expense_webkit/hr_expense_report.xml 1970-01-01 00:00:00 +0000
+++ hr_expense_webkit/hr_expense_report.xml 2013-10-10 09:59:30 +0000
@@ -0,0 +1,243 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="hr_webkit_header" 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>
+ <% import datetime %>
+ <body style="border:0; margin: 0;" onload="subst()">
+ <table style="border-top: 1px solid black; width: 1080px">
+ <tr style="border-collapse:collapse;">
+ <td style="text-align:left;font-size:15px;width:350px;">${formatLang( str(datetime.datetime.today()), date_time=True)}</td>
+ <td style="text-align:center;font-size:15px;width:350px;">${user.name or ''}</td>
+ <td style="text-align:right;font-size:15px;width:350px;">Page <span class="page"/></td>
+ <td style="text-align:left;font-size:15px;width:30px"> of <span class="topage"/></td>
+ </tr>
+ </table>
+ </body>
+</html>]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</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: 15;" onload="subst()">
+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:left;font-size:12;" width="20%">${ helper.embed_image('png',company.logo,200,50)|n }</td>
+ <td style="text-align:right;font-size:12;" width="80%"></br></br>${ company.rml_header1 }</td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+ <p style="text-align:left;font-size:12;">${company.name}</p></br></br>
+ <table width="100%">
+ <tr>
+ <td style="text-align:left;font-size:10;" width="25%">
+ Phone: ${company.phone or ''}
+ </td>
+ <td width="75%"></td>
+ </tr>
+
+ <tr>
+ <td style="text-align:left;font-size:10; border-bottom: 1px solid black;" width="25%">
+ Mail: ${company.email}
+ </td>
+ <td width="75%"></td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+</html>]]>
+ </field>
+ <field eval="45.0" name="margin_top"/>
+ <field eval="15.0" name="margin_bottom"/>
+ <field name="css"><![CDATA[
+
+body {
+font-family:Verdana;
+font-size:12;
+
+}
+
+
+.dest_address {
+margin-right:60%;
+font-size:12;
+}
+.header {
+margin-right:0;
+text-align:right;
+width:300px;
+font-size:12;
+}
+
+.title {
+font-size:16;
+font-weight: bold;
+
+}
+
+
+.basic_table{
+text-align:center;
+border:1px solid lightGrey;
+border-collapse: collapse;
+}
+.basic_table td {
+border:1px solid lightGrey;
+font-size:10px;
+padding-left:3px;
+padding-right:3px;
+padding-top:3px;
+padding-bottom:3px;
+
+}
+
+.list_table {
+border-color:black;
+text-align:center;
+border-collapse: collapse;
+
+}
+.list_table td {
+border-color:gray;
+border-top:1px solid #ccc;
+text-align:right;
+font-size:11px;
+padding-left:5px;
+padding-right:3px;
+padding-top:3px;
+padding-bottom:3px;
+}
+
+.list_table th {
+border-bottom:1px solid black;
+text-align:right;
+font-size:11px;
+font-weight:bold;
+padding-left:5px;
+padding-right:3px;
+padding-top:3px;
+padding-bottom:3px;
+}
+
+.list_tabe thead {
+ display:table-header-group;
+}
+
+
+.total {
+width:100%;
+}
+.lib {
+width:10.3%;
+}
+.tot {
+text-align:left;
+width:15%;
+}
+.righttot {
+width:74%;
+}
+.tax {
+width:50%;
+}
+table {
+ display: table;
+ width: 100%;
+ }
+
+ table thead {
+ display: table-header-group;
+ }
+
+ table tbody {
+ display: table-row-group;
+ }
+
+ table tfoot {
+ display: table-footer-group;
+ }
+
+ table tr {
+ display: table-row;
+ height: auto;
+ }
+
+ table th,
+ table td {
+ display: table-cell;
+ overflow: visible;
+ }
+
+ table th,
+ table td {
+ height: 1px; /* Do the trick to make div.nobrk fill td height */
+ }
+
+ table tr.singlecell td,
+ table tr.singlecell th {
+ height: auto; /* Reset trick for a full row td */
+ }
+
+ .nobrk {
+ page-break-inside: avoid;
+ orphans: 10;
+ widows: 10;
+ position: relative;
+ margin: -1px 0 0 -1px;
+ min-height: 14px;
+ line-height: 14px;
+ height: 100%;
+ }
+
+ table tbody td .nobrk {
+ min-height: 5px;
+ }
+]]>
+ </field>
+ <field name="name">HR Webkit Header</field>
+ </record>
+ </data>
+ <data>
+ <report
+ auto="False"
+ menu="True"
+ id="hr_expenses_webkit"
+ model="hr.expense.expense"
+ name="hr.expense.webkit"
+ file="hr_expense_webkit/report/hr_expense_report.mako"
+ string="HR expenses"
+ report_type="webkit"
+ webkit_header="hr_webkit_header" />
+ </data>
+</openerp>
=== added directory 'hr_expense_webkit/report'
=== added file 'hr_expense_webkit/report/__init__.py'
--- hr_expense_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_expense_webkit/report/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 hr_expense_report
+import hr_expense
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_expense_webkit/report/hr_expense.py'
--- hr_expense_webkit/report/hr_expense.py 1970-01-01 00:00:00 +0000
+++ hr_expense_webkit/report/hr_expense.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,38 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 datetime
+import time
+
+from openerp.report import report_sxw
+
+class expense(report_sxw.rml_parse):
+
+ def __init__(self, cr, uid, name, context):
+ super(expense, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({'time': time, })
+
+report_sxw.report_sxw('report.hr.expense.webkit', 'hr.expense.expense', 'addons/hr_expense_webkit/report/hr_expense_report.mako',parser=expense)
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'hr_expense_webkit/report/hr_expense_report.mako'
--- hr_expense_webkit/report/hr_expense_report.mako 1970-01-01 00:00:00 +0000
+++ hr_expense_webkit/report/hr_expense_report.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,83 @@
+<html>
+<head>
+ <style type="text/css">
+ ${css}
+ </style>
+</head>
+<body>
+ %for o in objects :
+ <br/>
+ <br/>
+ <center><h3>HR Expenses</h3></center>
+ <center><h4>${o.name or '' | entity}</h4></center>
+
+ <table class="basic_table" width="90%" align="center">
+ <tr>
+ <td width="25%"><b>${_("Employee")}</b></td>
+ <td width="25%"><b>${_("Date")}</b></td>
+ <td width="25%"><b>${_("Description")}</b></td>
+ <td width="25%"><b>${_("Validated By")}</b></td>
+ </tr>
+ <tr>
+ <td>${o.employee_id.name or ''|entity}</td>
+ <td>${formatLang(o.date,date=True) or ''|entity}</td>
+ <td>${o.name or '' |entity}</td>
+ <td>${o.user_valid.name or ''|entity}</td>
+ </tr>
+ </table>
+ <br />
+ <table class="list_table" width="100%">
+ <thead>
+ <tr>
+ <th style="text-align:left;">${_("Date")}</th>
+ <th style="text-align:left;">${_("Name")}</th>
+ <th style="text-align:left;">${_("Ref.")}</th>
+ <th style="text-align:right;">${_("Unit Price")}</th>
+ <th style="text-align:right;" >${_("Qty")}</th>
+ <th style="text-align:right;" >${_("Price")}</th>
+ </tr>
+ </thead>
+ %for line in o.line_ids :
+ <tbody>
+ <tr>
+ <td style="text-align:left;" width="10%">${formatLang(line.date_value,date=True)}</td>
+ <td style="text-align:left;" width="36%">${line.name or ''|entity}${line.description or ''|entity}</td>
+ <td style="text-align:right;" width="10%">${line.ref or '' |entity}</td>
+ <td style="text-align:right;" width="10%">${formatLang(line.unit_amount) or 0.0 |entity}</td>
+ <td style="text-align:right;" width="12%">${formatLang(line.unit_quantity) or 0.0 |entity}</td>
+ <td style="text-align:right;" width="12%">${formatLang(line.total_amount, currency_obj=o.currency_id) or 0.0 |entity}</td>
+ </tr>
+ %if line.analytic_account and line.analytic_account.complete_name:
+ <tr>
+ <td style="border-style:none"/>
+ <td style="border-style:none;text-align:left;font-size:10px"><i>${line.analytic_account and line.analytic_account.complete_name or '' |entity}</i></td>
+ <td style="border-style:none"/>
+ <td style="border-style:none"/>
+ <td style="border-style:none"/>
+ <td style="border-style:none"/>
+ </tr>
+ %endif
+ %endfor
+ <tr>
+ <td style="border-style:none"/>
+ <td style="border-style:none"/>
+ <td style="border-style:none"/>
+ <td style="border-style:none"/>
+ <td style="border-top:1px solid"><b>Total:</b></td>
+ <td style="border-top:1px solid;text-align:right">${formatLang(o.amount, digits=get_digits(dp='Account') , currency_obj=o.currency_id)}
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ <br/><br/>
+ %if o.note:
+ ${ o.note or '' | entity} <br/>
+ %endif
+ ${_("Certified honest and conform,")} <br/>
+ ${_("(Date and signature)")} <br/><br/>
+ ${_("This document must be dated and signed for reimbursement")}
+
+ <p style="page-break-after:always"></p>
+ %endfor
+</body>
+</html>
\ No newline at end of file
=== added file 'hr_expense_webkit/report/hr_expense_report.py'
--- hr_expense_webkit/report/hr_expense_report.py 1970-01-01 00:00:00 +0000
+++ hr_expense_webkit/report/hr_expense_report.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp import tools
+from openerp.osv import fields, osv
+
+from openerp.addons.decimal_precision import decimal_precision as dp
+
+
+class hr_expense_report(osv.osv):
+ _inherit = "hr.expense.report"
+ _description = "Expenses Statistics"
+
+hr_expense_report()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added directory 'hr_holidays_webkit'
=== added file 'hr_holidays_webkit/__init__.py'
--- hr_holidays_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_holidays_webkit/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 report
+import wizard
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
=== added file 'hr_holidays_webkit/__openerp__.py'
--- hr_holidays_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ hr_holidays_webkit/__openerp__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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/>.
+#
+############################################################################
+
+
+{
+ 'name' : 'HR Holidays Reports',
+ 'version' : '1.5',
+ 'author' : 'Serpent Consulting Services',
+ 'category' : 'Human resources',
+ 'description' : """
+Manage leaves and allocation requests
+====================================
+ It is conversion of rml report to Webkit Report.
+ """,
+ 'website': 'http://www.serpentcs.com',
+ 'depends' : ["report_webkit","hr_holidays",],
+ 'init_xml': [],
+ 'update_xml': [
+ "hr_holidays_report.xml",
+ ],
+ 'test': [
+ ],
+ 'installable': True,
+ 'auto_install': False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_holidays_webkit/hr_holidays_report.xml'
--- hr_holidays_webkit/hr_holidays_report.xml 1970-01-01 00:00:00 +0000
+++ hr_holidays_webkit/hr_holidays_report.xml 2013-10-10 09:59:30 +0000
@@ -0,0 +1,264 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="holidays_webkit_header" model="ir.header_webkit">
+ <field name="footer_html"><![CDATA[]]></field>
+ <field name="orientation">Landscape</field>
+ <field name="format">A4</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]);}
+ if(vars['page']!=1){
+ document.getElementById('inner_head').innerHTML=document.getElementById('actual_header').innerHTML;
+ }
+ 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()">
+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:right;font-size:12;" width="15%">${time.strftime('%m/%d/%Y %I:%M')}</td>
+ <td style="text-align:center;font-size:16;" width="75%">${company.partner_id.name |entity}</td>
+ <td style="text-align:left;font-size:12;" width="7%"><span class="page"/></td>
+ <td style="text-align:left;font-size:12;" width="1%">/</td>
+ <td style="text-align:right;font-size:12;" width="2%"><span class="topage"/></td>
+ </tr>
+ </table> ${_debug or ''|n}
+ <table id="inner_head" style="width: 98%;margin-left:1%;margin-right:1%;">
+
+ </table>${_debug or ''|n}
+ </body>
+</html>]]>
+ </field>
+ <field eval="15.0" name="margin_top"/>
+ <field eval="5.0" name="margin_bottom"/>
+ <field name="css"><![CDATA[
+
+body {
+font-family:Arial;
+font-size:12;
+}
+
+.header {
+ margin-left:0;
+ text-align:left;
+ width:300px;
+ font-size:12;
+}
+
+.cell{
+ border-spacing: 0;
+ border-collapse: collapse;
+ border-style:solid;
+ border: 1px solid grey;
+ font-size:10px;
+ text-align:center;
+}
+.tbl_header{
+ width:100%;
+ font-size:10px;
+}
+.tr_bottom_line{
+ border-bottom: thin solid black;
+ width:100%;
+}
+.tr_bottom_line_dark_grey{
+ border-bottom: thin solid grey;
+ width:100%;
+}
+.tr_bottom_line_light_grey{
+ border-bottom: thin solid #CCCCCC;
+ width:100%;
+}
+.td_f12{
+ font-size:12px;
+}
+.td_f10{
+ font-size:10px;
+}
+.td_f10_right{
+ font-size:10px;
+ text-align:right;
+}
+.td_f12{
+ font-size:12px;
+}
+.td_f12_right{
+ font-size:12px;
+ text-align:right;
+}
+.dest_address {
+margin-right:60%;
+font-size:12;
+}
+.title {
+font-size:16;
+font-weight: bold;
+
+}
+.basic_table{
+text-align:center;
+border:1px solid lightGrey;
+border-collapse: collapse;
+}
+.month_table{
+text-align:center;
+border:1px solid black;
+border-collapse: collapse;
+ }
+.basic_table td {
+border:1px solid lightGrey;
+font-size:12;
+}
+
+.list_table {
+border-color:black;
+text-align:center;
+border-collapse: collapse;
+
+}
+.list_table td {
+border-color:black;
+border-top:1px solid black;
+border-bottom:1px solid black;
+border-left:1px solid black;
+border-right:1px solid black;
+background-color:c0c0c0;
+font-size:6;
+padding-left:3px
+padding-right:3px
+padding-top:3px
+padding-bottom:3px
+}
+
+.list_table th {
+border-bottom:2px solid black;
+text-align:right;
+font-size:12;
+font-weight:bold;
+padding-left:3px
+padding-right:3px
+}
+
+.list_tabe thead {
+ display:table-header-group;
+}
+
+.color_table{
+width:15%;
+border-color:black;
+text-align:center;
+border-collapse: collapse;
+align: center;
+}
+.color_table td {
+border-color:black;
+border-top:1px solid black;
+border-bottom:1px solid black;
+border-left:1px solid black;
+border-right:1px solid black;
+text-align:center;
+font-size:8px;
+padding-left:3px
+padding-right:3px
+padding-top:3px
+padding-bottom:3px
+}
+.total {
+width:100%;
+}
+.lib {
+width:10.3%;
+}
+.tot {
+text-align:left;
+width:15%;
+}
+.righttot {
+width:74%;
+}
+.tax {
+width:50%;
+}
+table {
+ display: table;
+ width: 100%;
+ }
+
+ table thead {
+ display: table-header-group;
+ }
+
+ table tbody {
+ display: table-row-group;
+ }
+
+ table tfoot {
+ display: table-footer-group;
+ }
+
+ table tr {
+ display: table-row;
+ height: auto;
+ }
+
+ table th,
+ table td {
+ display: table-cell;
+ overflow: visible;
+ }
+
+ table th,
+ table td {
+ height: 1px; /* Do the trick to make div.nobrk fill td height */
+ }
+
+ table tr.singlecell td,
+ table tr.singlecell th {
+ height: auto; /* Reset trick for a full row td */
+ }
+
+ .nobrk {
+ page-break-inside: avoid;
+ orphans: 10;
+ widows: 10;
+ position: relative;
+ margin: -1px 0 0 -1px;
+ min-height: 14px;
+ line-height: 14px;
+ height: 100%;
+ }
+
+ table tbody td .nobrk {
+ min-height: 5px;
+ }
+ ]]>
+ </field>
+ <field name="name">Holidays Header Landscape</field>
+ </record>
+ <report auto="False"
+ id="holidays_emp_webkit"
+ menu="False"
+ model="hr.employee"
+ name="holidays.summary.webkit"
+ string="Holiday Summary"
+ file="hr_holidays_webkit/report/holidays_summary.mako"
+ report_type="webkit"
+ webkit_header="holidays_webkit_header"/>
+
+ </data>
+</openerp>
=== added directory 'hr_holidays_webkit/report'
=== added file 'hr_holidays_webkit/report/__init__.py'
--- hr_holidays_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_holidays_webkit/report/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 holidays_summary_report
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
=== added file 'hr_holidays_webkit/report/holidays_summary.mako'
--- hr_holidays_webkit/report/holidays_summary.mako 1970-01-01 00:00:00 +0000
+++ hr_holidays_webkit/report/holidays_summary.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,276 @@
+<html>
+<head>
+ <style type="text/css">
+ ${css}
+ </style>
+</head>
+<body>
+ <center><h1>${_("Leave Summary")} ${header_date(data)[2] or '' |entity}</h1></center>
+ <center>
+ ${_("Analyze from")} <u>${formatLang(header_date(data)[0].strftime("%Y-%m-%d"),date=True)}</u>
+ ${_("to")} <u>${formatLang(header_date(data)[1].strftime("%Y-%m-%d"),date=True)}</u>
+ ${_("of the")} <u>${header_date(data)[3] or '' |entity}</u>
+ ${_("leaves.")}
+ </center>
+ <br/><br/><br/>
+ <%
+ t_width = 0
+ t_width1 = 0
+ t_width2 = 0
+ %>
+ <table class="list_table" width="100%">
+ <tr>
+ <td width="8.3%" style="text-align=left;background-color:FFFFFF;font-size:10px;padding-left:5px;padding-bottom:7px;">
+ <b>${_("Month")}</b>
+ </td>
+ %for month in range((header_date(data)[1].month - header_date(data)[0].month)):
+ %if month == 0:
+ <% col = (len(range(header_date(data)[0].day, lengthmonth(header_date(data)[0].year, header_date(data)[0].month)+1)))%>
+ <% temp = str(col - 0.9)+'%' %>
+ <td width= ${temp} style="text-align=center;background-color:FFFFFF;font-size:10px;">
+ <b>${month_name(header_date(data)[0].month) or '' |entity}</b>
+ </td>
+ %else:
+ <% t_width1 = len(range(1,lengthmonth(header_date(data)[0].year, header_date(data)[0].month +1)+1))%>
+ <% temp1 = str(t_width1)+'%' %>
+ <td width=${temp1} style="text-align=center;background-color:FFFFFF;font-size:10px; ">
+ <b>${month_name(header_date(data)[0].month+1) or '' |entity}</b>
+ </td>
+ %endif
+ %endfor
+ <% t_width2 = len(range(1, 61-(col+t_width1)))%>
+ <% temp2 = str(t_width2)+'%' %>
+ <td width=${temp2} style="text-align=center;background-color:FFFFFF;font-size:10px;">
+ <b>${month_name(header_date(data)[1].month) or '' |entity}</b>
+ </td>
+ <td width="3%" style="text-align=center;background-color:FFFFFF;">
+ </td>
+ </tr>
+ </table>
+ <table class="list_table" >
+ <tr>
+ <td width="9%" style="text-align=center;background-color:FFFFFF;padding-bottom:7px;">
+ </td>
+ <%
+ sum=0
+ total = 0
+ total_a = 0
+ %>
+
+ %for month in range((header_date(data)[1].month - header_date(data)[0].month)):
+ %if month == 0:
+ %for x in range(header_date(data)[0].day, lengthmonth(header_date(data)[0].year, header_date(data)[0].month)+1):
+ %if get_day_name(header_date(data)[0].year,header_date(data)[0].month ,x) in ['Sat','Sun']:
+ <td width="1%" style="text-align=center;background-color:E1DEDE;padding-bottom:7px;">
+ ${get_day_name(header_date(data)[0].year, header_date(data)[0].month ,x) or '' |entity}
+ </td>
+ <% total=total +1%>
+ %else:
+ <td width="1%" style="text-align=center;background-color:FFFFFF;padding-bottom:7px;">
+ ${get_day_name(header_date(data)[0].year, header_date(data)[0].month ,x) or '' |entity}
+ </td>
+ <% total=total +1%>
+ %endif
+ %endfor
+ %else:
+ %for x in range(1,lengthmonth(header_date(data)[0].year, header_date(data)[0].month +1)+1):
+ %if get_day_name(header_date(data)[0].year, header_date(data)[0].month+1 ,x) in ['Sat','Sun']:
+ <td width="1%" style="text-align=center;background-color:E1DEDE;padding-bottom:7px;">
+ ${get_day_name(header_date(data)[0].year, header_date(data)[0].month+1 ,x) or '' |entity}
+ </td>
+ <%total_a =total_a +1%>
+ %else:
+ <td width="1%" style="text-align=center;background-color:FFFFFF;padding-bottom:7px;">
+ ${get_day_name(header_date(data)[0].year, header_date(data)[0].month+1 ,x) or '' |entity}
+ <% print get_day_name(header_date(data)[0].year,header_date(data)[0].month+1 ,x) %>
+ </td>
+ <%total_a =total_a +1%>
+ %endif
+ %endfor
+ %endif
+ <% sum = total + total_a%>
+ %endfor
+ %for x in range(1, 61-sum):
+ %if get_day_name(header_date(data)[0].year, header_date(data)[1].month ,x) in ['Sat','Sun']:
+ <td width="1%" style="text-align=center;background-color:E1DEDE;padding-bottom:7px;">
+ ${get_day_name(header_date(data)[0].year, header_date(data)[1].month ,x) or '' |entity}
+ </td>
+ %else:
+ <td width="1%" style="text-align=center;background-color:FFFFFF;padding-bottom:7px;">
+ ${get_day_name(header_date(data)[0].year, header_date(data)[1].month ,x) or '' |entity}
+ </td>
+ %endif
+ %endfor
+ <td width="4%" style="text-align=center;background-color:FFFFFF;padding-bottom:7px;">
+ </td>
+ </tr>
+ <tr>
+ <td width="10%" style="text-align=left;background-color:FFFFFF;font-size:8px;padding-left:5px;padding-right:10px;padding-bottom:7px;">
+ <b>${_("Departments and Employees")}</b>
+ </td>
+ <%
+ sum=0
+ total = 0
+ total_a = 0
+ %>
+ %for month in range((header_date(data)[1].month - header_date(data)[0].month)):
+ %if month == 0:
+ %for x in range(header_date(data)[0].day, lengthmonth(header_date(data)[0].year, header_date(data)[0].month)+1):
+ %if get_day_name(header_date(data)[0].year,header_date(data)[0].month ,x) in ['Sat','Sun']:
+ <td width="1%" style="text-align=center;background-color:E1DEDE;">
+ ${x}
+ </td>
+ <% total=total +1%>
+ %else:
+ <td width="1%" style="text-align=center;background-color:FFFFFF;">
+ ${x}
+ </td>
+ <% total=total +1%>
+ %endif
+ %endfor
+ %else:
+ %for x in range(1,lengthmonth(header_date(data)[0].year, header_date(data)[0].month +1)+1):
+ %if get_day_name(header_date(data)[0].year,header_date(data)[0].month ,x) in ['Sat','Sun']:
+ <td width="1%" style="text-align=center;background-color:E1DEDE;">
+ ${x}
+ </td>
+ %else:
+ <td width="1%" style="text-align=center;background-color:FFFFFF;">
+ ${x}
+ </td>
+ %endif
+ <%total_a =total_a +1%>
+ %endfor
+ %endif
+ <% sum = total + total_a%>
+ %endfor
+ %for x in range(1, 61-sum):
+ %if get_day_name(header_date(data)[0].year,header_date(data)[0].month+1 ,x) in ['Sat','Sun']:
+ <td width="1%" style="text-align=center;background-color:E1DEDE;">
+ ${x}
+ </td>
+ %else:
+ <td width="1%" style="text-align=center;background-color:FFFFFF;">
+ ${x}
+ </td>
+ %endif
+
+ %endfor
+ <td width="4%" style="text-align=center;background-color:FFFFFF;">
+ <b>${_("Sum")}</b>
+ </td>
+ </tr>
+ %for leave in leave_info_emp(data):
+ <tr>
+ <td width="10.9%" style="text-align=center;background-color:FFFFFF;padding-bottom:7px;">
+ ${leave['name'] or '' |entity}
+ </td>
+ <% total_leave = 0.0%>
+ <% display = emp_data(0,(header_date(data))[5],leave['id'], leave['name'], month_dates(data)[0], month_dates(data)[1]) %>
+ %if len(display) != 0 :
+ %for x in range(1,len(display)+1):
+ <% flag = True %>
+ %for l in range(0,len(leave_color())):
+ %if display[x] == leave_color()[l][0]:
+ <% clr = str(leave_color()[l][2]) %>
+ <td width="t_width %" style="text-align=center;background-color:${clr};">
+ </td>
+ <% flag= False%>
+ <%total_leave = total_leave +1%>
+ %endif
+ %endfor
+ %if flag == True:
+ <td width="t_width %" style="text-align=center;background-color:FFFFFF;">
+ </td>
+ %endif
+ %endfor
+ %else:
+ %for x in range(1, 61):
+ <td width="t_width %" style="text-align=center;background-color:FFFFFF;">
+ </td>
+ %endfor
+ %endif
+ <td style="text-align=center;background-color:FFFFFF;">
+ ${total_leave or 0 |entity}
+ </td>
+ </tr>
+ %endfor
+ %for dept in leave_info_dept(data)[1]:
+ <tr>
+ <td width="10.9%" style="text-align=center;font-size:10px;padding-bottom:7px;">
+ <b>${dept['name'] or '' |entity}</b>
+ </td>
+ %for i in range(60):
+ <td style="text-align=center;background-color:FFFFFF;">
+ </td>
+ %endfor
+ <td style="text-align=center;background-color:FFFFFF;">
+ </td>
+ </tr>
+ %for depts in leave_info_dept(data)[0]:
+ <tr>
+ %if dept['name'] == depts["department_id"][1]:
+
+ <td width="t_width %" style="text-align=left;background-color:FFFFFF;font-size:8px;padding-bottom:7px;">
+ ${depts['name'] or '' |entity}
+ </td>
+ <% total_leave = 0.0%>
+ <% display = emp_data(0,(header_date(data))[5],depts['id'], depts['name'], month_dates(data)[0], month_dates(data)[1]) %>
+ %if len(display) != 0 :
+ %for x in range(1,len(display)+1):
+ <% flag = True %>
+ %for l in range(0,len(leave_color())):
+ %if display[x] == leave_color()[l][0]:
+ <% clr = str(leave_color()[l][2])%>
+ <td width="t_width %" style="text-align=center;background-color:${clr};">
+ </td>
+ <% flag= False%>
+ <%total_leave = total_leave +1%>
+ %endif
+ %endfor
+ %if flag == True:
+ <td width="t_width %" style="text-align=center;background-color:FFFFFF;">
+ </td>
+ %endif
+ %endfor
+ <td style="text-align=center;background-color:FFFFFF;">
+ ${total_leave or 0 |entity}
+ </td>
+ %else:
+ %for x in range(1, 61):
+ <td width="t_width %" style="text-align=center;background-color:FFFFFF;">
+ </td>
+ %endfor
+ <td style="text-align=center;background-color:FFFFFF;">
+ ${total_leave or 0 |entity}
+ </td>
+ %endif
+ %endif
+ %endfor
+ </tr>
+ %endfor
+ </table>
+ <br/><br/><br/>
+ <center>
+ <table class="color_table" width="16%">
+ <tr>
+ <td width = "5%">
+ <b>${"Color"}</b>
+ </td>
+ <td width= "10%">
+ <b>${"Leave Type"}</b>
+ </td>
+ </tr>
+ %for l in range(0,len(leave_color())):
+ <% clr = str(leave_color()[l][2])%>
+ <tr>
+ <td style="text-align=center;background-color:${clr};">
+ </td>
+ <td width= "20%">
+ ${leave_color()[l][1]}
+ </td>
+ </tr>
+ %endfor
+ </center>
+</body>
+</html>
\ No newline at end of file
=== added file 'hr_holidays_webkit/report/holidays_summary_report.py'
--- hr_holidays_webkit/report/holidays_summary_report.py 1970-01-01 00:00:00 +0000
+++ hr_holidays_webkit/report/holidays_summary_report.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,202 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 datetime
+import time
+
+from openerp.osv import fields, osv
+from openerp.report.interface import report_rml
+from openerp.report.interface import toxml
+
+from openerp import pooler
+import time
+from openerp.report import report_sxw
+from openerp.tools import ustr
+from openerp.tools.translate import _
+from openerp.tools import to_xml
+
+#def lengthmonth(year, month):
+# if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))):
+# return 29
+# return [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]
+
+def strToDate(dt):
+ if dt:
+ dt_date=datetime.date(int(dt[0:4]),int(dt[5:7]),int(dt[8:10]))
+ return dt_date
+ else:
+ return
+
+class employee_holidays_summary(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(employee_holidays_summary, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({
+ 'time': time,
+ 'header_date':self.header_date,
+ 'lengthmonth':self.lengthmonth,
+ 'strToDate':self.strToDate,
+ 'month_name':self.month_name,
+ 'get_day_name':self.get_day_name,
+ 'leave_info_emp':self.leave_info_emp,
+ 'emp_data':self.emp_data,
+ 'month_dates':self.month_dates,
+ 'leave_info_dept':self.leave_info_dept,
+ 'leave_color':self.leave_color,
+
+ })
+ def emp_data(self,dept, holiday_type, empid, name, som, eom):
+ display={}
+ if dept==0:
+ count=0
+ p_id=pooler.get_pool(self.cr.dbname).get('hr.holidays').search(self.cr, self.uid, [('employee_id','in',[empid,False]), ('type', '=', 'remove')])
+ ids_date = pooler.get_pool(self.cr.dbname).get('hr.holidays').read(self.cr, self.uid, p_id, ['date_from','date_to','holiday_status_id','state'])
+
+ for index in range(1,61):
+ diff=index-1
+ current=som+datetime.timedelta(diff)
+ for item in ids_date:
+ if current >= strToDate(item['date_from']) and current <= strToDate(item['date_to']):
+ if item['state'] in holiday_type:
+ display[index]=item['holiday_status_id'][0]
+ count=count +1
+ else:
+ display[index]=' '
+ break
+ else:
+ display[index]=' '
+ else:
+ for index in range(1,61):
+ display[index]=' '
+ count=''
+ return display
+
+
+ def month_name(self, month):
+ month2name = [0, 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']
+ return month2name[month]
+
+ def lengthmonth(self, year, month):
+ if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))):
+ return 29
+ return [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]
+
+ def strToDate(self, dt):
+ if dt:
+ dt_date=datetime.date(int(dt[0:4]),int(dt[5:7]),int(dt[8:10]))
+ return dt_date
+ else:
+ return
+
+ def get_day_name(self, year, month, day):
+ days =[]
+ name_of_day = datetime.datetime.weekday(datetime.datetime(year,month,day))
+ if name_of_day == 0:
+ return "Mon"
+ elif name_of_day == 1:
+ return "Tue"
+ elif name_of_day == 2:
+ return "Wed"
+ elif name_of_day == 3:
+ return "Thus"
+ elif name_of_day == 4:
+ return "Fri"
+ elif name_of_day == 5:
+ return "Sat"
+ elif name_of_day == 6:
+ return "Sun"
+
+ def header_date(self, data):
+ obj_emp = pooler.get_pool(self.cr.dbname).get('hr.employee')
+ date_today=time.strftime('%Y-%m-%d %H:%M:%S')
+ today=datetime.datetime.today()
+ first_date=data['form']['date_from']
+ self.cr.execute("SELECT id, name, color_name FROM hr_holidays_status ORDER BY id")
+ legend=self.cr.fetchall()
+ som = strToDate(first_date)
+ eom = som+datetime.timedelta(59)
+ day_diff=eom-som
+ name = ''
+ if len(data['form'].get('emp', ())) == 1:
+ name = obj_emp.read(self.cr, self.uid, data['form']['emp'][0], ['name'])['name']
+
+ if data['form']['holiday_type']!='both':
+ type=data['form']['holiday_type']
+ if data['form']['holiday_type']=='Confirmed':
+ holiday_type=('confirm')
+ else:
+ holiday_type=('validate')
+ else:
+ type="Confirmed and Approved"
+ holiday_type=('confirm','validate')
+ return som, eom, name, type, day_diff,holiday_type
+
+ def month_dates(self,data):
+ first_date=data['form']['date_from']
+ som = strToDate(first_date)
+ eom = som+datetime.timedelta(59)
+ return som,eom
+
+ def leave_info_emp(self,data, context=None):
+ obj_dept = pooler.get_pool(self.cr.dbname).get('hr.department')
+ obj_emp = pooler.get_pool(self.cr.dbname).get('hr.employee')
+ first_date=data['form']['date_from']
+ som = strToDate(first_date)
+ eom = som+datetime.timedelta(59)
+ depts=[]
+ emp_id={}
+ emp_rec = []
+# done={}
+ rpt_obj = pooler.get_pool(self.cr.dbname).get('hr.holidays')
+ if data['model']=='hr.employee':
+ for id in data['form']['emp']:
+ items = obj_emp.read(self.cr, self.uid, id, ['id','name'])
+ emp_rec.append(items)
+ return emp_rec
+
+ def leave_color(self):
+ self.cr.execute("SELECT id, name, color_name FROM hr_holidays_status ORDER BY id")
+ legend=self.cr.fetchall()
+ return legend
+
+ def leave_info_dept(self,data, context=None):
+ obj_dept = pooler.get_pool(self.cr.dbname).get('hr.department')
+ obj_emp = pooler.get_pool(self.cr.dbname).get('hr.employee')
+ first_date=data['form']['date_from']
+ som = strToDate(first_date)
+ eom = som+datetime.timedelta(59)
+ depts=[]
+ emp_id={}
+ emp_rec = []
+ if data['model']=='ir.ui.menu':
+ for id in data['form']['depts']:
+ dept = obj_dept.browse(self.cr, self.uid, id, context=context)
+ self.cr.execute("""SELECT id FROM hr_employee \
+ WHERE department_id = %s""", (id,))
+ emp_ids = [x[0] for x in self.cr.fetchall()]
+ if emp_ids==[]:
+ continue
+ for item in obj_emp.read(self.cr, self.uid, emp_ids, ['id', 'name','department_id']):
+ emp_rec.append(item)
+ depts.append(dept)
+ return emp_rec,depts
+# print "emp_ids",emp_ids
+report_sxw.report_sxw('report.holidays.summary.webkit', 'hr.holidays', 'addons/hr_holidays_webkit/report/holidays_summary.mako', parser=employee_holidays_summary, header='internal')
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added directory 'hr_holidays_webkit/wizard'
=== added file 'hr_holidays_webkit/wizard/__init__.py'
--- hr_holidays_webkit/wizard/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_holidays_webkit/wizard/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 hr_holidays_summary_employees
+import hr_holidays_summary_department
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
=== added file 'hr_holidays_webkit/wizard/hr_holidays_summary_department.py'
--- hr_holidays_webkit/wizard/hr_holidays_summary_department.py 1970-01-01 00:00:00 +0000
+++ hr_holidays_webkit/wizard/hr_holidays_summary_department.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp.osv import fields, osv
+from openerp.tools.translate import _
+
+class hr_holidays_summary_dept(osv.osv_memory):
+ _inherit = 'hr.holidays.summary.dept'
+
+ def print_report(self, cr, uid, ids, context=None):
+ data = self.read(cr, uid, ids, [], context=context)[0]
+ if not data['depts']:
+ raise osv.except_osv(_('Error!'), _('You have to select at least one Department. And try again.'))
+ datas = {
+ 'ids': [],
+ 'model': 'ir.ui.menu',
+ 'form': data
+ }
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'holidays.summary.webkit',
+ 'datas': datas,
+ }
+
+hr_holidays_summary_dept()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_holidays_webkit/wizard/hr_holidays_summary_employees.py'
--- hr_holidays_webkit/wizard/hr_holidays_summary_employees.py 1970-01-01 00:00:00 +0000
+++ hr_holidays_webkit/wizard/hr_holidays_summary_employees.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp.osv import fields, osv
+
+class hr_holidays_summary_employee(osv.osv_memory):
+ _inherit = 'hr.holidays.summary.employee'
+
+ def print_report(self, cr, uid, ids, context=None):
+ data = self.read(cr, uid, ids, [], context=context)[0]
+ data['emp'] = context['active_ids']
+ datas = {
+ 'ids': [],
+ 'model': 'hr.employee',
+ 'form': data
+ }
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'holidays.summary.webkit',
+ 'datas': datas,
+ }
+
+hr_holidays_summary_employee()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added directory 'hr_payroll_webkit'
=== added file 'hr_payroll_webkit/__init__.py'
--- hr_payroll_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_payroll_webkit/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 report
+import wizard
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
=== added file 'hr_payroll_webkit/__openerp__.py'
--- hr_payroll_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ hr_payroll_webkit/__openerp__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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/>.
+#
+############################################################################
+
+{
+ 'name' : 'Payroll Reports',
+ 'version' : '1.1',
+ 'author' : 'Serpent Consulting Services',
+ 'category' : 'HR management',
+ 'description' : """
+HR Payroll Reports
+====================================
+ It is conversion of rml report to Webkit Report.
+ """,
+ 'website': 'http://www.serpentcs.com',
+ 'depends' : [
+ 'hr_payroll',
+ 'report_webkit'],
+ 'update_xml': [
+ 'report_xml_view.xml',
+ ],
+ 'installable': True,
+ 'auto_install': False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added directory 'hr_payroll_webkit/report'
=== added file 'hr_payroll_webkit/report/__init__.py'
--- hr_payroll_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_payroll_webkit/report/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 report_contribution_register
+import report_payslip_details_webkit
+import report_payslip_webkit
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
=== added file 'hr_payroll_webkit/report/report_contribution_register.py'
--- hr_payroll_webkit/report/report_contribution_register.py 1970-01-01 00:00:00 +0000
+++ hr_payroll_webkit/report/report_contribution_register.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,71 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 datetime import datetime
+from dateutil import relativedelta
+
+from openerp.report import report_sxw
+
+class contribution_register_report(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(contribution_register_report, self).__init__(cr, uid, name, context)
+ self.localcontext.update({
+ 'get_payslip_lines': self._get_payslip_lines,
+ 'sum_total': self.sum_total,
+ })
+
+ def set_context(self, objects, data, ids, report_type=None):
+ self.date_from = data['form'].get('date_from', time.strftime('%Y-%m-%d'))
+ self.date_to = data['form'].get('date_to', str(datetime.now() + relativedelta.relativedelta(months=+1, day=1, days=-1))[:10])
+ return super(contribution_register_report, self).set_context(objects, data, ids, report_type=report_type)
+
+ def sum_total(self):
+ return self.regi_total
+
+ def _get_payslip_lines(self, obj):
+ payslip_obj = self.pool.get('hr.payslip')
+ payslip_line = self.pool.get('hr.payslip.line')
+ payslip_lines = []
+ res = []
+ self.regi_total = 0.0
+ self.cr.execute("SELECT pl.id from hr_payslip_line as pl "\
+ "LEFT JOIN hr_payslip AS hp on (pl.slip_id = hp.id) "\
+ "WHERE (hp.date_from >= %s) AND (hp.date_to <= %s) "\
+ "AND pl.register_id = %s "\
+ "AND hp.state = 'done' "\
+ "ORDER BY pl.slip_id, pl.sequence",
+ (self.date_from, self.date_to, obj.id))
+ payslip_lines = [x[0] for x in self.cr.fetchall()]
+ for line in payslip_line.browse(self.cr, self.uid, payslip_lines):
+ res.append({
+ 'payslip_name': line.slip_id.name,
+ 'name': line.name,
+ 'code': line.code,
+ 'quantity': line.quantity,
+ 'amount': line.amount,
+ 'total': line.total,
+ })
+ self.regi_total += line.total
+ return res
+
+report_sxw.report_sxw('report.contribution.register.lines.webkit', 'hr.contribution.register', 'addons/hr_payroll_webkit/report/report_contribution_register_webkit.mako', parser=contribution_register_report)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_payroll_webkit/report/report_contribution_register_webkit.mako'
--- hr_payroll_webkit/report/report_contribution_register_webkit.mako 1970-01-01 00:00:00 +0000
+++ hr_payroll_webkit/report/report_contribution_register_webkit.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,93 @@
+<html>
+<head>
+ <style type="text/css">
+ ${css}
+ </style>
+</head>
+<body>
+ %for o in objects :
+ <br/>
+ <br/>
+ <center><h2>PaySlip Lines by Contribution Register</h2></center>
+ <br/>
+ <br/>
+ <table class="basic_table" width="100%" align="center" style="text-align:center">
+ <tr>
+ <td width="40%">
+ <b>${_("Register Name")} </b>
+ </td>
+ <td width="30%">
+ ${_("Date From")}
+ </td>
+ <td width="30%">
+ <b>${_("Date To")} </b>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ${o.name or '' |entity}
+ </td>
+ <td>
+ ${formatLang(data['form']['date_from'],date=True) or ''|entity}
+ </td>
+ <td>
+ <b>${formatLang(data['form']['date_from'],date=True) or ''|entity} </b>
+ </td>
+ </tr>
+ </table>
+ <br/><br/>
+ <table class="list_table" width="100%">
+ <thead>
+ <tr>
+ <th style="text-align:left;">${_("PaySlip Name")}</th>
+ <th style="text-align:left;">${_("Code")}</th>
+ <th style="text-align:left;">${_("Name")}</th>
+ <th style="text-align:right;">${_("Quantity/Rate")}</th>
+ <th style="text-align:right;" >${_("Amount")}</th>
+ <th style="text-align:right;" >${_("Total")}</th>
+ </tr>
+ </thead>
+ %for line in (get_payslip_lines(o)):
+ <tbody >
+ <tr>
+ <td style="text-align:left;">
+ ${line.get('payslip_name') or '' |entity}
+ </td>
+ <td style="text-align:left;">
+ ${line['code'] or '' |entity}
+ </td>
+ <td style="text-align:left;">
+ ${line['name'] or '' |entity}
+ </td>
+ <td>
+ ${formatLang(line['quantity']) or 0.0 |entity}
+ </td>
+ <td style="text-align:right;">
+ ${formatLang(line['amount'])or 0.0 |entity}
+ </td>
+ <td style="text-align:right;">
+ ${formatLang(line['total'], currency_obj = o.company_id and o.company_id.currency_id)}
+ </td>
+ </tr>
+ </tbody>
+ %endfor
+ </table>
+ <table class="list_table" width="30%" style="border-top:1px solid #ccc">
+ <thead >
+ <tr>
+ <td style="border-style:none" width="70%"></td>
+ <td style="border-top:1px solid black">
+ <table >
+ <tr>
+ <td style="text-align:left;border-top:0px" ><b>${_("Total :")}</b></td>
+ <td style="text-align:right;border-top:0px" >${formatLang(sum_total(), currency_obj = o.company_id and o.company_id.currency_id) or 0.0}</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </thead>
+ </table>
+ <p style="page-break-after:always"></p>
+ %endfor
+</body>
+</html>
\ No newline at end of file
=== added file 'hr_payroll_webkit/report/report_payslip_details_webkit.mako'
--- hr_payroll_webkit/report/report_payslip_details_webkit.mako 1970-01-01 00:00:00 +0000
+++ hr_payroll_webkit/report/report_payslip_details_webkit.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,193 @@
+<html>
+<head>
+ <style type="text/css">
+ ${css}
+ </style>
+</head>
+<body>
+ %for o in objects :
+ <br/>
+ <br/>
+ <center><h2>Pay Slip Details</h2></center>
+ %if o.credit_note!=False:
+ <center><h2>${("Credit")}</h2></center>
+ <center><h2>${("Note")}</h2></center>
+ %endif
+ <center>(${o.name or '' | entity})</center>
+ <table class="basic_table" width="100%" align="center">
+ <tr>
+ <td width="20%">
+ <b>${_("Name")} </b>
+ </td>
+ <td width="30%">
+ ${o.employee_id.name or '' |entity}
+ </td>
+ <td width="20%">
+ <b>${_("Designation")} </b>
+ </td>
+ <td width="30%">
+ ${o.employee_id.job_id.name or ''|entity}
+ </td>
+ </tr>
+ <tr>
+ <td >
+ <b>${_("Address")} </b></br></br></br>
+ </td>
+ <td colspan="3" style="text-align:left;">
+ ${o.employee_id.address_home_id and o.employee_id.address_home_id.name or ''|entity}<br/>
+ %if o.employee_id.address_home_id.street:
+ ${o.employee_id.address_home_id.street or ''|entity},<br/>
+ %endif
+ %if o.employee_id.address_home_id.street2:
+ ${o.employee_id.address_home_id.street2 or ''|entity},<br/>
+ %endif
+ %if o.employee_id.address_home_id:
+ ${o.employee_id.address_home_id.zip or ''|entity} ${o.employee_id.address_home_id.city or ''|entity},<br/>
+ %endif
+ %if o.employee_id.address_home_id.country_id:
+ ${o.employee_id.address_home_id.country_id.name or ''|entity},<br/>
+ %endif
+ %if o.employee_id.address_home_id.phone:
+ ${o.employee_id.address_home_id.phone or ''|entity},<br/>
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>${_("Email")} </b>
+ </td>
+ <td>
+ ${o.employee_id.work_email or '' |entity}
+ </td>
+ <td>
+ <b>${_("Identification No")} </b>
+ </td>
+ <td>
+ ${o.employee_id.identification_id or ''|entity}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>${_("Reference")} </b>
+ </td>
+ <td>
+ ${o.number or ''|entity}
+ </td>
+ <td>
+ <b>${_("Bank Account")} </b>
+ </td>
+ <td>
+ ${o.employee_id.otherid or ''|entity}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>${_("Date From")} </b>
+ </td>
+ <td>
+ ${formatLang(o.date_from,date=True) or ''|entity}
+ </td>
+ <td>
+ <b>${_("Date To")} </b>
+ </td>
+ <td>
+ ${formatLang(o.date_to,date=True) or ''|entity}
+ </td>
+ </tr>
+ </table>
+ <br/><br/>
+ <b>${_("Details by Salary Rule Category:")}</b>
+ <br/><br/>
+ <table class="list_table" width="100%">
+ <tr>
+ <th style="text-align:left;" width ="10%">${_("Code")}</th>
+ <th style="text-align:left;" width ="70%">${_("Salary Rule Category")}</th>
+ <th style="text-align:right;" width ="20%" >${_("Total")}</th>
+ </tr>
+ </thead>
+ %for line in (get_details_by_rule_category(o.details_by_salary_rule_category)):
+ <tbody>
+ <tr>
+ <td style="text-align:left;" width ="10%">
+ %if line['level'] !=0:
+ ${line['code'] or ''|entity}
+ %else:
+ <b>${line['code'] or ''|entity}</b>
+ %endif
+ </td>
+ <td style="text-align:left;" width ="70%">
+ %if line['level'] !=0:
+ <para style="padding-left:7px">${line['rule_category'] or ''|entity}</para>
+ %else:
+ <para font-color="white"><b>${'..'*line['level'] or ''|entity}</para>${line['rule_category'] or ''|entity}</b>
+ %endif
+ </td>
+ <td style="text-align:right;" width ="20%">
+ %if line['level'] !=0:
+ ${formatLang(line['total'], currency_obj = o.company_id and o.company_id.currency_id) or 0.0 |entity}
+ %else:
+ <b>${formatLang(line['total'], currency_obj = o.company_id and o.company_id.currency_id) or 0.0 |entity}</b>
+ %endif
+ </td>
+ </tr>
+ </tbody>
+ %endfor
+ </table>
+ <br/><br/>
+ <b>${_("Payslip Lines by Contribution Register:")}</b>
+ <br/><br/>
+ <table class="list_table" width="100%">
+ <thead>
+ <tr>
+ <th style="text-align:left;">${_("Register Name")}</th>
+ <th style="text-align:left;">${_("Code")}</th>
+ <th style="text-align:left;">${_("Name")}</th>
+ <th style="text-align:right;">${_("Quantity/Rate")}</th>
+ <th style="text-align:right;" >${_("Amount")}</th>
+ <th style="text-align:right;" >${_("Total")}</th>
+ </tr>
+ </thead>
+ %for line_r in (get_lines_by_contribution_register(o.details_by_salary_rule_category)):
+ <tbody>
+ <tr>
+ <td style="text-align:left;">
+ %if line.get('register_name'):
+ ${line_r.get('register_name') or '' |entity}
+ %else:
+ <b>${line_r.get('register_name') or ''|entity}<b>
+ %endif
+ </td>
+ <td style="text-align:left;">
+ ${line_r.get('code') or '' |entity}
+ </td>
+ <td style="text-align:left;">
+ ${line_r.get('name') or '' |entity}
+ </td>
+ <td style="text-align:right;">
+ ${line_r.get('quantity') or '' |entity}
+ </td>
+ <td style="text-align:right;">
+ ${line_r.get('amount') or '' |entity}
+ </td>
+ <td style="text-align:right;">
+ %if line_r.get('register_name'):
+ <b>${line_r.get('total') or 0.0 |entity}</b>
+ %else:
+ ${line_r.get('total') or 0.0 |entity}
+ %endif
+ </td>
+ </tr>
+ </tbody>
+ %endfor
+ </table>
+ <br/>
+ <br/>
+ <table class="sign" width="100%">
+ <tr>
+ <td style="text-align:right;"><b>${_("Authorized Signature")}</b></td>
+ </tr>
+ </table>
+ <p style="page-break-after:always"></p>
+ %endfor
+</body>
+</html>
\ No newline at end of file
=== added file 'hr_payroll_webkit/report/report_payslip_details_webkit.py'
--- hr_payroll_webkit/report/report_payslip_details_webkit.py 1970-01-01 00:00:00 +0000
+++ hr_payroll_webkit/report/report_payslip_details_webkit.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,115 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp.report import report_sxw
+from openerp.tools import amount_to_text_en
+
+class payslip_details_report(report_sxw.rml_parse):
+
+ def __init__(self, cr, uid, name, context):
+ super(payslip_details_report, self).__init__(cr, uid, name, context)
+ self.localcontext.update({
+ 'get_details_by_rule_category': self.get_details_by_rule_category,
+ 'get_lines_by_contribution_register': self.get_lines_by_contribution_register,
+ })
+
+ def get_details_by_rule_category(self, obj):
+ payslip_line = self.pool.get('hr.payslip.line')
+ rule_cate_obj = self.pool.get('hr.salary.rule.category')
+
+ def get_recursive_parent(rule_categories):
+ if not rule_categories:
+ return []
+ if rule_categories[0].parent_id:
+ rule_categories.insert(0, rule_categories[0].parent_id)
+ get_recursive_parent(rule_categories)
+ return rule_categories
+
+ res = []
+ result = {}
+ ids = []
+
+ for id in range(len(obj)):
+ ids.append(obj[id].id)
+ if ids:
+ self.cr.execute('''SELECT pl.id, pl.category_id FROM hr_payslip_line as pl \
+ LEFT JOIN hr_salary_rule_category AS rc on (pl.category_id = rc.id) \
+ WHERE pl.id in %s \
+ GROUP BY rc.parent_id, pl.sequence, pl.id, pl.category_id \
+ ORDER BY pl.sequence, rc.parent_id''',(tuple(ids),))
+ for x in self.cr.fetchall():
+ result.setdefault(x[1], [])
+ result[x[1]].append(x[0])
+ for key, value in result.iteritems():
+ rule_categories = rule_cate_obj.browse(self.cr, self.uid, [key])
+ parents = get_recursive_parent(rule_categories)
+ category_total = 0
+ for line in payslip_line.browse(self.cr, self.uid, value):
+ category_total += line.total
+ level = 0
+ for parent in parents:
+ res.append({
+ 'rule_category': parent.name,
+ 'name': parent.name,
+ 'code': parent.code,
+ 'level': level,
+ 'total': category_total,
+ })
+ level += 1
+ for line in payslip_line.browse(self.cr, self.uid, value):
+ res.append({
+ 'rule_category': line.name,
+ 'name': line.name,
+ 'code': line.code,
+ 'total': line.total,
+ 'level': level
+ })
+ return res
+
+ def get_lines_by_contribution_register(self, obj):
+ payslip_line = self.pool.get('hr.payslip.line')
+ result = {}
+ res = []
+
+ for id in range(len(obj)):
+ if obj[id].register_id:
+ result.setdefault(obj[id].register_id.name, [])
+ result[obj[id].register_id.name].append(obj[id].id)
+ for key, value in result.iteritems():
+ register_total = 0
+ for line in payslip_line.browse(self.cr, self.uid, value):
+ register_total += line.total
+ res.append({
+ 'register_name': key,
+ 'total': register_total,
+ })
+ for line in payslip_line.browse(self.cr, self.uid, value):
+ res.append({
+ 'name': line.name,
+ 'code': line.code,
+ 'quantity': line.quantity,
+ 'amount': line.amount,
+ 'total': line.total,
+ })
+ return res
+
+report_sxw.report_sxw('report.paylip.details.webkit', 'hr.payslip', 'addons/hr_payroll_webkit/report/report_payslip_details_webkit.mako', parser=payslip_details_report)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_payroll_webkit/report/report_payslip_webkit.mako'
--- hr_payroll_webkit/report/report_payslip_webkit.mako 1970-01-01 00:00:00 +0000
+++ hr_payroll_webkit/report/report_payslip_webkit.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,141 @@
+<html>
+<head>
+ <style type="text/css">
+ ${css}
+ </style>
+</head>
+<body>
+ %for o in objects :
+ <br/>
+ <br/>
+ <center><h2>${("Pay Slip")}</h2></center>
+ %if o.credit_note!=False:
+ <center><h2>${("Credit")}</h2></center>
+ <center><h2>${("Note")}</h2></center>
+ %endif
+ <center>(${o.name or '' | entity})</center>
+ <table class="basic_table" width="100%" align="center">
+ <tr>
+ <td width="20%">
+ <b>${_("Name")} </b>
+ </td>
+ <td width="30%">
+ ${o.employee_id.name or '' |entity}
+ </td>
+ <td width="20%">
+ <b>${_("Designation")} </b>
+ </td>
+ <td width="30%">
+ ${o.employee_id.job_id.name or ''|entity}
+ </td>
+ </tr>
+ <tr>
+ <td style="text-align:left;">
+ <b>${_("Address")} </b></br></br></br>
+ </td>
+ <td colspan="3" style="text-align:left">
+ ${o.employee_id.address_home_id and o.employee_id.address_home_id.name or ''|entity}<br/>
+ %if o.employee_id.address_home_id.street:
+ ${o.employee_id.address_home_id.street or ''|entity},<br/>
+ %endif
+ %if o.employee_id.address_home_id.street2:
+ ${o.employee_id.address_home_id.street2 or ''|entity},<br/>
+ %endif
+ %if o.employee_id.address_home_id:
+ ${o.employee_id.address_home_id.zip or ''|entity} ${o.employee_id.address_home_id.city or ''|entity},<br/>
+ %endif
+ %if o.employee_id.address_home_id.country_id:
+ ${o.employee_id.address_home_id.country_id.name or ''|entity},<br/>
+ %endif
+ %if o.employee_id.address_home_id.phone:
+ ${o.employee_id.address_home_id.phone or ''|entity},<br/>
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>${_("Email")} </b>
+ </td>
+ <td>
+ ${o.employee_id.work_email or '' |entity}
+ </td>
+ <td>
+ <b>${_("Identification No")} </b>
+ </td>
+ <td>
+ ${o.employee_id.identification_id or ''|entity}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>${_("Reference")} </b>
+ </td>
+ <td>
+ ${o.number or ''|entity}
+ </td>
+ <td>
+ <b>${_("Bank Account")} </b>
+ </td>
+ <td>
+ ${o.employee_id.otherid or ''|entity}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>${_("Date From")} </b>
+ </td>
+ <td>
+ ${formatLang(o.date_from,date=True) or ''|entity}
+ </td>
+ <td>
+ <b>${_("Date To")} </b>
+ </td>
+ <td>
+ ${formatLang(o.date_to,date=True) or ''|entity}
+ </td>
+ </tr>
+ </table>
+ <br/><br/>
+ <table class="list_table" width="100%">
+ <thead>
+ <tr>
+ <th style="text-align:left;">${_("Code")}</th>
+ <th style="text-align:left;">${_("Name")}</th>
+ <th style="text-align:right;">${_("Quantity/Rate")}</th>
+ <th style="text-align:right;" >${_("Amount")}</th>
+ <th style="text-align:right;" >${_("Total")}</th>
+ </tr>
+ </thead>
+ %for line in (get_payslip_lines(o.line_ids)):
+ <tbody>
+ <tr>
+ <td style="text-align:left;">
+ ${line.code or ''|entity}
+ </td>
+ <td style="text-align:left;">
+ ${line.name or '' |entity}
+ </td>
+ <td>
+ ${formatLang(line.quantity) or '' |entity}
+ </td>
+ <td style="text-align:right;">
+ ${formatLang(line.amount) or '' |entity}
+ </td>
+ <td style="text-align:right;">
+ ${formatLang(line.total, currency_obj = o.company_id and o.company_id.currency_id) or 0.0 |entity}
+ </td>
+ </tr>
+ </tbody>
+ %endfor
+ </table>
+ <br/>
+ <br/>
+ <table class="sign" width="100%">
+ <tr>
+ <td style="text-align:right;"><b>${_("Authorized Signature")}</b></td>
+ </tr>
+ </table>
+ <p style="page-break-after:always"></p>
+ %endfor
+</body>
+</html>
\ No newline at end of file
=== added file 'hr_payroll_webkit/report/report_payslip_webkit.py'
--- hr_payroll_webkit/report/report_payslip_webkit.py 1970-01-01 00:00:00 +0000
+++ hr_payroll_webkit/report/report_payslip_webkit.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp.report import report_sxw
+from openerp.tools import amount_to_text_en
+
+class payslip_report(report_sxw.rml_parse):
+
+ def __init__(self, cr, uid, name, context):
+ super(payslip_report, self).__init__(cr, uid, name, context)
+ self.localcontext.update({
+ 'get_payslip_lines': self.get_payslip_lines,
+ })
+
+ def get_payslip_lines(self, obj):
+ payslip_line = self.pool.get('hr.payslip.line')
+ res = []
+ ids = []
+ for id in range(len(obj)):
+ if obj[id].appears_on_payslip == True:
+ ids.append(obj[id].id)
+ if ids:
+ res = payslip_line.browse(self.cr, self.uid, ids)
+ return res
+
+report_sxw.report_sxw('report.payslip.webkit', 'hr.payslip', 'addons/hr_payroll_webkit/report/report_payslip_webkit.mako', parser=payslip_report)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_payroll_webkit/report_xml_view.xml'
--- hr_payroll_webkit/report_xml_view.xml 1970-01-01 00:00:00 +0000
+++ hr_payroll_webkit/report_xml_view.xml 2013-10-10 09:59:30 +0000
@@ -0,0 +1,257 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="hr_webkit_header" 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>
+ <% import datetime %>
+ <body style="border:0; margin: 0;" onload="subst()">
+ <table style="border-top: 1px solid black; width: 1080px">
+ <tr style="border-collapse:collapse;">
+ <td style="text-align:left;font-size:15px;width:350px;">${formatLang( str(datetime.datetime.today()), date_time=True)}</td>
+ <td style="text-align:center;font-size:15px;width:350px;">${user.name or ''}</td>
+ <td style="text-align:right;font-size:15px;width:350px;">Page <span class="page"/></td>
+ <td style="text-align:left;font-size:15px;width:30px"> of <span class="topage"/></td>
+ </tr>
+ </table>
+ </body>
+</html>]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</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: 15;" onload="subst()">
+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:left;font-size:12;" width="20%">${ helper.embed_image('png',company.logo,200,50)|n }</td>
+ <td style="text-align:right;font-size:12;" width="80%"></br></br>${ company.rml_header1 }</td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+ <p style="text-align:left;font-size:12;">${company.name}</p></br></br></br>
+ <table width="100%">
+ <tr>
+ <td style="text-align:left;font-size:10;" width="25%">
+ Phone: ${company.phone or ''}
+ </td>
+ <td width="75%"></td>
+ </tr>
+ <tr>
+ <td style="text-align:left;font-size:10px; border-bottom: 1px solid black;" width="25%">
+ Mail: ${company.email}
+ </td>
+ <td width="75%"></td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+</html>]]>
+ </field>
+ <field eval="45.0" name="margin_top"/>
+ <field eval="15.0" name="margin_bottom"/>
+ <field name="css"><![CDATA[
+
+ body {
+ font-family:Verdana;
+ font-size:12px;
+
+ }
+
+
+ .dest_address {
+ margin-right:60%;
+ font-size:12;
+
+ }
+ .header {
+ margin-right:0;
+ text-align:right;
+ width:300px;
+ font-size:12;
+ }
+
+ .title {
+ font-size:16;
+ font-weight: bold;
+ }
+
+ .basic_table{
+ border:1px solid lightGrey;
+ border-collapse: collapse;
+ }
+ .basic_table td {
+ border:1px solid lightGrey;
+ font-size:11px;
+ padding-left:5px;
+ padding-top:3px;
+
+ }
+
+ .list_table {
+ border-color:black;
+ text-align:center;
+ border-collapse: collapse;
+
+ }
+ .list_table td {
+ border-color:gray;
+ border-top:1px solid #ccc;
+ text-align:right;
+ font-size:11px;
+ padding-left:7px;
+ padding-right:3px;
+ padding-top:3px;
+ padding-bottom:3px;
+ }
+
+ .list_table th {
+ border-bottom:2px solid black;
+ text-align:right;
+ font-size:12px;
+ font-weight:bold;
+ padding-left:7px;
+ padding-right:3px;
+ }
+
+ .list_tabe thead {
+ display:table-header-group;
+ }
+ .sign{
+ text-align:right;
+ font-size:12px;
+ font-weight:bold;
+ }
+ .total {
+ width:100%;
+ }
+ .lib {
+ width:10.3%;
+ }
+ .tot {
+ text-align:left;
+ width:15%;
+ }
+ .righttot {
+ width:74%;
+ }
+ .tax {
+ width:50%;
+ }
+ table {
+ display: table;
+ width: 100%;
+ }
+
+ table thead {
+ display: table-header-group;
+ }
+
+ table tbody {
+ display: table-row-group;
+ }
+
+ table tfoot {
+ display: table-footer-group;
+ }
+
+ table tr {
+ display: table-row;
+ height: auto;
+ }
+
+ table th,
+ table td {
+ display: table-cell;
+ overflow: visible;
+ }
+
+ table th,
+ table td {
+ height: 1px; /* Do the trick to make div.nobrk fill td height */
+ }
+
+ table tr.singlecell td,
+ table tr.singlecell th {
+ height: auto; /* Reset trick for a full row td */
+ }
+
+ .nobrk {
+ page-break-inside: avoid;
+ orphans: 10;
+ widows: 10;
+ position: relative;
+ margin: -1px 0 0 -1px;
+ min-height: 14px;
+ line-height: 14px;
+ height: 100%;
+ }
+
+ table tbody td .nobrk {
+ min-height: 5px;
+ }
+]]>
+ </field>
+ <field name="name">HR Webkit Header</field>
+ </record>
+ </data>
+ <data>
+ <report
+ auto="False"
+ menu="False"
+ id="contribution_register_webkit"
+ model="hr.contribution.register"
+ name="contribution.register.lines.webkit"
+ file="hr_payroll_webkit/report/report_contribution_register_webkit.mako"
+ string="PaySlip Lines"
+ report_type="webkit"
+ webkit_header="hr_webkit_header"/>
+ <report
+ auto="False"
+ id="hr_payroll.payslip_details_report"
+ model="hr.payslip"
+ name="paylip.details.webkit"
+ file="hr_payroll_webkit/report/report_payslip_details_webkit.mako"
+ string="PaySlip Details"
+ report_type="webkit"
+ webkit_header="hr_webkit_header" />
+ <report
+ auto="False"
+ id="hr_payroll.payslip_report"
+ model="hr.payslip"
+ name="payslip.webkit"
+ file="hr_payroll_webkit/report/report_payslip_webkit.mako"
+ string="Employee PaySlip"
+ report_type="webkit"
+ webkit_header="hr_webkit_header"/>
+ </data>
+</openerp>
=== added directory 'hr_payroll_webkit/wizard'
=== added file 'hr_payroll_webkit/wizard/__init__.py'
--- hr_payroll_webkit/wizard/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_payroll_webkit/wizard/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 hr_payroll_contribution_register_report
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_payroll_webkit/wizard/hr_payroll_contribution_register_report.py'
--- hr_payroll_webkit/wizard/hr_payroll_contribution_register_report.py 1970-01-01 00:00:00 +0000
+++ hr_payroll_webkit/wizard/hr_payroll_contribution_register_report.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 datetime import datetime
+from dateutil import relativedelta
+
+from openerp.osv import fields, osv
+
+class payslip_lines_contribution_register(osv.osv_memory):
+
+ _inherit = 'payslip.lines.contribution.register'
+
+ def print_report(self, cr, uid, ids, context=None):
+ datas = {
+ 'ids': context.get('active_ids', []),
+ 'model': 'hr.contribution.register',
+ 'form': self.read(cr, uid, ids, [], context=context)[0]
+ }
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'contribution.register.lines.webkit',
+ 'datas': datas,
+ }
+
+payslip_lines_contribution_register()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added directory 'hr_timesheet_invoice_webkit'
=== added file 'hr_timesheet_invoice_webkit/__init__.py'
--- hr_timesheet_invoice_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_timesheet_invoice_webkit/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 report
+import wizard
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
=== added file 'hr_timesheet_invoice_webkit/__openerp__.py'
--- hr_timesheet_invoice_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ hr_timesheet_invoice_webkit/__openerp__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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/>.
+#
+############################################################################
+
+{
+ 'name' : 'Invoice on Timesheets Reports',
+ 'version' : '1.1',
+ 'author' : 'Serpent Consulting Services',
+ 'category' : 'Sales Management',
+ 'description' : """
+HR invoice on timesheets Reports
+====================================
+ It is conversion invoice timesheet reports in to Webkit Report.
+ """,
+ 'website': 'http://www.serpentcs.com',
+ 'depends' : [
+ 'hr_timesheet_invoice',
+ 'report_webkit'],
+ 'update_xml': [
+ 'timesheet_invoice_report_view.xml',
+ ],
+ 'installable': True,
+ 'auto_install': False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added directory 'hr_timesheet_invoice_webkit/report'
=== added file 'hr_timesheet_invoice_webkit/report/__init__.py'
--- hr_timesheet_invoice_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_timesheet_invoice_webkit/report/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 account_analytic_profit
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
=== added file 'hr_timesheet_invoice_webkit/report/account_analytic_profit.py'
--- hr_timesheet_invoice_webkit/report/account_analytic_profit.py 1970-01-01 00:00:00 +0000
+++ hr_timesheet_invoice_webkit/report/account_analytic_profit.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,123 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp.report import report_sxw
+from openerp import pooler
+
+class account_analytic_profit(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(account_analytic_profit, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({
+ 'lines': self._lines,
+ 'user_ids': self._user_ids,
+ 'journal_ids': self._journal_ids,
+ 'line': self._line,
+ })
+ def _user_ids(self, lines):
+ user_obj=pooler.get_pool(self.cr.dbname).get('res.users')
+ ids=list(set([b.user_id.id for b in lines]))
+ return user_obj.browse(self.cr, self.uid, ids)
+
+ def _journal_ids(self, form, user_id):
+ line_obj=pooler.get_pool(self.cr.dbname).get('account.analytic.line')
+ journal_obj=pooler.get_pool(self.cr.dbname).get('account.analytic.journal')
+ line_ids=line_obj.search(self.cr, self.uid, [
+ ('date', '>=', form['date_from']),
+ ('date', '<=', form['date_to']),
+ ('journal_id', 'in', form['journal_ids'][0][2]),
+ ('user_id', '=', user_id),
+ ])
+ ids=list(set([b.journal_id.id for b in line_obj.browse(self.cr, self.uid, line_ids)]))
+ return journal_obj.browse(self.cr, self.uid, ids)
+
+ def _line(self, form, journal_ids, user_ids):
+ pool=pooler.get_pool(self.cr.dbname)
+ line_obj=pool.get('account.analytic.line')
+ product_obj=pool.get('product.product')
+ price_obj=pool.get('product.pricelist')
+ ids=line_obj.search(self.cr, self.uid, [
+ ('date', '>=', form['date_from']),
+ ('date', '<=', form['date_to']),
+ ('journal_id', 'in', journal_ids),
+ ('user_id', 'in', user_ids),
+ ])
+ res={}
+ for line in line_obj.browse(self.cr, self.uid, ids):
+ if line.account_id.pricelist_id:
+ if line.account_id.to_invoice:
+ if line.to_invoice:
+ id=line.to_invoice.id
+ name=line.to_invoice.name
+ discount=line.to_invoice.factor
+ else:
+ name="/"
+ discount=1.0
+ id = -1
+ else:
+ name="Fixed"
+ discount=0.0
+ id=0
+ pl=line.account_id.pricelist_id.id
+ price=price_obj.price_get(self.cr, self.uid, [pl], line.product_id.id, line.unit_amount or 1.0, line.account_id.partner_id.id)[pl]
+ else:
+ name="/"
+ discount=1.0
+ id = -1
+ price=0.0
+ if id not in res:
+ res[id]={'name': name, 'amount': 0, 'cost':0, 'unit_amount':0,'amount_th':0}
+ xxx = round(price * line.unit_amount * (1-(discount or 0.0)), 2)
+ res[id]['amount_th']+=xxx
+ if line.invoice_id:
+ self.cr.execute('select id from account_analytic_line where invoice_id=%s', (line.invoice_id.id,))
+ tot = 0
+ for lid in self.cr.fetchall():
+ lid2 = line_obj.browse(self.cr, self.uid, lid[0])
+ pl=lid2.account_id.pricelist_id.id
+ price=price_obj.price_get(self.cr, self.uid, [pl], lid2.product_id.id, lid2.unit_amount or 1.0, lid2.account_id.partner_id.id)[pl]
+ tot += price * lid2.unit_amount * (1-(discount or 0.0))
+ if tot:
+ procent = line.invoice_id.amount_untaxed / tot
+ res[id]['amount'] += xxx * procent
+ else:
+ res[id]['amount'] += xxx
+ else:
+ res[id]['amount'] += xxx
+ res[id]['cost']+=line.amount
+ res[id]['unit_amount']+=line.unit_amount
+ for id in res:
+ res[id]['profit']=res[id]['amount']+res[id]['cost']
+ res[id]['eff']=res[id]['cost'] and '%d' % (-res[id]['amount'] / res[id]['cost'] * 100,) or 0.0
+ return res.values()
+
+ def _lines(self, form):
+ line_obj=pooler.get_pool(self.cr.dbname).get('account.analytic.line')
+ ids=line_obj.search(self.cr, self.uid, [
+ ('date', '>=', form['date_from']),
+ ('date', '<=', form['date_to']),
+ ('journal_id', 'in', form['journal_ids'][0][2]),
+ ('user_id', 'in', form['employee_ids'][0][2]),
+ ])
+ return line_obj.browse(self.cr, self.uid, ids)
+
+report_sxw.report_sxw('report.account.analytic.profit.webkit', 'account.analytic.line', 'addons/hr_timesheet_invoice_webkit/report/account_analytic_profit_webkit.mako', parser=account_analytic_profit)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_timesheet_invoice_webkit/report/account_analytic_profit_webkit.mako'
--- hr_timesheet_invoice_webkit/report/account_analytic_profit_webkit.mako 1970-01-01 00:00:00 +0000
+++ hr_timesheet_invoice_webkit/report/account_analytic_profit_webkit.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,156 @@
+<html>
+
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+
+ <body>
+ %for o in objects:
+ <br/>
+ <br/>
+ <center><h2>Invoice rate by user</h2></center>
+ <br/>
+ <br/>
+ <table class="basic_table" width="100%" align="center">
+ <tr>
+ <td width="40%">
+ <b>${_("Period from startdate")} </b>
+ </td>
+ <td width="30%">
+ <b>${_("Period to enddate")}</b>
+ </td>
+ <td width="30%">
+ <b>${_("Currency")} </b>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ${formatLang(data['form']['date_from'],date=True) or '' |entity}
+ </td>
+ <td>
+ ${formatLang (data['form']['date_to'] ,date=True) or ''|entity}
+ </td>
+ <td>
+ ${company.currency_id.name or ''|entity}
+ </td>
+ </tr>
+ </table>
+ <br/><br/>
+ <table class="list_table" width="100%">
+ <thead>
+ <tr>
+ <th style="text-align:left;" width="30%">${_("User or Journal Name")}</th>
+ <th style="text-align:left;" width="5%"></th>
+ <th style="text-align:left;" width="10%">${_("Units")}</th>
+ <th style="text-align:left;" width="15%">${_("Theorical")}</th>
+ <th style="text-align:right;" width="10%">${_("Income")}</th>
+ <th style="text-align:right;" width="10%">${_("Cost")}</th>
+ <th style="text-align:right;" width="10%">${_("Profit")}</th>
+ <th style="text-align:right;" width="10%">${_("Eff.")}</th>
+ </tr>
+ </thead>
+ </table>
+ <br/>
+ <table class="list_table" width="100%">
+ <thead>
+ <tr>
+ <th style="text-align:left;" width="30%">${_("Totals:")}</th>
+ <th style="text-align:left;" width="5%"></th>
+ <th style="text-align:left;" width="10%">${reduce(lambda x, y: x+y['unit_amount'], line(data['form'], data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) }</th>
+ <th style="text-align:left;" width="15%"></th>
+ <th style="text-align:right;" width="10%">${reduce(lambda x, y: x+y['amount'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) }</th>
+ <th style="text-align:right;" width="10%">${reduce(lambda x, y: x+y['cost'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) }</th>
+ <th style="text-align:right;" width="10%">${reduce(lambda x, y: x+y['profit'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) }</th>
+ <th style="text-align:right;" width="10%">${reduce(lambda x, y: x+y['cost'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0) and round(reduce(lambda x, y: x+y['amount'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0)/reduce(lambda x, y: x+y['cost'], line(data['form'],data['form']['journal_ids'][0][2], data['form']['employee_ids'][0][2]), 0)* -100, 2)}%</th>
+ </tr>
+ </thead>
+ %for e in user_ids(lines(data['form'])):
+ <tbody>
+ <tr>
+ <td class="td_line" style="text-align:left;">
+ <b>${e.name or '' |entity}</b>
+ </td>
+ %for j in journal_ids(data['form'], [e.id]):
+ <td style="text-align:left;">
+ </td>
+ <td style="text-align:left;">
+ ${reduce(lambda x, y: x+y['unit_amount'], line(data['form'], [j.id], [e.id]), 0) or '' |entity}
+ </td>
+ <td style="text-align:left;">
+ ${reduce(lambda x, y: x+y['amount_th'], line(data['form'], [j.id], [e.id]), 0) or '' |entity}
+ </td>
+ <td style="text-align:left;">
+ ${reduce(lambda x, y: x+y['amount'], line(data['form'], [j.id], [e.id]), 0) or '' |entity}
+ </td>
+ <td style="text-align:right;">
+ ${reduce(lambda x, y: x+y['cost'], line(data['form'], [j.id], [e.id]), 0) or 0.0 |entity}
+ </td>
+ <td style="text-align:right;">
+ ${reduce(lambda x, y: x+y['profit'], line(data['form'], [j.id], [e.id]), 0) or 0.0 |entity}
+ </td>
+ <td style="text-align:right;">
+ ${reduce(lambda x, y: x+y['cost'], line(data['form'], [j.id], [e.id]), 0) and '%d' % (reduce(lambda x, y: x+y['amount'], line(data['form'], [j.id], [e.id]), 0) / reduce(lambda x, y: x+y['cost'], line(data['form'], [j.id], [e.id]), 0) * 100.0)} %
+ </td>
+ </tr>
+ </tbody>
+ <tbody>
+ <tr>
+ <td style="text-align:left;">
+ ${j.name or '' |entity}
+ </td>
+ <td style="text-align:left;">
+ </td>
+ <td style="text-align:left;">
+ </td>
+ <td style="text-align:left;">
+ </td>
+ <td style="text-align:left;">
+ </td>
+ <td style="text-align:right;">
+ </td>
+ <td style="text-align:right;">
+ </td>
+ <td style="text-align:right;">
+ </td>
+ </tr>
+ </tbody>
+ %endfor
+ %endfor
+ </table>
+ <table class="list_table" width="100%">
+ %for l in line(data['form'], [j.id],[e.id]):
+ <tbody>
+ <tr>
+ <td style="text-align:left; border-style:none;" width="30%">
+ ${ l['name'] or '' |entity}
+ </td>
+ <td style="text-align:left; border-style:none;" width="5%">
+ </td>
+ <td style="text-align:left; border-style:none;" width="10%">
+ ${ l['unit_amount'] or '' |entity}
+ </td>
+ <td style="text-align:left; border-style:none;" width="15%">
+ ${ l['amount_th'] or '' |entity}
+ </td>
+ <td style="text-align:right; border-style:none;" width="10%">
+ ${ l['amount'] or '' |entity}
+ </td>
+ <td style="text-align:right; border-style:none;" width="10%">
+ ${ l['cost'] or '' |entity}
+ </td>
+ <td style="text-align:right; border-style:none;" width="10%">
+ ${ l['profit'] or '' |entity}
+ </td>
+ <td style="text-align:right; border-style:none;" width="10%">
+ ${ l['eff'] or '' |entity} %
+ </td>
+ </tr>
+ </tbody>
+ %endfor
+ </table>
+ <p style="page-break-after:always"></p>
+ %endfor
+</body>
+</html>
=== added file 'hr_timesheet_invoice_webkit/timesheet_invoice_report_view.xml'
--- hr_timesheet_invoice_webkit/timesheet_invoice_report_view.xml 1970-01-01 00:00:00 +0000
+++ hr_timesheet_invoice_webkit/timesheet_invoice_report_view.xml 2013-10-10 09:59:30 +0000
@@ -0,0 +1,175 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="hr_webkit_header" 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>
+ <% import datetime %>
+ <body style="border:0; margin: 0;" onload="subst()">
+ <table style="border-top: 1px solid black; width: 1080px">
+ <tr style="border-collapse:collapse;">
+ <td style="text-align:left;font-size:15px;width:350px;">${formatLang( str(datetime.datetime.today()), date_time=True)}</td>
+ <td style="text-align:center;font-size:15px;width:350px;">${user.name or ''}</td>
+ <td style="text-align:right;font-size:15px;width:350px;">Page <span class="page"/></td>
+ <td style="text-align:left;font-size:15px;width:30px"> of <span class="topage"/></td>
+ </tr>
+ </table>
+ </body>
+</html>]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</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: 15;" onload="subst()">
+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:left;font-size:12;" width="20%">${ helper.embed_image('png',company.logo,200,50)|n }</td>
+ <td style="text-align:right;font-size:12;" width="80%"></br></br>${ company.rml_header1 }</td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+ <p style="text-align:left;font-size:12;">${company.name}</p></br></br></br>
+ <table width="100%">
+ <tr>
+ <td style="text-align:left;font-size:10;" width="25%">
+ Phone: ${company.phone or ''}
+ </td>
+ <td width="75%"></td>
+ </tr>
+
+ <tr>
+ <td style="text-align:left;font-size:10; border-bottom: 1px solid black;" width="25%">
+ Mail: ${company.email}
+ </td>
+ <td width="75%"></td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+</html>]]>
+ </field>
+ <field eval="45.0" name="margin_top"/>
+ <field eval="15.0" name="margin_bottom"/>
+ <field name="css"><![CDATA[
+
+ body {
+ font-family:Arial;
+ font-size:12;
+
+ }
+
+
+ .dest_address {
+ margin-right:60%;
+ font-size:12;
+
+ }
+ .header {
+ margin-right:0;
+ text-align:right;
+ width:300px;
+ font-size:12;
+ }
+
+ .title {
+ font-size:16;
+ font-weight: bold;
+
+ }
+
+
+ .basic_table{
+ text-align:center;
+ border:1px solid lightGrey;
+ border-collapse: collapse;
+ }
+ .basic_table td {
+ border:1px solid lightGrey;
+ font-size:12;
+
+
+ }
+
+ .list_table {
+ border-color:black;
+ text-align:center;
+ border-collapse: collapse;
+
+ }
+ .list_table td {
+ text-align:right;
+ font-size:12;
+ padding-left:3px;
+ padding-right:3px;
+ padding-top:3px;
+ padding-bottom:3px;
+ }
+
+ .list_table th {
+ border-bottom:2px solid black;
+ text-align:right;
+ font-size:12;
+ font-weight:bold;
+ padding-left:3px;
+ padding-right:3px;
+ padding-bottom:3px;
+ }
+
+ .list_tabe thead {
+ display:table-header-group;
+ padding-bottom:3px;
+ }
+ .td_line {
+ border-bottom:1px solid #ccc;
+
+ }
+
+]]>
+ </field>
+ <field name="name">HR Webkit Header</field>
+ </record>
+ </data>
+ <data>
+ <report
+ auto="False"
+ id="report_analytical_profit_webkit"
+ menu="False"
+ model="account.analytic.line"
+ name="account.analytic.profit.webkit"
+ file="hr_timesheet_invoice_webkit/report/account_analytic_profit_webkit.mako"
+ string="Timesheet Profit"
+ report_type="webkit"
+ webkit_header="hr_webkit_header" />
+
+ </data>
+</openerp>
=== added directory 'hr_timesheet_invoice_webkit/wizard'
=== added file 'hr_timesheet_invoice_webkit/wizard/__init__.py'
--- hr_timesheet_invoice_webkit/wizard/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_timesheet_invoice_webkit/wizard/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 hr_timesheet_analytic_profit
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
=== added file 'hr_timesheet_invoice_webkit/wizard/hr_timesheet_analytic_profit.py'
--- hr_timesheet_invoice_webkit/wizard/hr_timesheet_analytic_profit.py 1970-01-01 00:00:00 +0000
+++ hr_timesheet_invoice_webkit/wizard/hr_timesheet_analytic_profit.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,58 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 datetime
+
+from openerp.osv import fields, osv
+from openerp.tools.translate import _
+
+class account_analytic_profit(osv.osv_memory):
+ _inherit = 'hr.timesheet.analytic.profit'
+ _description = 'Print Timesheet Profit'
+
+ def print_report(self, cr, uid, ids, context=None):
+ line_obj = self.pool.get('account.analytic.line')
+ data = {}
+ data['form'] = self.read(cr, uid , ids, [], context=context)[0]
+ ids_chk = line_obj.search(cr, uid, [
+ ('date', '>=', data['form']['date_from']),
+ ('date', '<=', data['form']['date_to']),
+ ('journal_id', 'in', data['form']['journal_ids']),
+ ('user_id', 'in', data['form']['employee_ids']),
+ ], context=context)
+ if not ids_chk:
+ raise osv.except_osv(_('Insufficient Data!'), _('No record(s) found for this report.'))
+
+ data['form']['journal_ids'] = [(6, 0, data['form']['journal_ids'])] # Improve me => Change the rml/sxw so that it can support withou [0][2]
+ data['form']['employee_ids'] = [(6, 0, data['form']['employee_ids'])]
+ datas = {
+ 'ids': ids,
+ 'model': 'account.analytic.line',
+ 'form': data['form']
+ }
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'account.analytic.profit.webkit',
+ 'datas': datas,
+ }
+
+account_analytic_profit()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added directory 'hr_timesheet_webkit'
=== added file 'hr_timesheet_webkit/__init__.py'
--- hr_timesheet_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_timesheet_webkit/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 wizard
+import report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'hr_timesheet_webkit/__openerp__.py'
--- hr_timesheet_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ hr_timesheet_webkit/__openerp__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,40 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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/>.
+#
+############################################################################
+
+
+{
+ 'name': 'Timesheets',
+ 'version': '1.0',
+ 'category': 'Human Resources',
+ 'sequence': 23,
+ 'description': """
+This module implements a timesheet system.
+==========================================
+ Employee timesheet reports converted into the WebKit reprort .
+ """,
+ 'author': 'Serpent Consulting Services',
+ 'website': 'http://www.serpentcs.com',
+ 'depends': ['hr_timesheet', 'report_webkit'],
+ 'update_xml': ["report_webkit_hr_timesheet.xml"],
+ 'installable': True,
+ 'auto_install': False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added directory 'hr_timesheet_webkit/report'
=== added file 'hr_timesheet_webkit/report/__init__.py'
--- hr_timesheet_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_timesheet_webkit/report/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 user_timesheet
+import users_timesheet
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
=== added file 'hr_timesheet_webkit/report/user_timesheet.mako'
--- hr_timesheet_webkit/report/user_timesheet.mako 1970-01-01 00:00:00 +0000
+++ hr_timesheet_webkit/report/user_timesheet.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,101 @@
+<html>
+<head>
+ <style type="text/css">
+ ${css}
+ </style>
+</head>
+<body>
+ <br/>
+ <center><h2> ${_("Timesheet by Employee")} </h2></center>
+ <br/><br/>
+ <table>
+ <tr>
+ <td style="color:0040FF;"><i>${get_emp_name(data)}</i> </td>
+ </tr>
+ <table>
+ <br/>
+ <br/>
+ <table class="list_table">
+ <tr>
+ <td width="8%" style="background-color:FFFFFF;text-align:left;">${data['form']['year']}</td>
+ %for month in range(lengthmonth(data['form']['year'],data['form']['month'])):
+ %if get_day_name(data['form']['year'],data['form']['month'],month+1) in ['Sat','Sun']:
+ <td width="2.5%" style="background-color:E1DEDE;">${get_day_name(data['form']['year'],data['form']['month'],month+1)}</td>
+ %else:
+ <td width="2.5%">${get_day_name(data['form']['year'],data['form']['month'],month+1)}</td>
+ %endif
+ %endfor
+ <td width="8%" style="background-color:FFFFFF;"></td>
+ </tr>
+ <tr>
+ <td width="8%" style="background-color:FFFFFF;text-align:left;">${get_month_name(data['form']['month'])}</td>
+ %for month in range(lengthmonth(data['form']['year'],data['form']['month'])):
+ %if get_day_name(data['form']['year'],data['form']['month'],month+1) in ['Sat','Sun']:
+ <td width="2.5%" style="text-align=center; background-color:E1DEDE;">${month +1 }</td>
+ %else:
+ <td width="2.5%" style="text-align=center;">${month +1 }</td>
+ %endif
+ %endfor
+ <td width="8%" style="background-color:FFFFFF;"><b>${_("Total")}</b></td>
+ </tr>
+ <%
+ sum = 0.0
+ %>
+ %for acc in range(len(get_emp_data(data)[0])):
+ <tr>
+ <td width="8%" style="background-color:FFFFFF;text-align:left;">${get_emp_data(data)[0][acc]}</td>
+ <%
+ k = (get_emp_data(data)[1])[acc].values()
+ v = (get_emp_data(data)[1])[acc].keys()
+ counter = 0
+ total=0.0
+ %>
+ %for month in range(lengthmonth(data['form']['year'],data['form']['month'])):
+ %if get_day_name(data['form']['year'],data['form']['month'],month+1) in ['Sat','Sun']:
+ %if month+1 in v:
+ %if v > counter:
+ <td width="2.5%" style="background-color:E1DEDE;">${k[counter]}</td>
+ <%
+ total = total + k[counter]
+ counter = counter +1
+ %>
+ %endif
+ %else:
+ <td width="2.5%" style="background-color:FFFFFF;"></td>
+ %endif
+ %else:
+ %if month+1 in v:
+ %if v > counter:
+ <td width="2.5%" style="background-color:FFFFFF;">${k[counter]}</td>
+ <%
+ total = total + k[counter]
+ counter = counter +1
+ %>
+ %endif
+ %else:
+ <td width="2.5%" style="background-color:FFFFFF;"></td>
+ %endif
+ %endif
+ %endfor
+ <td width="8%" style="background-color:FFFFFF;text-align:left;padding-top:0px;">${total}</td>
+ </tr>
+ <% sum = sum + total%>
+ %endfor
+ %for acc in range(len(get_emp_data(data)[0])):
+ <% grand_total = sum %>
+ <tr>
+ <td width="8%" style="background-color:FFFFFF;text-align:left;"><b>${_("Sum")}</b></td>
+ <% sum = 0.0 %>
+ %for month in range(lengthmonth(data['form']['year'],data['form']['month'])):
+ %if get_day_name(data['form']['year'],data['form']['month'],month+1) in ['Sat','Sun']:
+ <td width="2.5%" style="background-color:E1DEDE; color:red">0</td>
+ %else:
+ <td width="2.5%" style="background-color:FFFFFF;color:red">0</td>
+ %endif
+ %endfor
+ <td width="2.5%" style="background-color:FFFFFF;"><b>${grand_total}</b></td>
+ <tr>
+ %endfor
+ </table>
+</body>
+</html>
\ No newline at end of file
=== added file 'hr_timesheet_webkit/report/user_timesheet.py'
--- hr_timesheet_webkit/report/user_timesheet.py 1970-01-01 00:00:00 +0000
+++ hr_timesheet_webkit/report/user_timesheet.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,121 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 datetime import datetime, timedelta
+from dateutil.relativedelta import relativedelta
+import datetime
+
+from openerp.tools.translate import _
+import time
+from openerp import pooler
+from openerp.report import report_sxw
+
+def lengthmonth(year, month):
+ if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))):
+ return 29
+ return [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]
+
+class employee_timesheet(report_sxw.rml_parse):
+
+ def __init__(self, cr, uid, name, context):
+ super(employee_timesheet, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({
+ 'time': time,
+ 'get_month_name':self.get_month_name,
+ 'get_day_name':self.get_day_name,
+ 'lengthmonth':self.lengthmonth,
+ 'get_emp_data':self.get_emp_data,
+ 'get_emp_name':self.get_emp_name,
+ })
+
+ def lengthmonth(self,year, month):
+ if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))):
+ return 29
+ return [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]
+
+ def get_month_name(self, month, context=None):
+ _months = {1:_("January"), 2:_("February"), 3:_("March"), 4:_("April"), 5:_("May"), 6:_("June"), 7:_("July"), 8:_("August"), 9:_("September"), 10:_("October"), 11:_("November"), 12:_("December")}
+ return _months[month]
+
+ def get_day_name(self, year, month, day):
+ days =[]
+ name_of_day = datetime.datetime.weekday(datetime.date(year,month,day))
+ if name_of_day == 0:
+ return "Mon"
+ elif name_of_day == 1:
+ return "Tue"
+ elif name_of_day == 2:
+ return "Wed"
+ elif name_of_day == 3:
+ return "Thus"
+ elif name_of_day == 4:
+ return "Fri"
+ elif name_of_day == 5:
+ return "Sat"
+ elif name_of_day == 6:
+ return "Sun"
+
+ def get_emp_name(self, data, context=None):
+ # Get the user id from the selected employee record
+ emp_id = data['form']['employee_id']
+ emp_obj = pooler.get_pool(self.cr.dbname).get('hr.employee')
+ user_id = emp_obj.browse(self.cr, self.uid, emp_id).user_id.id
+ empl_name = emp_obj.browse(self.cr, self.uid, emp_id).name
+ return empl_name
+
+ def get_emp_data(self, data, context=None):
+ emp_id = data['form']['employee_id']
+ emp_obj = pooler.get_pool(self.cr.dbname).get('hr.employee')
+ user_id = emp_obj.browse(self.cr, self.uid, emp_id).user_id.id
+ # Computing the dates (start of month: som, and end of month: eom)
+ som = datetime.date(data['form']['year'], data['form']['month'], 1)
+ eom = som + datetime.timedelta(lengthmonth(som.year, som.month))
+ # Sum attendence by account, then by day
+ accounts = {}
+ if user_id:
+ # Computing the attendence by analytical account
+ self.cr.execute(
+ "select line.date, (unit_amount / unit.factor) as amount, account_id, account.name "\
+ "from account_analytic_line as line, hr_analytic_timesheet as hr, "\
+ "account_analytic_account as account, product_uom as unit "\
+ "where hr.line_id=line.id and line.account_id=account.id "\
+ "and product_uom_id = unit.id "\
+ "and line.user_id=%s and line.date >= %s and line.date < %s "
+ "order by line.date",
+ (user_id, som.strftime('%Y-%m-%d'), eom.strftime('%Y-%m-%d')))
+ for presence in self.cr.dictfetchall():
+ day = int(presence['date'][-2:])
+ account = accounts.setdefault((presence['account_id'], presence['name']), {})
+ account[day] = account.get(day, 0.0) + presence['amount']
+ tel = []
+ name = []
+ for account, telems in accounts.iteritems():
+ aid, aname = account
+ aname = pooler.get_pool(self.cr.dbname).get('account.analytic.account').name_get(self.cr, self.uid, [aid], context)
+ name.append(aname[0][1])
+ tel.append(telems)
+ return name, tel
+
+report_sxw.report_sxw('report.hr.analytical.timesheet.webkit', 'hr.employee','addons/hr_timesheet_webkit/report/user_timesheet.mako', parser=employee_timesheet, header='internal')
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_timesheet_webkit/report/users_timesheet.mako'
--- hr_timesheet_webkit/report/users_timesheet.mako 1970-01-01 00:00:00 +0000
+++ hr_timesheet_webkit/report/users_timesheet.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,80 @@
+<html>
+<head>
+ <style type="text/css">
+ ${css}
+ </style>
+</head>
+<body>
+ <br/>
+ <center><h2> ${_("Employees Timesheet")} </h2></center>
+
+ <br/><br/>
+
+ <table class="list_table">
+ <tr>
+ <td width="8%" style="background-color:FFFFFF;text-align:left;">${data['form']['year']}</td>
+ %for month in range(lengthmonth(data['form']['year'],data['form']['month'])):
+ %if get_day_name(data['form']['year'],data['form']['month'],month+1) in ['Sat','Sun']:
+ <td width="2.5%" style="background-color:E1DEDE;"><b>${get_day_name(data['form']['year'],data['form']['month'],month+1)}</b></td>
+ %else:
+ <td width="2.5%"><b>${get_day_name(data['form']['year'],data['form']['month'],month+1)}</b></td>
+ %endif
+ %endfor
+ <td width="8%" style="background-color:FFFFFF;"><b></b></td>
+ </tr>
+ <tr>
+ <td width="8%" style="background-color:FFFFFF;text-align:left;">${get_month_name(data['form']['month'])}</td>
+ %for month in range(lengthmonth(data['form']['year'],data['form']['month'])):
+ %if get_day_name(data['form']['year'],data['form']['month'],month+1) in ['Sat','Sun']:
+ <td width="2.5%" style="text-align=center; background-color:E1DEDE;">${month +1 }</td>
+ %else:
+ <td width="2.5%" style="text-align=center;">${month +1 }</td>
+ %endif
+ %endfor
+ <td width="8%" style="background-color:FFFFFF;"><b>${_("Total")}</b></td>
+ </tr>
+ <% sum = 0.0 %>
+ %for user in users_data(data):
+ <tr>
+ <%
+ counter = 0
+ total=0.0
+ %>
+ <td width="8%" style="background-color:FFFFFF;text-align:left;">${user_name(data, user)}</td>
+ %for month in range(lengthmonth(data['form']['year'],data['form']['month'])):
+ <%
+ print "MONTH ",month
+ %>
+ %if month + 1 in (emp_data(data, user)[0]):
+ <td width="2.5%" style="background-color:FFFFFF; color:#DF0101">${(emp_data(data, user)[1])[counter]}</td>
+ <%
+ total = total + (emp_data(data, user)[1])[counter]
+ counter = counter +1
+ print "counter",counter
+ %>
+ %else:
+ <td width="2.5%" style="background-color:FFFFFF;color:#DF0101"">${0}</td>
+ %endif
+ %endfor
+ <td width="8%" style="background-color:FFFFFF;">${total}</td>
+ </tr>
+ <%sum =sum +total%>
+ %endfor
+ <tr>
+ <%
+ counter = 0
+ grand_total = sum
+ %>
+ <td width="8%" style="background-color:FFFFFF;text-align:left;">${_("Sum")}</td>
+ %for month in range(lengthmonth(data['form']['year'],data['form']['month'])):
+ %if month +1 in (emp_data(data, user)[0]):
+ <td width="2.5%" style="background-color:FFFFFF;">${(emp_data(data, user)[1])[counter]}</td>
+ %else:
+ <td width="2.5%" style="background-color:FFFFFF;">${0}</td>
+ %endif
+ %endfor
+ <td width="8%" style="background-color:FFFFFF;">${grand_total}</td>
+ </tr>
+ </table>
+</body>
+</html>
\ No newline at end of file
=== added file 'hr_timesheet_webkit/report/users_timesheet.py'
--- hr_timesheet_webkit/report/users_timesheet.py 1970-01-01 00:00:00 +0000
+++ hr_timesheet_webkit/report/users_timesheet.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,161 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 datetime
+import time
+from openerp import pooler
+from openerp.tools.translate import _
+from openerp.report import report_sxw
+from openerp.tools import ustr
+
+
+def lengthmonth(year, month):
+ if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))):
+ return 29
+ return [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]
+
+#def emp_data(cr, id, som, eom, emp):
+# # Computing the attendence by analytical account
+# cr.execute(
+# "select line.date, (unit_amount / unit.factor) as amount "\
+# "from account_analytic_line as line, hr_analytic_timesheet as hr, "\
+# "product_uom as unit "\
+# "where hr.line_id=line.id "\
+# "and product_uom_id = unit.id "\
+# "and line.user_id=%s and line.date >= %s and line.date < %s "
+# "order by line.date",
+# (id, som.strftime('%Y-%m-%d'), eom.strftime('%Y-%m-%d')))
+#
+# # Sum by day
+# month = {}
+# days = []
+# amounts =[]
+# for presence in cr.dictfetchall():
+# day = int(presence['date'][-2:])
+# month[day] = month.get(day, 0.0) + presence['amount']
+# for day, amount in month.iteritems():
+# days.append(day)
+# amounts.append(amount)
+# return days, amounts,emp
+
+
+class users_timesheet(report_sxw.rml_parse):
+
+ def __init__(self, cr, uid, name, context):
+ super(users_timesheet, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({
+ 'time': time,
+ 'get_month_name':self.get_month_name,
+ 'get_day_name':self.get_day_name,
+ 'users_data':self.users_data,
+ 'lengthmonth':self.lengthmonth,
+ 'emp_data':self.emp_data,
+ 'user_name':self.user_name,
+ 'total_amt':self.total_amt,
+ })
+
+ def lengthmonth(self,year, month):
+ if month == 2 and ((year % 4 == 0) and ((year % 100 != 0) or (year % 400 == 0))):
+ return 29
+ return [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]
+
+ def get_month_name(self, month, context=None):
+ _months = {1:_("January"), 2:_("February"), 3:_("March"), 4:_("April"), 5:_("May"), 6:_("June"), 7:_("July"), 8:_("August"), 9:_("September"), 10:_("October"), 11:_("November"), 12:_("December")}
+ return _months[month]
+
+ def get_day_name(self, year, month, day):
+ days =[]
+ name_of_day = datetime.datetime.weekday(datetime.date(year,month,day))
+ _day = {0:_('Mon'), 1:_('Tue'), 2:_('Wed'), 3:_('Thu'), 4:_('Fri'), 5:_('Sat'), 6:_('Sun')}
+ return _day[name_of_day]
+
+ def users_data(self, data, context=None):
+
+ # Computing the dates (start of month: som, and end of month: eom)
+ print "DATA ",data
+ som = datetime.date(data['form']['year'], data['form']['month'], 1)
+ eom = som + datetime.timedelta(lengthmonth(som.year, som.month))
+ emp_obj = pooler.get_pool(self.cr.dbname).get('hr.employee')
+ user_ids = []
+ emp_names = []
+ for id in data['form']['employee_ids']:
+ user = emp_obj.browse(self.cr, self.uid, id).user_id.id
+ empl_name = emp_obj.browse(self.cr, self.uid, id).name
+ if user:
+ user_ids.append(user)
+ emp_names.append(empl_name)
+ return user_ids
+
+ def user_name(self, data, id, context=None):
+ emp_obj = pooler.get_pool(self.cr.dbname).get('hr.employee')
+ if id in data['form']['employee_ids']:
+# user = emp_obj.browse(self.cr, self.uid, id).user_id.id
+ empl_name = emp_obj.browse(self.cr, self.uid, id).name
+ return empl_name
+
+ def emp_data(self, data, id, context=None):
+ # Computing the attendence by analytical account
+
+ som = datetime.date(data['form']['year'], data['form']['month'], 1)
+ eom = som + datetime.timedelta(lengthmonth(som.year, som.month))
+
+ self.cr.execute(
+ "select line.date, (unit_amount / unit.factor) as amount "\
+ "from account_analytic_line as line, hr_analytic_timesheet as hr, "\
+ "product_uom as unit "\
+ "where hr.line_id=line.id "\
+ "and product_uom_id = unit.id "\
+ "and line.user_id=%s and line.date >= %s and line.date < %s "
+ "order by line.date",
+ (id, som.strftime('%Y-%m-%d'), eom.strftime('%Y-%m-%d')))
+
+ # Sum by day
+ month = {}
+ days = []
+ amounts =[]
+ for presence in self.cr.dictfetchall():
+ day = int(presence['date'][-2:])
+ month[day] = month.get(day, 0.0) + presence['amount']
+ for day, amount in month.iteritems():
+ days.append(day)
+ amounts.append(amount)
+
+
+# print "DAYS ",days, " AMOUNTS ",amounts," MONTH ",month
+ return days, amounts, month
+
+ def total_amt(self, data):
+ som = datetime.date(data['form']['year'], data['form']['month'], 1)
+ eom = som + datetime.timedelta(lengthmonth(som.year, som.month))
+
+ print "day",days
+ print "amounts",amounts
+# total = []
+# line = 0.0
+ for day in days:
+ print day
+# for amt in amounts:
+# line = line + amt
+# print amounts
+
+report_sxw.report_sxw('report.hr.analytical.timesheet_users.webkit', 'hr.employee','addons/hr_timesheet_webkit/report/users_timesheet.mako', parser=users_timesheet, header='internal')
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'hr_timesheet_webkit/report_webkit_hr_timesheet.xml'
--- hr_timesheet_webkit/report_webkit_hr_timesheet.xml 1970-01-01 00:00:00 +0000
+++ hr_timesheet_webkit/report_webkit_hr_timesheet.xml 2013-10-10 09:59:30 +0000
@@ -0,0 +1,191 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="emp_timesheet_webkit_header" model="ir.header_webkit">
+ <field name="footer_html"><![CDATA[]]></field>
+ <field name="orientation">Landscape</field>
+ <field name="format">A4</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]);}
+ if(vars['page']!=1){
+ document.getElementById('inner_head').innerHTML=document.getElementById('actual_header').innerHTML;
+ }
+ 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()">
+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:right;font-size:12;" width="15%">${time.strftime('%m/%d/%Y %I:%M')}</td>
+ <td style="text-align:center;font-size:16;" width="75%">${company.partner_id.name |entity}</td>
+ <td style="text-align:left;font-size:12;" width="7%"><span class="page"/></td>
+ <td style="text-align:left;font-size:12;" width="1%">/</td>
+ <td style="text-align:right;font-size:12;" width="2%"><span class="topage"/></td>
+ </tr>
+ </table> ${_debug or ''|n}
+ <table id="inner_head" style="width: 98%;margin-left:1%;margin-right:1%;">
+
+ </table>${_debug or ''|n}
+ </body>
+</html>]]>
+ </field>
+ <field eval="15.0" name="margin_top"/>
+ <field eval="5.0" name="margin_bottom"/>
+ <field eval="15.0" name="margin_right"/>
+ <field eval="15.0" name="margin_left"/>
+ <field name="css"><![CDATA[
+
+body {
+font-family:Arial;
+font-size:12;
+}
+
+.header {
+ margin-left:0;
+ text-align:left;
+ width:300px;
+ font-size:12;
+}
+
+.cell{
+ border-spacing: 0;
+ border-collapse: collapse;
+ border-style:solid;
+ border: 1px solid grey;
+ font-size:10px;
+ text-align:center;
+}
+
+
+
+.list_table {
+border-color:black;
+text-align:center;
+border-collapse: collapse;
+
+}
+.list_table td {
+width:100%;
+border-color:black;
+border-top:1px solid black;
+border-bottom:1px solid black;
+border-left:1px solid black;
+border-right:1px solid black;
+text-align:center;
+background-color:c0c0c0;
+font-size:12px;
+padding-left:5px;
+padding-right:5px;
+padding-top:5px;
+padding-bottom:5px;
+}
+
+.list_table th {
+border-bottom:2px solid black;
+text-align:right;
+font-size:12;
+font-weight:bold;
+padding-left:3px
+padding-right:3px
+}
+
+.list_tabe thead {
+ display:table-header-group;
+}
+
+
+
+table {
+ display: table;
+ width: 100%;
+ }
+
+ table thead {
+ display: table-header-group;
+ }
+
+ table tbody {
+ display: table-row-group;
+ }
+
+ table tfoot {
+ display: table-footer-group;
+ }
+
+ table tr {
+ display: table-row;
+ height: auto;
+ }
+
+ table th,
+ table td {
+ display: table-cell;
+ overflow: visible;
+ }
+
+ table th,
+ table td {
+ height: 1px; /* Do the trick to make div.nobrk fill td height */
+ }
+
+ table tr.singlecell td,
+ table tr.singlecell th {
+ height: auto; /* Reset trick for a full row td */
+ }
+
+ .nobrk {
+ page-break-inside: avoid;
+ orphans: 10;
+ widows: 10;
+ position: relative;
+ margin: -1px 0 0 -1px;
+ min-height: 14px;
+ line-height: 14px;
+ height: 100%;
+ }
+
+ table tbody td .nobrk {
+ min-height: 5px;
+ }
+ ]]>
+ </field>
+ <field name="name">Employee Timesheet Header Landscape</field>
+ </record>
+ <report
+ auto="False"
+ id="report_user_timesheet_webkit"
+ menu="False"
+ model="hr.employee"
+ name="hr.analytical.timesheet.webkit"
+ string="Employee timesheet"
+ file="hr_timesheet_webkit/report/user_timesheet.mako"
+ report_type="webkit"
+ webkit_header="emp_timesheet_webkit_header"/>
+
+ <report auto="False"
+ id="report_users_timesheet_webkit"
+ menu="False"
+ model="hr.employee"
+ name="hr.analytical.timesheet_users.webkit"
+ string="Employee timesheet"
+ file="hr_timesheet_webkit/report/users_timesheet.mako"
+ report_type="webkit"
+ webkit_header="emp_timesheet_webkit_header"/>
+
+ </data>
+</openerp>
=== added directory 'hr_timesheet_webkit/wizard'
=== added file 'hr_timesheet_webkit/wizard/__init__.py'
--- hr_timesheet_webkit/wizard/__init__.py 1970-01-01 00:00:00 +0000
+++ hr_timesheet_webkit/wizard/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 hr_timesheet_print_employee
+import hr_timesheet_print_users
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
=== added file 'hr_timesheet_webkit/wizard/hr_timesheet_print_employee.py'
--- hr_timesheet_webkit/wizard/hr_timesheet_print_employee.py 1970-01-01 00:00:00 +0000
+++ hr_timesheet_webkit/wizard/hr_timesheet_print_employee.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 datetime
+
+from openerp.osv import fields, osv
+from openerp.tools.translate import _
+
+class analytical_timesheet_employee(osv.osv_memory):
+ _inherit = 'hr.analytical.timesheet.employee'
+
+ def print_report(self, cr, uid, ids, context=None):
+ data = self.read(cr, uid, ids, context=context)[0]
+ data['employee_id'] = data['employee_id'][0]
+ datas = {
+ 'ids': ids,
+ 'model': 'hr.employee',
+ 'form': data
+ }
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'hr.analytical.timesheet.webkit',
+ 'datas': datas,
+ }
+analytical_timesheet_employee()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'hr_timesheet_webkit/wizard/hr_timesheet_print_users.py'
--- hr_timesheet_webkit/wizard/hr_timesheet_print_users.py 1970-01-01 00:00:00 +0000
+++ hr_timesheet_webkit/wizard/hr_timesheet_print_users.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 datetime
+
+from openerp.osv import fields, osv
+
+class analytical_timesheet_employees(osv.osv_memory):
+ _inherit = 'hr.analytical.timesheet.users'
+
+ def print_report(self, cr, uid, ids, context=None):
+ data = self.read(cr, uid, ids, context=context)[0]
+ datas = {
+ 'ids': [],
+ 'model': 'hr.employee',
+ 'form': data
+ }
+ return {
+ 'type': 'ir.actions.report.xml',
+ 'report_name': 'hr.analytical.timesheet_users.webkit',
+ 'datas': datas,
+ }
+
+analytical_timesheet_employees()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added directory 'l10n_fr_hr_payroll_webkit'
=== added file 'l10n_fr_hr_payroll_webkit/__init__.py'
--- l10n_fr_hr_payroll_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ l10n_fr_hr_payroll_webkit/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,23 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'l10n_fr_hr_payroll_webkit/__openerp__.py'
--- l10n_fr_hr_payroll_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ l10n_fr_hr_payroll_webkit/__openerp__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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/>.
+#
+############################################################################
+{
+ 'name': 'French Payroll',
+ 'category': 'Localization/Payroll',
+ 'author': 'Serpent Consulting Services',
+ 'website': 'http://www.serpentcs.com',
+ 'depends': ['l10n_fr_hr_payroll', 'report_webkit'],
+ 'version': '1.0',
+ 'description': """
+French Payroll Rules.
+=====================
+ It is conversion of rml report to Webkit Report.
+ """,
+
+ 'active': False,
+ 'data': [
+ 'l10n_fr_hr_payroll_view.xml'
+ ],
+ 'installable': True
+}
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'l10n_fr_hr_payroll_webkit/l10n_fr_hr_payroll_view.xml'
--- l10n_fr_hr_payroll_webkit/l10n_fr_hr_payroll_view.xml 1970-01-01 00:00:00 +0000
+++ l10n_fr_hr_payroll_webkit/l10n_fr_hr_payroll_view.xml 2013-10-10 09:59:30 +0000
@@ -0,0 +1,102 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+
+ <record id="hr_payroll_webkit_header" model="ir.header_webkit">
+ <field name="footer_html"><![CDATA[]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</field>
+ <field name="html"><![CDATA[
+ ]]>
+ </field>
+ <field eval="10.0" name="margin_top"/>
+ <field eval="10.0" name="margin_bottom"/>
+ <field eval="10.0" name="margin_right"/>
+ <field eval="10.0" name="margin_left"/>
+ <field name="css"><![CDATA[
+
+ body, table, td, span, div {
+ font-family: Helvetica, Arial;
+ }
+
+ body {
+ font-family:Arial;
+ font-size:12;
+ width:100%
+ }
+ .border{
+
+ text-align:center;
+ font-weight: bold;
+ font-size:18px;
+ border:1px solid black; }
+
+ .header {
+ margin-left:0;
+ text-align:left;
+ width:300px;
+ font-size:12;
+ }
+ .basic_table{
+ text-align:center;
+ border:1px solid lightGrey;
+ border-collapse: collapse;
+ }
+ .basic_table td {
+ border:1px solid lightGrey;
+ font-size:12px;
+ }
+
+ .tr_border{
+ text-align:center;
+ width:100%
+ border:1px solid black;
+ font-size:11px;
+ border-collapse: collapse;
+ font-family: Helvetica;
+ }
+
+ .tr_border td{
+ padding-top: 3px;
+ border:1px solid black;
+ }
+ .list_table {
+ width:100%;
+ border:1px solid black;
+ font-size:11px;
+ border-collapse: collapse;
+ font-family: Helvetica;
+ }
+ .list_table td{
+ padding-left:2px;
+ }
+ .td_f12{
+ font-size:12px;
+ font-weight: bold;
+ font-family: sans-serif, serif;
+ }
+ .font{
+ font-family: sans-serif, serif;
+ font-size:10px;
+ text-align:center;
+ }
+ ]]>
+ </field>
+ <field name="name">HR Payroll Webkit Header</field>
+ </record>
+
+
+ <report
+
+ id="fiche_paye"
+ auto="False"
+ menu="True"
+ model="hr.payslip"
+ name="fiche.paye.webkit"
+ file="l10n_fr_hr_payroll_webkit/report/fiche_paye.mako"
+ string="Fiche de Paie"
+ report_type="webkit"
+ webkit_header="hr_payroll_webkit_header"/>
+
+ </data>
+</openerp>
\ No newline at end of file
=== added directory 'l10n_fr_hr_payroll_webkit/report'
=== added file 'l10n_fr_hr_payroll_webkit/report/__init__.py'
--- l10n_fr_hr_payroll_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ l10n_fr_hr_payroll_webkit/report/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,25 @@
+#-*- coding:utf-8 -*-
+
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 fiche_paye
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'l10n_fr_hr_payroll_webkit/report/fiche_paye.mako'
--- l10n_fr_hr_payroll_webkit/report/fiche_paye.mako 1970-01-01 00:00:00 +0000
+++ l10n_fr_hr_payroll_webkit/report/fiche_paye.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,187 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+<body>
+ %for o in objects:
+ <table width="100%">
+ <tr>
+ <td width="45%">
+ <table width="100%">
+ <tr>
+ <td class="border" width="100%">
+ BULLETIN DE PAIE
+ </td>
+ </tr>
+ <tr>
+ <td width="100%" style:padding-bottom:0px;>
+ <h5><b> PAIE DU ${ formatLang(o.date_from, date=True) or ''} AU ${ formatLang(o.date_to, date=True) or '' }</b></h5>
+ </td>
+ </tr>
+ <tr>
+ <td class="list_table">
+ Matricule : <para style="padding-left:14px"> ${ o.employee_id.sinid or '_'}</para></br>
+ N° s.s : <para style="padding-left:25px">${ o.employee_id.ssnid or '_' }</para></br>
+ Emploi : <para style="padding-left:25px">${ o.contract_id.job_id.name or '_'}</para></br>
+ Qualif : <para style="padding-left:30px">${ o.contract_id.qualif or '_'}</para></br>
+ Niveau : <para style="padding-left:24px">${ o.contract_id.niveau or '_'}</para></br>
+ Coef : <para style="padding-left:35px">${ o.contract_id.coef or '_'}</para></br>
+ Entrée : <para style="padding-left:25px"> ${ o.contract_id.date_start or '_'} Sortie : ${o.contract_id.date_end or ''}</para></br>
+ ORG. S.S : <para style="padding-left:11px">${ o.employee_id.company_id.org_ss or '_' }</para>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td width="10%">
+ </td>
+ <td width="45%">
+ <table width="100%">
+ <tr>
+ <td class="list_table">
+ ${ o.employee_id.company_id.partner_id.title.name or ''} ${o.employee_id.company_id.name or '_'}</br>
+ ${ o.employee_id.company_id.street or '_'}</br>
+ ${ o.employee_id.company_id.street2 or ''}</br>
+ ${ o.employee_id.company_id.zip or '_'} ${ o.employee_id.company_id.city or ''}</br>
+ SIRET : ${o.employee_id.company_id.siret or '_'} APE : ${ o.employee_id.company_id.ape or '_' }
+ </td>
+ </tr>
+ <tr> <td width="100%"> </td></tr>
+ <tr>
+ <td class="td_f12" width="100%" style="padding-top:50px;">
+ ${ o.employee_id.name or '_'}</br>
+ ${ o.employee_id.address_home_id.street or '' }</br>
+ ${ o.employee_id.address_home_id.city or '' } ${ o.employee_id.address_home_id.zip or '' }</br>
+ ${ o.employee_id.address_home_id.country_id.name or '' }</br>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </br>
+ <table class="tr_border">
+ <tr>
+ <td width="50%">
+ <b>DESIGNATION</b>
+ </td>
+ <td width="8%">
+ <b>QUANTITE / BASE</b>
+ </td>
+ <td width="9%">
+ <b>TAUX</b>
+ </td>
+ <td width="8%">
+ <b>MONTANT</b>
+ </td>
+ <td width="15%" colspan="2">
+ <b>CHARGES PATRONALES</b>
+ </td>
+ </tr>
+ %for p in get_payslip_lines(o.line_ids):
+ <tr>
+ <td width="50%" align="left">
+ ${ p.code or '' } ${ p.name or '' }
+ </td>
+ <td width="8%">
+ %if p.amount_select <> 'fix' and p.amount_select <> 'percentage' or '' :
+ %if p.amount_select== 'percentage' or '':
+ ${ p.amount or '' }
+ %endif
+ %if p.amount_select== 'fix' or '':
+ ${ p.quantity or '' }
+ %endif
+ %endif
+ </td>
+ <td width="9%">
+ %if p.amount_select <> 'percentage' or '':
+ %if p.amount_select == 'percentage' or '':
+ ${ p.rate or '' }
+ %endif
+ %endif
+ </td>
+ <td width="8%">
+ ${ p.total or '' }
+ </td>
+ <td >
+ ${ get_employer_line(o, p) and get_employer_line(o, p).rate or ''}
+ </td>
+ <td >
+ ${ get_employer_line(o,p) and get_employer_line(o,p).total or '' }
+ </td>
+ </tr>
+ %endfor
+ </table>
+ </br>
+ <table width="100%" class="tr_border">
+ <tr>
+ <td style="border: 0px;text-align:left;font-weight: bold; font-size:10px; width:"40% ; " colspan="4">
+ Mode de reglement : ${ o.payment_mode or '' }</br>
+ Paye le :
+ </td>
+ <td style="border-bottom: 0px;"><b>
+ NET A PAYER </b>
+ </td>
+ <td style="border-bottom: 0px;"><b>
+ TOTAL CHARGES PATRONALES</b>
+ </td>
+ </tr>
+ <tr>
+ <td style="border: 0px;text-align:left;font-weight: bold; font-size:10px;padding-top:0px " width="40%" colspan="4">
+ Conv. Coll.: ${ o.employee_id.company_id.conv_coll or '' }
+ </td>
+ <td style="font-size:10px;text-align:right;paddind-bottom:0px;border-top: 0px;">
+ ${ get_total_by_rule_category(o, 'NET') }
+ </td>
+ <td style="font-size:10px;text-align:right;paddind-bottom:0px;border-top: 0px;">
+ ${ get_total_by_rule_category(o, 'COMP') }
+ </td>
+ </tr>
+ <tr>
+ <td width="16%" style="padding-top:0px;border-bottom: 0px">
+ <b>SALAIRE BRUT</b>
+ </td>
+ <td width="16%" style="padding-top:0px;border-bottom: 0px">
+ <b>TOTAL CHARGES SALARIALES</b>
+ </td>
+ <td width="16%" style="padding-top:0px;border-bottom: 0px">
+ <b>NET IMPOSABLE</b>
+ </td>
+ <td width="18%" style="padding-top:0px;border-bottom: 0px">
+ <b>PLAFOND S.S.</b>
+ </td>
+ <td width="16%" style="padding-top:0px;border-bottom: 0px">
+ </td>
+ <td width="18%" style="padding-top:0px;border-bottom: 0px">
+ <b>COUT GLOBAL SALARIE</b>
+ </td>
+ </tr>
+ <tr>
+ <td style="font-size:10px;text-align:right;paddind-bottom:0px;border-top: 0px;">
+ ${ get_total_by_rule_category(o, 'BRUT') }
+ </td>
+ <td style="font-size:10px;text-align:right;paddind-bottom:0px;border-top: 0px;">
+ ${ get_total_by_rule_category(o, 'SALC') }
+ </td>
+ <td style="font-size:10px;text-align:right;paddind-bottom:0px;border-top: 0px;">
+ ${ get_total_by_rule_category(o, 'C_IMP') }
+ </td>
+ <td style="font-size:10px;text-align:right;paddind-bottom:0px;border-top: 0px;">
+ ${ o.employee_id.company_id.plafond_secu or '' }
+ </td>
+ <td style="font-size:10px;text-align:right;paddind-bottom:0px;border-top: 0px;">
+ </td>
+ <td style="font-size:10px;text-align:right;paddind-bottom:0px;border-top: 0px;">
+ ${ get_total_by_rule_category(o, 'TOTAL') }
+ </td>
+ </tr>
+ </table>
+ </br>
+ </br>
+ <p class="font">DANS VOTRE INTERET ET POUR VOUS AIDER A FAIRE VALOIR VOS DROITS, CONSERVEZ CE BULLETIN DE PAIE SANS LIMITATION DE DUREE</p>
+ <p style="page-break-after:always"></p>
+ %endfor
+
+</body>
+</html>
\ No newline at end of file
=== added file 'l10n_fr_hr_payroll_webkit/report/fiche_paye.py'
--- l10n_fr_hr_payroll_webkit/report/fiche_paye.py 1970-01-01 00:00:00 +0000
+++ l10n_fr_hr_payroll_webkit/report/fiche_paye.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+##############################################################################
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp.report import report_sxw
+
+class fiche_paye_parser(report_sxw.rml_parse):
+
+ def __init__(self, cr, uid, name, context):
+ super(fiche_paye_parser, self).__init__(cr, uid, name, context)
+ self.localcontext.update({
+ 'get_payslip_lines': self.get_payslip_lines,
+ 'get_total_by_rule_category': self.get_total_by_rule_category,
+ 'get_employer_line': self.get_employer_line,
+ })
+
+ def get_payslip_lines(self, objs):
+ payslip_line = self.pool.get('hr.payslip.line')
+ res = []
+ ids = []
+ for item in objs:
+ if item.appears_on_payslip == True and not item.salary_rule_id.parent_rule_id :
+ ids.append(item.id)
+ if ids:
+ res = payslip_line.browse(self.cr, self.uid, ids)
+ return res
+
+
+ def get_total_by_rule_category(self, obj, code):
+ payslip_line = self.pool.get('hr.payslip.line')
+ rule_cate_obj = self.pool.get('hr.salary.rule.category')
+
+ cate_ids = rule_cate_obj.search(self.cr, self.uid, [('code', '=', code)])
+
+ category_total = 0
+ if cate_ids:
+ line_ids = payslip_line.search(self.cr, self.uid, [('slip_id', '=', obj.id),('category_id.id', '=', cate_ids[0] )])
+ for line in payslip_line.browse(self.cr, self.uid, line_ids):
+ category_total += line.total
+
+ return category_total
+
+
+ def get_employer_line(self, obj, parent_line):
+
+ payslip_line = self.pool.get('hr.payslip.line')
+
+ line_ids = payslip_line.search(self.cr, self.uid, [('slip_id', '=', obj.id), ('salary_rule_id.parent_rule_id.id', '=', parent_line.salary_rule_id.id )])
+ res = line_ids and payslip_line.browse(self.cr, self.uid, line_ids[0]) or False
+
+ return res
+
+
+report_sxw.report_sxw('report.fiche.paye.webkit', 'hr.payslip', 'l10n_fr_hr_payroll_webkit/report/fiche_paye.mako', parser=fiche_paye_parser)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added directory 'l10n_fr_webkit'
=== added file 'l10n_fr_webkit/__init__.py'
--- l10n_fr_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ l10n_fr_webkit/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 report
+import wizard
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'l10n_fr_webkit/__openerp__.py'
--- l10n_fr_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ l10n_fr_webkit/__openerp__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,39 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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/>.
+#
+############################################################################
+{
+ 'name': 'France - Accounting',
+ 'version': '1.1',
+ 'author': 'Serpent Consulting Services',
+ 'website': 'http://www.serpentcs.com',
+ 'category': 'Localization/Account Charts',
+ 'description': """
+This is the module to manage the accounting chart for France in OpenERP.
+========================================================================
+ It is conversion of rml report to Webkit Report.
+ """,
+ 'depends': ['l10n_fr', 'report_webkit'],
+ 'data': ['l10n_fr_report.xml'
+ ],
+ 'auto_install': False,
+ 'installable': True,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'l10n_fr_webkit/l10n_fr_report.xml'
--- l10n_fr_webkit/l10n_fr_report.xml 1970-01-01 00:00:00 +0000
+++ l10n_fr_webkit/l10n_fr_report.xml 2013-10-10 09:59:30 +0000
@@ -0,0 +1,76 @@
+<?xml version="1.0"?>
+<openerp>
+ <data>
+ <record id="bilan_header" model="ir.header_webkit">
+ <field name="footer_html"><![CDATA[ ]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</field>
+ <field name="html"><![CDATA[ ]]>
+ </field>
+ <field eval="15.0" name="margin_right"/>
+ <field eval="15.0" name="margin_left"/>
+ <field name="css"><![CDATA[
+ body {
+ font-family:Times New Roman;
+ font-size:11px;
+ }
+
+ .main {
+ background-color:#E6E6E6;
+ width:100%;
+ font-size:11px;
+ border:1px solid white;
+ padding-bottom:0px;
+ }
+ .main td{
+
+ padding-top:3px;
+ padding-bottom:3px;
+ padding-right:3px;
+ padding-left:3px;
+ }
+ .table {
+ padding-top:0px;
+ border:1px solid black;
+ width:100%;
+ font-size:9px;
+ border-collapse: collapse;
+ padding-bottom:0px;
+ }
+ .table td{
+ border:1px solid black;
+ padding-left:5px;
+ padding-top:3px;
+ padding-bottom:3px;
+ padding-right:3px;
+ }
+ ]]>
+ </field>
+ <field name="name">Bilan Header</field>
+ </record>
+
+ <report
+ id="bilan_report"
+ string="Bilan Report"
+ model="account.move.line"
+ name="l10n.fr.bilan.webkit"
+ file="l10n_fr_webkit/report/bilan_report.mako"
+ auto="False"
+ menu="False"
+ report_type="webkit"
+ webkit_header="bilan_header"
+ />
+
+ <report
+ id="compute_resultant"
+ string="Compute Resultant Report"
+ model="account.move.line"
+ name="l10n.fr.compute_resultant.webkit"
+ file="l10n_fr_webkit/report/compute_resultant_report.mako"
+ auto="False"
+ menu="False"
+ report_type="webkit"
+ webkit_header="bilan_header"
+ />
+ </data>
+</openerp>
\ No newline at end of file
=== added directory 'l10n_fr_webkit/report'
=== added file 'l10n_fr_webkit/report/__init__.py'
--- l10n_fr_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ l10n_fr_webkit/report/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,28 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 base_report
+import bilan_report
+import compute_resultant_report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'l10n_fr_webkit/report/base_report.py'
--- l10n_fr_webkit/report/base_report.py 1970-01-01 00:00:00 +0000
+++ l10n_fr_webkit/report/base_report.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,129 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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
+import math
+from openerp.report import report_sxw
+
+class base_report(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context=None):
+
+ super(base_report, self).__init__(cr, uid, name, context=context)
+ con = {}
+ self.localcontext.update({
+ 'time': time,
+ '_load': self._load,
+ '_get_variable': self._get_variable,
+ '_set_variable': self._set_variable,
+ '_get_end_date' : self._get_end_date,
+ '_abs':self._abs,
+ })
+ self.context = context
+
+ def _abs(self):
+ val=self.localcontext['bpcheck']
+ if math.fabs(val)<0.0001:
+ v = "Attention, pour que votre bilan soit correct, vous devez solder les comptes 120 ou 129 (Résultat de l'exercice précédant) dans un compte de report à nouveau (compte 110 ou 119) ou dans le compte 108. Renseignez vous sur votre structure juridique et son fonctionnement comptable."
+ return v
+
+ def _load(self, name, form):
+ fiscalyear = self.pool.get('account.fiscalyear').browse(self.cr, self.uid, form['fiscalyear_id'])
+ period_ids=self.pool.get('account.period').search(self.cr, self.uid, [('fiscalyear_id', '=', form['fiscalyear_id'])])
+
+ if period_ids:
+ self.cr.execute("SELECT MIN(date_start) AS date_start, MAX(date_stop) AS date_stop FROM account_period WHERE id = ANY(%s)", (period_ids,))
+ dates = self.cr.dictfetchall()
+ else:
+ dates = False
+ if dates:
+ self._set_variable('date_start', dates[0]['date_start'])
+ self._set_variable('date_stop', dates[0]['date_stop'])
+
+ self.cr.execute("SELECT l10n_fr_line.code,definition FROM l10n_fr_line LEFT JOIN l10n_fr_report ON l10n_fr_report.id=report_id WHERE l10n_fr_report.code=%s",(name,))
+ datas = self.cr.dictfetchall()
+ for line in datas:
+ self._load_accounts(form,line['code'],eval(line['definition']),fiscalyear,period_ids)
+
+ def _set_variable(self, variable, valeur):
+ self.localcontext.update({variable: valeur})
+
+ def _get_variable(self, variable):
+ if self.localcontext.get(variable):
+ return self.localcontext.get(variable)
+ else:
+ return 0.0
+
+ def _get_end_date(self):
+ return self.localcontext['date_stop']
+
+ def _load_accounts(self, form, code, definition, fiscalyear, period_ids):
+ accounts = {}
+ for x in definition['load']:
+ p = x.split(":")
+ accounts[p[1]] = [p[0],p[2]]
+ sum = 0.0
+ if fiscalyear.state != 'done' or not code.startswith('bpcheck'):
+ query_params = []
+ query_cond = "("
+ for account in accounts:
+ query_cond += "aa.code LIKE '" + account + "%%' OR "
+ query_cond = query_cond[:-4]+")"
+
+ if len(definition['except']) > 0:
+ query_cond = query_cond+" and ("
+ for account in definition['except']:
+ query_cond += "aa.code NOT LIKE '"+account+"%%' AND "
+ query_cond = query_cond[:-5]+")"
+
+ closed_cond = ""
+ if fiscalyear.state == 'done':
+ closed_cond=" AND (aml.move_id NOT IN (SELECT account_move.id as move_id FROM account_move WHERE period_id = ANY(%s) AND journal_id=(SELECT res_id FROM ir_model_data WHERE name='closing_journal' AND module='l10n_fr')) OR (aa.type != 'income' AND aa.type !='expense'))"
+ query_params.append(list(period_ids))
+
+ query = "SELECT aa.code AS code, SUM(debit) as debit, SUM(credit) as credit " \
+ " FROM account_move_line aml LEFT JOIN account_account aa ON aa.id=aml.account_id "\
+ " WHERE "+query_cond+closed_cond+" AND aml.state='valid' AND aml.period_id = ANY(%s) GROUP BY code"
+ query_params.append(list(period_ids))
+ self.cr.execute(query, query_params)
+
+ lines =self.cr.dictfetchall()
+ for line in lines:
+ for account in accounts:
+ if(line["code"].startswith(account)):
+ operator=accounts[account][0]
+ type=accounts[account][1]
+ value=0.0
+ if(type == "S"):
+ value=line["debit"]-line["credit"]
+ elif(type == "D"):
+ value=line["debit"]-line["credit"]
+ if(abs(value)<0.001): value=0.0
+ elif(type == "C"):
+ value=line["credit"]-line["debit"]
+ if(abs(value)<0.001): value=0.0
+ if(operator == '+'):
+ sum += value
+ else:
+ sum -= value
+ break
+ self._set_variable(code, sum)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'l10n_fr_webkit/report/bilan_report.mako'
--- l10n_fr_webkit/report/bilan_report.mako 1970-01-01 00:00:00 +0000
+++ l10n_fr_webkit/report/bilan_report.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,1440 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+<body>
+ </br></br></br></br>
+ ${ _load('bilan',data['form']) or ''}
+ <%
+ at1a=_get_variable('at1a')
+ at1b=_get_variable('at1b')
+ a = at1a+at1b
+ at2a=_get_variable('at2a')
+ at2b=_get_variable('at2b')
+ b = at2a + at2b
+ val=0.0
+ val1=0.0
+ valb=0.0
+ valb1=0.0
+ vala=_get_variable('at1')+_get_variable('at2')+_get_variable('bavar34')+_get_variable('bavar35')+_get_variable('bavar36')
+ for i in range(1,21):
+ val +=_get_variable('bavar'+str(i))
+ for i in range(21,34):
+ val1 +=_get_variable('bavar'+str(i))
+
+ bpval=0.0
+ for i in range(1,13):
+ bpval +=_get_variable('bpvar'+str(i))
+
+ bpval1=0.0
+ for i in range(15,23):
+ bpval +=_get_variable('bpvar'+str(i))
+
+ for i in range(2,21):
+ if i == 8 :
+ continue
+ if i == 14 :
+ continue;
+ else:
+ valb +=_get_variable('bavar'+str(i)+'b')
+
+ for i in range(21,31):
+ if i == 25 :
+ continue
+ if i == 28 :
+ continue;
+ else:
+ valb1 +=_get_variable('bavar'+str(i)+'b')
+
+ valpt=_get_variable('bpvar13')+_get_variable('bpvar14')
+ pt = bpval+valpt+bpval1+_get_variable('bpvar26')
+ %>
+ ${ _set_variable('at1a',val) or ''}
+ ${ _set_variable('at1b',valb) or ''}
+ ${ _set_variable('at1',a) or ''}
+ ${ _set_variable('at2a',val1) or ''}
+ ${ _set_variable('at2b',valb1) or ''}
+ ${ _set_variable('at2',b) or '' }
+ ${ _set_variable('actif',vala) or ''}
+ ${ _set_variable('pt1',bpval) or ''}
+ ${ _set_variable('pt2', valpt) or ''}
+ ${ _set_variable('pt3', bpval1) or ''}
+ ${ _set_variable('passif',pt) or ''}
+ <table class="main">
+ <tr>
+ <td width="18%" align="left">
+ <h2>${company.name}</h2> au ${time.strftime('%d-%m-%Y',time.strptime(_get_end_date(),'%Y-%m-%d'))}
+ </td>
+ <td width="62%" align="center" >
+ <h1>Bilan</h1>
+ </td>
+ <td width="20%" align="right" style="padding-bottom:30px;">
+ Imprimé le : ${ time.strftime('%d-%m-%Y') }
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" align="right">Tenue de Compte : ${ company.currency_id.name }</td>
+ </tr>
+ </table>
+ <h3>${_(" ACTIF")}</h3>
+ <table class="table">
+ <tr>
+ <td width="40%">
+
+ </td>
+ <td align="right" width="20%">
+ ${_("Brut")}
+ </td>
+ <td align="right" width="23%">
+ Amortissements et dépréciations
+ </td>
+ <td align="right" width="17%">
+ Net
+ </td>
+ </tr>
+ <tr>
+ <td width="40%">
+ <b><font face="Times-Roman" size="1.0">Capital souscrit - non appelé</font></b>
+ </td>
+ <td align="right" width="20%">
+ %if _get_variable('bavar1') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar1')}
+ %endif
+ </td>
+ <td align="right" width="23%">
+ </td>
+ <td align="right" width="17%">
+ %if _get_variable('bavar1') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar1')}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>ACTIF IMMOBILISÉ</b>
+ </td>
+ <td></td><td></td><td></td>
+ </tr>
+ <tr>
+ <td>
+ <b>IMMOBILISATIONS INCORPORELLES</b>
+ </td>
+ <td></td><td></td><td></td>
+ </tr>
+ <tr>
+ <td>
+ Frais d'établissement
+ </td>
+ <td align="right">
+ %if _get_variable('bavar2') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar2') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar2b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar2b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar2') + _get_variable('bavar2b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar2') + _get_variable('bavar2b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Frais de recherche et de développement</td>
+ <td align="right">
+ %if _get_variable('bavar3') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar3') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar3b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar3b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar3') + _get_variable('bavar3b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar3') + _get_variable('bavar3b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Concessions, brevets, licences,..., droits et valeurs similaires</td>
+ <td align="right">
+ %if _get_variable('bavar4') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar4') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar4b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar4b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar4') + _get_variable('bavar4b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar4') + _get_variable('bavar4b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Fonds commercial</td>
+ <td align="right">
+ %if _get_variable('bavar5') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar5') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar5b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar5b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar5') + _get_variable('bavar5b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar5') + _get_variable('bavar5b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Autres</td>
+ <td align="right">
+ %if _get_variable('bavar6') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar6') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar6b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar6b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar6') + _get_variable('bavar6b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar6') + _get_variable('bavar6b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Immobilisations incorporelles en cours</td>
+ <td align="right">
+ %if _get_variable('bavar7') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar7') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar7b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar7b')or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar7') + _get_variable('bavar7b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar7') + _get_variable('bavar7b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Avances et acomptes</td>
+ <td align="right">
+ %if _get_variable('bavar8') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar8') or ''}
+ %endif
+ </td>
+ <td align="right">
+ </td>
+ <td align="right">
+ %if _get_variable('bavar8') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar8') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>IMMOBILISATIONS CORPORELLES</b>
+ </td>
+ <td align="right">
+ </td>
+ <td align="right">
+ </td>
+ <td align="right">
+ </td>
+ </tr>
+ <tr>
+ <td>Terrains</td>
+ <td align="right">
+ %if _get_variable('bavar9') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar9') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar9b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar9b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar9') + _get_variable('bavar9b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar9') + _get_variable('bavar9b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Constructions</td>
+ <td align="right">
+ %if _get_variable('bavar10') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar10') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar10b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar10b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar10') + _get_variable('bavar10b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar10') + _get_variable('bavar10b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Installations techniques,matériel et outillage</td>
+ <td align="right">
+ %if _get_variable('bavar11') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar11') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar11b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar11b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar11') + _get_variable('bavar11b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar11') + _get_variable('bavar11b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Autres</td>
+ <td align="right">
+ %if _get_variable('bavar12') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar12') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar12b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar12b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar12') + _get_variable('bavar12b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar12') + _get_variable('bavar12b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Immobilisations corporelles en cours</td>
+ <td align="right">
+ %if _get_variable('bavar13') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar13') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar13b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar13b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar13') + _get_variable('bavar13b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar13') + _get_variable('bavar13b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Avances et acomptes</td>
+ <td align="right">
+ %if _get_variable('bavar14') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar14') or ''}
+ %endif
+ </td>
+ <td align="right">
+ </td>
+ <td align="right">
+ %if _get_variable('bavar14') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar14') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>IMMOBILISATIONS FINANCIÉRES</td>
+ <td align="right">
+ </td>
+ <td align="right">
+ </td>
+ <td align="right">
+ </td>
+ </tr>
+ <tr>
+ <td>Participations</td>
+ <td align="right">
+ %if _get_variable('bavar15') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar15') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar15b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar15b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar15') + _get_variable('bavar15b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar15') + _get_variable('bavar15b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Créances rattachées à des participations</td>
+ <td align="right">
+ %if _get_variable('bavar16') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar16') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar16b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar16b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar16') + _get_variable('bavar16b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar16') + _get_variable('bavar16b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Titres immobilisés de l'activité de portefeuille</td>
+ <td align="right">
+ %if _get_variable('bavar17') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar17') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar17b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar17b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar17') + _get_variable('bavar17b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar17') + _get_variable('bavar17b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Autres titres immobilisés</td>
+ <td align="right">
+ %if _get_variable('bavar18') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar18') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar18b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar18b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar18') + _get_variable('bavar18b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar18') + _get_variable('bavar18b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Prêts</td>
+ <td align="right">
+ %if _get_variable('bavar19') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar19') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar19b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar19b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar19') + _get_variable('bavar19b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar19') + _get_variable('bavar19b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Autres</td>
+ <td align="right">
+ %if _get_variable('bavar20') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar20') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar20b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar20b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar20') + _get_variable('bavar20b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar20') + _get_variable('bavar20b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td align="right"><b>TOTAL I</b></td>
+ <td align="right">
+ %if _get_variable('at1a') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('at1a') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-at1b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-at1b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('at1') + _get_variable('at1') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('at1') + _get_variable('at1') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>ACTIF CIRCULANT</b>
+ </td>
+ <td></td><td></td><td></td>
+ </tr>
+ <tr>
+ <td>
+ <b>STOCK EN COURS</b>
+ </td>
+ <td></td><td></td><td></td>
+ </tr>
+ <tr>
+ <td>Matières premières et autres approvisionnements</td>
+ <td align="right">
+ %if _get_variable('bavar21') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar21') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar21b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar21b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar21') + _get_variable('bavar21b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar21') + _get_variable('bavar21b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>En-cours de production [biens et services]</td>
+ <td align="right">
+ %if _get_variable('bavar22') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar22') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar22b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar22b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar22') + _get_variable('bavar22b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar22') + _get_variable('bavar22b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Produits intermédiaires et finis</td>
+ <td align="right">
+ %if _get_variable('bavar23') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar23') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar23b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar23b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar23') + _get_variable('bavar23b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar23') + _get_variable('bavar23b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Marchandises</td>
+ <td align="right">
+ %if _get_variable('bavar24') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar24') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar24b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar24b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar24') + _get_variable('bavar24b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar24') + _get_variable('bavar24b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Avances et acomptes versés sur commandes</td>
+ <td align="right">
+ %if _get_variable('bavar25') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar25') or ''}
+ %endif
+ </td>
+ <td align="right">
+ </td>
+ <td align="right">
+ %if _get_variable('bavar25') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar25') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>CRÉANCES</b>
+ </td>
+ <td></td><td></td><td></td>
+ </tr>
+ <tr>
+ <td>Créances clients et comptes rattachés</td>
+ <td align="right">
+ %if _get_variable('bavar26') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar26') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar26b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar26b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar26') + _get_variable('bavar26b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar26') + _get_variable('bavar26b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Autres</td>
+ <td align="right">
+ %if _get_variable('bavar27') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar27') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar27b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar27b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar27') + _get_variable('bavar27b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar27') + _get_variable('bavar27b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Avances et acomptes versés sur commandes</td>
+ <td align="right">
+ %if _get_variable('bavar28') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar28') or ''}
+ %endif
+ </td>
+ <td align="right">
+ </td>
+ <td align="right">
+ %if _get_variable('bavar28') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar28') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>VALEURS MOBILIÈRES DE PLACEMENT</b>
+ </td>
+ <td></td><td></td><td></td>
+ </tr>
+ <tr>
+ <td >Actions propres</td>
+ <td align="right">
+ %if _get_variable('bavar29') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar29') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar29b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar29b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar29') + _get_variable('bavar29b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar29') + _get_variable('bavar29b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Autres titres</td>
+ <td align="right">
+ %if _get_variable('bavar30') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar30') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-bavar30b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-bavar30b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('bavar30') + _get_variable('bavar30b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar30') + _get_variable('bavar30b') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td >Instruments de trésorerie</td>
+ <td align="right">
+ %if _get_variable('bavar31') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar31') or ''}
+ %endif
+ </td>
+ <td align="right">
+ </td>
+ <td align="right">
+ %if _get_variable('bavar31') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar31') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Disponibilités</td>
+ <td align="right">
+ %if _get_variable('bavar32') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar32') or ''}
+ %endif
+ </td>
+ <td align="right">
+ </td>
+ <td align="right">
+ %if _get_variable('bavar32') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar32') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>Charges constatés d'avance</td>
+ <td align="right">
+ %if _get_variable('bavar33') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar33') or ''}
+ %endif
+ </td>
+ <td align="right">
+ </td>
+ <td align="right">
+ %if _get_variable('bavar33') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar33') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td align="right"><b>TOTAL II</b></td>
+ <td align="right">
+ %if _get_variable('at2a') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('at2a') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('-at2b') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('-at2b') or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('at2') + _get_variable('at2') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('at2') + _get_variable('at2') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td align="right">Charges à répartir sur plusieurs exercices( III )</td>
+ <td align="right">
+ %if _get_variable('bavar34') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar34') or ''}
+ %endif
+ </td>
+ <td align="right">
+ </td>
+ <td align="right">
+ %if _get_variable('bavar34') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar34') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td align="right">Primes de remboursement des emprunts( IV )</td>
+ <td align="right">
+ %if _get_variable('bavar35') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar35') or ''}
+ %endif
+ </td>
+ <td align="right">
+ </td>
+ <td align="right">
+ %if _get_variable('bavar35') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar35') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td align="right">Écarts de conversion actif( V )</td>
+ <td align="right">
+ %if _get_variable('bavar36') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar36') or ''}
+ %endif
+ </td>
+ <td align="right">
+ </td>
+ <td align="right">
+ %if _get_variable('bavar36') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bavar36') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td align="right"><b>TOTAL ACTIF ( I + II + III + IV + V )</b></td>
+ <td align="right">
+ <%
+ h2=_get_variable('at1a')+_get_variable('at2a')
+ %>
+ %if h2 == 0.0:
+ ${}
+ %else:
+ ${h2 or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if ( (_get_variable('at1a'))+(_get_variable('at2a')) )== 0.0:
+ ${}
+ %else:
+ - ${( (_get_variable('at1a')) + (_get_variable('at2a')) ) or ''}
+ %endif
+ </td>
+ <td align="right">
+ %if _get_variable('actif') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('actif') or ''}
+ %endif
+ </td>
+ </tr>
+ </table>
+ <h3>${_(" PASSIF")}</h3>
+ <table class="table">
+ <tr>
+ <td width="45%">
+ <b>CAPITAUX PROPRES</b>
+ </td>
+ <td width="55%" align="right">
+ </td>
+ </tr>
+ <tr>
+ <td width="45%">
+ Capital [dont versé...]
+ </td>
+ <td width="55%" align="right">
+ %if _get_variable('bpvar1') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar1') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Primes d'émission, de fusion, d'apport
+ </td>
+ <td width="55%" align="right">
+ %if _get_variable('bpvar2') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar2') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Écarts de réévaluation
+ </td>
+ <td width="55%" align="right">
+ %if _get_variable('bpvar3') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar3') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Écart d'équivalence
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar4') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar4') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>RÉSERVES</b>
+ </td>
+ <td align="right">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Réserve légale
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar5') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar5') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Réserves statutaires ou contractuelles
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar6') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar6') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Réserves réglementées
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar7') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar7') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Autres réserves
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar8') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar8') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Report à nouveau
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar9') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar9') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>RÉSULTAT DE L'EXERCICE [bénéfice ou perte]</b>
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar10') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar10') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Subventions d'investissement
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar11') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar11') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Provisions réglementées
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar12') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar12') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ <b>TOTAL I</b>
+ </td>
+ <td align="right">
+ ${_get_variable('pt1') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>PROVISIONS</b>
+ </td>
+ <td align="right">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Provisions pour risques
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar13') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar13') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Provisions pour charges
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar14') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar14') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ <b>TOTAL II</b>
+ </td>
+ <td align="right">
+ %if _get_variable('pt2') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('pt2') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>DETTES</b>
+ </td>
+ <td align="right">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Emprunts obligataires convertibles
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar15') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar15') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Autres emprunts obligataires
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar16') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar16') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Emprunts et dettes auprès des établissements de crédit
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar17') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar17') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Emprunts et dettes financières diverses
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar18') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar18') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Avances et acomptes reçus sur commandes en cours
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar19') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar19') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Dettes fournisseurs et comptes rattachés
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar20') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar20') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Dettes fiscales et sociales
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar21') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar21') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Dettes sur immobilisations et comptes rattachés
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar22') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar22') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Autres dettes
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar23') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar23') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Instruments de trésorerie
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar24') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar24') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Produits constatés d'avance
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar25') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar25') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ <b>TOTAL III</b>
+ </td>
+ <td align="right">
+ %if _get_variable('pt3') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('pt3') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ Écarts de conversion passif ( IV )
+ </td>
+ <td align="right">
+ %if _get_variable('bpvar26') == 0.0:
+ ${}
+ %else:
+ ${_get_variable('bpvar26') or ''}
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ <b>TOTAL GÉNÉRAL (I + II + III + IV)</b>
+ </td>
+ <td align="right">
+ ${_get_variable('passif') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ <b>ACTIF - PASSIF</b>
+ </td>
+ <%
+ ans=round(((_get_variable('actif')) - (_get_variable('passif'))) ,2)
+
+ %>
+ <td align="right">
+ ${ans}
+ </td>
+ </tr>
+ </table>
+ </br>
+ ${_abs()}
+</body>
+</html>
\ No newline at end of file
=== added file 'l10n_fr_webkit/report/bilan_report.py'
--- l10n_fr_webkit/report/bilan_report.py 1970-01-01 00:00:00 +0000
+++ l10n_fr_webkit/report/bilan_report.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 base_report
+from openerp.report import report_sxw
+
+class bilan(base_report.base_report):
+ def __init__(self, cr, uid, name, context):
+ super(bilan, self).__init__(cr, uid, name, context)
+
+report_sxw.report_sxw('report.l10n.fr.bilan.webkit', 'account.move.line','addons/l10n_fr_webkit/report/bilan_report.mako', parser=bilan, header=False)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'l10n_fr_webkit/report/compute_resultant_report.mako'
--- l10n_fr_webkit/report/compute_resultant_report.mako 1970-01-01 00:00:00 +0000
+++ l10n_fr_webkit/report/compute_resultant_report.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,564 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+<body>
+ </br></br></br>
+ ${ _load('cdr',data['form']) or ''}
+ <%
+ val = 0.0
+ for i in range(1,16):
+ val +=_get_variable('cdrc'+str(i))
+
+ val1 = 0.0
+ for i in range(17,21):
+ val1 +=_get_variable('cdrc'+str(i))
+
+ val2 = 0.0
+ for i in range(21,24):
+ val2 +=_get_variable('cdrc'+str(i))
+
+ char = val+_get_variable('cdrc16')+val2+val2+_get_variable('cdrc24')+_get_variable('cdrc25')
+
+ v = _get_variable('cdrp1')+_get_variable('cdrp2')
+
+ v1 = 0.0
+ for i in range(3,8):
+ v1 +=_get_variable('cdrp'+str(i))
+
+ v3=v+v1
+
+ v4=0.0
+ for i in range(9,15):
+ v4 +=_get_variable('cdrp'+str(i))
+
+ v5= _get_variable('cdrp15')+_get_variable('cdrp16')+_get_variable('cdrp17')
+
+ pro = v3 + _get_variable('cdrp8')+v4+v5
+ %>
+
+ ${(_set_variable('ct1', val)) or ''}
+ ${(_set_variable('ct3',val1)) or ''}
+ ${(_set_variable('ct4',val2)) or ''}
+ ${(_set_variable('charges',char)) or ''}
+ ${(_set_variable('pta',v)) or ''}
+ ${(_set_variable('ptb', v1)) or ''}
+ ${(_set_variable('pt1', v3)) or ''}
+ ${(_set_variable('pt3',v4 )) or ''}
+ ${(_set_variable('pt4',v5 )) or ''}
+ ${(_set_variable('produits',pro )) or ''}
+
+ <table class="main">
+ <tr>
+ <td width="30%" align="left">
+ <h2>${company.name}</h2>
+ période du ${time.strftime('%d-%m-%Y',time.strptime((_get_variable('date_start')),'%Y-%m-%d'))}
+ au ${time.strftime('%d-%m-%Y',time.strptime((_get_variable('date_stop')),'%Y-%m-%d'))}
+ </td>
+ <td width="50%" align="center" >
+ <h1>Compte de résultat</h1>
+ </td>
+ <td width="20%" align="right" style="padding-bottom:30px;">
+ Imprimé le : ${ time.strftime('%d-%m-%Y') }
+ </td>
+ </tr>
+ <tr>
+ <td colspan="3" align="right">Tenue de Compte : ${ company.currency_id.name }</td>
+ </tr>
+ </table>
+ </br>
+ </br>
+ <table class="table">
+ <tr>
+ <td width="70%" align="center" style="font-size:10px">
+ <b>CHARGES ( hors taxes )</b>
+ </td>
+ <td width="30%" align="right"></td>
+ </tr>
+ <tr>
+ <td style="font-size:11px">
+ <b>CHARGES D'EXPLOITATION</b>
+ </td>
+ <td align="right"></td>
+ </tr>
+ <tr>
+ <td>
+ Achat de marchandises
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc1') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Variation des stocks
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc2') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Achats de matières premières et autres approvisionnements
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc3') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Variation des stocks
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc4') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Autres achats et charges externes
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc5') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Redevances de crédit-bail mobilier
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc6') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Redevances de crédit-bail immobilier
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc7') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Impôts, taxes et versements assimilés
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc8') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Salaires et traitements
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc9') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Charges sociales
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc10') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Charges sociales
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc10') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Charges sociales
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc10') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Dotation aux amortissements et aux dépréciations
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc10') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Sur immobilisations : dotations aux amortissements
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc11') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Sur immobilisations : dotations aux dépréciations
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc12') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Sur actif circulant : dotations aux dépréciations
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc13') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Dotations aux provisions
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc14') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Autres charges
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc15') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ <b>TOTAL I</b>
+ </td>
+ <td align="right">
+ ${_get_variable('ct1') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>Quotes-parts de résultat sur opérations faites en commun ( II )</b>
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc16') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td style="font-size:11px">
+ <b>CHARGES FINANCIÈRES</b>
+ </td>
+ <td align="right">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Dotations aux amortissements, aux dépréciations et aux provisions
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc17') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Intérêts et charges assimilées
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc18') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Différences négatives de change
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc19') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ Charges nettes sur cessions de valeurs mobilières de placement
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc20') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td align="right">
+ <b>TOTAL III</b>
+ </td>
+ <td align="right">
+ ${_get_variable('ct3') or ''}
+ </td>
+ </tr>
+
+ <tr>
+ <td style="font-size:11px">
+ <b>CHARGES EXCEPTIONNELLES</b>
+ </td>
+ <td align="right">
+ </td>
+ </tr>
+ <tr>
+ <td>Sur opérations de gestionDotations aux provisions
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc21') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>Sur opérations en capital
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc22') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>Dotations aux amortissements, aux dépréciations et aux provisions
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc23') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td align="right"><b>TOTAL IV</b>
+ </td>
+ <td align="right">
+ ${_get_variable('ct4') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td><b>Participation des salariés aux résultats ( V )</b>
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc24') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td><b>Impôts sur les bénéfices ( VI )</b>
+ </td>
+ <td align="right">
+ ${_get_variable('cdrc25') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td align="right"><b>TOTAL CHARGES ( I + II + III + IV+ V+ VI )</b>
+ </td>
+ <td align="right">
+ ${_get_variable('charges') or ''}
+ </td>
+ </tr>
+ </table>
+ </br>
+ </br></br></br></br>
+ </br></br></br></br>
+ </br></br></br></br>
+ </br></br></br></br>
+ </br></br></br>
+ <table class="table">
+ <tr>
+ <td align="center" width="70%" style="font-size:10px"><b>PRODUITS (hors taxes)</b>
+ </td>
+ <td align="right" width="30%">
+ </td>
+ </tr>
+ <tr>
+ <td style="font-size:11px"><b>PRODUITS D'EXPLOITATION</b>
+ </td>
+ <td align="right">
+ </td>
+ </tr>
+ <tr>
+ <td>Vente de marchandises
+ </td>
+ <td align="right">
+ ${_get_variable('cdrp1') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>Production vendue [biens et services]
+ </td>
+ <td align="right">
+ ${_get_variable('cdrp2') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td><b>Sous-total A - Montant net du chiffre d'affaires</b>
+ </td>
+ <td align="right">
+ ${_get_variable('pta') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>Production stockée
+ </td>
+ <td align="right">
+ ${_get_variable('cdrp3') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>Production immobilisée
+ </td>
+ <td align="right">
+ ${_get_variable('cdrp4') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>Subventions d'exploitation
+ </td>
+ <td align="right">
+ ${_get_variable('cdrp5') or ''}
+ </td>
+ </tr>
+
+ <tr>
+ <td>Reprises sur provisions, dépréciations (et amortissements) et transferts de charges
+ </td>
+ <td align="right">
+ ${_get_variable('cdrp6') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>Autres produits
+ </td>
+ <td align="right">
+ ${_get_variable('cdrp7') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td><b>Sous-total B</b>
+ </td>
+ <td align="right">
+ ${_get_variable('ptb') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td align="right"><b>TOTAL I ( A + B )</b>
+ </td>
+ <td align="right">
+ ${_get_variable('pt1') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td><b>Quotes-parts de résultat sur opérations faites en commun (II)</b>
+ </td>
+ <td align="right">
+ ${_get_variable('cdrp8') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td><b>PRODUITS FINANCIERS</b>
+ </td>
+ <td align="right">
+ </td>
+ </tr>
+ <tr>
+ <td>Quotes-parts de résultat sur opérations faites en commun (II)
+ </td>
+ <td align="right">
+ ${_get_variable('cdrp8') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>De participation
+ </td>
+ <td align="right">
+ ${_get_variable('cdrp9') or ''}
+ </td>
+ </tr>
+
+ <tr>
+ <td>D'autres valeurs mobilières et créances de l'actif immobilisé
+ </td>
+ <td align="right">
+ ${_get_variable('cdrp10') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>Autres intérêts et produits assimilés
+ </td>
+ <td align="right">
+ ${_get_variable('cdrp11') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>Reprises sur provisions, dépréciations et transferts de charges
+ </td>
+ <td align="right">
+ ${_get_variable('cdrp12') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>Différences positives de change
+ </td>
+ <td align="right">
+ ${_get_variable('cdrp13') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>Produits nets sur cessions de valeurs mobilières de placement
+ </td>
+ <td align="right">
+ ${_get_variable('cdrp14') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td align="right"><b>TOTAL III</b>
+ </td>
+ <td align="right">
+ ${_get_variable('pt3') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td><b>PRODUITS EXCEPTIONNELS</b>
+ </td>
+ <td align="right">
+ </td>
+ </tr>
+ <tr>
+ <td>Sur opérations de gestion
+ </td>
+ <td align="right">
+ ${_get_variable('cdrp15') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>Sur opérations en capital
+ </td>
+ <td align="right">
+ ${_get_variable('cdrp16') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td>Reprises sur provisions, dépréciations et transferts de charges
+ </td>
+ <td align="right">
+ ${_get_variable('cdrp17') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td align="right"><b>TOTAL IV</b>
+ </td>
+ <td align="right">
+ ${_get_variable('pt4') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td align="right"><b>TOTAL DES PRODUITS ( I + II + III + IV )</b>
+ </td>
+ <td align="right">
+ ${_get_variable('produits') or ''}
+ </td>
+ </tr>
+ <tr>
+ <td align="right"><b>PRODUITS - CHARGES</b>
+ </td>
+ <%
+ ans=( (_get_variable('produits')) - (_get_variable('charges')) )
+ %>
+ <td align="right">
+ ${ans}
+ </td>
+ </tr>
+ </table>
+</body>
+</html>
\ No newline at end of file
=== added file 'l10n_fr_webkit/report/compute_resultant_report.py'
--- l10n_fr_webkit/report/compute_resultant_report.py 1970-01-01 00:00:00 +0000
+++ l10n_fr_webkit/report/compute_resultant_report.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,32 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 base_report
+from openerp.report import report_sxw
+
+class cdr(base_report.base_report):
+ def __init__(self, cr, uid, name, context):
+ super(cdr, self).__init__(cr, uid, name, context)
+
+report_sxw.report_sxw('report.l10n.fr.compute_resultant.webkit', 'account.move.line','addons/l10n_fr_webkit/report/compute_resultant_report.mako', parser=cdr, header=False)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added directory 'l10n_fr_webkit/wizard'
=== added file 'l10n_fr_webkit/wizard/__init__.py'
--- l10n_fr_webkit/wizard/__init__.py 1970-01-01 00:00:00 +0000
+++ l10n_fr_webkit/wizard/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 fr_report_bilan
+import fr_report_compute_resultant
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'l10n_fr_webkit/wizard/fr_report_bilan.py'
--- l10n_fr_webkit/wizard/fr_report_bilan.py 1970-01-01 00:00:00 +0000
+++ l10n_fr_webkit/wizard/fr_report_bilan.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp.osv import fields, osv
+
+class account_bilan_report(osv.osv_memory):
+ _inherit = 'account.bilan.report'
+
+ def print_bilan_report(self, cr, uid, ids, context=None):
+ active_ids = context.get('active_ids', [])
+ data = {}
+ data['form'] = {}
+ data['ids'] = active_ids
+ data['form']['fiscalyear_id'] = self.browse(cr, uid, ids)[0].fiscalyear_id.id
+ return {'type': 'ir.actions.report.xml', 'report_name': 'l10n.fr.bilan.webkit', 'datas': data}
+
+account_bilan_report()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'l10n_fr_webkit/wizard/fr_report_compute_resultant.py'
--- l10n_fr_webkit/wizard/fr_report_compute_resultant.py 1970-01-01 00:00:00 +0000
+++ l10n_fr_webkit/wizard/fr_report_compute_resultant.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,37 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp.osv import fields, osv
+
+class account_cdr_report(osv.osv_memory):
+ _inherit = 'account.cdr.report'
+
+ def print_cdr_report(self, cr, uid, ids, context=None):
+ active_ids = context.get('active_ids', [])
+ data = {}
+ data['form'] = {}
+ data['ids'] = active_ids
+ data['form']['fiscalyear_id'] = self.browse(cr, uid, ids)[0].fiscalyear_id.id
+ return { 'type': 'ir.actions.report.xml', 'report_name': 'l10n.fr.compute_resultant.webkit', 'datas': data}
+
+account_cdr_report()
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added directory 'lunch_webkit'
=== added file 'lunch_webkit/__init__.py'
--- lunch_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ lunch_webkit/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,22 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 report
\ No newline at end of file
=== added file 'lunch_webkit/__openerp__.py'
--- lunch_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ lunch_webkit/__openerp__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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/>.
+#
+############################################################################
+
+
+{
+ 'name': 'Lunch Orders Webkit',
+ 'author': 'Serpent Consulting Services',
+ 'version': '1.1',
+ 'depends': ['report_webkit','lunch'],
+ 'category' : 'Tools',
+ 'summary': 'Lunch Order, Meal, Food',
+ 'description': """
+The base module to manage lunch.
+================================
+ It is conversion of rml report to Webkit Report.
+
+ """,
+ 'data': [
+ 'lunch_report.xml',
+ ],
+ 'installable': True,
+ 'application' : True,
+ 'auto_install': False,
+}
=== added file 'lunch_webkit/lunch_report.xml'
--- lunch_webkit/lunch_report.xml 1970-01-01 00:00:00 +0000
+++ lunch_webkit/lunch_report.xml 2013-10-10 09:59:30 +0000
@@ -0,0 +1,152 @@
+<?xml version="1.0"?>
+<openerp>
+ <data>
+ <record id="lunch_header" 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>
+ <style type="text/css">
+
+ ${css}
+ </style>
+ </head>
+ <body style="border:0; margin: 0;" onload="subst()">
+ <table class="header" style="border-top: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:center;font-size:12;" >${ company.rml_footer }</td>
+ </tr>
+ <tr >
+ <td style="text-align:center;font-size:12;" >Contact : ${ user.name }</td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+ </html>
+ ]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</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()">
+ <table class="header">
+ <tr >
+ <td style="text-align:left;font-size:12;" width="20%">${ helper.embed_image('png',company.logo,200,50)|n }</td>
+ <td style="text-align:right;font-size:12;" width="80%"></br></br>${ company.rml_header1 }</td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+ <p style="text-align:left;font-size:12;">${company.name}</p>
+ </html>]]>
+ </field>
+ <field eval="25.0" name="margin_top"/>
+ <field eval="25.0" name="margin_bottom"/>
+ <field name="css"><![CDATA[
+
+ body, table, td, span, div {
+ font-family: Helvetica, Arial;
+ }
+
+ body {
+ font-family:Arial;
+ font-size:9;
+
+ }
+ .header {
+ margin-left:0;
+ text-align:left;
+ width:300px;
+ font-size:12;
+ border-bottom: 1px solid black;
+ width: 100%;
+ }
+ .title {
+ font-size:16;
+ font-weight: bold;
+ }
+ .top{
+ border-top: 1px solid black;
+ }
+ .td_line_grey{
+ border-bottom: 1px solid #ccc !important;
+ text-align:left;
+ font-size:12;"
+ }
+
+ .basic_table{
+ text-align:center;
+ border:1px solid lightGrey;
+ border-collapse: collapse;
+ }
+ .basic_table td {
+ border:1px solid lightGrey;
+ font-size:12;
+
+
+ }
+
+ .list_table {
+
+ text-align:left;
+ border-bottom:1px solid black;
+ font-size:12px;
+ font-weight: bold;
+
+ }
+ .tr_bottom_line_dark_grey{
+ border-bottom: thin solid grey;
+ width:100%;
+ }
+ .tr_bottom_line_light_grey{
+ border-bottom: thin solid #CCCCCC;
+ width:100%;
+ }
+ .td_f12{
+ font-size:12px;
+ }
+
+ ]]>
+ </field>
+ <field name="name">Lunch Webkit Header</field>
+ </record>
+
+ <report
+ id="report_lunch_order"
+ string="Lunch Order"
+ model="lunch.order.line"
+ name="lunch.order.line.webkit"
+ file="lunch_webkit/report/order.mako"
+ auto="False"
+ report_type="webkit"
+ webkit_header="lunch_header"
+ />
+ </data>
+</openerp>
=== added directory 'lunch_webkit/report'
=== added file 'lunch_webkit/report/__init__.py'
--- lunch_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ lunch_webkit/report/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 order
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'lunch_webkit/report/order.mako'
--- lunch_webkit/report/order.mako 1970-01-01 00:00:00 +0000
+++ lunch_webkit/report/order.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,119 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+<body>
+ </br>
+ </br>
+ </br>
+ <table cellspacing="0" width="100%">
+ <tr>
+ <td width="80%" >
+ <table class="td_f12 tr_bottom_line_dark" width="40%" >
+ <tr>
+ <td width="25%">Phone</td>
+ <td>: ${ company.phone or ''}</td>
+ </tr>
+ <tr>
+ <td>Mail</td>
+ <td>: ${ company.email or '' }</td>
+ </tr>
+ </table>
+ </td>
+ <td width="20%">
+ </td>
+ </tr>
+ <tr>
+ <td width="80%"></td>
+ <td width="20%" class="td_f12">
+ ${user.name} </br>
+ ${user.login}</br>
+ ${user.email} </br>
+ </td>
+ </tr>
+ </table>
+ </br>
+ <h1><b>Lunch Order</b></h1>
+
+ <table width="100%" class="list_table">
+ <tr>
+ <td width="30%">
+ ${_('Name/Date')}
+ </td>
+ <td width="25%">
+ ${_('Order')}
+ </td>
+ <td width="25%">
+ ${_('Description')}
+ </td>
+ <td width="20%" align="right">
+ ${_('Unit Price')}
+ </td>
+ </tr>
+ </table>
+ %for o in get_users(objects):
+ <table width="100%" >
+ <tr>
+ <td width="60%" style="border-bottom: 1px solid grey ; font-size:12px;font-weight: bold;">
+ ${ o.name }
+ </td>
+ <td width="20%">
+
+ </td>
+ <td width="20%" align="right" style=" font-size:12px;font-weight: bold;">
+
+ <u>${ formatLang(get_total(o,objects)) } ${ (o.company_id and o.company_id.currency_id and o.company_id.currency_id.symbol) or '' }</u>
+
+ </td>
+ </tr>
+ </table>
+ %for lines in get_lines(o,objects):
+ <table width="100%" class="td_line_grey">
+ <tr>
+ <td width="30%" style=" padding-left:10px;">
+ ${ formatLang(lines.date,date=True)}
+ </td>
+ <td width="25%">
+ ${ (lines.product_id and lines.product_id.name) or '' }
+ </td>
+ <td width="25%">
+ ${ lines.note}
+ </td>
+ <td width="20%" align="right" >
+ ${ lines.price } ${ (o.company_id and o.company_id.currency_id and o.company_id.currency_id.symbol) or '' }
+ </td>
+ </tr>
+ </table>
+ %endfor
+ %endfor
+
+ <table width="100%">
+ <tr>
+ <td width="30%" >
+
+ </td>
+ <td width="30%" >
+ </td>
+ <td width="20%" >
+
+ </td>
+ <td width="20%" class="top" >
+ <table width="100%">
+ <tr>
+ <td width="50%">
+ Total:
+ </td>
+ <td width="50%" align="right">
+ ${ formatLang(get_nettotal()) } ${ (o.company_id and o.company_id.currency_id and o.company_id.currency_id.symbol) or '' }
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ <p style="page-break-after:always">
+ </p>
+
+</body>
=== added file 'lunch_webkit/report/order.py'
--- lunch_webkit/report/order.py 1970-01-01 00:00:00 +0000
+++ lunch_webkit/report/order.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,79 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp.report import report_sxw
+from openerp.osv import osv
+
+
+class order(report_sxw.rml_parse):
+
+ def get_lines(self, user,objects):
+ lines=[]
+ for obj in objects:
+ if user.id==obj.user_id.id:
+ lines.append(obj)
+ return lines
+
+ def get_total(self, user,objects):
+ lines=[]
+ for obj in objects:
+ if user.id==obj.user_id.id:
+ lines.append(obj)
+ total=0.0
+ for line in lines:
+ total+=line.price
+ self.net_total+=total
+ return total
+
+ def get_nettotal(self):
+ return self.net_total
+
+ def get_users(self, objects):
+ users=[]
+ for obj in objects:
+ if obj.user_id not in users:
+ users.append(obj.user_id)
+ return users
+
+ def get_note(self,objects):
+ notes=[]
+ for obj in objects:
+ notes.append(obj.note)
+ return notes
+
+ def __init__(self, cr, uid, name, context):
+ super(order, self).__init__(cr, uid, name, context)
+ self.net_total=0.0
+ self.localcontext.update({
+ 'time': time,
+ 'get_lines': self.get_lines,
+ 'get_users': self.get_users,
+ 'get_total': self.get_total,
+ 'get_nettotal': self.get_nettotal,
+ 'get_note': self.get_note,
+ })
+
+report_sxw.report_sxw('report.lunch.order.line.webkit', 'lunch.order.line',
+ 'lunch_webkit/report/order.mako',parser=order, header='external')
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added directory 'mrp_operations_webkit'
=== added file 'mrp_operations_webkit/__init__.py'
--- mrp_operations_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ mrp_operations_webkit/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 report
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'mrp_operations_webkit/__openerp__.py'
--- mrp_operations_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ mrp_operations_webkit/__openerp__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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/>.
+#
+############################################################################
+
+
+{
+ 'name': 'Manufacturing Operations',
+ 'version': '1.0',
+ 'category': 'Manufacturing',
+ 'description': """
+This module adds state, date_start, date_stop in manufacturing order operation lines (in the 'Work Orders' tab).
+================================================================================================================
+ It is conversion of rml report to Webkit Report.
+ """,
+ 'author': 'Serpent Consulting Services',
+ 'website': 'http://www.serpentcs.com',
+ 'depends': ['mrp_operations','report_webkit'],
+ 'data': [
+ 'mrp_operations_report.xml',
+ ],
+ 'installable': True,
+ 'auto_install': False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'mrp_operations_webkit/mrp_operations_report.xml'
--- mrp_operations_webkit/mrp_operations_report.xml 1970-01-01 00:00:00 +0000
+++ mrp_operations_webkit/mrp_operations_report.xml 2013-10-10 09:59:30 +0000
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<openerp>
+ <data>
+ <record id="mrp_operation_header" model="ir.header_webkit">
+ <field name="footer_html"><![CDATA[]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</field>
+ <field name="html"><![CDATA[]]>
+ </field>
+ <field eval="15.0" name="margin_top"/>
+ <field eval="5.0" name="margin_bottom"/>
+ <field name="css"><![CDATA[ ]]>
+ </field>
+ <field name="name">MRP webkit header</field>
+ </record>
+ <report
+ id="report_wc_barcode"
+ string="Work Centers Barcode"
+ model="mrp.workcenter"
+ name="mrp.wc.barcode.webkit"
+ file="mrp_operations_webkit/report/mrp_wc_barcode.mako"
+ report_type="webkit"
+ webkit_header="mrp_operation_header" />
+
+ <report
+ id="report_code_barcode"
+ string="Start/Stop Barcode"
+ model="mrp_operations.operation.code"
+ name="mrp.code.barcode.webkit"
+ file="mrp_operations_webkit/report/mrp_code_barcode.mako"
+ report_type="webkit"
+
+ webkit_header="mrp_operation_header"/>
+
+ </data>
+</openerp>
=== added directory 'mrp_operations_webkit/report'
=== added file 'mrp_operations_webkit/report/__init__.py'
--- mrp_operations_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ mrp_operations_webkit/report/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 mrp_wc_barcode
+import mrp_code_barcode
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'mrp_operations_webkit/report/mrp_code_barcode.mako'
--- mrp_operations_webkit/report/mrp_code_barcode.mako 1970-01-01 00:00:00 +0000
+++ mrp_operations_webkit/report/mrp_code_barcode.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,50 @@
+<html>
+ <head>
+ <style type="text/css">
+ body {
+ font-family:Times New Roman;
+ width:"100%"
+ padding-top:15%;
+ padding-bottom:15%;
+ padding-left:15%;
+ padding-right:15%;
+ }
+ .barcode39 {
+ font-family: "wasp 39 m";
+ font-size: 36pt;
+ height:50px;
+ text-align:left;
+ padding-bottom:0px;
+ padding-left:10px;
+ }
+ </style>
+ </head>
+<body>
+%for o in objects:
+ </br></br>
+ <table width="100%">
+ <tr>
+ <td width="25%">
+ </td>
+ <td align="center" style="background-color:lightgrey ;border:1.8px solid black;width:50%;font-size:10px;padding-bottom:0px;height=100%;">
+ ${ o.name }( ${ o.code })
+ </br></br></br></br></br></br></br></br></br>
+ </br>
+ </br>
+ </br>
+ <%
+ id = generate_barcode('ID'+str(o.id))+".svg"
+ %>
+ <p class="barcode39">
+ <img src='${id}' height="50px" width="130px"/>
+ </p>
+ </td>
+ <td width="25%">
+ </td>
+ </tr>
+ </table>
+ <p style="page-break-after:always;"></p>
+ %endfor
+ remove()
+</body>
+</html>
\ No newline at end of file
=== added file 'mrp_operations_webkit/report/mrp_code_barcode.py'
--- mrp_operations_webkit/report/mrp_code_barcode.py 1970-01-01 00:00:00 +0000
+++ mrp_operations_webkit/report/mrp_code_barcode.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp import pooler
+import time
+import barcode
+import tempfile
+from openerp.report import report_sxw
+
+class code_barcode(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(code_barcode, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({
+ 'time': time,
+ 'generate_barcode': self.generate_barcode,
+ })
+
+ def generate_barcode(self, barcode_string):
+
+ temp_path_svg = tempfile.gettempdir()+"/temp_barcode_"+barcode_string+""
+ code39 = barcode.get_barcode_class('code39')
+ c39 = code39(str(barcode_string))
+ c39.save(temp_path_svg)
+ return temp_path_svg
+
+report_sxw.report_sxw('report.mrp.code.barcode.webkit', 'mrp_operations.operation.code', 'addons/mrp_operations_webkit/report/mrp_code_barcode.mako',parser=code_barcode,header=False)
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'mrp_operations_webkit/report/mrp_wc_barcode.mako'
--- mrp_operations_webkit/report/mrp_wc_barcode.mako 1970-01-01 00:00:00 +0000
+++ mrp_operations_webkit/report/mrp_wc_barcode.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,50 @@
+<html>
+ <head>
+ <style type="text/css" media="screen">
+ body {
+ font-family:Times New Roman;
+ width:"100%"
+ padding-top:15%;
+ padding-bottom:15%;
+ padding-left:15%;
+ padding-right:15%;
+ }
+ .barcode39 {
+ font-family: "wasp 39 m";
+ font-size: 36pt;
+ height:50px;
+ text-align:left;
+ padding-bottom:0px;
+ padding-left:10px;
+ }
+ </style>
+ </head>
+<body>
+ %for o in objects:
+ </br></br>
+ <table width="100%">
+ <tr>
+ <td width="25%">
+ </td>
+ <td align="center" style="background-color:lightgrey ;border:1.8px solid black;width:50%;font-size:10px;padding-bottom:0px;height=100%;">
+ ${ str(o.name) }
+ </br></br></br></br></br></br></br></br></br>
+ </br>
+ </br>
+ </br>
+ <%
+ id = generate_barcode('ID'+str(o.id))
+ %>
+ <p class="barcode39">
+ <img src='${id}' height="50px" width="130px"/>
+ </p>
+ </td>
+ <td width="25%">
+ </td>
+ </tr>
+ </table>
+ <p style="page-break-after:always;"></p>
+ %endfor
+</body>
+</html>
+
=== added file 'mrp_operations_webkit/report/mrp_wc_barcode.py'
--- mrp_operations_webkit/report/mrp_wc_barcode.py 1970-01-01 00:00:00 +0000
+++ mrp_operations_webkit/report/mrp_wc_barcode.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp import pooler
+import time
+from string import digits
+import barcode
+from osv.orm import browse_record
+import tempfile
+from openerp.report import report_sxw
+
+class workcenter_code(report_sxw.rml_parse):
+
+ def __init__(self, cr, uid, name, context):
+ super(workcenter_code, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({
+ 'time': time,
+ 'generate_barcode': self.generate_barcode,
+ })
+
+ def generate_barcode(self, barcode_string):
+ temp_path_svg = tempfile.gettempdir()+"/temp_barcode_"+barcode_string+""
+ code39 = barcode.get_barcode_class('code39')
+ c39 = code39(str(barcode_string))
+ c39.save(temp_path_svg)
+ return temp_path_svg+".svg"
+
+
+report_sxw.report_sxw('report.mrp.wc.barcode.webkit', 'mrp.workcenter', 'addons/mrp_operations_webkit/report/mrp_wc_barcode.mako',parser=workcenter_code,header=False)
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added directory 'mrp_repair_webkit'
=== added file 'mrp_repair_webkit/__init__.py'
--- mrp_repair_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ mrp_repair_webkit/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# This module uses OpenERP, Open Source Management Solution Framework.
+# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd.(<http://www.serpentcs.com>)
+#
+# 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/>
+#
+##############################################################################
+import report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'mrp_repair_webkit/__openerp__.py'
--- mrp_repair_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ mrp_repair_webkit/__openerp__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,42 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# This module uses OpenERP, Open Source Management Solution Framework.
+# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd.(<http://www.serpentcs.com>)
+#
+# 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': 'Repairs Management',
+ 'version': '1.0',
+ 'category': 'Manufacturing',
+ 'description': """
+The aim is to have a complete module to manage all products repairs.
+====================================================================
+ It is conversion of rml report to Webkit Report.
+
+""",
+ 'author': 'Serpent Consulting Services',
+ 'website': 'http://www.serpentcs.com',
+ 'depends': ['mrp_repair', 'report_webkit'],
+ 'data': [
+ 'mrp_repair_report.xml',
+ ],
+ 'installable': True,
+ 'auto_install': False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'mrp_repair_webkit/mrp_repair_report.xml'
--- mrp_repair_webkit/mrp_repair_report.xml 1970-01-01 00:00:00 +0000
+++ mrp_repair_webkit/mrp_repair_report.xml 2013-10-10 09:59:30 +0000
@@ -0,0 +1,194 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="mrp_header" 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>
+ <style type="text/css">
+
+ ${css}
+ </style>
+ </head>
+ <body style="border:0; margin: 0;" onload="subst()">
+ <table class="header" style="border-top: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:center;font-size:12;" >${ company.rml_footer or '' }</td>
+ </tr>
+ <tr >
+ <td style="text-align:center;font-size:12;" >Contact : ${ user.name }</td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+ </html>
+ ]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</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()">
+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:left;font-size:12;" width="20%">${ helper.embed_image('png',company.logo,200,50)|n }</td>
+ <td style="text-align:right;font-size:12;" width="80%"></br></br>${ company.rml_header1 }</td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+ <p style="text-align:left;font-size:12;">${company.name}</p></br></br>
+ <table width="100%">
+ <tr>
+ <td style="text-align:left;font-size:10;" width="25%">
+ Phone: ${company.phone or ''}
+ </td>
+ <td width="75%"></td>
+ </tr>
+
+ <tr>
+ <td style="text-align:left;font-size:10; border-bottom: 1px solid black;" width="25%">
+ Mail: ${company.email}
+ </td>
+ <td width="75%"></td>
+ </tr>
+ </table>
+ </html>]]>
+ </field>
+ <field eval="45.0" name="margin_top"/>
+ <field eval="25.0" name="margin_bottom"/>
+ <field name="css"><![CDATA[
+
+ body, table, td, span, div {
+ font-family: Helvetica;
+ }
+
+ body {
+ font-family;
+ font-size:9;
+
+ }
+
+
+ .header {
+ margin-left:0;
+ text-align:left;
+ width:300px;
+ font-size:12;
+ }
+ .title {
+ font-size:16px;
+ font-weight: bold;
+ font-family: Helvetica;
+ padding-bottom:20px;
+ padding-top:20px;
+ }
+
+
+ .basic_table{
+ width:100%;
+ text-align:center;
+ border:1px solid lightGrey;
+ border-collapse: collapse;
+ font-family: Helvetica;
+ padding-bottom:20px;
+ padding-top:20px;
+ }
+
+ .basic_table td {
+ border:1px solid lightGrey;
+ font-size:11px;
+ font-family: Helvetica;
+ padding:3px 3px 3px 3px;
+ }
+
+ .list_table {
+ border-bottom:1px solid black;
+ font-size:13px;
+ border-collapse: collapse;
+ font-family: Helvetica;
+ font-weight: bold;
+ width:100%;
+ padding-top:30px;
+ }
+ .add{
+ width:100%;
+ font-size:12px;
+ font-family: Helvetica; }
+ .tbl_header{
+ width:100%;
+ font-size:10px;
+ font-family: Helvetica;
+ border:1px solid lightGrey;
+ border-collapse: collapse;
+ }
+ .tr_bottom_line{
+ border-bottom: thin solid black;
+ width:100%;
+ font-size:12px;
+ font-family: Helvetica;
+ }
+ .tr_bottom_line_dark_grey{
+ border-bottom: thin solid #ccc;
+ width:100%;
+ font-size:12px;
+ font-family: Helvetica;
+ padding-left: 3px ;
+ }
+ .tr_top{
+ border-top: 1px solid black;
+ width:100%;
+ font-size:12px;
+ font-family: Helvetica;
+ }
+
+ .td_f12{
+ font-size:12px;
+ font-family: Helvetica;
+ }
+
+
+
+ ]]>
+ </field>
+ <field name="name">MRP Header</field>
+ </record>
+
+ <report
+ id="report_mrp_repair_webkit"
+ string="Quotation / Order"
+ model="mrp.repair"
+ name="repair.order.webkit"
+ file="mrp_repair_webkit/report/order.mako"
+ auto="False"
+ report_type="webkit"
+ webkit_header="mrp_header"/>
+ </data>
+</openerp>
=== added directory 'mrp_repair_webkit/report'
=== added file 'mrp_repair_webkit/report/__init__.py'
--- mrp_repair_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ mrp_repair_webkit/report/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,25 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# This module uses OpenERP, Open Source Management Solution Framework.
+# Copyright (C) 2013-Today Serpent Consulting Services Pvt. Ltd.(<http://www.serpentcs.com>)
+#
+# 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/>
+#
+##############################################################################
+
+import order
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'mrp_repair_webkit/report/order.mako'
--- mrp_repair_webkit/report/order.mako 1970-01-01 00:00:00 +0000
+++ mrp_repair_webkit/report/order.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,235 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ <title>qutation_order.pdf</title>
+ </head>
+ <body>
+ %for o in objects:
+ <table class="add">
+ <tr>
+ <td width="70%">
+ </br>
+ <b>Shipping address :</b></br>
+ ${ o.partner_id.name }</br>
+ ${ o.address_id.street or '' }</br>
+ ${ o.address_id.city or '' } ${ o.address_id.zip or '' }</br>
+ ${ o.address_id.country_id.name or '' }</br>
+ %if (o.address_id.phone):
+ Tel. : ${ o.address_id.phone or '' }</br>
+ %endif
+ %if o.address_id.fax:
+ Fax : ${ o.address_id.fax or '' }</br>
+ %endif
+ %if o.address_id.vat:
+ ${ o.address_id.vat or '' }</br>
+ %endif
+
+
+ </td>
+ <td width="30%" colspan="2">
+ ${ o.partner_id.name or '' }
+ ${ o.default_address_id.street or '' }</br>
+ ${ o.default_address_id.city or '' } ${ o.default_address_id.zip or '' }</br>
+ ${ o.default_address_id.country_id.name or '' }</br>
+ %if (o.default_address_id.phone):
+ Tel. : ${ o.default_address_id.phone or '' }</br>
+ %endif
+ %if o.default_address_id.fax:
+ Fax : ${ o.default_address_id.fax or '' }</br>
+ %endif
+ %if o.default_address_id.vat:
+ ${ o.default_address_id.vat or '' }
+ %endif
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>Invoice address :</b></br>
+ ${ o.partner_id and o.partner_id.property_payment_term.name or ''}</br>
+ ${ o.partner_invoice_id.name or ''}</br>
+ ${ o.partner_invoice_id.street or '' }</br>
+ ${ o.partner_invoice_id.city or '' } ${ o.partner_invoice_id.zip or '' }</br>
+ ${ o.partner_invoice_id.country_id.name or '' }</br>
+ %if (o.partner_invoice_id.phone):
+ Tel. : ${ o.partner_invoice_id.phone or '' }</br>
+ %endif
+ %if o.partner_invoice_id.fax:
+ Fax : ${ o.partner_invoice_id.fax or '' }</br>
+ %endif
+ %if o.partner_invoice_id.vat:
+ ${ o.partner_invoice_id.vat or '' }
+ %endif
+
+ </td>
+ </tr>
+ </table>
+ <p class="title">
+ %if o.state <> 'draft' or '':
+ Repair Quotation N° : ${ o.name }
+ %endif
+ %if o.state=='draft' or '' :
+ Repair Order N° : ${ o.name }
+ %endif
+ </p>
+ <table class="basic_table">
+ <tr>
+ <td class="25%">
+ <b>${_("Product to Repair")} </b>
+ </td>
+ <td class="25%">
+ <b>${_("Lot Number")}</b>
+ </td>
+ <td class="25%">
+ <b>${_("Guarantee Limit")}</b>
+ </td>
+ <td class="25%">
+ <b>${_("Printing Date")}</b>
+ </td>
+ </tr>
+ <tr>
+ <td class="25%">
+ ${ o.product_id.name or '' }
+ </td>
+ <td class="25%">
+ ${ o.prodlot_id.name or ' ' }
+ </td>
+ <td class="25%">
+ ${ formatLang(o.guarantee_limit,date = True) }
+ </td>
+ <td class="25%">
+ ${ formatLang(time.strftime('%Y-%m-%d'),date = True)}
+ </td>
+ </tr>
+ </table>
+ </br>
+ <table class="list_table">
+ <tr>
+ <td width="57%">
+ ${_("Description")}
+ </td>
+ <td width="10%">
+ ${_("Tax")}
+ </td>
+ <td width="10%" align="right">
+ ${_("Quantity")}
+ </td>
+ <td width="8%" align="right">
+ ${_("Unit Price")}
+ </td>
+ <td width="15%" align="right">
+ ${_("Price")}
+ </td>
+ </tr>
+ </table>
+ <h3><b>Operation Line(s)</b></h3>
+ %for line in o.operations:
+ %if line['to_invoice']==True:
+ <table class="tr_bottom_line_dark_grey">
+ <tr>
+ <td width="57%">
+ %if line.type == 'add' or '':
+ (Add)${ line.name }
+ %endif
+ %if line.type == 'remove' or '':
+ (Remove) ${ line.name }
+ %endif
+ </td>
+ <td width="10%">
+ ${ ','.join(map( lambda x: x.name, line.tax_id)) }
+ </td>
+ <td width="10%" align="right">
+ ${ formatLang(line.product_uom_qty) } ${ line.product_uom.name }
+ </td>
+ <td width="8%" align="right">
+ ${ formatLang(line.price_unit) }
+ </td>
+ <td width="15%" align="right">
+ ${ formatLang(line.price_subtotal, currency_obj = o.pricelist_id.currency_id) }
+ </td>
+ </tr>
+ </table>
+ %endif
+ %endfor
+ %if len(o.fees_lines) != 0 :
+
+ <h3><b>Fees Line(s)</b></h3>
+ %for fees in o.fees_lines:
+ %if fees.to_invoice==True:
+ <table class="tr_bottom_line_dark_grey">
+ <tr>
+ <td width="57%">
+ ${ fees.name }
+ </td>
+ <td width="10%">
+ ${ ','.join(map( lambda x: x.name, fees.tax_id)) }
+ </td>
+ <td width="10%" align="right">
+ ${ formatLang(fees.product_uom_qty) } ${ fees.product_uom.name }
+ </td>
+ <td width="8" align="right">
+ ${ formatLang(fees.price_unit) }
+ </td>
+ <td width="15%" align="right">
+ ${ formatLang(fees.price_subtotal, currency_obj = o.pricelist_id.currency_id) }
+ </td>
+ </tr>
+ </table>
+ %endif
+ %endfor
+ %endif
+ <table width="100%">
+ <tr>
+ <td width="70%">
+ </td>
+ <td width="30%">
+ <table class="tr_top">
+ <tr>
+ <td>
+ <b>Net Total :</b>
+ </td>
+ <td align="right">
+ ${ formatLang(o.amount_untaxed, dp='Sale Price', currency_obj=o.pricelist_id.currency_id) }
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <b>${_("Taxes:")}</b>
+ </td>
+ <td align="right">
+ ${ formatLang(o.amount_tax, dp='Account', currency_obj=o.pricelist_id.currency_id) }
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr>
+ <td width="70%">
+ </td>
+ <td width="30%">
+ <table class="tr_top">
+ <tr>
+ <td><b>
+ ${_("Total :")}</b>
+ </td>
+ <td align="right"> <b>
+ ${ formatLang(total(o), dp='Sale Price', currency_obj=o.pricelist_id.currency_id) }</b>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ <table width="100%">
+ <tr>
+ <td class="td_f12">
+ ${ o.quotation_notes or '' }
+ </td>
+ </tr>
+ </table>
+ <p style="page-break-after:always">
+ </p>
+ %endfor
+ </body>
+</html>
\ No newline at end of file
=== added file 'mrp_repair_webkit/report/order.py'
--- mrp_repair_webkit/report/order.py 1970-01-01 00:00:00 +0000
+++ mrp_repair_webkit/report/order.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,45 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# This module uses OpenERP, Open Source Management Solution Framework.
+# Copyright (C) 2012-Today Serpent Consulting Services Pvt. Ltd.(<http://www.serpentcs.com>)
+#
+# 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/>
+#
+##############################################################################
+import time
+from openerp.report import report_sxw
+
+class order(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(order, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({
+ 'time': time,
+ 'total': self.total,
+ })
+
+ def total(self, repair):
+ print "repair",repair
+ total = 0.0
+ for operation in repair.operations:
+ total += operation.price_subtotal
+ for fee in repair.fees_lines:
+ total += fee.price_subtotal
+ total = total + repair.amount_tax
+ return total
+
+report_sxw.report_sxw('report.repair.order.webkit','mrp.repair','addons/mrp_repair_webkit/report/order.mako',parser=order)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added directory 'mrp_webkit'
=== added file 'mrp_webkit/__init__.py'
--- mrp_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ mrp_webkit/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,24 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'mrp_webkit/__openerp__.py'
--- mrp_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ mrp_webkit/__openerp__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,46 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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/>.
+#
+############################################################################
+
+
+{
+ 'name': 'MRP',
+ 'version': '1.1',
+ 'author': 'Serpent Consulting Services',
+ 'website': 'http://www.serpentcs.com',
+ 'category': 'Manufacturing',
+ 'sequence': 18,
+ 'summary': 'Manufacturing Orders, Bill of Materials, Routing',
+ 'depends': ['mrp','report_webkit'],
+ 'description': """
+Manage the Manufacturing process in OpenERP
+===========================================
+
+ It is conversion of rml report to Webkit Report.
+
+ """,
+ 'data': [
+ 'mrp_report.xml',
+ ],
+ 'installable': True,
+ 'application': True,
+ 'auto_install': False,
+}
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'mrp_webkit/mrp_report.xml'
--- mrp_webkit/mrp_report.xml 1970-01-01 00:00:00 +0000
+++ mrp_webkit/mrp_report.xml 2013-10-10 09:59:30 +0000
@@ -0,0 +1,330 @@
+<?xml version="1.0" encoding="utf-8"?>
+<openerp>
+ <data>
+ <record id="bom webkit header" model="ir.header_webkit">
+ <field name="footer_html"><![CDATA[]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</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]);}
+ if(vars['page']!=1){
+ document.getElementById('inner_head').innerHTML=document.getElementById('actual_header').innerHTML;
+ }
+ 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()">
+ <table style="border:0" width="100%">
+ <tr>
+ <td width="92%">
+ <td width="4%" style="text-align:right;font-size:10;width:350px;"> <span class="page"/></td>
+ <td width="4%" style="text-align:left;font-size:10;width:30px"> / <span class="topage"/></td>
+ </tr>
+ </table> ${_debug or ''|n}
+ <table id="inner_head" style="width: 100%;margin-left:1%;margin-right:1%;" >
+
+ </table>${_debug or ''|n}
+ <table id="actual_header" style="display:none;margin-left:5%;" class="basic_table">
+ <tr >
+ <td style="text-align:left; border-color:black;border-bottom:2px solid black; font-size:14; font-family: Helvetica-Bold;" width="35%"><b>${ _('BOM Name') }</b></td>
+ <td style="text-align:left;border-color:black;border-bottom:2px solid black; font-size:14; font-family: Helvetica-Bold;" width="35%"><b>${ _('Product Name') }</b></td>
+ <td style="text-align:right;border-color:black;border-bottom:2px solid black; font-size:14; font-family: Helvetica-Bold;" width="15%"><b>${ _('Quantity') }<b></td>
+ <td style="text-align:center;border-color:black;border-bottom:2px solid black; font-size:14; font-family: Helvetica-Bold;" width="15%"><b>${ _('BOM Ref') }</b></td>
+ </tr>
+ </table>
+ </body>
+</html>]]>
+ </field>
+ <field eval="15.0" name="margin_top"/>
+ <field eval="5.0" name="margin_bottom"/>
+ <field name="css"><![CDATA[
+
+
+
+
+.basic_table{
+border-color:black;
+border-collapse: collapse;
+font-family: Helvetica-Bold;
+}
+.basic_table td {
+border-color:black;
+border-bottom:2px solid black;
+font-size:12px;
+}
+
+.list_table {
+border-color:black;
+border-collapse: collapse;
+font-family: Helvetica;
+}
+.list_table td {
+border-bottom:1px solid #ccc;
+font-size:12px;
+padding-left:3px
+padding-right:3px
+padding-top:3px
+padding-bottom:3px
+}
+.list_table1 {
+border-color:black;
+border-collapse: collapse;
+font-family: Helvetica;
+}
+.list_table1 td {
+border-color:gray;
+border-bottom:2px solid gray;
+font-size:12px;
+
+}
+.list_table2 {
+border-color:black;
+border-collapse: collapse;
+
+}
+.list_table2 td {
+border-color:black;
+border-top:2px solid black;
+border-bottom:2px solid black;
+font-size:12;
+padding-left:3px
+padding-right:3px
+padding-top:3px
+padding-bottom:3px
+}
+.list_table th {
+border-bottom:2px solid black;
+text-align:left;
+font-size:12px;
+font-weight:bold;
+padding-left:3px
+padding-right:3px
+}
+
+.list_tabe thead {
+ display:table-header-group;
+}
+
+
+.total {
+width:100%;
+}
+.lib {
+width:10.3%;
+}
+.tot {
+text-align:left;
+width:15%;
+}
+.righttot {
+width:74%;
+}
+.tax {
+width:50%;
+}
+table {
+ display: table;
+ width: 100%;
+ }
+
+ table thead {
+ display: table-header-group;
+ }
+
+ table tbody {
+ display: table-row-group;
+ }
+
+ table tfoot {
+ display: table-footer-group;
+ }
+
+ table tr {
+ display: table-row;
+ height: auto;
+ }
+
+ table th,
+ table td {
+ display: table-cell;
+ overflow: visible;
+ }
+
+ table th,
+ table td {
+ height: 1px; /* Do the trick to make div.nobrk fill td height */
+ }
+
+ table tr.singlecell td,
+ table tr.singlecell th {
+ height: auto; /* Reset trick for a full row td */
+ }
+
+ .nobrk {
+ page-break-inside: avoid;
+ orphans: 10;
+ widows: 10;
+ position: relative;
+ margin: -1px 0 0 -1px;
+ min-height: 14px;
+ line-height: 14px;
+ height: 100%;
+ }
+
+ table tbody td .nobrk {
+ min-height: 5px;
+ }
+ ]]>
+ </field>
+ <field name="name">bom webkit header</field>
+ </record>
+
+<record id="production webkit header" model="ir.header_webkit">
+ <field name="footer_html"><![CDATA[]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</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]);}
+ if(vars['page']!=1){
+ document.getElementById('inner_head').innerHTML=document.getElementById('actual_header').innerHTML;
+ }
+ 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()">
+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:right;font-size:10;font-family: Helvetica-Bold;" width="15%">${ formatLang(time.strftime('%Y-%m-%d'),date=True)} ${time.strftime('%I:%M')}</td>
+ <td style="text-align:center;font-size:14; font-family: Helvetica-Bold;" width="75%"><b>${company.partner_id.name |entity}</b></td>
+ <td width="5%" style="text-align:right;font-size:10;width:350px; font-family: Helvetica-Bold;" > <span class="page"/></td>
+ <td width="5%" style="text-align:left;font-size:10;width:30px font-family: Helvetica-Bold;"> / <span class="topage"/></td>
+ </tr>
+ </table> ${_debug or ''|n}
+ <table id="inner_head" style="width: 100%;margin-left:1%;margin-right:1%;" >
+
+ </table>${_debug or ''|n}
+ <table id="actual_header" style="display:none;margin-left:5%;" class="basic_table">
+ <tr >
+
+ </tr>
+ </table>
+ </body>
+</html>]]>
+ </field>
+ <field eval="15.0" name="margin_top"/>
+ <field eval="5.0" name="margin_bottom"/>
+ <field name="css"><![CDATA[
+
+.basic_table{
+border-collapse: collapse;
+font-family: Helvetica-Bold;
+}
+.basic_table td {
+border-color:black;
+border-bottom:2px solid black;
+
+}
+
+ .title{
+ text-align:left
+ font-family: Helvetica-Bold;
+ font-size:12px;
+}
+
+.list_table {
+border-color:black;
+border-collapse: collapse;
+font-family: Helvetica;
+}
+.list_table td {
+border-color:gray;
+border-bottom:1px solid gray;
+font-size:12px;
+
+}
+.list_table1 {
+border-color:black;
+border-collapse: collapse;
+font-family: Helvetica;
+font-size:12px;
+}
+.list_table1 td {
+border-color:gray;
+border-bottom:1px solid gray;
+
+
+}
+.list_table2 {
+text-align:center;
+border-collapse: collapse;
+}
+.list_table2 td {
+ border:1px solid lightGrey;
+ border-collapse: collapse;
+ font-family: Helvetica;
+ font-size:11px;
+ }
+
+}
+
+ ]]>
+ </field>
+ <field name="name">production webkit header</field>
+ </record>
+
+ <report
+ auto="True"
+ header="False"
+ id="report_bom_structure"
+ model="mrp.bom"
+ name="bom.structure.webkit"
+ file="mrp_webkit/report/bom_structure.mako"
+ string="BOM Structure"
+ report_type="webkit"
+ webkit_header="bom webkit header"/>
+
+ <report
+ id="report_mrp_production_report"
+ string="Production Order"
+ model="mrp.production"
+ name="mrp.production.order.webkit"
+ file="mrp_webkit/report/order.mako"
+ auto="False"
+ report_type="webkit"
+ webkit_header="production webkit header"
+ />
+
+ </data>
+</openerp>
=== added directory 'mrp_webkit/report'
=== added file 'mrp_webkit/report/__init__.py'
--- mrp_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ mrp_webkit/report/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 order
+import bom_structure
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'mrp_webkit/report/bom_structure.mako'
--- mrp_webkit/report/bom_structure.mako 1970-01-01 00:00:00 +0000
+++ mrp_webkit/report/bom_structure.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,66 @@
+<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ <title>BOM Structure.pdf</title>
+ </head>
+ <body>
+ <table width="100%">
+ <tr>
+ <td style="text-align:center;">
+ <h2><b>${ _('BOM Structure') } </b></h2>
+ </td>
+ </tr>
+ </table>
+
+ <table width="100%" class="basic_table">
+ <tr >
+ <td style="text-align:left;" width="35%"><b>${ _('BOM Name') }</b></td>
+ <td style="text-align:left;" width="35%"><b>${ _('Product Name') }</b></td>
+ <td style="text-align:right;" width="15%"><b>${ _('Quantity') }<b></td>
+ <td style="text-align:center;" width="15%"><b>${ _('BOM Ref') }</b></td>
+ </tr>
+ </table>
+ %for o in objects:
+ <table width="100%" class="list_table1">
+ <tr >
+ <td style="text-align:left;" width="35%"><b>
+ ${o.name}</b>
+ </td>
+ <td style="text-align:left;" width="35%"><b>
+ [ ${(o.product_id.default_code) or removeParentNode('font')}] ${o.product_id.name}</b>
+ </td>
+ <td style="text-align:right;" width="15%"><b>
+ ${o.product_qty} ${o.product_uom.name}</b>
+ </td>
+ <td style="text-align:center;" width="15%"><b>
+ ${o.code or ''}</b>
+ </td><br/>
+ </tr>
+ </table>
+
+ %for l in get_children(o.bom_lines):
+ <table width="100%" class="list_table">
+ <tr>
+ <td style="text-align:left ; padding-left:10px" width="35%" class="cell_extended_gray">
+ <font color="white" >${'... '*(l['level'])}</font> - ${l['name']}
+ </td>
+ <td style="text-align:left;" width="35%" class="cell_extended_gray">
+ ${ (l['pcode']) or '' } ${l['pname']}
+ </td>
+ <td style="text-align:right;" width="15%" class="cell_extended_gray">
+ ${l['pqty']} ${l['uname']}
+ </td>
+ <td style="text-align:center;" width="15%" class="cell_extended_gray">
+ ${l['code'] or ''}
+ </td>
+ </tr>
+ </table>
+ %endfor
+ </br>
+ %endfor
+</body>
+</html>
\ No newline at end of file
=== added file 'mrp_webkit/report/bom_structure.py'
--- mrp_webkit/report/bom_structure.py 1970-01-01 00:00:00 +0000
+++ mrp_webkit/report/bom_structure.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,64 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp.report import report_sxw
+from openerp.osv import osv
+from openerp import pooler
+
+class bom_structure(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(bom_structure, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({
+ 'time': time,
+ 'get_children':self.get_children,
+ })
+
+ def get_children(self, object, level=0):
+ result = []
+
+ def _get_rec(object, level):
+ for l in object:
+ res = {}
+ res['name'] = l.name
+ res['pname'] = l.product_id.name
+ res['pcode'] = l.product_id.default_code
+ res['pqty'] = l.product_qty
+ res['uname'] = l.product_uom.name
+ res['code'] = l.code
+ res['level'] = level
+ result.append(res)
+ if l.child_complete_ids:
+ if level<6:
+ level += 1
+ _get_rec(l.child_complete_ids,level)
+ if level>0 and level<6:
+ level -= 1
+ return result
+
+ children = _get_rec(object,level)
+
+ return children
+
+report_sxw.report_sxw('report.bom.structure.webkit','mrp.bom','mrp_webkit/report/bom_structure.mako',parser=bom_structure,header='internal')
+
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'mrp_webkit/report/order.mako'
--- mrp_webkit/report/order.mako 1970-01-01 00:00:00 +0000
+++ mrp_webkit/report/order.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,220 @@
+<!DOCTYPE html SYSTEM "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+
+<html xmlns="http://www.w3.org/1999/xhtml">
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ <title>Production Order.pdf</title>
+ </head>
+ <body>
+ %for o in objects:
+ <table class="title" width="100%">
+ <tr>
+ <td width="100%">
+ <h3><b>${ _('Production Order N°') } : ${o.name}</b></h3>
+ </td>
+ </tr>
+ </table>
+
+ <table width="100%" class="list_table2">
+ <tr>
+ <td width="35%">
+ <b>${ _('Source Document') }</b>
+ </td>
+ <td width="40%">
+ <b>${ _('Product') }</b>
+ </td>
+ <td width="25%">
+ <b>${ _('Quantity') }</b>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" class="list_table2">
+ <tr>
+ <td width="35%">
+ ${o.origin or ''}
+ </td>
+ <td width="40%">
+ ${o.product_id and o.product_id.code or ''} ${o.product_id and o.product_id.name or ''}
+ </td>
+ <td width="25%">
+ ${formatLang(o.product_qty)} ${o.product_id and o.product_uom and o.product_uom.name or ''}
+ </td>
+ </tr>
+ </table>
+ <br/>
+
+ <table width="100%" class="list_table2">
+ <tr>
+ <td width="35%">
+ <b>${ _('Scheduled Date') }</b>
+ </td>
+ <td width="18%">
+ <b>${ _('Printing date') }</b>
+ </td>
+ <td width="22%">
+ <b>${ _('Partner Ref') }</b>
+ </td>
+ <td width="25%">
+ <b>${ _('SO Number') }</b>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" class="list_table2">
+ <tr>
+ <td width="35%">
+ ${formatLang(o.date_planned, date_time = True)}
+ </td>
+ <td width="18%">
+ ${formatLang(time.strftime('%Y-%m-%d'),date = True)}
+ </td>
+ <td width="22%">
+ ${'sale_ref' in o._columns.keys() and o.sale_ref or ''}
+ </td>
+ <td width="25%">
+ ${'sale_name' in o._columns.keys() and o.sale_name or ''}
+ </td>
+ </tr>
+ </table>
+ <br/>
+
+ %if o.workcenter_lines ==[]:
+
+ %else:
+ <table width="100%">
+ <tr>
+ <td style="text-align:left;" width="100%">
+ <h4><b>${ _('Work Orders') }</b></h4>
+ </td>
+ </tr>
+ </table>
+ <table width="100%" class="list_table2">
+ <tr>
+ <td width="15%">
+ <b>${ _('Sequence') }</b>
+ </td>
+ <td width="30%">
+ <b>${ _('Name') }</b>
+ </td>
+ <td width="30%">
+ <b>${ _('WorkCenter') }</b>
+ </td>
+ <td width="12%">
+ <b>${ _('No. Of Cycles') }</b>
+ </td>
+ <td width="13%">
+ <b>${ _('No. Of Hours') }</b>
+ </td>
+ </tr>
+ </table>
+ %for line2 in o.workcenter_lines:
+ <table width="100%" class="list_table2">
+ <tr>
+ <td width="15%">
+ ${str(line2.sequence)}
+ </td>
+ <td width="30%">
+ ${line2.name}
+ </td>
+ <td width="30%">
+ ${line2.workcenter_id and line2.workcenter_id.name or ''}
+ </td>
+ <td width="12%">
+ ${formatLang(line2.cycle)}
+ </td>
+ <td width="13%">
+ ${formatLang(line2.hour)}
+ </td>
+ </tr>
+ </table><br/>
+ %endfor
+ %endif
+
+ <table class="title" width="100%">
+ <tr>
+ <td width="100%">
+ <h3>${ _('Bill Of Material') }</h3>
+ </td>
+ </tr>
+ </table>
+ <table style="border-bottom:2px solid black;font-family: Helvetica; font-size:11px;" width="100%" >
+ <tr>
+ <td style="text-align:left; " width="55%">
+ <b>${ _('Product') }</b>
+ </td>
+ <td style="text-align:right;" width="10%">
+ <b>${ _('Quantity') }</b>
+ </td>
+ <td style="text-align:center;" width="20%">
+ <b>${ _('Source Location') }</b>
+ </td>
+ <td style="text-align:center;" width="15%">
+ <b>${ _('Destination Location') }</b>
+ </td>
+ </tr>
+ </table>
+
+ %if o.move_lines ==[]:
+
+ %else:
+ <table style="font-family: Helvetica; font-size:11px;" width="100%">
+ <tr>
+ <td width="100%">
+ <b>${ _('Products to Consume') }</b>
+ </td>
+ </tr>
+ </table>
+ %for line in o.move_lines:
+ <table width="100%" class="list_table">
+ <tr>
+ <td style="text-align:left;" width="55%">
+ ${line.product_id and line.product_id.code or ''} ${line.product_id and line.product_id.name or ''}
+ </td>
+ <td style="text-align:right;" width="10%">
+ ${formatLang( line.product_qty)} ${line.product_uom and line.product_uom.name or ''}
+ </td>
+ <td style="text-align:center;"width="20%">
+ ${line.location_id and line.location_id.name or ''}
+ </td>
+ <td style="text-align:center;"width="15%">
+ ${line.location_dest_id and line.location_dest_id.name or ''}
+ </td>
+ </tr>
+ </table>
+ %endfor
+ %endif
+
+ %if o.move_lines2 ==[]:
+
+ %else:
+ <table class="title" width="100%">
+ <tr>
+ <td width="100%">
+ <h5><b>${ _('Consumed Products') }</b></h5>
+ </td>
+ </tr>
+ </table>
+ %for line2 in o.move_lines2:
+ <table width="100%" class="list_table1">
+ <tr>
+ <td style="text-align:left;"width="55%">
+ ${line2.product_id and line2.product_id.code or ''} ${line2.product_id and line2.product_id.name or ''}
+ </td>
+ <td style="text-align:right;"width="10%">
+ ${formatLang( line2.product_qty)} ${line2.product_uom and line2.product_uom.name or ''}
+ </td>
+ <td style="text-align:center;"width="20%">
+ ${line2.location_id and line2.location_id.name or ''}
+ </td>
+ <td style="text-align:center;"width="15%">
+ ${line2.location_dest_id and line2.location_dest_id.name or ''}
+ </td>
+ </tr>
+ </table>
+ %endfor
+ %endif
+ <p style="page-break-after:always"></p>
+ %endfor
+ </body>
+</html>
\ No newline at end of file
=== added file 'mrp_webkit/report/order.py'
--- mrp_webkit/report/order.py 1970-01-01 00:00:00 +0000
+++ mrp_webkit/report/order.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,34 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp.report import report_sxw
+
+class order(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(order, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({
+ 'time': time,
+ })
+
+report_sxw.report_sxw('report.mrp.production.order.webkit','mrp.production','addons/mrp_webkit/report/order.mako',parser=order,header='internal')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added directory 'point_of_sale_webkit'
=== added file 'point_of_sale_webkit/__init__.py'
--- point_of_sale_webkit/__init__.py 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,26 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 wizard
+import report
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
+
=== added file 'point_of_sale_webkit/__openerp__.py'
--- point_of_sale_webkit/__openerp__.py 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/__openerp__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,43 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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/>.
+#
+############################################################################
+
+
+{
+ 'name': 'Point of Sale',
+ 'version': '1.0.1',
+ 'category': 'Point Of Sale',
+ 'sequence': 6,
+ 'summary': 'Touchscreen Interface for Shops',
+ 'description': """
+Quick and Easy sale process
+===========================
+ It is conversion of rml report to Webkit Report.
+ """,
+ 'author': 'Serpent Consulting Services',
+ 'depends': ['point_of_sale','report_webkit'],
+ 'data': [
+ 'point_of_sale_report.xml',
+ 'account_statement_report.xml',
+ ],
+ 'auto_install': False,
+}
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'point_of_sale_webkit/account_statement_report.xml'
--- point_of_sale_webkit/account_statement_report.xml 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/account_statement_report.xml 2013-10-10 09:59:30 +0000
@@ -0,0 +1,276 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<openerp>
+ <data>
+ <record id="account_statement_webkit_header" model="ir.header_webkit">
+ <field name="footer_html"><![CDATA[]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</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()">
+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:left;font-size:12;" width="17%">${time.strftime('%m/%d/%Y %I:%M')}</td>
+ <td style="text-align:center;font-size:16;" width="76%"><b>${company.partner_id.name |entity}<b></td>
+ <td style="text-align:left;font-size:12;" width="3%"><span class="page"/> </td>
+ <td style="text-align:left;font-size:12;" width="1%"> /</td>
+ <td style="text-align:right;font-size:12;" width="3%"><span class="topage"/></td>
+ </tr>
+ </table>${_debug or ''|n} </body>
+ </html>]]>
+ </field>
+ <field eval="15.0" name="margin_top"/>
+ <field eval="5.0" name="margin_bottom"/>
+ <field name="css"><![CDATA[
+
+ body, table, td, span, div {
+ font-family:Verdana;
+ }
+
+ body {
+ font-family:Arial;
+ font-size:12;
+
+ }
+
+
+ .header {
+ margin-left:0;
+ text-align:left;
+ width:300px;
+ font-size:12;
+ }
+ .title {
+ font-size:16;
+ font-weight: bold;
+
+ }
+
+
+ .basic_table{
+ text-align:center;
+ width:100%;
+ border:1px solid lightGrey;
+ border-collapse: collapse;
+ padding-top:20px;
+ }
+ .basic_table td {
+ border:1px solid lightGrey;
+ font-size:11px;
+ padding-top:3px;
+ padding-left:3px;
+ padding-bottom:3px;
+ padding-right:3px;
+ }
+
+ .list_table {
+ border-color:black;
+ width:100%;
+ text-align:left;
+ border-collapse: collapse;
+ padding-top:20px;
+ }
+ .list_table td {
+ border-color:gray;
+ border-bottom:1px solid lightGrey;
+ font-size:11px;
+ padding-left:3px;
+ padding-right:3px;
+ padding-top:3px;
+ padding-bottom:3px;
+ }
+
+ .list_table th {
+ border-bottom:1px solid black;
+ text-align:left;
+ font-size:11px;
+ font-weight:bold;
+ padding-left:3px;
+ padding-right:3px;
+ }
+
+ .list_tabe thead {
+ display:table-header-group;
+ }
+
+
+ .total {
+ width:100%;
+ }
+ .lib {
+ width:10.3%;
+ }
+ .tot {
+ text-align:left;
+ width:15%;
+ }
+ .righttot {
+ width:74%;
+ }
+ .tax {
+ width:50%;
+ }
+
+ .cell{
+ border-spacing: 0;
+ border-collapse: collapse;
+ border-style:solid;
+ border: 1px solid grey;
+ font-size:10px;
+ text-align:center;
+ }
+
+ .tbl_header{
+ width:100%;
+ font-size:10px;
+ }
+ .tr_bottom_line{
+ border-bottom: thin solid black;
+ width:100%;
+ }
+ .tr_bottom_line_dark_grey{
+ border-bottom: thin solid grey;
+ width:100%;
+ }
+ .tr_bottom_line_light_grey{
+ border-bottom: thin solid #CCCCCC;
+ width:100%;
+ }
+ .td_f12{
+ font-size:12px;
+ }
+ .td_f10{
+ font-size:10px;
+ }
+ .td_f10_right{
+ font-size:10px;
+ text-align:right;
+ }
+ .td_f12{
+ font-size:12px;
+ }
+ .td_f12_right{
+ font-size:12px;
+ text-align:right;
+ }
+ table.head_border_style{
+ border:1px solid;
+ color: #cccccc;
+ }
+ tr.head_border_style{
+ border:1px solid;
+ color: #cccccc;
+ }
+ tr.table_header{
+ font-weight: bold;
+ font-family: sans-serif, serif;
+ font-size: 14px;
+ caption-side: top;
+ padding: 5px;
+ }
+ tr.table_parent_data{
+ font-family: Helvetica-Bold;
+ font-size: 12px;
+ caption-side: top;
+ font-weight: bold;
+ }
+ tr.table_child_data{
+ font-family: Helvetica;
+ font-size: 12px;
+ caption-side: top;
+ }
+ tr.report_header{
+ font-size: 30px;
+ caption-side: top;
+ font-family: Helvetica-Bold
+ padding: 5px;
+ border-bottom: 15px solid black;
+ align: center
+ }
+
+ .top{
+ border-top:1px solid black;
+ font-size:11px;
+ padding-top:0px;
+ }
+ .bottom {
+ border-bottom:thin solid;
+ border-color:#cccccc;
+ }
+ .head_bottom_border{
+ border-bottom:thin solid;
+ border-color:black;
+ }
+ .left {
+ border-left:thin solid;
+ border-color:#cccccc;
+ }
+ .right {
+ border-right:thin solid;
+ border-color:#cccccc;account_wbkit
+ }
+
+ ]]>
+ </field>
+ <field name="name">Account Statement Webkit Header</field>
+ </record>
+
+ <report
+ id="pos_users_product_re"
+ string="User's Product"
+ model="account.bank.statement"
+ name="pos.user.product.webkit"
+ auto="False"
+ multi="True"
+ file="point_of_sale_webkit/report/pos_users_product.mako"
+ report_type="webkit"
+ webkit_header="account_statement_webkit_header"
+ />
+
+ <report
+ id="account_statement"
+ string="Statement"
+ model="account.bank.statement"
+ name="account.statement.webkit"
+ auto="False"
+ multi="True"
+ file="point_of_sale_webkit/report/account_statement.mako"
+ report_type="webkit"
+ webkit_header="account_statement_webkit_header" />
+
+
+ <report
+ id="all_closed_cashbox_of_the_day"
+ string="All Closed CashBox"
+ model="account.bank.statement"
+ name="all.closed.cashbox.of.the.day.webkit"
+ auto="False"
+ multi="True"
+ menu = 'True'
+ file="point_of_sale_webkit/report/all_closed_cashbox_of_the_day.mako"
+ report_type="webkit"
+ webkit_header="account_statement_webkit_header"
+ />
+
+
+ </data>
+</openerp>
=== added file 'point_of_sale_webkit/point_of_sale_report.xml'
--- point_of_sale_webkit/point_of_sale_report.xml 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/point_of_sale_report.xml 2013-10-10 09:59:30 +0000
@@ -0,0 +1,667 @@
+<?xml version="1.0" encoding="iso-8859-1"?>
+<openerp>
+ <data>
+ <record id="point_of_sale_webkit_header" model="ir.header_webkit">
+ <field name="footer_html"><![CDATA[]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</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()">
+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:left;font-size:12;" width="17%">${time.strftime('%m/%d/%Y %I:%M')}</td>
+ <td style="text-align:center;font-size:16;" width="76%"><b>${company.partner_id.name |entity}</b></td>
+ <td style="text-align:left;font-size:12;" width="3%"><span class="page"/> </td>
+ <td style="text-align:left;font-size:12;" width="1%"> /</td>
+ <td style="text-align:right;font-size:12;" width="3%"><span class="topage"/></td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+ </html>]]>
+ </field>
+ <field eval="15.0" name="margin_top"/>
+ <field eval="5.0" name="margin_bottom"/>
+ <field name="css"><![CDATA[
+
+ body, table, td, span, div {
+ font-family:Verdana;
+ }
+
+ body {
+ font-family:Arial;
+ font-size:12;
+
+ }
+
+
+ .header {
+ margin-left:0;
+ text-align:left;
+ width:300px;
+ font-size:12;
+ }
+ .title {
+ font-size:16;
+ font-weight: bold;
+
+ }
+
+
+ .basic_table{
+ text-align:center;
+ width:100%;
+ border:1px solid lightGrey;
+ border-collapse: collapse;
+ padding-top:30px;
+ }
+ .basic_table td {
+ border:1px solid lightGrey;
+ font-size:11px;
+ padding-top:3px;
+ padding-left:3px;
+ padding-bottom:3px;
+ padding-right:3px;
+ }
+
+ .list_table {
+ border-color:black;
+ width:100%;
+ text-align:left;
+ border-collapse: collapse;
+ padding-top:30px;
+
+ }
+ .list_table td {
+ border-color:gray;
+ border-top:1px solid lightGrey;
+ font-size:11px;
+ padding-left:3px;
+ padding-right:3px;
+ padding-top:3px;
+ padding-bottom:3px;
+ }
+
+ .list_table th {
+ border-bottom:1px solid black;
+ font-size:11px;
+ font-weight:bold;
+ padding-left:3px;
+ padding-right:3px;
+ }
+
+ .list_tabe thead {
+ display:table-header-group;
+ }
+
+
+ .total {
+ width:100%;
+ }
+ .lib {
+ width:10.3%;
+ }
+ .tot {
+ text-align:left;
+ width:15%;
+ }
+ .righttot {
+ width:74%;
+ }
+ .tax {
+ width:50%;
+ }
+
+ .cell{
+ border-spacing: 0;
+ border-collapse: collapse;
+ border-style:solid;
+ border: 1px solid grey;
+ font-size:10px;
+ text-align:center;
+ }
+
+ .tbl_header{
+ width:100%;
+ font-size:10px;
+ }
+ .tr_bottom_line{
+ border-bottom: thin solid black;
+ width:100%;
+ }
+ .tr_bottom_line_dark_grey{
+ border-bottom: thin solid grey;
+ width:100%;
+ }
+ .tr_bottom_line_light_grey{
+ border-bottom: thin solid #CCCCCC;
+ width:100%;
+ }
+ .td_f12{
+ font-size:12px;
+ }
+ .td_f10{
+ font-size:10px;
+ }
+ .td_f10_right{
+ font-size:10px;
+ text-align:right;
+ }
+ .td_f12{
+ font-size:12px;
+ }
+ .td_f12_right{
+ font-size:12px;
+ text-align:right;
+ }
+ table.head_border_style{
+ border:1px solid;
+ color: #cccccc;
+ }
+ tr.head_border_style{
+ border:1px solid;
+ color: #cccccc;
+ }
+ tr.table_header{
+ font-weight: bold;
+ font-family: sans-serif, serif;
+ font-size: 14px;
+ caption-side: top;
+ padding: 5px;
+ }
+ tr.table_parent_data{
+ font-family: Helvetica-Bold;
+ font-size: 12px;
+ caption-side: top;
+ font-weight: bold;
+ }
+ tr.table_child_data{
+ font-family: Helvetica;
+ font-size: 12px;
+ caption-side: top;
+ }
+ tr.report_header{
+ font-size: 30px;
+ caption-side: top;
+ font-family: Helvetica-Bold
+ padding: 5px;
+ border-bottom: 15px solid black;
+ align: center
+ }
+
+ .top{
+ border-top:1px solid black;
+ font-size:11px;
+ }
+ .bottom {
+ border-bottom:thin solid;
+ border-color:#cccccc;
+ }
+ .head_bottom_border{
+ border-bottom:thin solid;
+ border-color:black;
+ }
+ .left {
+ border-left:thin solid;
+ border-color:#cccccc;
+ }
+ .right {
+ border-right:thin solid;
+ border-color:#cccccc;account_wbkit
+ }
+
+ ]]>
+ </field>
+ <field name="name">Point Of Sale Webkit Header</field>
+ </record>
+ <record id="invoice_webkit_header" 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>
+ <% import datetime %>
+ <body style="border:0; margin: 0;" onload="subst()">
+ <table style="border-top: 1px solid black; width: 1080px">
+ <tr style="border-collapse:collapse;">
+ <td style="text-align:left;font-size:15px;width:350px;">${formatLang( str(datetime.datetime.today()), date_time=True)}</td>
+ <td style="text-align:center;font-size:15px;width:350px;">${user.name or ''}</td>
+ <td style="text-align:right;font-size:15px;width:350px;">Page <span class="page"/></td>
+ <td style="text-align:left;font-size:15px;width:30px"> of <span class="topage"/></td>
+ </tr>
+ </table>
+ </body>
+ </html>]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</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: 15;" onload="subst()">
+ <table class="header" style="border-bottom: 1px solid black; width: 100%">
+ <tr >
+ <td style="text-align:left;font-size:12;" width="20%">${ helper.embed_image('png',company.logo,200,50)|n }</td>
+ <td style="text-align:right;font-size:12;" width="80%"></br></br>${ company.rml_header1 }</td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+ <p style="text-align:left;font-size:12;">${company.name}</p></br></br>
+ <table width="100%">
+ <tr>
+ <td style="text-align:left;font-size:10;" width="25%">
+ Phone: ${company.phone or ''}
+ </td>
+ <td width="75%"></td>
+ </tr>
+
+ <tr>
+ <td style="text-align:left;font-size:10; border-bottom: 1px solid black;" width="25%">
+ Mail: ${company.email}
+ </td>
+ <td width="75%"></td>
+ </tr>
+ </table> ${_debug or ''|n} </body>
+ </html>]]>
+ </field>
+ <field eval="45.0" name="margin_top"/>
+ <field eval="15.0" name="margin_bottom"/>
+ <field name="css"><![CDATA[
+
+ body {
+ font-family:Verdana;
+ font-size:12;
+
+ }
+
+
+ .dest_address {
+ margin-right:60%;
+ font-size:12;
+ }
+ .header {
+ margin-right:0;
+ text-align:right;
+ width:300px;
+ font-size:12px;
+ }
+
+ .title {
+ font-size:11px;
+ text-align:left;
+
+ }
+ font {
+
+ }
+
+ .basic_table{
+ text-align:center;
+ width:100%;
+ border:1px solid lightGrey;
+ border-collapse: collapse;
+
+ }
+ .basic_table td {
+ border:1px solid lightGrey;
+ font-size:10px;
+ padding-left:3px;
+ padding-right:3px;
+ padding-top:3px;
+ padding-bottom:3px;
+
+ }
+
+ .list_table {
+ width:100%;
+ border-color:black;
+ text-align:left;
+ border-collapse: collapse;
+
+ }
+ .list_table td {
+ border-color:gray;
+ border-top:1px solid lightGrey;
+ text-align:left;
+ font-size:11px;
+ padding-left:5px;
+ padding-right:3px;
+ padding-top:3px;
+ padding-bottom:3px;
+ }
+
+ .list_table th {
+ border-bottom:1px solid black;
+ text-align:left;
+ font-size:11px;
+ padding-left:5px;
+ padding-right:3px;
+ padding-top:3px;
+ padding-bottom:3px;
+ }
+
+ .list_tabe thead {
+ display:table-header-group;
+ }
+
+
+ .total {
+ width:100%;
+ }
+ .lib {
+ width:10.3%;
+ }
+ .tot {
+ text-align:left;
+ width:15%;
+ }
+ .righttot {
+ width:74%;
+ }
+ .tax {
+ width:50%;
+ }
+ table {
+ display: table;
+ width: 100%;
+ }
+
+ table thead {
+ display: table-header-group;
+ }
+
+ table tbody {
+ display: table-row-group;
+ }
+
+ table tfoot {
+ display: table-footer-group;
+ }
+
+ table tr {
+ display: table-row;
+ height: auto;
+ }
+
+ table th,
+ table td {
+ display: table-cell;
+ overflow: visible;
+ }
+
+ table th,
+ table td {
+ height: 1px; /* Do the trick to make div.nobrk fill td height */
+ }
+
+ table tr.singlecell td,
+ table tr.singlecell th {
+ height: auto; /* Reset trick for a full row td */
+ }
+
+ .nobrk {
+ page-break-inside: avoid;
+ orphans: 10;
+ widows: 10;
+ position: relative;
+ margin: -1px 0 0 -1px;
+ min-height: 14px;
+ line-height: 14px;
+ height: 100%;
+ }
+
+ table tbody td .nobrk {
+ min-height: 5px;
+ }
+ ]]>
+ </field>
+ <field name="name">invoice Webkit Header</field>
+ </record>
+
+
+ <record id="receipt_webkit_header" model="ir.header_webkit">
+ <field name="footer_html"><![CDATA[
+ ]]></field>
+ <field name="orientation">Portrait</field>
+ <field name="format">A4</field>
+ <field name="html"><![CDATA[
+ ]]></field>
+ <field eval="20.0" name="margin_top"/>
+ <field eval="0.0" name="margin_bottom"/>
+ <field eval="0.0" name="margin_right"/>
+ <field eval="0.0" name="margin_left"/>
+ <field name="css"><![CDATA[
+
+ body {
+ font-family:Verdana;
+ font-size:12;
+ }
+ .font {
+ width:100%;
+ font-family:Helvetica;
+ font-size:40px;
+ rightIndent:0.0;
+ leftIndent:0.0;
+ leading:11;
+ text-align:center;
+ }
+ .list{
+ width:100%;
+ border-color:black;
+ text-align:left;
+ border-collapse: collapse;
+ }
+ .list th{
+ border-bottom:1px solid black;
+ font-size:30px;
+ padding-left:5px;
+ padding-right:3px;
+ padding-top:3px;
+ padding-bottom:3px;
+
+ }
+ .list td {
+ text-align:left;
+ font-size:30px;
+ padding-left:5px;
+ padding-right:5px;
+ padding-top:3px;
+ padding-bottom:5px;
+ }
+ .list_table {
+ width:100%;
+ border-color:black;
+ text-align:left;
+ border-collapse: collapse;
+
+ }
+ .list_table td {
+ border-color:gray;
+ border-bottom:1px solid lightGrey;
+ text-align:left;
+ font-size:30px;
+ padding-left:5px;
+ padding-right:3px;
+ padding-top:3px;
+ padding-bottom:3px;
+ }
+
+ .list_table th {
+ border-bottom:1px solid black;
+ font-family:Courier-Bold;
+ font-size:30px;
+ padding-left:5px;
+ padding-right:3px;
+ padding-top:3px;
+ padding-bottom:3px;
+ }
+
+
+
+ ]]>
+ </field>
+ <field name="name">receipt Webkit Header</field>
+ </record>
+
+ <report
+ id="pos_receipt_report"
+ string="Pos Receipt"
+ model="pos.order"
+ name="pos.receipt.webkit"
+ auto="False"
+ multi="True"
+ menu="False"
+ file="point_of_sale_webkit/report/pos_receipt.mako"
+ report_type="webkit"
+ webkit_header="receipt_webkit_header"
+ />
+
+ <report
+ id="pos_invoice_report"
+ string="Invoice"
+ model="pos.order"
+ name="pos.invoice.webkit"
+ auto="False"
+ multi="True"
+ file="point_of_sale_webkit/report/pos_invoice.mako"
+ report_type="webkit"
+ webkit_header="invoice_webkit_header"
+ />
+
+ <report
+ id="pos_lines_detail"
+ string="Details of Sales"
+ model="pos.order"
+ name="pos.details.webkit"
+ auto="False"
+ multi="True"
+ menu="False"
+ file="point_of_sale_webkit/report/pos_details.mako"
+ report_type="webkit"
+ webkit_header="point_of_sale_webkit_header"
+ />
+
+ <report
+ id="pos_details_summary"
+ string="Sales (summary)"
+ model="pos.order"
+ name="pos.details.summary.webkit"
+ auto="False"
+ multi="True"
+ file="point_of_sale_webkit/report/pos_detail_summary.mako"
+ report_type="webkit"
+ webkit_header="point_of_sale_webkit_header"
+ />
+
+ <report
+ id="pos_lines_report"
+ string="Pos Lines"
+ model="pos.order"
+ name="pos.lines.webkit"
+ auto="False"
+ multi="True"
+ file="point_of_sale_webkit/report/pos_lines.mako"
+ report_type="webkit"
+ webkit_header="point_of_sale_webkit_header"
+ />
+
+ <report
+ id="pos_sales_user"
+ string="Sales Report"
+ model="pos.order"
+ name="pos.sales.user.webkit"
+ auto="False"
+ multi="True"
+ menu="False"
+ file="point_of_sale_webkit/report/pos_sales_user.mako"
+ report_type="webkit"
+ webkit_header="point_of_sale_webkit_header"
+ />
+
+ <report
+ id="pos_sales_user_today"
+ string="Today's Sales"
+ model="pos.order"
+ name="pos.sales.user.today.webkit"
+ auto="False"
+ multi="True"
+ menu="False"
+ file="point_of_sale_webkit/report/pos_sales_user_today.mako"
+ report_type="webkit"
+ webkit_header="point_of_sale_webkit_header"
+ />
+
+ <report
+ id="pos_payment_report_user"
+ string="Today's Payment By User"
+ model="pos.order"
+ name="pos.payment.report.user.webkit"
+ auto="False"
+ multi="True"
+ menu="False"
+ file="point_of_sale_webkit/report/pos_payment_report_user.mako"
+ report_type="webkit"
+ webkit_header="point_of_sale_webkit_header"
+ />
+
+ <report
+ id="pos_payment_report1"
+ string="Payment For Sale"
+ model="pos.order"
+ name="pos.payment.report.webkit"
+ auto="False"
+ multi="True"
+ menu="False"
+ file="point_of_sale_webkit/report/pos_payment_report.mako"
+ report_type="webkit"
+ webkit_header="point_of_sale_webkit_header"
+ />
+
+
+ </data>
+</openerp>
=== added directory 'point_of_sale_webkit/report'
=== added file 'point_of_sale_webkit/report/__init__.py'
--- point_of_sale_webkit/report/__init__.py 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/report/__init__.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,35 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 pos_users_product
+import account_statement
+import all_closed_cashbox_of_the_day
+import pos_receipt
+import pos_invoice
+import pos_lines
+import pos_details
+import pos_details_summary
+import pos_payment_report
+import pos_sales_user
+import pos_sales_user_today
+import pos_payment_report_user
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'point_of_sale_webkit/report/account_statement.mako'
--- point_of_sale_webkit/report/account_statement.mako 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/report/account_statement.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,121 @@
+<html>
+<head>
+ <style type="text/css">
+ ${css}
+ </style>
+</head>
+<body>
+ %for statement in objects:
+ </br>
+ <center><h1>Statement<h1></center>
+ <table class="basic_table">
+ <tr>
+ <td width="25%">
+ <b>${_("Statement Name")}</b>
+ </td>
+ <td width="25%">
+ <b>${_("Journal")}</b>
+ </td>
+ <td width="25%">
+ <b>${_("Company")}</b>
+ </td>
+ <td width="25%">
+ <b>${_("User")}</b>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ${ statement.name }
+ </td>
+ <td>
+ ${statement.journal_id.name}
+ </td>
+ <td>
+ ${statement.company_id.name}
+ </td>
+ <td>
+ ${statement.user_id.name }
+ </td>
+ </tr>
+ </table>
+ </br>
+ <table class="basic_table">
+ <tr>
+ <td width="25%">
+ <b>${_("Opening Date")}</b>
+ </td>
+ <td width="25%">
+ <b>${_("Closing Date")}</b>
+ </td>
+ <td width="25%">
+ <b>${_("Starting Balance")}</b>
+ </td>
+ <td width="25%">
+ <b>${_("Ending Balance")}</b>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ${formatLang(statement.date,date=True)}
+ </td>
+ <td>
+ ${formatLang(statement.closing_date,date_time=True)}
+ </td>
+ <td>
+ ${formatLang(statement.balance_start, dp='Account', currency_obj = company.currency_id)}
+ </td>
+ <td>
+ ${formatLang(statement.balance_end_real, dp='Account', currency_obj = company.currency_id)}
+ </td>
+ </tr>
+ </table>
+ </br>
+ <table class="list_table">
+ <tr>
+ <th width="15%">
+ ${_("Name")}
+ </th>
+ <th width="70%">
+ ${_("Partner")}
+ </th>
+ <th width="15%" align="right">
+ ${_("Amount")}
+ </th>
+ </tr>
+ %for line_ids in statement.line_ids or get_data(statement):
+ <tr>
+ <td>
+ ${line_ids.name}
+ </td>
+ <td>
+ ${line_ids.partner_id.name}
+ </td>
+ <td align="right">
+ ${formatLang(line_ids.amount, dp='Account', currency_obj=company.currency_id)}
+ </td>
+ </tr>
+ %endfor
+ </table>
+ <table width="100%">
+ <tr>
+ <td width="70%">
+ </td>
+ <td width="30%" style="padding-top:0px">
+ <table class="top" width="100%">
+ <tr>
+ <td width="50%" align="left">
+ <b>Total:</b>
+ </td>
+ <td align="right" width="50%">
+ ${formatLang(get_total(statement.line_ids), dp='Account', currency_obj = company.currency_id)}
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ <p style="page-break-after:always">
+ </p>
+ %endfor
+</body>
+</html>
\ No newline at end of file
=== added file 'point_of_sale_webkit/report/account_statement.py'
--- point_of_sale_webkit/report/account_statement.py 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/report/account_statement.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,51 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp.report import report_sxw
+
+class account_statement(report_sxw.rml_parse):
+
+ def __init__(self, cr, uid, name, context):
+ super(account_statement, self).__init__(cr, uid, name, context=context)
+ self.total = 0.0
+ self.localcontext.update({
+ 'time': time,
+ 'get_total': self._get_total,
+ 'get_data': self._get_data,
+ })
+
+ def _get_data(self, statement):
+ lines = []
+ for line in statement.line_ids:
+ lines.append(line)
+
+ return lines
+
+ def _get_total(self, statement_line_ids):
+ total = 0.0
+ for line in statement_line_ids:
+ total += line.amount
+ return total
+
+report_sxw.report_sxw('report.account.statement.webkit', 'account.bank.statement', 'addons/point_of_sale_webkit/report/account_statement.mako', parser=account_statement,header='internal')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'point_of_sale_webkit/report/all_closed_cashbox_of_the_day.mako'
--- point_of_sale_webkit/report/all_closed_cashbox_of_the_day.mako 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/report/all_closed_cashbox_of_the_day.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,107 @@
+<html>
+<head>
+ <style type="text/css">
+ ${css}
+ </style>
+</head>
+<body>
+ %for statement in objects:
+ </br>
+ </br>
+ <center><h1>Today's Closed Cashbox</h1></center>
+ <table class="basic_table">
+ <tr>
+ <td width="50%">
+ <b>${_("Company")}</b>
+ </td>
+ <td>
+ <b>${_("User")}</b>
+ </td>
+ </tr>
+ <tr>
+ <td width="50%">
+ ${company.name}
+ </td>
+ <td>
+ ${user.name}
+ </td>
+ </tr>
+ </table>
+ </br>
+ <table class="list_table">
+ <tr>
+ <th width="18%">
+ ${_("St.Name")}
+ </th>
+ <th width="16%">
+ ${_("Journal")}
+ </th>
+ <th width="16%">
+ ${_("Opening Date")}
+ </th>
+ <th width="16%">
+ ${_("Closing Date")}
+ </th>
+ <th width="18%" style="text-align:right;">
+ ${_("Starting Balance")}
+ </th>
+ <th style="text-align:right;" width="16%">
+ ${_("Ending Balance")}
+ </th>
+ </tr>
+ <tr>
+ <td>
+ <b>Total:</b>
+ </td>
+ <td colspan="4" align="right">
+ <u>${formatLang(get_net_total_starting(user)[1], currency_obj = company.currency_id)}</u>
+ </td>
+ <td align="right">
+ <u>${formatLang(get_net_total(user), currency_obj = company.currency_id)}</u>
+ </td>
+ </tr>
+ %for statement in get_data(user.id):
+ <tr>
+ <td>
+ ${statement['statement']}
+ </td>
+ <td>
+ ${statement['journal']}
+ </td>
+ <td>
+ ${statement['date']}
+ </td>
+ <td>
+ ${statement['closing_date']}
+ </td>
+ <td align="right">
+ <u>${formatLang(get_bal(statement), currency_obj = company.currency_id)}</u>
+ </td>
+ <td align="right">
+ <u>${formatLang(get_sub_total(user,statement['journal_id'],statement['date']), currency_obj = company.currency_id)}</u>
+ </td>
+ </tr>
+ %endfor
+ %for line_ids in get_lines(statement):
+ <tr>
+ <td>
+ ${line_ids['name']}
+ </td>
+ <td>
+ ${get_partner(line_ids) or ''}
+ </td>
+ <td>
+ ${get_user(line_ids) or ''}
+ </td>
+ <td colspan="3" align="right">
+ ${formatLang(line_ids['amount'], currency_obj = company.currency_id)}
+ </td>
+ </tr>
+ %endfor
+ </table>
+ <p style="page-break-after:always">
+ </p>
+ %endfor
+
+</body>
+</html>
\ No newline at end of file
=== added file 'point_of_sale_webkit/report/all_closed_cashbox_of_the_day.py'
--- point_of_sale_webkit/report/all_closed_cashbox_of_the_day.py 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/report/all_closed_cashbox_of_the_day.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,141 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp.report import report_sxw
+
+class all_closed_cashbox_of_the_day(report_sxw.rml_parse):
+ #TOFIX: sql injection problem: SQL Request must be pass from sql injection...
+ def __init__(self, cr, uid, name, context):
+ super(all_closed_cashbox_of_the_day, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({
+ 'time': time,
+ 'get_data':self._get_data,
+ 'get_bal':self._get_bal,
+ 'get_lines':self._get_lines,
+ 'get_partner':self._get_partner,
+ 'get_net_total':self._get_net_total,
+ 'get_user':self._get_user,
+ 'get_sub_total':self._get_sub_total,
+ 'get_net_total_starting':self._get_net_total_starting,
+ })
+
+ def _get_user(self, line_ids):
+ sql = "select name from res_partner left join res_users on res_users.partner_id = res_partner.id where res_users.create_uid=%d"%(line_ids['create_uid'])
+ self.cr.execute(sql)
+ user = self.cr.fetchone()
+ return user[0]
+
+ def _get_data(self, user):
+ print "user::::::::::",user
+ data = {}
+ sql = """ SELECT abs.journal_id,abs.id,abs.date,abs.closing_date,abs.name as statement,aj.name as journal,ap.name as period ,rc.name as company,
+ abs.state,abs.balance_end_real FROM account_bank_statement as abs
+ LEFT JOIN account_journal as aj ON aj.id = abs.journal_id
+ LEFT JOIN account_period as ap ON ap.id = abs.period_id
+ LEFT JOIN res_users as ru ON ru.id = abs.user_id
+ LEFT JOIN res_company as rc ON rc.id = abs.company_id
+ WHERE to_char(date_trunc('day',abs.date),'YYYY-MM-DD')::date = current_date and abs.state IN ('confirm','open') and abs.user_id = %d"""%(user)
+ self.cr.execute(sql)
+ data = self.cr.dictfetchall()
+ print "DATA::::::::::",data
+ return data
+
+ def _get_lines(self, statement):
+ data = {}
+ sql = """ select absl.* from account_bank_statement_line as absl, account_bank_statement as abs
+ where absl.statement_id = abs.id and abs.id = %d"""%(statement['id'])
+ self.cr.execute(sql)
+ data = self.cr.dictfetchall()
+ return data
+
+ def _get_bal(self, data):
+ res = {}
+ sql =""" select sum(pieces*number) as bal from account_cashbox_line where starting_id = %d """%(data['id'])
+ self.cr.execute(sql)
+ res = self.cr.dictfetchall()
+ if res:
+ return res[0]['bal']
+ else:
+ return 0
+
+ def _get_sub_total(self, user, data, date):
+ res={}
+ self.cr.execute(""" select sum(absl.amount) from account_bank_statement as abs
+ LEFT JOIN account_bank_statement_line as absl ON abs.id = absl.statement_id
+ WHERE abs.journal_id = %d
+ and abs.state IN ('confirm','open')
+ and abs.date = '%s'
+ and abs.user_id = %d
+ """%(data,date,user.id))
+ res = self.cr.fetchall()
+ if res[0][0]:
+ return res[0][0]
+ else:
+ return False
+
+ def _get_partner(self, statement):
+ res = {}
+ if statement['pos_statement_id']:
+ sql =""" select rp.name from account_bank_statement_line as absl,res_partner as rp
+ where absl.partner_id = rp.id
+ and absl.pos_statement_id = %d"""%(statement['pos_statement_id'])
+ self.cr.execute(sql)
+ res = self.cr.dictfetchall() or {}
+ return res and res[0]['name']
+ else:
+ return 0.00
+
+ def _get_net_total_starting(self, user):
+ lst = []
+ res={}
+ total_ending_bal = 0.0
+ total_starting_bal = 0.0
+ sql = """ SELECT abs.id,abs.balance_end_real as net_total FROM account_bank_statement as abs
+ WHERE to_char(date_trunc('day',abs.date),'YYYY-MM-DD')::date = current_date
+ and abs.state IN ('confirm','open')
+ and abs.user_id = %d"""%(user.id)
+ self.cr.execute(sql)
+ res = self.cr.dictfetchall()
+ for r in res:
+ total_ending_bal += (r['net_total'] or 0.0)
+ sql1 =""" select sum(pieces*number) as bal from account_cashbox_line where starting_id = %d"""%(r['id'])
+ self.cr.execute(sql1)
+ data = self.cr.dictfetchall()
+ if data[0]['bal']:
+ total_starting_bal += data[0]['bal']
+ lst.append(total_ending_bal)
+ lst.append(total_starting_bal)
+ return lst
+
+ def _get_net_total(self, user):
+ res={}
+ sql = """select sum(absl.amount) as net_total from account_bank_statement as abs
+ LEFT JOIN account_bank_statement_line as absl ON abs.id = absl.statement_id
+ where abs.state IN ('confirm','open') and abs.user_id = %d
+ and to_char(date_trunc('day',abs.date),'YYYY-MM-DD')::date = current_date """%(user.id)
+
+ self.cr.execute(sql)
+ res = self.cr.dictfetchall()
+ return res[0]['net_total'] or 0.0
+
+report_sxw.report_sxw('report.all.closed.cashbox.of.the.day.webkit', 'account.bank.statement', 'addons/point_of_sale_webkit/report/all_closed_cashbox_of_the_day.mako', parser=all_closed_cashbox_of_the_day,header='internal')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'point_of_sale_webkit/report/pos_detail_summary.mako'
--- point_of_sale_webkit/report/pos_detail_summary.mako 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/report/pos_detail_summary.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,137 @@
+<html>
+<head>
+ <style type="text/css">
+ ${css}
+ </style>
+</head>
+<body>
+ <center><h2>Details of Sales<h2></center>
+ <table class="basic_table">
+ <tr>
+ <td width="25%">
+ <b>${_("Company")}</b>
+ </td>
+ <td width="25%">
+ <b>${_("Print Date")}</b>
+ </td>
+ <td width="25%">
+ <b>${_("Start Period")}</b>
+ </td>
+ <td width="25%">
+ <b>${_("End Period")}</b>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ${company.name}
+ </td>
+ <td>
+ ${formatLang(time.strftime('%Y-%m-%d'),date=True)}
+ </td>
+ <td>
+ ${'%s' % getstartperiod(objects)}
+ </td>
+ <td>
+ ${'%s' % getendperiod(objects)}
+ </td>
+ </tr>
+ </table>
+ </br>
+ <table class="list_table">
+ <tr>
+ <th width="40%">
+ ${_("Mode of Taxes")}
+ </th>
+ <th width="60%"></th>
+ </tr>
+ %for p in gettaxamount(objects).items():
+ <tr>
+ <td width="50%">
+ ${p[0].name}
+ </td>
+ <td align="right" width="50%">
+ <b>${formatLang(p[1], currency_obj=company.currency_id)}</b>
+ </td>
+ </tr>
+ %endfor
+ </table>
+ </br>
+ <table class="list_table">
+ <tr>
+ <th width="60%">
+ ${_("Mode of Payment")}
+ </th>
+ <th width="40%"></th>
+ </tr>
+ %for t in getpayments(objects).items():
+ <tr>
+ <td width="40%">
+ ${t[0].name}
+ </td>
+ <td align="right" width="60%">
+ <b> ${formatLang(t[1], currency_obj=company.currency_id)}</b>
+ </td>
+ </tr>
+ %endfor
+ </table>
+ </br>
+ <table class="list_table">
+ <tr>
+ <th width="40%" >
+ ${_("Summary")}
+ </th>
+ <th width="60%"></th>
+ </tr>
+ <tr>
+ <td width="40%">
+ <b>${_("Sales total")}</b>
+ </td>
+ <td align="right" width="60%">
+ <b> ${'%d' % getsalestotal(objects)}</b>
+ </td>
+ </tr>
+ <tr>
+ <td width="40%">
+ <b>${_("Qty of product")}</b>
+ </td>
+ <td align="right" width="60%">
+ <b>${'%d' % getqtytotal(objects)}</b>
+ </td>
+ </tr>
+ <tr>
+ <td width="40%">
+ <b>${_("Total invoiced")}</b>
+ </td>
+ <td align="right" width="60%">
+ <b>${formatLang(getsuminvoice(objects), currency_obj=company.currency_id)}</b>
+ </td>
+ </tr>
+ <tr>
+ <td width="40%">
+ <b>${_("Total discount")}</b>
+ </td>
+ <td align="right" width="60%">
+ <b>${formatLang(getsumdisc(objects), currency_obj=company.currency_id)}</b>
+ </td>
+ </tr>
+ <tr>
+ <td width="40%">
+ <b>${_("Total paid")}</b>
+ </td>
+ <td align="right" width="60%">
+ <b>${formatLang(getpaidtotal(objects), currency_obj=company.currency_id)}</b>
+ </td>
+ </tr>
+ <tr>
+ <td width="40%">
+ <b>${_("Total of the day")}</b>
+ </td>
+ <td align="right" width="60%">
+ <b>${formatLang(gettotalofthaday(objects), currency_obj=company.currency_id)}</b>
+ </td>
+ </tr>
+ </table>
+ <p style="page-break-after:always">
+ </p>
+</body>
+</html>
\ No newline at end of file
=== added file 'point_of_sale_webkit/report/pos_details.mako'
--- point_of_sale_webkit/report/pos_details.mako 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/report/pos_details.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,206 @@
+<html>
+<head>
+ <style type="text/css">
+ ${css}
+ </style>
+</head>
+<body>
+
+ <center><h2>Details of Sales</h2></center>
+ <table class="basic_table">
+ <tr>
+ <td width="20%">
+ <b>${_("Company")}</b>
+ </td>
+ <td width="20%">
+ <b>${_("Users")}</b>
+ </td>
+ <td width="20%">
+ <b>${_("Print Date")}</b>
+ </td>
+ <td width="20%">
+ <b>${_("Start Period")}</b>
+ </td>
+ <td width="20%">
+ <b>${_("End Period")}</b>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ${company.name}
+ </td>
+ <td>
+ ${get_user_names(data['form']['user_ids']) or 'All'}
+ </td>
+ <td>
+ ${formatLang(time.strftime('%Y-%m-%d'),date=True)}
+ </td>
+ <td>
+ ${formatLang(data['form']['date_start'],date=True)}
+ </td>
+ <td>
+ ${formatLang(data['form']['date_end'],date=True)}
+ </td>
+ </tr>
+ </table>
+ </br>
+ <table class="list_table">
+ <tr>
+ <th width="20%">
+ ${_("Date")}
+ </th>
+ <th width="10%">
+ ${_("Order")}
+ </th>
+ <th width="30%" >
+ ${_("Product")}
+ </th>
+ <th width="10%" align="right">
+ ${_("Price")}
+ </th>
+ <th width="10%" align="right">
+ ${_("Qty")}
+ </th>
+ <th width="10%" align="right">
+ ${_("Disc(%)")}
+ </th>
+ <th width="10%" align="right">
+ ${_("Invoiced")}
+ </th>
+ </tr>
+ %for line_ids in pos_sales_details(data['form']):
+ <tr>
+ <td>
+ ${formatLang(line_ids['date_order'],date_time = True)}
+ </td>
+ <td>
+ ${line_ids['pos_name']}
+ </td>
+ <td>
+ ${line_ids['code']} ${line_ids['name']}
+ </td>
+ <td>
+ ${formatLang(line_ids['price_unit'], dp='Sale Price', currency_obj = company.currency_id)}
+ </td>
+ <td>
+ ${formatLang(line_ids['qty'])} ${line_ids['uom']}
+ </td>
+ <td>
+ ${formatLang(line_ids['discount'], dp='Sale Price')}
+ </td>
+ <td>
+ ${getinvoice(line_ids['invoice_id']) or ''}
+ </td>
+ </tr>
+ %endfor
+ </table>
+ </br>
+ <table width="100%">
+ <tr>
+ <td width="3%">
+ </td>
+ <td width="94%">
+ <table class="list_table">
+ <tr>
+ <th width="50%">
+ ${_("Taxes")}
+ </th>
+ <th width="50%"></th>
+ </tr>
+ %for p in gettaxamount(data['form']):
+ <tr>
+ <td width="50%" style="border-bottom:1px solid lightGrey;">
+ <b>${p['name'] or ''}</b>
+ </td>
+ <td align="right" width="50%" style="border-bottom:1px solid lightGrey;">
+ <b>${formatLang(p['amount'], currency_obj = company.currency_id) or ''}</b>
+ </td>
+ </tr>
+ %endfor
+ </table>
+ </br>
+ <table class="list_table">
+ <tr>
+ <th width="50%">
+ ${_("Payment")}
+ </th>
+ <th width="50%"></th>
+ </tr>
+ %for p in getpayments(data['form']):
+ <tr>
+ <td width="50%">
+ ${p['name'] or ''}
+ </td>
+ <td align="right" width="50%">
+ ${formatLang(p['sum'], dp='Account', currency_obj = company.currency_id) or ''}
+ </td>
+ </tr>
+ %endfor
+ </table>
+ </br>
+ <table class="list_table">
+ <tr>
+ <th width="50%">
+ ${_("Summary")}
+ </th>
+ <th width="50%"></th>
+ </tr>
+ <tr>
+ <td width="50%">
+ <b>${_("Sales total(Revenue)")}</b>
+ </td>
+ <td align="right" width="50%">
+ <b>${formatLang(getsalestotal2(), dp='Sale Price', currency_obj = company.currency_id)}</b>
+ </td>
+ </tr>
+ <tr>
+ <td width="50%">
+ <b>${_("Qty of product")}</b>
+ </td>
+ <td align="right" width="50%">
+ <b>${formatLang(getqtytotal2())}</b>
+ </td>
+ </tr>
+ <tr>
+ <td width="50%">
+ <b>${_("Total invoiced")}</b>
+ </td>
+ <td align="right" width="50%">
+ <b>${formatLang(getsuminvoice2(data['form']), dp='Sale Price', currency_obj = company.currency_id)}</b>
+ </td>
+ </tr>
+ <tr>
+ <td width="50%">
+ <b>${_("Total discount")}</b>
+ </td>
+ <td align="right" width="50%">
+ <b>${formatLang(getsumdisc(data['form']), dp='Sale Price', currency_obj = company.currency_id)}</b>
+ </td>
+ </tr>
+ <tr>
+ <td width="50%">
+ <b>${_("Total paid")}</b>
+ </td>
+ <td align="right" width="50%">
+ <b>${formatLang(getpaidtotal2(), dp='Sale Price', currency_obj = company.currency_id)}</b>
+ </td>
+ </tr>
+ <tr>
+ <td width="50%">
+ <b>${_("Total of the day")}</b>
+ </td>
+ <td align="right" width="50%">
+ <b>${formatLang(gettotalofthaday(data['form']), dp='Sale Price', currency_obj = company.currency_id)}</b>
+ </td>
+ </tr>
+ </table>
+ </td>
+ <td width="3%">
+ </td>
+ </tr>
+ </table>
+
+ <p style="page-break-after:always">
+ </p>
+</body>
+</html>
\ No newline at end of file
=== added file 'point_of_sale_webkit/report/pos_details.py'
--- point_of_sale_webkit/report/pos_details.py 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/report/pos_details.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,201 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp.report import report_sxw
+
+class pos_details(report_sxw.rml_parse):
+
+ def _get_invoice(self, inv_id):
+ res={}
+ if inv_id:
+ self.cr.execute("select number from account_invoice as ac where id = %s", (inv_id,))
+ res = self.cr.fetchone()
+ return res[0] or 'Draft'
+ else:
+ return ''
+
+ def _get_all_users(self):
+ user_obj = self.pool.get('res.users')
+ return user_obj.search(self.cr, self.uid, [])
+
+ def _pos_sales_details(self, form):
+ pos_obj = self.pool.get('pos.order')
+ user_obj = self.pool.get('res.users')
+ data = []
+ result = {}
+ user_ids = form['user_ids'] or self._get_all_users()
+ company_id = user_obj.browse(self.cr, self.uid, self.uid).company_id.id
+ pos_ids = pos_obj.search(self.cr, self.uid, [('date_order','>=',form['date_start'] + ' 00:00:00'),('date_order','<=',form['date_end'] + ' 23:59:59'),('user_id','in',user_ids),('state','in',['done','paid','invoiced']),('company_id','=',company_id)])
+ for pos in pos_obj.browse(self.cr, self.uid, pos_ids):
+ for pol in pos.lines:
+ result = {
+ 'code': pol.product_id.default_code,
+ 'name': pol.product_id.name,
+ 'invoice_id': pos.invoice_id.id,
+ 'price_unit': pol.price_unit,
+ 'qty': pol.qty,
+ 'discount': pol.discount,
+ 'total': (pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)),
+ 'date_order': pos.date_order,
+ 'pos_name': pos.name,
+ 'uom': pol.product_id.uom_id.name
+ }
+ data.append(result)
+ self.total += result['total']
+ self.qty += result['qty']
+ self.discount += result['discount']
+ if data:
+ return data
+ else:
+ return {}
+
+ def _get_qty_total_2(self):
+ return self.qty
+
+ def _get_sales_total_2(self):
+ return self.total
+
+ def _get_sum_invoice_2(self, form):
+ pos_obj = self.pool.get('pos.order')
+ user_obj = self.pool.get('res.users')
+ user_ids = form['user_ids'] or self._get_all_users()
+ company_id = user_obj.browse(self.cr, self.uid, self.uid).company_id.id
+ pos_ids = pos_obj.search(self.cr, self.uid, [('date_order','>=',form['date_start'] + ' 00:00:00'),('date_order','<=',form['date_end'] + ' 23:59:59'),('user_id','in',user_ids),('company_id','=',company_id),('invoice_id','<>',False)])
+ for pos in pos_obj.browse(self.cr, self.uid, pos_ids):
+ for pol in pos.lines:
+ self.total_invoiced += (pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0))
+ return self.total_invoiced or False
+
+ def _paid_total_2(self):
+ return self.total or 0.0
+
+ def _get_sum_dis_2(self):
+ return self.discount or 0.0
+
+ def _get_sum_discount(self, form):
+ #code for the sum of discount value
+ pos_obj = self.pool.get('pos.order')
+ user_obj = self.pool.get('res.users')
+ user_ids = form['user_ids'] or self._get_all_users()
+ company_id = user_obj.browse(self.cr, self.uid, self.uid).company_id.id
+ pos_ids = pos_obj.search(self.cr, self.uid, [('date_order','>=',form['date_start'] + ' 00:00:00'),('date_order','<=',form['date_end'] + ' 23:59:59'),('user_id','in',user_ids),('company_id','=',company_id)])
+ for pos in pos_obj.browse(self.cr, self.uid, pos_ids):
+ for pol in pos.lines:
+ self.total_discount += ((pol.price_unit * pol.qty) * (pol.discount / 100))
+ return self.total_discount or False
+
+ def _get_payments(self, form):
+ statement_line_obj = self.pool.get("account.bank.statement.line")
+ pos_order_obj = self.pool.get("pos.order")
+ user_ids = form['user_ids'] or self._get_all_users()
+ pos_ids = pos_order_obj.search(self.cr, self.uid, [('date_order','>=',form['date_start'] + ' 00:00:00'),('date_order','<=',form['date_end'] + ' 23:59:59'),('state','in',['paid','invoiced','done']),('user_id','in',user_ids)])
+ data={}
+ if pos_ids:
+ st_line_ids = statement_line_obj.search(self.cr, self.uid, [('pos_statement_id', 'in', pos_ids)])
+ if st_line_ids:
+ st_id = statement_line_obj.browse(self.cr, self.uid, st_line_ids)
+ a_l=[]
+ for r in st_id:
+ a_l.append(r['id'])
+ self.cr.execute("select aj.name,sum(amount) from account_bank_statement_line as absl,account_bank_statement as abs,account_journal as aj " \
+ "where absl.statement_id = abs.id and abs.journal_id = aj.id and absl.id IN %s " \
+ "group by aj.name ",(tuple(a_l),))
+
+ data = self.cr.dictfetchall()
+ return data
+ else:
+ return {}
+
+ def _total_of_the_day(self, objects):
+ if self.total:
+ if self.total == self.total_invoiced:
+ return self.total
+ else:
+ return ((self.total or 0.00) - (self.total_invoiced or 0.00))
+ else:
+ return False
+
+ def _sum_invoice(self, objects):
+ return reduce(lambda acc, obj:
+ acc + obj.invoice_id.amount_total,
+ [o for o in objects if o.invoice_id and o.invoice_id.number],
+ 0.0)
+
+ def _ellipsis(self, orig_str, maxlen=100, ellipsis='...'):
+ maxlen = maxlen - len(ellipsis)
+ if maxlen <= 0:
+ maxlen = 1
+ new_str = orig_str[:maxlen]
+ return new_str
+
+ def _strip_name(self, name, maxlen=50):
+ return self._ellipsis(name, maxlen, ' ...')
+
+ def _get_tax_amount(self, form):
+ res = {}
+ temp = {}
+ list_ids = []
+ temp2 = 0.0
+ user_ids = form['user_ids'] or self._get_all_users()
+ pos_order_obj = self.pool.get('pos.order')
+ pos_ids = pos_order_obj.search(self.cr, self.uid, [('date_order','>=',form['date_start'] + ' 00:00:00'),('date_order','<=',form['date_end'] + ' 23:59:59'),('state','in',['paid','invoiced','done']),('user_id','in',user_ids)])
+ temp.update({'name': ''})
+ for order in pos_order_obj.browse(self.cr, self.uid, pos_ids):
+ temp2 += order.amount_tax
+ for line in order.lines:
+ if len(line.product_id.taxes_id):
+ tax = line.product_id.taxes_id[0]
+ res[tax.name] = (line.price_unit * line.qty * (1-(line.discount or 0.0) / 100.0)) + (tax.id in list_ids and res[tax.name] or 0)
+ list_ids.append(tax.id)
+ temp.update({'name': tax.name})
+ temp.update({'amount': temp2})
+ return [temp] or False
+
+ def _get_user_names(self, user_ids):
+ user_obj = self.pool.get('res.users')
+ return ', '.join(map(lambda x: x.name, user_obj.browse(self.cr, self.uid, user_ids)))
+
+ def __init__(self, cr, uid, name, context):
+ super(pos_details, self).__init__(cr, uid, name, context=context)
+ self.total = 0.0
+ self.qty = 0.0
+ self.total_invoiced = 0.0
+ self.discount = 0.0
+ self.total_discount = 0.0
+ self.localcontext.update({
+ 'time': time,
+ 'strip_name': self._strip_name,
+ 'getpayments': self._get_payments,
+ 'getsumdisc': self._get_sum_discount,
+ 'gettotalofthaday': self._total_of_the_day,
+ 'gettaxamount': self._get_tax_amount,
+ 'pos_sales_details':self._pos_sales_details,
+ 'getqtytotal2': self._get_qty_total_2,
+ 'getsalestotal2': self._get_sales_total_2,
+ 'getsuminvoice2':self._get_sum_invoice_2,
+ 'getpaidtotal2': self._paid_total_2,
+ 'getinvoice':self._get_invoice,
+ 'get_user_names': self._get_user_names,
+ })
+
+report_sxw.report_sxw('report.pos.details.webkit', 'pos.order', 'addons/point_of_sale_webkit/report/pos_details.mako', parser=pos_details, header='internal')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'point_of_sale_webkit/report/pos_details_summary.py'
--- point_of_sale_webkit/report/pos_details_summary.py 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/report/pos_details_summary.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,132 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp.report import report_sxw
+
+class pos_details_summary(report_sxw.rml_parse):
+ def __init__(self, cr, uid, name, context):
+ super(pos_details_summary, self).__init__(cr, uid, name, context=context)
+ self.total = 0.0
+ self.localcontext.update({
+ 'time': time,
+ 'strip_name': self._strip_name,
+ 'getpayments': self._get_payments,
+ 'getqtytotal': self._get_qty_total,
+ 'getsumdisc': self._get_sum_discount,
+ 'getpaidtotal': self._paid_total,
+ 'gettotalofthaday': self._total_of_the_day,
+ 'getsuminvoice': self._sum_invoice,
+ 'gettaxamount': self._get_tax_amount,
+ 'getsalestotal': self._get_sales_total,
+ 'getstartperiod': self._get_start_period,
+ 'getendperiod': self._get_end_period,
+ 'getcompany':self.get_company
+ })
+
+ def get_company(self, objects):
+ comp=[obj.company_id.name for obj in objects]
+ return '%s' % (comp[0])
+
+ def _get_qty_total(self, objects):
+ #code for the sum of qty_total
+ return reduce(lambda acc, object:
+ acc + reduce(
+ lambda sum_qty, line:
+ sum_qty + line.qty,
+ object.lines,
+ 0 ),
+ objects,
+ 0)
+
+ def _get_sum_discount(self, objects):
+ #code for the sum of discount value
+ return reduce(lambda acc, object:
+ acc + reduce(
+ lambda sum_dis, line:
+ sum_dis + ((line.price_unit * line.qty ) * (line.discount / 100)),
+ object.lines,
+ 0.0),
+ objects,
+ 0.0 )
+
+ def _get_payments(self, objects):
+ result = {}
+ for obj in objects:
+ for statement in obj.statement_ids:
+ if statement.journal_id:
+ result[statement.journal_id] = result.get(statement.journal_id, 0.0) + statement.amount
+ return result
+
+ def _paid_total(self, objects):
+ return sum(self._get_payments(objects).values(), 0.0)
+
+ def _total_of_the_day(self, objects):
+ total_paid = self._paid_total(objects)
+ total_invoiced = self._sum_invoice(objects)
+ return total_paid - total_invoiced
+
+ def _sum_invoice(self, objects):
+ return reduce(lambda acc, obj:
+ acc + obj.invoice_id.amount_total,
+ [o for o in objects if o.invoice_id and o.invoice_id.number],
+ 0.0)
+
+ def _ellipsis(self, string, maxlen=100, ellipsis = '...'):
+ ellipsis = ellipsis or ''
+ return string[:maxlen - len(ellipsis) ] + (ellipsis, '')[len(string) < maxlen]
+
+ def _strip_name(self, name, maxlen=50):
+ return self._ellipsis(name, maxlen, ' ...')
+
+ def _get_tax_amount(self, objects):
+ res = {}
+ list_ids = []
+ for order in objects:
+ for line in order.lines:
+ if len(line.product_id.taxes_id):
+ tax = line.product_id.taxes_id[0]
+ res[tax.name] = (line.price_unit * line.qty * (1-(line.discount or 0.0) / 100.0)) + (tax.id in list_ids and res[tax.name] or 0)
+ list_ids.append(tax.id)
+ return res
+
+ def _get_sales_total(self, objects):
+ return reduce(lambda x, o: x + len(o.lines), objects, 0)
+
+ def _get_start_period(self, objects):
+ date_orders = sorted([obj.date_order for obj in objects])
+ min_date = date_orders[0]
+ return '%s' % min_date
+
+
+ def _get_end_period(self, objects):
+ date_orders = sorted([obj.date_order for obj in objects])
+ max_date = date_orders[-1]
+ return '%s' % max_date
+
+
+report_sxw.report_sxw('report.pos.details.summary.webkit',
+ 'pos.order',
+ 'addons/point_of_sale_webkit/report/pos_detail_summary.mako',
+ parser=pos_details_summary,
+ header='internal')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'point_of_sale_webkit/report/pos_invoice.mako'
--- point_of_sale_webkit/report/pos_invoice.mako 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/report/pos_invoice.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,149 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+ <body >
+
+ %for o in objects:
+ <% setLang(o.partner_id.lang) %>
+ </br></br></br>
+ <table cellspacing="0" width="100%">
+ <tr>
+ <td width="70%" >
+
+ </td>
+ <td width="30%" class="title">
+ ${ (o.partner_id and o.partner_id.title and o.partner_id.title.name) or '' }${ (o.partner_id and o.partner_id.name) or '' }</br>
+ ${ o.partner_id.parent_id.name or '' }</br>
+ ${ o.partner_id.street or '' }</br>
+ ${ o.partner_id.city or '' } ${ o.partner_id.zip or '' }</br>
+ ${ o.partner_id.country_id.name or '' }</br>
+ </br>
+ %if (o.partner_id.phone):
+ Tel. : ${ o.partner_id.phone or '' }</br>
+ %endif
+ %if o.partner_id.fax:
+ Fax : ${ o.partner_id.fax or '' }</br>
+ %endif
+ %if o.partner_id.vat:
+ ${ o.partner_id.vat or '' }
+ %endif
+ </td>
+ </tr>
+ </table>
+ </br>
+ <h2>
+ %if (o.type == 'out_invoice' and (o.state == 'open' or o.state == 'paid')):
+ ${ _('Invoice')} ${ o.number }
+ %endif
+ %if (o.type == 'out_invoice' and o.state == 'proforma2'):
+ ${ _('PRO-FORMA') }
+ %endif
+ %if (o.type == 'out_invoice' and o.state == 'draft'):
+ ${ _('Draft Invoice') }
+ %endif
+ %if (o.type == 'out_invoice' and o.state == 'cancel'):
+ ${ _('Cancelled Invoice') } ${ o.number }
+ %endif
+ %if o.type=='out_refund':
+ ${ _('Refund') } ${ o.number }
+ %endif
+ %if o.type=='in_refund':
+ ${ _('Supplier Refund') } ${ o.number }
+ %endif
+ %if o.type=='in_invoice':
+ ${ _('Supplier Invoice') } ${ o.number }
+ %endif
+ </h2>
+ </br>
+ <table class="basic_table">
+ <tr>
+ <td width="25%"><b>${_('Description')}</b></td>
+ <td width="25%"><b>${_('Invoice Date')}</b></td>
+ <td width="25%"><b>${_('Source')}</b></td>
+ <td width="25%"><b>${_('Customer Code')}</b></td>
+ </tr>
+ <tr>
+ <td >${ o.name or '' }</td>
+ <td >${ formatLang(o.date_invoice,date=True) }</td>
+ <td >${ o.origin or '' }</td>
+ <td >${ o.partner_id.ref or '' }</td>
+ </tr>
+ </table>
+ </br>
+ <table class="list_table" cellspacing="0">
+ <tr>
+ <th width="35%"><b>${_('Description')}</b></th>
+ <th width="13%"><center><b>${_('Taxes')}</b></center></th>
+ <th width="15%" style="text-align:right"><b>${_('Quantity')}</b></th>
+ <th width="11%" style="text-align:right"><b>${_('Unit Price')}</b></th>
+ <th width="10%" style="text-align:right"><b>${_('Disc.(%)')}</b></th>
+ <th width="16%" style="text-align:right"><b>${_('Price')}</b></th>
+ </tr>
+ <% rec = len(o.invoice_line) %>
+ <% i = 1 %>
+ %for l in o.invoice_line:
+ <tr>
+ <td >${ format(l.name) }</b></td>
+ <td ><center>${ ', '.join([ lt.name or '' for lt in l.invoice_line_tax_id ]) }</center></td>
+ <td style="text-align:right">${ formatLang(l.quantity) } ${ (l.uos_id and l.uos_id.name) or '' }</td>
+ <td style="text-align:right">${ formatLang(l.price_unit) }</td>
+ <td style="text-align:right">${ formatLang(l.discount, dp='Account') }</td>
+ <td style="text-align:right">${ formatLang(l.price_subtotal, dp='Account', currency_obj=o.currency_id) }</td>
+ </tr>
+
+ %endfor
+ <tr>
+ <td colspan="3" style="border-bottom:0px;"></td>
+ <td colspan="2" style="border-top:1px solid black;border-bottom:0px;">${ _('Net Total:') }</td>
+ <td style="border-top:1px solid black;text-align:right">${ formatLang(o.amount_untaxed, digits=get_digits(dp='Account'), currency_obj=o.currency_id) }</td>
+ </tr>
+ <tr>
+ <td style="border-bottom:0px;border-top:0px;" colspan="3"></td>
+ <td style="border-top:0px;border-bottom:0px" colspan="2">${ _('Taxes:') }</td>
+ <td align="right" style="border-top:0px;font-weight:none;text-align:right;">${ formatLang(o.amount_tax, dp='Account', currency_obj=o.currency_id) }</td>
+ </tr>
+ <tr>
+ <td colspan="3" style="border-bottom:0px;border-top:0px;"></td>
+ <td colspan="2" style="border-bottom:0px;border-top:1px solid black;"><b>${ _('Total:') }</b></td>
+ <td style="border-bottom:0px;border-top:1px solid black;text-align:right;" ><b>${ formatLang(o.amount_total, digits=get_digits(dp='Account'), currency_obj=o.currency_id) }</b></td>
+ </tr>
+ </table>
+ </br>
+ %if o.tax_line!=[]:
+ <table class="list_table" cellspacing="0">
+ <tr>
+ <th width="39%"><b>${_('Tax')}</b></th>
+ <th width="13%"><b>${_('Base')}</b></th>
+ <th width="13%"><b>${_('Amount')}</b></th>
+ <th width="35%"><b>${_('')}</b></th>
+ </tr>
+ %for t in o.tax_line:
+ %if not (t.tax_code_id and t.tax_code_id.notprintable):
+ <tr>
+ <td width="39%">${ t.name }</td>
+ <td width="13%">${ formatLang(t.base, dp='Account', currency_obj=o.currency_id) }</td>
+ <td width="13%">${ formatLang(t.amount, digits=get_digits(dp='Account'), currency_obj=o.currency_id) }</td>
+ <td width="35%">${_('')}</td>
+ </tr>
+ %endif
+ %endfor
+ </table>
+ %endif
+ <p class="title">
+ %if o.comment:
+ ${ format(o.comment) }
+ %endif
+ </p>
+ </br>
+ <p class="title">
+ %if o.payment_term and o.payment_term.note:
+ ${ format(o.payment_term and o.payment_term.note) }
+ %endif
+ </p>
+ <p style="page-break-after:always;"></p>
+ %endfor
+ </body>
+</html>
\ No newline at end of file
=== added file 'point_of_sale_webkit/report/pos_invoice.py'
--- point_of_sale_webkit/report/pos_invoice.py 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/report/pos_invoice.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,57 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp.report import report_sxw
+from openerp.osv import osv
+from openerp.tools.translate import _
+
+class pos_invoice(report_sxw.rml_parse):
+
+ def __init__(self, cr, uid, name, context):
+ super(pos_invoice, self).__init__(cr, uid, name, context=context)
+ self.localcontext.update({
+ 'time': time,
+ })
+
+ def set_context(self, objects, data, ids, report_type=None):
+ super(pos_invoice, self).set_context(objects, data, ids, report_type)
+ iids = []
+ nids = []
+
+ for order in objects:
+ order.write({'nb_print': order.nb_print + 1})
+
+ if order.invoice_id and order.invoice_id not in iids:
+ if not order.invoice_id:
+ raise osv.except_osv(_('Error!'), _('Please create an invoice for this sale.'))
+ iids.append(order.invoice_id)
+ nids.append(order.invoice_id.id)
+ data['ids'] = nids
+ self.datas = data
+ self.ids = nids
+ self.objects = iids
+ self.localcontext['data'] = data
+ self.localcontext['objects'] = iids
+
+report_sxw.report_sxw('report.pos.invoice.webkit', 'pos.order', 'addons/point_of_sale_webkit/report/pos_invoice.mako', parser= pos_invoice)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'point_of_sale_webkit/report/pos_lines.mako'
--- point_of_sale_webkit/report/pos_lines.mako 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/report/pos_lines.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,104 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+ <body>
+ %for o in objects:
+ </br>
+ </br>
+ <% setLang(o.partner_id.lang) %>
+ <center><h2>Sales lines</h2></center>
+ <table class="basic_table">
+ <tr>
+ <td width="35%">
+ <b>${_("Company")}</b>
+ </td>
+ <td width="30%">
+ <b>${_("Print Date")}</b>
+ </td>
+ <td width="35%">
+ <b>${_("No. Of Articles")}</b>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ${company.name}
+ </td>
+ <td>
+ ${formatLang(time.strftime('%Y-%m-%d'),date = True)}
+ </td>
+ <td>
+ ${formatLang(total_quantity(o))}
+ </td>
+ </tr>
+ </table>
+ </br>
+ <table class="list_table">
+ <tr>
+ <th width="40%">
+ <b>${_("Description")}</b>
+ </th>
+ <th width="10%">
+ <b>${_("Tax")}</b>
+ </th>
+ <th width="8%" align="left">
+ <b>${_("Quantity")}</b>
+ </th>
+ <th width="7%" align="left">
+ <b>${_("Unit Price")}</b>
+ </th>
+ <th width="10%" align="left">
+ <b>${_("Disc.(%)")}</b>
+ </th>
+ <th width="10%" align="right">
+ <b>${_("Price")}</b>
+ </th>
+ </tr>
+ %for l in o.lines:
+ <tr>
+ <td width="40%">
+ [ ${ l.product_id.code or ''} ] ${ l.product_id.name or ''}
+ </td>
+ <td width="10%">
+ %if taxes(l) :
+ ${ taxes(l) or ''|entity }
+ %endif
+ </td>
+ <td width="8%" align="left">
+ ${ formatLang(l.qty) } ${ l.product_id.uom_id.name }
+ </td>
+ <td width="8%" >
+ ${ formatLang(l.price_unit) }
+ </td>
+ <td width="10%">
+ ${ formatLang(l.discount) }
+ </td>
+ <td width="10%" style="text-align:right">
+ ${ formatLang(l.price_subtotal, currency_obj=o.pricelist_id.currency_id) }
+ </td>
+ </tr>
+ %endfor
+ <tr>
+ <td colspan="3" style="border-bottom:0px;"></td>
+ <td colspan="2" style="border-top:1px solid black;border-bottom:0px;">${ _('Net Total:') }</td>
+ <td style="border-top:1px solid black;text-align:right">${ formatLang(o.amount_total, currency_obj=o.pricelist_id.currency_id) }</td>
+ </tr>
+ <tr>
+ <td style="border-bottom:0px;border-top:0px;" colspan="3"></td>
+ <td style="border-top:0px;border-bottom:0px" colspan="2">${ _('Taxes:') }</td>
+ <td align="right" style="border-top:0px;font-weight:none;text-align:right;">${ formatLang(o.amount_tax, currency_obj=o.pricelist_id.currency_id) }</td>
+ </tr>
+ <tr>
+ <td colspan="3" style="border-bottom:0px;border-top:0px;"></td>
+ <td colspan="2" style="border-bottom:0px;border-top:1px solid black;"><b>${ _('Total:') }</b></td>
+ <td style="border-bottom:0px;border-top:1px solid black;text-align:right;" ><b>${ formatLang(o.amount_total + o.amount_tax, currency_obj=o.pricelist_id.currency_id) }</b></td>
+ </tr>
+ </table>
+ <p style="page-break-after:always">
+ </p>
+ %endfor
+
+ </body>
+</html>
\ No newline at end of file
=== added file 'point_of_sale_webkit/report/pos_lines.py'
--- point_of_sale_webkit/report/pos_lines.py 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/report/pos_lines.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,55 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp.report import report_sxw
+
+class pos_lines(report_sxw.rml_parse):
+
+ def __init__(self, cr, uid, name, context):
+ super(pos_lines, self).__init__(cr, uid, name, context=context)
+ self.total = 0.0
+ self.localcontext.update({
+ 'time': time,
+ 'total_quantity': self.__total_quantity__,
+ 'taxes':self.__taxes__,
+
+ })
+
+ def __total_quantity__(self, obj):
+ tot = 0
+ for line in obj.lines:
+ tot += line.qty
+ self.total = tot
+ return self.total
+
+ def __taxes__(self, obj):
+ self.cr.execute ( " Select acct.name from pos_order as po " \
+ " LEFT JOIN pos_order_line as pol ON po.id = pol.order_id " \
+ " LEFT JOIN product_taxes_rel as ptr ON pol.product_id = ptr.prod_id " \
+ " LEFT JOIN account_tax as acct ON acct.id = ptr.tax_id " \
+ " WHERE pol.id = %s", (obj.id,))
+ res=self.cr.fetchone()[0]
+ return res
+
+report_sxw.report_sxw('report.pos.lines.webkit', 'pos.order', 'addons/point_of_sale_webkit/report/pos_lines.mako', parser=pos_lines,header='internal')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'point_of_sale_webkit/report/pos_payment_report.mako'
--- point_of_sale_webkit/report/pos_payment_report.mako 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/report/pos_payment_report.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,79 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+ <body>
+ <center><h1>Payment For Sale</h1><center>
+ <table class="basic_table">
+ <tr>
+ <td width="50%">
+ <b>${_("Company")}</b>
+ </td>
+ <td width="50%">
+ <b>${_("Print Date")}</b>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ${company.name}
+ </td>
+ <td>
+ ${formatLang(time.strftime('%Y-%m-%d'),date = True)}
+ </td>
+ </tr>
+ </table>
+ </br>
+ <table class="list_table">
+ <tr>
+ <th width="50%">
+ ${_("Product")}
+ </th>
+ <th align="right" width="12%">
+ ${_("Qty")}
+ </th>
+ <th align="right" width="12%">
+ ${_("Disc.(%)")}
+ </th>
+ <th align="right" width="12%">
+ ${_("Unit Price")}
+ </th>
+ <th align="right" width="14%">
+ ${_("Total")}
+ </th>
+ </tr>
+ %for o in objects:
+ %for line_ids in pos_payment(o):
+ <tr>
+ <td>
+ [${ line_ids['code'] or '' }] ${line_ids['name']}
+ </td>
+ <td align="right">
+ ${formatLang(line_ids['qty'])} ${line_ids['uom']}
+ </td>
+ <td align="right">
+ ${formatLang(line_ids['discount'])}
+ </td>
+ <td align="right">
+ ${formatLang(line_ids['price_unit'])}
+ </td>
+ <td align="right">
+ ${formatLang(line_ids['total'], currency_obj = company.currency_id)}
+ </td>
+ </tr>
+ %endfor
+ <tr>
+ <td colspan="3" style="border-bottom:0px;">
+ </td>
+ <td style="border-top:1px solid black;border-bottom:0px;">
+ <b>Net Total:</b>
+ </td>
+ <td style="border-top:1px solid black;text-align:right">
+ <b>${formatLang(pos_payment_total(o), currency_obj = company.currency_id) or ''}</b>
+ </td>
+ <tr>
+ %endfor
+ </table>
+ </body>
+</html>
\ No newline at end of file
=== added file 'point_of_sale_webkit/report/pos_payment_report.py'
--- point_of_sale_webkit/report/pos_payment_report.py 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/report/pos_payment_report.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,64 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp.report import report_sxw
+
+class pos_payment_report(report_sxw.rml_parse):
+
+ def __init__(self, cr, uid, name, context):
+ print "hfhghdfghghg"
+ super(pos_payment_report, self).__init__(cr, uid, name, context=context)
+ self.total = 0.0
+ self.localcontext.update({
+ 'time': time,
+ 'pos_payment': self._pos_payment,
+ 'pos_payment_total':self._pos_payment_total,
+ })
+
+ def _pos_payment(self, obj):
+ data={}
+ sql = """ select id from pos_order where id = %d"""%(obj.id)
+ self.cr.execute(sql)
+ if self.cr.fetchone():
+ self.cr.execute ("select pt.name,pp.default_code as code,pol.qty,pu.name as uom,pol.discount,pol.price_unit, " \
+ "(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)) as total " \
+ "from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt, product_uom as pu " \
+ "where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id and pu.id=pt.uom_id " \
+ "and po.state IN ('paid','invoiced') and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date = current_date and po.id=%d"%(obj.id))
+ data=self.cr.dictfetchall()
+ else:
+ self.cr.execute ("select pt.name,pp.default_code as code,pol.qty,pu.name as uom,pol.discount,pol.price_unit, " \
+ "(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)) as total " \
+ "from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt, product_uom as pu " \
+ "where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id and pu.id=pt.uom_id " \
+ "and po.state IN ('paid','invoiced') and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date = current_date")
+ data=self.cr.dictfetchall()
+
+ for d in data:
+ self.total += d['price_unit'] * d['qty']
+ return data
+
+ def _pos_payment_total(self, o):
+ return self.total
+
+report_sxw.report_sxw('report.pos.payment.report.webkit', 'pos.order', 'addons/point_of_sale_webkit/report/pos_payment_report.mako', parser=pos_payment_report,header='internal')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'point_of_sale_webkit/report/pos_payment_report_user.mako'
--- point_of_sale_webkit/report/pos_payment_report_user.mako 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/report/pos_payment_report_user.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,82 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+ <body>
+ </br>
+ </br>
+ <center><h1>Payment By User</h1></center>
+
+ <table class="basic_table">
+ <tr>
+ <td width="50%">
+ <b>${_("Company")}</b>
+ </td>
+ <td width="50%">
+ <b>${_("Print Date")}</b>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ${company.name}
+ </td>
+ <td>
+ ${formatLang(time.strftime('%Y-%m-%d'),date = True)}
+ </td>
+ </tr>
+ </table>
+ </br>
+ <table class="list_table">
+ <tr>
+ <th width="50%">
+ ${_("Product")}
+ </th>
+ <th align="right" width="12%">
+ ${_("Qty")}
+ </th>
+ <th align="right" width="12%">
+ ${_("Disc.(%)")}
+ </th>
+ <th align="right" width="12%">
+ ${_("Unit Price")}
+ </th>
+ <th align="right" width="14%">
+ ${_("Total")}
+ </th>
+ </tr>
+ %for o in objects:
+ %for line_ids in pos_payment(o):
+ <tr>
+ <td>
+ [${ line_ids['code'] or '' }] ${line_ids['name']}
+ </td>
+ <td align="right">
+ ${formatLang(line_ids['qty'])} ${line_ids['uom']}
+ </td>
+ <td align="right">
+ ${formatLang(line_ids['discount'])}
+ </td>
+ <td align="right">
+ ${formatLang(line_ids['price_unit'])}
+ </td>
+ <td align="right">
+ ${formatLang(line_ids['total'], currency_obj = company.currency_id)}
+ </td>
+ </tr>
+ %endfor
+ <tr>
+ <td colspan="3" style="border-bottom:0px;">
+ </td>
+ <td style="border-top:1px solid black;border-bottom:0px;">
+ <b>Net Total:</b>
+ </td>
+ <td style="border-top:1px solid black;text-align:right">
+ <b>${formatLang(pos_payment_total(o), currency_obj = company.currency_id) or ''}</b>
+ </td>
+ <tr>
+ %endfor
+ </table>
+ </body>
+</html>
\ No newline at end of file
=== added file 'point_of_sale_webkit/report/pos_payment_report_user.py'
--- point_of_sale_webkit/report/pos_payment_report_user.py 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/report/pos_payment_report_user.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,65 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp.report import report_sxw
+
+class pos_payment_report_user(report_sxw.rml_parse):
+
+ def __init__(self, cr, uid, name, context):
+ print "hfhghdfghghg"
+ super(pos_payment_report_user, self).__init__(cr, uid, name, context=context)
+ self.total = 0.0
+ self.localcontext.update({
+ 'time': time,
+ 'pos_payment_user': self.__pos_payment_user__,
+ 'pos_payment_user_total':self.__pos_payment_user__total__,
+ })
+
+ def __pos_payment_user__(self, form):
+ data={}
+ ids = form['user_id']
+ sql = "select pt.name,pp.default_code as code,pol.qty,pu.name as uom,pol.discount,pol.price_unit, " \
+ "(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)) as total " \
+ "from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt,product_uom as pu " \
+ "where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id and pu.id=pt.uom_id " \
+ "and po.state in ('paid','invoiced') and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date = current_date " \
+ "and po.user_id IN %s"
+ self.cr.execute (sql, (tuple(ids), ))
+ data=self.cr.dictfetchall()
+ return data
+
+ def __pos_payment_user__total__(self, form):
+ res=[]
+ ids = form['user_id']
+ self.cr.execute ("select sum(pol.price_unit * pol.qty * (1 - (pol.discount) / 100.0)) " \
+ "from pos_order as po,pos_order_line as pol,product_product as pp,product_template as pt " \
+ "where pt.id=pp.product_tmpl_id and pp.id=pol.product_id and po.id = pol.order_id " \
+ "and po.state='paid' and to_char(date_trunc('day',po.date_order),'YYYY-MM-DD')::date = current_date " \
+ "and po.user_id IN %s",(tuple(ids),))
+ res=self.cr.fetchone()
+ res = res and res[0] or 0.0
+
+ return res
+
+report_sxw.report_sxw('report.pos.payment.report.user.webkit', 'pos.order', 'addons/point_of_sale_webkit/report/pos_payment_report_user.mako', parser=pos_payment_report_user,header='internal')
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'point_of_sale_webkit/report/pos_receipt.mako'
--- point_of_sale_webkit/report/pos_receipt.mako 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/report/pos_receipt.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,117 @@
+<html>
+ <head>
+ <style type="text/css">
+ ${css}
+ </style>
+ </head>
+ <body>
+ <center>
+ %for o in objects:
+ <table class="font">
+ <tr>
+ <td width="100%" style="font-family:"Courier-Bold;">
+ <b>${o.user_id.company_id.name or ''}</b>
+ </td>
+ </tr>
+ <tr>
+ <td width="100%">
+ ${address and display_address(address) or ''}
+ </td>
+ </tr>
+ <tr>
+ <td width="100%">
+ Tel:${address and address.phone or ''}
+ </td>
+ </tr>
+ <tr>
+ <td width="100%">
+ User:${o.user_id.name or ''}
+ </td>
+ </tr>
+ <tr>
+ <td width="100%">
+ Shop:${o.shop_id.name or ''}
+ </td>
+ </tr>
+ <tr>
+ <td width="100%">
+ Date:${o.date_order or ''}
+ </td>
+ </tr>
+ </table>
+ </br>
+ </br>
+ </br>
+ <h1>N° : ${o.name or ''}</h1>
+ </center>
+ <table class="list">
+ <tr>
+ <th width="50%">${_("Description")}</th>
+ <th width="20%" align="right">${_("Qty")}</th>
+ <th align="right" width="30%">${_("Price")}</th>
+ </tr>
+ %for line in o.lines:
+ <tr>
+ <td width="50%" style="padding-bottom:20px; ">
+ ${line.product_id.name}
+ %if line and line.discount == 0.0:
+ ${}
+ %else:
+ <font face="Helvetica">With a ${ line and line.discount == 0.0 or '' } (${ '%.2f' % line.discount or ''}) % discount.</font>
+ %endif
+ </td>
+ <td style="text-align:right;padding-bottom:20px; " width="20%">
+ ${o.state=='cancel' and o.statement_ids and '-' or ''} ${'%.f' % line.qty}
+ </td>
+ <td style="text-align:right;padding-bottom:20px; " width="30%">
+ ${o.state=='cancel' and o.statement_ids and '-' or ''} ${formatLang(net(line.id), currency_obj=company.currency_id)}
+ %if line and line.discount == 0.0:
+ ${}
+ %else:
+ <font face="Helvetica">${ line and line.discount == 0.0 or '' } ${ formatLang(line.discount, currency_obj=company.currency_id) })</font>
+ %endif
+ </td>
+ </tr>
+ %endfor
+ <tr>
+ <td colspan="2" style="text-align:right;">
+ Taxes :
+ </td>
+ <td style="border-top:2px solid black;text-align:right;" width="30%">
+ ${o.state=='cancel' and o.statement_ids and '-' or ''} ${formatLang(o.amount_tax, currency_obj=company.currency_id)}
+ </td>
+ </tr>
+ <tr>
+ <td style="text-align:right;" colspan="2">
+ <b>Total :</b>
+ </td>
+ <td style="text-align:right;" width="30%" >
+ <b>${o.state=='cancel' and o.statement_ids and '-' or ''} ${formatLang(o.amount_total, currency_obj=company.currency_id)}</b>
+ </td>
+ </tr>
+ </table>
+ </br>
+ <table class="list_table">
+ <tr>
+ <th style="font-family:"Courier-Bold;">
+ ${_("Payment Mode")}
+ </th>
+ <th align="right" style="font-family:"Courier-Bold;">
+ ${_("Amount")}
+ </th>
+ </tr>
+ %for d in get_journal_amt(o):
+ <tr>
+ <td>
+ ${d['name']}
+ </td>
+ <td style="text-align:right">
+ ${formatLang(d['amt'] or 0, currency_obj=company.currency_id)}
+ </td>
+ </tr>
+ %endfor
+ </table>
+
+ %endfor
+ </body>
+</html>
\ No newline at end of file
=== added file 'point_of_sale_webkit/report/pos_receipt.py'
--- point_of_sale_webkit/report/pos_receipt.py 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/report/pos_receipt.py 2013-10-10 09:59:30 +0000
@@ -0,0 +1,77 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# OpenERP, Open Source Management Solution
+# Copyright (C) 2011-2013 Serpent Consulting Services (<http://www.serpentcs.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 openerp.report import report_sxw
+from openerp import pooler
+
+def titlize(journal_name):
+ words = journal_name.split()
+ while words.pop() != 'journal':
+ continue
+ return ' '.join(words)
+
+class order(report_sxw.rml_parse):
+
+ def __init__(self, cr, uid, name, context):
+ super(order, self).__init__(cr, uid, name, context=context)
+
+ user = pooler.get_pool(cr.dbname).get('res.users').browse(cr, uid, uid, context=context)
+ partner = user.company_id.partner_id
+
+ self.localcontext.update({
+ 'time': time,
+ 'disc': self.discount,
+ 'net': self.netamount,
+ 'get_journal_amt': self._get_journal_amt,
+ 'address': partner or False,
+ 'titlize': titlize
+ })
+
+ def netamount(self, order_line_id):
+ sql = 'select (qty*price_unit) as net_price from pos_order_line where id = %s'
+ self.cr.execute(sql, (order_line_id,))
+ res = self.cr.fetchone()
+ return res[0]
+
+ def discount(self, order_id):
+ sql = 'select discount, price_unit, qty from pos_order_line where order_id = %s '
+ self.cr.execute(sql, (order_id,))
+ res = self.cr.fetchall()
+ dsum = 0
+ for line in res:
+ if line[0] != 0:
+ dsum = dsum +(line[2] * (line[0]*line[1]/100))
+ return dsum
+
+ def _get_journal_amt(self, order_id):
+ data={}
+ sql = """ select aj.name,absl.amount as amt from account_bank_statement as abs
+ LEFT JOIN account_bank_statement_line as absl ON abs.id = absl.statement_id
+ LEFT JOIN account_journal as aj ON aj.id = abs.journal_id
+ WHERE absl.pos_statement_id =%d"""%(order_id)
+ self.cr.execute(sql)
+ data = self.cr.dictfetchall()
+ return data
+
+report_sxw.report_sxw('report.pos.receipt.webkit', 'pos.order', 'addons/point_of_sale_webkit/report/pos_receipt.mako', parser=order, header=False)
+
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
=== added file 'point_of_sale_webkit/report/pos_sales_user.mako'
--- point_of_sale_webkit/report/pos_sales_user.mako 1970-01-01 00:00:00 +0000
+++ point_of_sale_webkit/report/pos_sales_user.mako 2013-10-10 09:59:30 +0000
@@ -0,0 +1,70 @@
+<html>
+ <head>
+ <style type=text/css>
+ ${css}
+ </style>
+ </head>
+ <body>
+ </br>
+ </br>
+ <center><h1>Sales Report</h1></center>
+
+ <table class="basic_table">
+ <tr>
+ <td width="50%">
+ ${_("Company")}
+ </td>
+ <td width="50%">
+ ${_("Print Date")}
+ </td>
+ </tr>
+ <tr>
+ <td>
+ ${company.name}
+ </td>
+ <td>
+ ${formatLang(time.strftime('%Y-%m-%d'),date = True)}
+ </td>
+ </tr>
+ </table>
+ </br>
+ <table class="list_table">
+ <tr>
+ <th width="20%">
+ ${_("Name")}
+
Follow ups