Add support for multi-currency

Works with a single account journal
Usability and many other enhancements
This commit is contained in:
Alexis de Lattre
2014-10-08 13:47:28 +02:00
committed by ps-tubtim
parent 7820f8029d
commit 58291eac65
14 changed files with 517 additions and 662 deletions

View File

@@ -1,6 +0,0 @@
[Dolphin]
AdditionalInfoV2=Details_Size,Details_Date,CustomizedDetails
Sorting=2
Timestamp=2012,3,5,14,27,49
Version=2
ViewMode=1

View File

@@ -1,275 +0,0 @@
<html>
<head>
<style type="text/css">
${css}
pre {font-family:helvetica; font-size:12;}
</style>
</head>
<body>
<style type="text/css">
table {
width: 100%;
page-break-after:auto;
border-collapse: collapse;
cellspacing="0";
font-size:10px;
}
td { margin: 0px; padding: 3px; border: 1px solid lightgrey; vertical-align: top; }
pre {font-family:helvetica; font-size:12;}
</style>
<%
def carriage_returns(text):
return text.replace('\n', '<br />')
%>
%for order in objects :
<br>
<% setLang(order.partner_id.lang) %>
<table >
%if order.company_id.address_label_position == 'left':
<tr>
<td style="width:50%">
${_("Shipping Address")}
<hr>
<pre>
${order.partner_shipping_id.address_label}
<pre>
</td>
<td style="width:50%">
%if order.partner_id.address_label != order.partner_shipping_id.address_label:
<b>${_("Ordering Contact")}</b><br>
${order.partner_id.address_label|carriage_returns}
%endif
%if order.partner_id.phone :
${_("Phone")}: ${order.partner_id.phone|entity} <br>
%endif
%if order.partner_id.fax :
${_("Fax")}: ${order.partner_id.fax|entity} <br>
%endif
%if order.partner_id.email :
${_("Mail")}: ${order.partner_id.email|entity} <br>
%endif
%if order.partner_invoice_id.address_label != order.partner_shipping_id.address_label:
<br>
<b>${_("Invoice Address")}</b><br>
${order.partner_invoice_id.address_label|carriage_returns}
%endif
%if order.partner_invoice_id.partner_id.vat :
${_("VAT")}: ${order.partner_invoice_id.partner_id.vat|entity} <br>
%endif
</td>
</tr>
%endif
%if order.company_id.address_label_position == 'right' or not order.company_id.address_label_position:
<tr>
<td style="width:50%">
%if order.partner_id.address_label != order.partner_shipping_id.address_label:
<b>${_("Ordering Contact")}</b><br>
<hr>
${order.partner_id.address_label|carriage_returns}
%endif
%if order.partner_id.phone :
${_("Tel")}: ${order.partner_id.phone|entity} <br>
%endif
%if order.partner_id.fax :
${_("Fax")}: ${order.partner_id.fax|entity} <br>
%endif
%if order.partner_id.email :
${_("E-mail")}: ${order.partner_id.email|entity} <br>
%endif
%if order.partner_invoice_id.address_label != order.partner_shipping_id.address_label:
<br>
<hr>
<b>${_("Invoice Address")}</b><br>
<hr>
${order.partner_invoice_id.address_label|carriage_returns}
%endif
%if order.partner_invoice_id.vat :
${_("VAT")}: ${order.partner_invoice_id.vat|entity} <br>
%endif
</td>
<td style="width:50%">
<b>${_("Shipping Address")}</b><br>
<hr>
<pre>
${order.partner_shipping_id.address_label}
<pre>
</td>
</tr>
%endif
</table>
<br />
<br />
%if order.state == 'draft' :
<span class="title">${_("Quotation N°")} ${order.name or ''|entity}</span>
%elif order.state == 'cancel' :
<span class="title">${_("Sale Order Canceled")} ${order.name or ''|entity}</span>
%else :
<span class="title">${_("Order N°")} ${order.name or ''|entity}</span>
%endif
<br/>
<table style="width:100%">
<tr>
%if order.client_order_ref:
<td>${_("Reference")}</td>
%endif
%if order.project_id:
<td>${_("Projekt")}</td>
%endif
<td style="text-align:center;white-space:nowrap"><b>${_("Order Date")}</b></td>
%if order.carrier_id:
<td style="text-align:center;white-space:nowrap"><b>${_("Carrier")}</b></td>
%endif
%if order.user_id:
<td style="text-align:center;white-space:nowrap"><b>${_("Salesman")}</b></td>
%endif
%if order.payment_term :
<td style="text-align:center;white-space:nowrap"><b>${_("Payment Term")}</b></td>
%endif
%if order.incoterm:
<td style="text-align:center;white-space:nowrap"><b>${_("Incoterm")}</b></td>
%endif
<td style="text-align:center;white-space:nowrap"><b>${_("Curr")}</b></td>
</tr>
<tr>
%if order.client_order_ref:
<td>
${order.client_order_ref}
</td>
%endif
%if order.project_id:
<td>${order.project_id.name}</td>
%endif
%if order.date_order:
<td>
${order.date_order or ''}</td>
%endif
%if order.carrier_id:
<td>
${order.carrier_id.name }
</td>
%endif
%if order.user_id :
<td>${order.user_id.name or ''}</td>
%endif
%if order.payment_term :
<td>${order.payment_term.name}</td>
%endif
%if order.incoterm:
<td>${order.incoterm.name}</td>
%endif
<td style="white-space:nowrap">${order.pricelist_id.currency_id.name} </td>
</table>
<h1><br /></h1>
<table style="width:100%">
<thead>
<tr>
%if order.print_code:
<td style="text-align:center;white-space:nowrap"><b>${_("Code")}</b></td>
<td style="text-align:center;white-space:nowrap"><b>${_("Description")}</b></td>
%else:
<td style="text-align:center;white-space:nowrap"><b>${_("Description")}</b></td>
%endif
<td style="text-align:center;white-space:nowrap"><b>${_("Tax")}</b></td>
%if order.print_uom:
<td style="text-align:center;white-space:nowrap"><b>${_("Quantity")}</b></td><td style="text-align:center;white-space:nowrap"><b>${_("UoM")}</b></td>
%endif
%if order.print_uos:
<th style="text-align:center;white-space:nowrap">${_("UoS Qty")}</th><th style="text-align:center;white-space:nowrap;">${_("UoS")}</th>
%endif
%if order.print_ean:
<td style="text-align:center;white-space:nowrap"><b>${_("EAN")}</b></td>
%endif
%if order.print_packing:
<td style="text-align:center;white-space:nowrap"><b>${_("Pack")}</b></td>
<td style="text-align:center;white-space:nowrap"><b>${_("Packaging")}</b></td>
%endif
<td style="text-align:center;white-space:nowrap"><b>${_("Price Unit")}</b></td>
%if order.print_discount:
<td style="text-align:center;white-space:nowrap"><b>${_("Discount")}</b></td>
%endif
<td style="text-align:center;white-space:nowrap"><b>${_("Sub Total")}</b></td>
</tr>
</thead>
%for line in order.order_line_sorted :
<tbody>
<tr>
%if order.print_code:
<td>${line.product_id.default_code or ''|entity}</td>
<td>
${line.product_id.name or line.name|entity}
</td>
%else:
<td>${line.name|entity}
</td
%endif
<td>${ ', '.join([tax.name or '' for tax in line.tax_id]) }</td>
%if order.print_uom:
<td style="white-space:nowrap;text-align:right;">${str(line.product_uom_qty).replace(',000','') or '0'}</td>
<td style="white-space:nowrap;text-align:left;">${line.product_uom.name or ''}</td>
%endif
%if order.print_uos:
<td style="white-space:nowrap;text-align:right;">${str(line.product_uos_qty).replace(',000','') or '0'}</td>
<td style="white-space:nowrap;text-align:left;">${line.product_uos.name or ''}</td>
%endif
%if order.print_ean:
<td style="white-space:nowrap;text-align:left;">${line.product_packaging.ean or line.product_id.ean13 or ''}</td>
%endif
%if order.print_packing:
<td style="white-space:normal;text-align:left;">${line.product_packaging.qty and line.product_uom_qty/line.product_packaging.qty or ''}</td>
<td style="white-space:normal;text-align:left;">${line.product_packaging and line.product_packaging.ul.name or ''} ${line.product_packaging and _(" / " or '')} ${line.product_packaging and line.product_packaging.qty or ''} ${line.product_packaging and line.product_id.uom_id.name or ''}</td>
%endif
<td style="white-space:nowrap;text-align:right;">${line.price_unit or ''}</td>
%if order.print_discount:
<td style="text-align:right;">${line.discount}</th>
%endif
<td style="white-space:nowrap;text-align:right;">${line.price_subtotal or ''}</td>
</tr>
%endfor
</tbody>
<tfoot>
<tr>
<td colspan="${order.cols}" style="border-style:none"/>
<td style="border-top: 2px solid"><b>${_("Net Total:")}</b></td>
<td class="amount" style="border-top:2px solid;text-align:right;">${formatLang(order.amount_untaxed, get_digits(dp='Sale Price'))} </td>
</tr>
<tr>
<td colspan="${order.cols}" style="border-style:none"/>
<td style="border-style:none"><b>${_("Taxes:")}</b></td>
<td class="amount" style="text-align:right;">${formatLang(order.amount_tax, get_digits(dp='Sale Price'))} </td>
</tr>
<tr>
<td colspan="${order.cols}" style="border-style:none"/>
<td style="border-top:2px solid"><b>${_("Total:")}</b></td>
<td class="amount" style="border-top:2px solid;text-align:right;">${formatLang(order.amount_total, get_digits(dp='Sale Price'))} </td>
</tr>
</tfoot>
</table>
%if order.note and 'note_print' not in order._columns:
<br>
<pre>${order.note}</pre>
%endif:
%if 'note_print' in order._columns and order.note_print:
<br>
<pre>${order.note_print}</pre>
%endif:
<p style="page-break-after:always"></p>
%endfor
</body>
</html>

