diff --git a/addons/account/__init__.py b/addons/account/__init__.py
index 0608bb83c88..24129306e13 100644
--- a/addons/account/__init__.py
+++ b/addons/account/__init__.py
@@ -33,5 +33,6 @@ import report
import product
import sequence
import company
+import res_currency
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account/account.py b/addons/account/account.py
index f8a2d00b5e4..8fc21799c08 100644
--- a/addons/account/account.py
+++ b/addons/account/account.py
@@ -708,6 +708,7 @@ class account_journal(osv.osv):
return self.name_get(cr, user, ids, context=context)
+
def onchange_type(self, cr, uid, ids, type, currency, context=None):
obj_data = self.pool.get('ir.model.data')
user_pool = self.pool.get('res.users')
diff --git a/addons/account/account_bank_statement.py b/addons/account/account_bank_statement.py
index e96b8b1f0fb..a42d35c59ed 100644
--- a/addons/account/account_bank_statement.py
+++ b/addons/account/account_bank_statement.py
@@ -225,9 +225,11 @@ class account_bank_statement(osv.osv):
account_id = st.journal_id.default_debit_account_id.id
acc_cur = ((st_line.amount<=0) and st.journal_id.default_debit_account_id) or st_line.account_id
+ context.update({
+ 'res.currency.compute.account': acc_cur,
+ })
amount = res_currency_obj.compute(cr, uid, st.currency.id,
- company_currency_id, st_line.amount, context=context,
- account=acc_cur)
+ company_currency_id, st_line.amount, context=context)
val = {
'name': st_line.name,
@@ -245,20 +247,15 @@ class account_bank_statement(osv.osv):
'analytic_account_id': st_line.analytic_account_id and st_line.analytic_account_id.id or False
}
- amount = res_currency_obj.compute(cr, uid, st.currency.id,
- company_currency_id, st_line.amount, context=context,
- account=acc_cur)
if st.currency.id <> company_currency_id:
amount_cur = res_currency_obj.compute(cr, uid, company_currency_id,
- st.currency.id, amount, context=context,
- account=acc_cur)
+ st.currency.id, amount, context=context)
val['amount_currency'] = -amount_cur
if st_line.account_id and st_line.account_id.currency_id and st_line.account_id.currency_id.id <> company_currency_id:
val['currency_id'] = st_line.account_id.currency_id.id
amount_cur = res_currency_obj.compute(cr, uid, company_currency_id,
- st_line.account_id.currency_id.id, amount, context=context,
- account=acc_cur)
+ st_line.account_id.currency_id.id, amount, context=context)
val['amount_currency'] = -amount_cur
move_line_id = account_move_line_obj.create(cr, uid, val, context=context)
diff --git a/addons/account/account_move_line.py b/addons/account/account_move_line.py
index 10ed021084a..2c4293f2ba4 100644
--- a/addons/account/account_move_line.py
+++ b/addons/account/account_move_line.py
@@ -289,7 +289,12 @@ class account_move_line(osv.osv):
acc = account
if s>0:
acc = acc1
- v = currency_obj.compute(cr, uid, account.company_id.currency_id.id, data['currency_id'], s, account=acc, account_invert=True)
+ compute_ctx = context.copy()
+ compute_ctx.update({
+ 'res.currency.compute.account': acc,
+ 'res.currency.compute.account_invert': True,
+ })
+ v = currency_obj.compute(cr, uid, account.company_id.currency_id.id, data['currency_id'], s, context=compute_ctx)
data['amount_currency'] = v
return data
@@ -556,8 +561,11 @@ class account_move_line(osv.osv):
if (amount>0) and journal:
x = journal_obj.browse(cr, uid, journal).default_credit_account_id
if x: acc = x
- context.update({'date': date})
- v = currency_obj.compute(cr, uid, currency_id, acc.company_id.currency_id.id, amount, account=acc, context=context)
+ context.update({
+ 'date': date,
+ 'res.currency.compute.account': acc,
+ })
+ v = currency_obj.compute(cr, uid, currency_id, acc.company_id.currency_id.id, amount, context=context)
result['value'] = {
'debit': v > 0 and v or 0.0,
'credit': v < 0 and -v or 0.0
@@ -955,7 +963,6 @@ class account_move_line(osv.osv):
if field in widths:
attrs.append('width="'+str(widths[field])+'"')
- attrs.append('string="'+field_it[2]+'"')
attrs.append("invisible=\"context.get('visible_id') not in %s\"" % (fields.get(field)))
xml += '''\n''' % (field,' '.join(attrs))
diff --git a/addons/account/i18n/fr.po b/addons/account/i18n/fr.po
index 2fd02c7b945..2de3b000b19 100644
--- a/addons/account/i18n/fr.po
+++ b/addons/account/i18n/fr.po
@@ -7,14 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 6.0dev\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2010-12-21 19:43+0000\n"
-"PO-Revision-Date: 2010-12-21 14:12+0000\n"
-"Last-Translator: Maxime Chambreuil (http://www.savoirfairelinux.com) "
-"\n"
+"PO-Revision-Date: 2010-12-22 22:19+0000\n"
+"Last-Translator: lolivier \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-12-22 05:06+0000\n"
+"X-Launchpad-Export-Date: 2010-12-23 05:01+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account
@@ -2408,6 +2407,8 @@ msgid ""
"A supplier refund is a credit note from your supplier indicating that he "
"refunds part or totality of the invoice sent to you."
msgstr ""
+"Un avoir fournisseur est une note de crédit reçue de votre fournisseur qui "
+"vous indique vous faire un avoir sur tout ou partie de sa facture."
#. module: account
#: field:account.tax,base_sign:0
@@ -6629,6 +6630,13 @@ msgid ""
"\n"
"e.g. My model on %(date)s"
msgstr ""
+"Vous pouvez indiquer l'année, le mois et la date dans le nom du modèle en "
+"utilisant les étiquettes suivantes :\n"
+"%(year)s : pour indiquer l'année \n"
+"%(month)s : pour indique le mois \n"
+"%(date)s : date actuelle\n"
+"\n"
+"par exmple : Mon modèle du %(date)s"
#. module: account
#: model:ir.actions.act_window,name:account.action_aged_income
@@ -6705,6 +6713,9 @@ msgid ""
"Here you can personalize and create each view of your financial journals by "
"selecting the fields you want to appear and the sequence they will appear."
msgstr ""
+"Ici, vous pouvez personnaliser et créer chaque vue de vos journaux "
+"financiers en sélectionnant les champs que vous voulez afficher et l'ordre "
+"dans lequel ils vont s'afficher."
#. module: account
#: field:account.invoice,origin:0
@@ -6804,6 +6815,8 @@ msgid ""
"Can not find account chart for this company in invoice line account, Please "
"Create account."
msgstr ""
+"Impossible de trouver le plan comptable pour cette société dans le compte de "
+"la ligne de facture. Créer le compte SVP."
#. module: account
#: view:account.tax.template:0
@@ -7020,6 +7033,9 @@ msgid ""
"the system to go through the reconciliation process, based on the latest day "
"it have been reconciled."
msgstr ""
+"Ce champ vous indique le prochain partenaire qui sera automatiquement choisi "
+"par le système pour passer au travers du processus de rapprochement, en "
+"fonction du dernier jour où il a été rapproché."
#. module: account
#: field:account.move.line.reconcile.writeoff,comment:0
@@ -7328,7 +7344,7 @@ msgstr "Ventes par type de compte"
#. module: account
#: help:account.invoice,move_id:0
msgid "Link to the automatically generated Journal Items."
-msgstr ""
+msgstr "Lier automatiquement à la ligne d'écriture générée"
#. module: account
#: selection:account.installer,period:0
@@ -7575,6 +7591,8 @@ msgid ""
"This account will be used for invoices instead of the default one to value "
"sales for the current product"
msgstr ""
+"Ce compte sera utilisé pour les factures à la place du compte par défaut "
+"pour valoriser les ventes du produit actuel"
#. module: account
#: help:account.journal,group_invoice_lines:0
@@ -7704,7 +7722,7 @@ msgstr ""
#. module: account
#: model:ir.module.module,shortdesc:account.module_meta_information
msgid "Accounting and Financial Management"
-msgstr ""
+msgstr "Gestion de la comptabilité et des finances"
#. module: account
#: field:account.automatic.reconcile,period_id:0
@@ -7804,7 +7822,7 @@ msgstr "Devise société"
#: report:account.third_party_ledger:0
#: report:account.third_party_ledger_other:0
msgid "Chart of Account"
-msgstr ""
+msgstr "Plan comptable"
#. module: account
#: model:process.node,name:account.process_node_paymententries0
diff --git a/addons/account/i18n/zh_CN.po b/addons/account/i18n/zh_CN.po
index 8e7545ec3aa..f136c0c7e1c 100644
--- a/addons/account/i18n/zh_CN.po
+++ b/addons/account/i18n/zh_CN.po
@@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 6.0dev\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2010-12-21 19:43+0000\n"
-"PO-Revision-Date: 2010-12-04 08:52+0000\n"
-"Last-Translator: GongyuanMao \n"
+"PO-Revision-Date: 2010-12-22 17:00+0000\n"
+"Last-Translator: Weichen Wang \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-12-22 05:13+0000\n"
+"X-Launchpad-Export-Date: 2010-12-23 05:01+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account
@@ -127,7 +127,7 @@ msgstr ""
#. module: account
#: report:account.tax.code.entries:0
msgid "Accounting Entries-"
-msgstr "凭证-"
+msgstr "会计分录"
#. module: account
#: code:addons/account/account.py:0
@@ -2344,7 +2344,7 @@ msgstr ""
#: field:account.invoice,amount_tax:0
#: field:account.move.line,account_tax_id:0
msgid "Tax"
-msgstr "税"
+msgstr "税目"
#. module: account
#: view:account.analytic.account:0
@@ -2921,7 +2921,7 @@ msgstr ""
#: view:account.tax:0
#: view:account.tax.template:0
msgid "Keep empty to use the expense account"
-msgstr "留空为使用费用科目"
+msgstr "为使用费用科目而留空"
#. module: account
#: field:account.aged.trial.balance,journal_ids:0
@@ -3937,7 +3937,7 @@ msgstr "科目模板"
#: view:account.bank.statement:0
#: field:account.bank.statement,balance_end_real:0
msgid "Closing Balance"
-msgstr ""
+msgstr "期终结余"
#. module: account
#: code:addons/account/report/common_report_header.py:0
@@ -9308,7 +9308,7 @@ msgstr ""
#. module: account
#: help:account.invoice.line,account_id:0
msgid "The income or expense account related to the selected product."
-msgstr "选择产品的收入和费用科目"
+msgstr "和选择的产品相关的收入或费用科目"
#. module: account
#: code:addons/account/account_move_line.py:0
diff --git a/addons/account/invoice.py b/addons/account/invoice.py
index b6d8fcb9de0..e6e07b8eb68 100644
--- a/addons/account/invoice.py
+++ b/addons/account/invoice.py
@@ -1313,7 +1313,6 @@ class account_invoice_line(osv.osv):
if context is None:
context = {}
company_id = context.get('company_id',False)
- tax_obj = self.pool.get('account.tax')
if not partner_id:
raise osv.except_osv(_('No Partner Defined !'),_("You must first select a partner !") )
if not product:
diff --git a/addons/account/res_currency.py b/addons/account/res_currency.py
new file mode 100644
index 00000000000..6ec404edcf4
--- /dev/null
+++ b/addons/account/res_currency.py
@@ -0,0 +1,44 @@
+# -*- coding: utf-8 -*-
+##############################################################################
+#
+# Copyright (C) 2010 OpenERP s.a. ().
+#
+# 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 .
+#
+##############################################################################
+
+from osv import osv
+
+"""Inherit res.currency to handle accounting date values when converting currencies"""
+class res_currency_account(osv.osv):
+ _inherit = "res.currency"
+
+ def _get_conversion_rate(self, cr, uid, from_currency, to_currency, context=None):
+ if context is None:
+ context = {}
+ rate = super(res_currency_account, self)._get_conversion_rate(cr, uid, from_currency, to_currency, context=context)
+ account = context.get('res.currency.compute.account')
+ account_invert = context.get('res.currency.compute.account_invert')
+ if account and account.currency_mode == 'average' and account.currency_id:
+ query = self.pool.get('account.move.line')._query_get(cr, uid, context=context)
+ cr.execute('select sum(debit-credit),sum(amount_currency) from account_move_line l ' \
+ 'where l.currency_id=%s and l.account_id=%s and '+query, (account.currency_id.id,account.id,))
+ tot1,tot2 = cr.fetchone()
+ if tot2 and not account_invert:
+ rate = float(tot1)/float(tot2)
+ elif tot1 and account_invert:
+ rate = float(tot2)/float(tot1)
+ return rate
+
+res_currency_account()
\ No newline at end of file
diff --git a/addons/account_accountant/i18n/fr.po b/addons/account_accountant/i18n/fr.po
index 2d412f4a926..86a3ba1a73c 100644
--- a/addons/account_accountant/i18n/fr.po
+++ b/addons/account_accountant/i18n/fr.po
@@ -8,13 +8,13 @@ msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME \n"
"POT-Creation-Date: 2010-12-21 19:43+0000\n"
-"PO-Revision-Date: 2010-11-24 09:41+0000\n"
-"Last-Translator: OpenERP Administrators \n"
+"PO-Revision-Date: 2010-12-22 14:09+0000\n"
+"Last-Translator: Aline (OpenERP) \n"
"Language-Team: French \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-12-22 05:44+0000\n"
+"X-Launchpad-Export-Date: 2010-12-23 05:02+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account_accountant
diff --git a/addons/account_analytic_default/i18n/pt_BR.po b/addons/account_analytic_default/i18n/pt_BR.po
index 882ce4549e9..66798558785 100644
--- a/addons/account_analytic_default/i18n/pt_BR.po
+++ b/addons/account_analytic_default/i18n/pt_BR.po
@@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 6.0dev\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2010-12-21 19:43+0000\n"
-"PO-Revision-Date: 2010-11-27 07:53+0000\n"
-"Last-Translator: OpenERP Administrators \n"
+"PO-Revision-Date: 2010-12-22 13:09+0000\n"
+"Last-Translator: Alexsandro Haag \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-12-22 05:23+0000\n"
+"X-Launchpad-Export-Date: 2010-12-23 05:02+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account_analytic_default
@@ -147,6 +147,15 @@ msgid ""
"* Date\n"
" "
msgstr ""
+"\n"
+"Permite selecionar automaticamente contas analíticas baseado nestes "
+"critérios:\n"
+"* Produto\n"
+"* Parceiro\n"
+"* Usuário\n"
+"* Empresa\n"
+"* Data\n"
+" "
#. module: account_analytic_default
#: help:account.analytic.default,product_id:0
@@ -201,7 +210,7 @@ msgstr ""
#. module: account_analytic_default
#: model:ir.model,name:account_analytic_default.model_sale_order_line
msgid "Sales Order Line"
-msgstr ""
+msgstr "Item de Pedido de Vendas"
#~ msgid "Analytic Distributions"
#~ msgstr "Distribuição analítica"
diff --git a/addons/account_analytic_default/i18n/ru.po b/addons/account_analytic_default/i18n/ru.po
index 329f808717e..1b38fc9c3d6 100644
--- a/addons/account_analytic_default/i18n/ru.po
+++ b/addons/account_analytic_default/i18n/ru.po
@@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 6.0dev\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2010-12-21 19:43+0000\n"
-"PO-Revision-Date: 2010-11-29 07:56+0000\n"
-"Last-Translator: OpenERP Administrators \n"
+"PO-Revision-Date: 2010-12-22 11:11+0000\n"
+"Last-Translator: Chertykov Denis \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-12-22 05:23+0000\n"
+"X-Launchpad-Export-Date: 2010-12-23 05:02+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account_analytic_default
@@ -39,7 +39,7 @@ msgstr "Правила аналитики"
#. module: account_analytic_default
#: help:account.analytic.default,analytic_id:0
msgid "Analytical Account"
-msgstr ""
+msgstr "Аналитический счет"
#. module: account_analytic_default
#: view:account.analytic.default:0
@@ -187,7 +187,7 @@ msgstr ""
#. module: account_analytic_default
#: model:ir.model,name:account_analytic_default.model_sale_order_line
msgid "Sales Order Line"
-msgstr ""
+msgstr "Позиция заказа на продажу"
#~ msgid "Seq"
#~ msgstr "Последовательность"
diff --git a/addons/account_analytic_plans/report/crossovered_analytic.py b/addons/account_analytic_plans/report/crossovered_analytic.py
index 74f268db168..e2ad9e05b04 100644
--- a/addons/account_analytic_plans/report/crossovered_analytic.py
+++ b/addons/account_analytic_plans/report/crossovered_analytic.py
@@ -65,8 +65,6 @@ class crossovered_analytic(report_sxw.rml_parse):
def _ref_lines(self,form):
result = []
res = {}
- acc_id = []
- final = []
acc_pool = self.pool.get('account.analytic.account')
line_pool = self.pool.get('account.analytic.line')
@@ -128,7 +126,6 @@ class crossovered_analytic(report_sxw.rml_parse):
line_pool = self.pool.get('account.analytic.line')
acc_id = []
final = []
- child_ids = []
self.list_ids = []
self.final_list = self.find_children(ids)
diff --git a/addons/account_cancel/i18n/mn.po b/addons/account_cancel/i18n/mn.po
index 91bd122d9ec..de684bcd98a 100644
--- a/addons/account_cancel/i18n/mn.po
+++ b/addons/account_cancel/i18n/mn.po
@@ -8,13 +8,13 @@ msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME \n"
"POT-Creation-Date: 2010-12-21 19:43+0000\n"
-"PO-Revision-Date: 2010-12-22 02:55+0000\n"
-"Last-Translator: sugi \n"
+"PO-Revision-Date: 2010-12-22 12:59+0000\n"
+"Last-Translator: OpenERP Administrators \n"
"Language-Team: Mongolian \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-12-22 05:41+0000\n"
+"X-Launchpad-Export-Date: 2010-12-23 05:02+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account_cancel
diff --git a/addons/account_followup/i18n/zh_CN.po b/addons/account_followup/i18n/zh_CN.po
index 668fef2f105..3d06ac05f6c 100644
--- a/addons/account_followup/i18n/zh_CN.po
+++ b/addons/account_followup/i18n/zh_CN.po
@@ -7,13 +7,13 @@ msgstr ""
"Project-Id-Version: OpenERP Server 6.0dev\n"
"Report-Msgid-Bugs-To: support@openerp.com\n"
"POT-Creation-Date: 2010-12-21 19:43+0000\n"
-"PO-Revision-Date: 2010-09-29 10:27+0000\n"
-"Last-Translator: Black Jack \n"
+"PO-Revision-Date: 2010-12-22 17:04+0000\n"
+"Last-Translator: Weichen Wang \n"
"Language-Team: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-12-22 05:03+0000\n"
+"X-Launchpad-Export-Date: 2010-12-23 05:01+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account_followup
@@ -158,7 +158,7 @@ msgstr "%(heading):凭证明细的头"
#: view:res.company:0
#: field:res.company,follow_up_msg:0
msgid "Follow-up Message"
-msgstr ""
+msgstr "跟进消息"
#. module: account_followup
#: field:account.followup.print,followup_id:0
@@ -280,7 +280,7 @@ msgstr ""
#. module: account_followup
#: field:account.followup.print.all,partner_lang:0
msgid "Send Email in Partner Language"
-msgstr ""
+msgstr "用业务伙伴的语言发电子邮件"
#. module: account_followup
#: constraint:account.move.line:0
diff --git a/addons/account_payment/i18n/mn.po b/addons/account_payment/i18n/mn.po
index d51507d417d..f9fc4fd26bc 100644
--- a/addons/account_payment/i18n/mn.po
+++ b/addons/account_payment/i18n/mn.po
@@ -8,13 +8,13 @@ msgstr ""
"Project-Id-Version: openobject-addons\n"
"Report-Msgid-Bugs-To: FULL NAME \n"
"POT-Creation-Date: 2010-12-21 19:43+0000\n"
-"PO-Revision-Date: 2010-12-22 03:06+0000\n"
-"Last-Translator: sugi \n"
+"PO-Revision-Date: 2010-12-22 08:47+0000\n"
+"Last-Translator: OpenERP Administrators \n"
"Language-Team: Mongolian \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
-"X-Launchpad-Export-Date: 2010-12-22 05:20+0000\n"
+"X-Launchpad-Export-Date: 2010-12-23 05:02+0000\n"
"X-Generator: Launchpad (build Unknown)\n"
#. module: account_payment
diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py
index 570bfb1d8b7..e4b76cc8770 100644
--- a/addons/account_voucher/account_voucher.py
+++ b/addons/account_voucher/account_voucher.py
@@ -401,7 +401,7 @@ class account_voucher(osv.osv):
return default
- def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, context=None):
+ def onchange_partner_id(self, cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, date, context=None):
"""price
Returns a dict that contains new values and context
@@ -415,6 +415,9 @@ class account_voucher(osv.osv):
context = {}
if not journal_id:
return {}
+ context_multi_currency = context.copy()
+ if date:
+ context_multi_currency.update({'date': date})
line_pool = self.pool.get('account.voucher.line')
line_ids = ids and line_pool.search(cr, uid, [('voucher_id', '=', ids[0])]) or False
@@ -476,9 +479,9 @@ class account_voucher(osv.osv):
company_currency = journal.company_id.currency_id.id
if company_currency != currency_id and ttype == 'payment':
- total_debit = currency_pool.compute(cr, uid, currency_id, company_currency, total_debit)
+ total_debit = currency_pool.compute(cr, uid, currency_id, company_currency, total_debit, context=context_multi_currency)
elif company_currency != currency_id and ttype == 'receipt':
- total_credit = currency_pool.compute(cr, uid, currency_id, company_currency, total_credit)
+ total_credit = currency_pool.compute(cr, uid, currency_id, company_currency, total_credit, context=context_multi_currency)
for line in moves:
if line.credit and line.reconcile_partial_id and ttype == 'receipt':
@@ -500,18 +503,18 @@ class account_voucher(osv.osv):
'type': line.credit and 'dr' or 'cr',
'move_line_id':line.id,
'account_id':line.account_id.id,
- 'amount_original':currency_pool.compute(cr, uid, company_currency, currency_id, original_amount),
+ 'amount_original':currency_pool.compute(cr, uid, company_currency, currency_id, original_amount, context=context_multi_currency),
'date_original':line.date,
'date_due':line.date_maturity,
- 'amount_unreconciled':currency_pool.compute(cr, uid, company_currency, currency_id, line.amount_unreconciled)
+ 'amount_unreconciled':currency_pool.compute(cr, uid, company_currency, currency_id, line.amount_unreconciled, context=context_multi_currency)
}
if line.credit:
amount = min(line.amount_unreconciled, total_debit)
- rs['amount'] = currency_pool.compute(cr, uid, company_currency, currency_id, amount)
+ rs['amount'] = currency_pool.compute(cr, uid, company_currency, currency_id, amount, context=context_multi_currency)
total_debit -= amount
else:
amount = min(line.amount_unreconciled, total_credit)
- rs['amount'] = currency_pool.compute(cr, uid, company_currency, currency_id, amount)
+ rs['amount'] = currency_pool.compute(cr, uid, company_currency, currency_id, amount, context=context_multi_currency)
total_credit -= amount
default['value']['line_ids'].append(rs)
@@ -528,7 +531,7 @@ class account_voucher(osv.osv):
return default
- def onchange_date(self, cr, user, ids, date, context=None):
+ def onchange_date(self, cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, date, context=None):
"""
@param date: latest value from user input for field date
@param args: other arguments
@@ -536,14 +539,13 @@ class account_voucher(osv.osv):
@return: Returns a dict which contains new values, and context
"""
period_pool = self.pool.get('account.period')
- pids = period_pool.search(cr, user, [('date_start', '<=', date), ('date_stop', '>=', date)])
- if not pids:
- return {}
- return {
- 'value':{
- 'period_id':pids[0]
- }
- }
+ res = self.onchange_partner_id(cr, uid, ids, partner_id, journal_id, price, currency_id, ttype, date, context=context)
+ pids = period_pool.search(cr, uid, [('date_start', '<=', date), ('date_stop', '>=', date)])
+ if pids:
+ if not 'value' in res:
+ res['value'] = {}
+ res['value'].update({'period_id':pids[0]})
+ return res
def onchange_journal(self, cr, uid, ids, journal_id, line_ids, tax_id, partner_id, context=None):
if not journal_id:
@@ -642,6 +644,9 @@ class account_voucher(osv.osv):
for inv in self.browse(cr, uid, ids, context=context):
if inv.move_id:
continue
+ context_multi_currency = context.copy()
+ context_multi_currency.update({'date': inv.date})
+
if inv.number:
name = inv.number
elif inv.journal_id.sequence_id:
@@ -671,9 +676,9 @@ class account_voucher(osv.osv):
# TODO: is there any other alternative then the voucher type ??
# -for sale, purchase we have but for the payment and receipt we do not have as based on the bank/cash journal we can not know its payment or receipt
if inv.type in ('purchase', 'payment'):
- credit = currency_pool.compute(cr, uid, current_currency, company_currency, inv.amount)
+ credit = currency_pool.compute(cr, uid, current_currency, company_currency, inv.amount, context=context_multi_currency)
elif inv.type in ('sale', 'receipt'):
- debit = currency_pool.compute(cr, uid, current_currency, company_currency, inv.amount)
+ debit = currency_pool.compute(cr, uid, current_currency, company_currency, inv.amount, context=context_multi_currency)
if debit < 0:
credit = -debit
debit = 0.0
@@ -701,14 +706,14 @@ class account_voucher(osv.osv):
rec_list_ids = []
line_total = debit - credit
if inv.type == 'sale':
- line_total = line_total - currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.tax_amount)
+ line_total = line_total - currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.tax_amount, context=context_multi_currency)
elif inv.type == 'purchase':
- line_total = line_total + currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.tax_amount)
+ line_total = line_total + currency_pool.compute(cr, uid, inv.currency_id.id, company_currency, inv.tax_amount, context=context_multi_currency)
for line in inv.line_ids:
if not line.amount:
continue
- amount = currency_pool.compute(cr, uid, current_currency, company_currency, line.untax_amount or line.amount)
+ amount = currency_pool.compute(cr, uid, current_currency, company_currency, line.untax_amount or line.amount, context=context_multi_currency)
move_line = {
'journal_id': inv.journal_id.id,
'period_id': inv.period_id.id,
@@ -770,7 +775,7 @@ class account_voucher(osv.osv):
'date': inv.date,
'credit': diff > 0 and diff or 0.0,
'debit': diff < 0 and -diff or 0.0,
- 'amount_currency': company_currency <> current_currency and currency_pool.compute(cr, uid, company_currency, current_currency, diff * -1) or 0.0,
+ 'amount_currency': company_currency <> current_currency and currency_pool.compute(cr, uid, company_currency, current_currency, diff * -1, context=context_multi_currency) or 0.0,
'currency_id': company_currency <> current_currency and current_currency or False,
}
@@ -1004,4 +1009,4 @@ class account_bank_statement_line(osv.osv):
account_bank_statement_line()
-# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
\ No newline at end of file
+# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4:
diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml
index c41356f3973..5a2c4b88dd9 100644
--- a/addons/account_voucher/account_voucher_view.xml
+++ b/addons/account_voucher/account_voucher_view.xml
@@ -29,9 +29,10 @@
@@ -245,11 +240,8 @@
-