View File

@@ -1,32 +1,22 @@
#-*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com)
# All Right Reserved
# account_check_deposit for Odoo/OpenERP
# Copyright (C) 2012-2014 Akretion (http://www.akretion.com/)
#
# Author : Ferdinand Gassauer (Camptocamp Austria)
# 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.
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
# This program is 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.
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
# 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/>.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
###############################################################################
import report_webkit_html
from . import report_webkit_html

View File

@@ -37,76 +37,54 @@
</head>
<body>
%for deposit in objects :
<% setLang(deposit.partner_id.lang) %>
<b><span class="titre">${_("Deposit Slip of Checks(Euros)")}</span></b>
<br>
<br>
<br>
<br>
<br>
<br>
<h2>
<b>${_("Deposit N°")} ${deposit.name}</b>
</h2>
<% setLang(deposit.company_id.partner_id.lang) %>
<b><span class="titre">${_("Deposit Slip of Checks in ")} ${deposit.currency_id.name}</span></b>
<h1>
<b>${_("Deposit Date")}</b><span class="vtrait1">${_("|")}</span>
<span class="valign_up1"> ${deposit.deposit_date}</span>
<b><span class="halign">${_("Bank Code")}</span></b>
<span class="vtrait2">${_("|")}</span><span class="valign_up2"> ${deposit.bank_id.bank_code}</span>
<br>
<b>${_("Beneficiary")}</b><span class="vtrait1">${_("|")}</span>
<span class="valign_up1"> ${company.partner_id.name}</span>
<b><span class="halign">${_("Office Code")}</span></b>
<span class="vtrait2">${_("|")}</span><span class="valign_up2"> ${deposit.bank_id.office}</span>
<br>
<b>${_("Account to crediting")}</b><span class="vtrait1">${_("|")}</span>
<span class="valign_up1"> ${deposit.bank_id.rib_acc_number}</span>
<b><span class="halign">${_("BIS Key")}</span></b><span class="vtrait2">${_("|")}</span>
<span class="valign_up2"> ${deposit.bank_id.key}</span>
</h1>
<br>
<h3>
<b>${_("Check Payments")}</b>
</h3>
<table class="basic_table" width="100%">
<tr>
<th class="date">${_("Deposit Date")}</th>
<th class="text-align:center;">${_("Deposit Ref")}</th>
<th class="text-align:center;">${_("Beneficiary")}</th>
<th class="text-align:center;">${_("Bank Account Number")}</th>
</tr>
<tr>
<td class="date">${formatLang(deposit.deposit_date, date=True)}</td>
<td class="text-align:center;">${deposit.name}</td>
<td class="text-align:center;">${deposit.company_id.partner_id.name}</td>
<td class="text-align:center;">${deposit.partner_bank_id.acc_number}</td>
</tr>
</table>
<h3>${_("Check Payments")}</h3>
<table style="width:100%">
<thead>
<tr>
<th class="entete_tab">${_("Payment Date")}</th>
<th class="entete_tab">${_("Reference")}</th>
<th class="entete_tab">${_("Description")}</th>
<th class="entete_tab">${_("Designation")}</th>
<th class="entete_tab">${_("Debtor")}</th>
<th class="entete_tab">${_("Amount")}</th>
</thead>
</tr>
<br>
%for move_line in deposit.check_payment_ids :
<tbody>
<tr>
<td class="cellule_tab">${move_line.date or ''}</td>
<td class="cellule_tab">${move_line.ref or ''}</td>
<td class="cellule_tab">${move_line.name or ''}</td>
<td class="cellule_tab">${move_line.partner_id.name or ''}</td>
<td class="amount">${move_line.debit or '0'}</td>
<td class="amount">${deposit.currency_id == deposit.company_id.currency_id and move_line.debit or move_line.amount_currency} ${deposit.currency_id.name}</td>
</tr>
</tbody>
%endfor
%endfor
<tfoot>
<tr>
<td colspan=4 class="amount total"><b>${_("Total:")}</b></td>
<td colspan=5 class="amount total"><b>${deposit.total_amount or '0'}</b></td>
<td colspan="3" class="amount total"><b>${_("Total:")}</b></td>
<td class="amount total"><b>${deposit.total_amount or '0'} ${deposit.currency_id.name}</b></td>
</tr>
</tfoot>
</table>
</body>
</html>

View File

@@ -1,34 +1,35 @@
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2012 Camptocamp Austria (<http://www.camptocamp.at>)
# Copyright (C) 2013 AKRETION (<http://www.akretion.com>)
# account_check_deposit for Odoo/OpenERP
# Copyright (C) 2012-2014 Akretion (http://www.akretion.com/)
# @author: Benoît GUILLOT <benoit.guillot@akretion.com>
# @author: Chafique DELLI <chafique.delli@akretion.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
# This program is 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.
# 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/>.
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
###############################################################################
import time
from report import report_sxw
class report_webkit_html(report_sxw.rml_parse):
def __init__(self, cr, uid, name, context):
super(report_webkit_html, self).__init__(cr, uid, name, context=context)
super(report_webkit_html, self).__init__(
cr, uid, name, context=context)
self.localcontext.update({
'time': time,
'cr': cr,