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 @@
+ - + @@ -54,7 +55,6 @@ - diff --git a/addons/account_voucher/i18n/mn.po b/addons/account_voucher/i18n/mn.po index ff1c3f46e74..3d5fa12e2eb 100644 --- a/addons/account_voucher/i18n/mn.po +++ b/addons/account_voucher/i18n/mn.po @@ -14,7 +14,7 @@ msgstr "" "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:31+0000\n" +"X-Launchpad-Export-Date: 2010-12-23 05:02+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: account_voucher diff --git a/addons/account_voucher/test/sales_payment.yml b/addons/account_voucher/test/sales_payment.yml index e6e3be8f920..f6025389896 100644 --- a/addons/account_voucher/test/sales_payment.yml +++ b/addons/account_voucher/test/sales_payment.yml @@ -42,7 +42,7 @@ import netsvc vals = {} journal_id = self.default_get(cr, uid, ['journal_id']).get('journal_id',None) - res = self.onchange_partner_id(cr, uid, [], ref("base.res_partner_seagate"), journal_id, 0.0, 1, ttype='receipt') + res = self.onchange_partner_id(cr, uid, [], ref("base.res_partner_seagate"), journal_id, 0.0, 1, ttype='receipt', date=False) vals = { 'account_id': ref('account.cash'), 'amount': 450.0, diff --git a/addons/account_voucher/test/sales_receipt.yml b/addons/account_voucher/test/sales_receipt.yml index 628d1795bc8..a1793527f67 100644 --- a/addons/account_voucher/test/sales_receipt.yml +++ b/addons/account_voucher/test/sales_receipt.yml @@ -50,7 +50,7 @@ import netsvc vals = {} journal_id = self.default_get(cr, uid, ['journal_id']).get('journal_id',None) - res = self.onchange_partner_id(cr, uid, [], ref("base.res_partner_seagate"), journal_id, 0.0, 1, ttype='receipt') + res = self.onchange_partner_id(cr, uid, [], ref("base.res_partner_seagate"), journal_id, 0.0, 1, ttype='receipt', date=False) vals = { 'account_id': ref('account.cash'), 'amount': 30000.0, diff --git a/addons/account_voucher/voucher_payment_receipt_view.xml b/addons/account_voucher/voucher_payment_receipt_view.xml index b47fa46bb7e..3a3e996975f 100644 --- a/addons/account_voucher/voucher_payment_receipt_view.xml +++ b/addons/account_voucher/voucher_payment_receipt_view.xml @@ -88,15 +88,16 @@ - + + - + - + @@ -134,7 +135,6 @@ - @@ -151,15 +151,16 @@ - + + - + - + @@ -211,7 +212,6 @@ groups="analytic.group_analytic_accounting"/> - @@ -285,17 +285,18 @@ - + + + on_change="onchange_partner_id(partner_id, journal_id, amount, currency_id, type, date)"/> - + @@ -348,7 +349,6 @@ - diff --git a/addons/account_voucher/voucher_sales_purchase_view.xml b/addons/account_voucher/voucher_sales_purchase_view.xml index 2800511a8e0..3367b08583b 100644 --- a/addons/account_voucher/voucher_sales_purchase_view.xml +++ b/addons/account_voucher/voucher_sales_purchase_view.xml @@ -96,11 +96,11 @@ - + + - @@ -222,10 +222,11 @@ - + + - + @@ -248,7 +249,6 @@ - diff --git a/addons/analytic_journal_billing_rate/i18n/sv.po b/addons/analytic_journal_billing_rate/i18n/sv.po index 51258e99e90..84b3735758e 100644 --- a/addons/analytic_journal_billing_rate/i18n/sv.po +++ b/addons/analytic_journal_billing_rate/i18n/sv.po @@ -7,13 +7,13 @@ msgstr "" "Project-Id-Version: OpenERP Server 5.0.14\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 22:40+0000\n" -"Last-Translator: Magnus Brandt (mba), Aspirix AB \n" +"PO-Revision-Date: 2010-12-23 04:55+0000\n" +"Last-Translator: OpenERP Administrators \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:32+0000\n" +"X-Launchpad-Export-Date: 2010-12-23 05:02+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: analytic_journal_billing_rate diff --git a/addons/audittrail/audittrail.py b/addons/audittrail/audittrail.py index 52819428dbc..b744a10b3d9 100644 --- a/addons/audittrail/audittrail.py +++ b/addons/audittrail/audittrail.py @@ -106,14 +106,16 @@ class audittrail_rule(osv.osv): """ obj_action = self.pool.get('ir.actions.act_window') val_obj = self.pool.get('ir.values') + value='' #start Loop for thisrule in self.browse(cr, uid, ids): if thisrule.id in self.__functions: for function in self.__functions[thisrule.id]: setattr(function[0], function[1], function[2]) w_id = obj_action.search(cr, uid, [('name', '=', 'View Log'), ('res_model', '=', 'audittrail.log'), ('src_model', '=', thisrule.object_id.model)]) - obj_action.unlink(cr, uid, w_id) - value = "ir.actions.act_window" + ',' + str(w_id[0]) + if w_id: + obj_action.unlink(cr, uid, w_id) + value = "ir.actions.act_window" + ',' + str(w_id[0]) val_id = val_obj.search(cr, uid, [('model', '=', thisrule.object_id.model), ('value', '=', value)]) if val_id: res = ir.ir_del(cr, uid, val_id[0]) diff --git a/addons/audittrail/i18n/mn.po b/addons/audittrail/i18n/mn.po index 8f13287977a..2f6a4b7b02e 100644 --- a/addons/audittrail/i18n/mn.po +++ b/addons/audittrail/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:25+0000\n" -"Last-Translator: sugi \n" +"PO-Revision-Date: 2010-12-22 10:32+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:30+0000\n" +"X-Launchpad-Export-Date: 2010-12-23 05:02+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: audittrail diff --git a/addons/audittrail/i18n/sv.po b/addons/audittrail/i18n/sv.po index 64080433026..31382f64009 100644 --- a/addons/audittrail/i18n/sv.po +++ b/addons/audittrail/i18n/sv.po @@ -7,13 +7,13 @@ msgstr "" "Project-Id-Version: OpenERP Server 5.0.14\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 22:07+0000\n" -"Last-Translator: Magnus Brandt (mba), Aspirix AB \n" +"PO-Revision-Date: 2010-12-23 00:28+0000\n" +"Last-Translator: OpenERP Administrators \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:30+0000\n" +"X-Launchpad-Export-Date: 2010-12-23 05:02+0000\n" "X-Generator: Launchpad (build Unknown)\n" #. module: audittrail diff --git a/addons/base_action_rule/base_action_rule.py b/addons/base_action_rule/base_action_rule.py index bf34c137b5a..d528aaae28e 100644 --- a/addons/base_action_rule/base_action_rule.py +++ b/addons/base_action_rule/base_action_rule.py @@ -29,6 +29,11 @@ import re import time import tools + +def get_datetime(date_field): + return datetime.strptime(date_field[:19], '%Y-%m-%d %H:%M:%S') + + class base_action_rule(osv.osv): """ Base Action Rules """ @@ -115,6 +120,7 @@ the rule to mark CC(mail to any other person defined in actions)."), help="Use a python expression to specify the right field on which one than we will use for the 'From' field of the header"), 'act_email_to' : fields.char('Email To', size=64, required=False, help="Use a python expression to specify the right field on which one than we will use for the 'To' field of the header"), + 'last_run': fields.datetime('Last Run', readonly=1), } _defaults = { @@ -145,7 +151,7 @@ the rule to mark CC(mail to any other person defined in actions)."), # Searching for action rules cr.execute("SELECT model.model, rule.id FROM base_action_rule rule \ LEFT JOIN ir_model model on (model.id = rule.model_id) \ - where active") + WHERE active") res = cr.fetchall() # Check if any rule matching with current object for obj_name, rule_id in res: @@ -153,7 +159,10 @@ the rule to mark CC(mail to any other person defined in actions)."), continue else: obj = self.pool.get(obj_name) - self._action(cr, uid, [rule_id], obj.browse(cr, uid, ids, context=context), context=context) + # If the rule doesn't involve a time condition, run it immediately + # Otherwise we let the scheduler run the action + if self.browse(cr, uid, rule_id, context=context).trg_date_type == 'none': + self._action(cr, uid, [rule_id], obj.browse(cr, uid, ids, context=context), context=context) return True def _create(self, old_create, model, context=None): @@ -206,8 +215,50 @@ the rule to mark CC(mail to any other person defined in actions)."), """ rule_pool = self.pool.get('base.action.rule') rule_ids = rule_pool.search(cr, uid, [], context=context) - return self._register_hook(cr, uid, rule_ids, context=context) - + self._register_hook(cr, uid, rule_ids, context=context) + + rules = self.browse(cr, uid, rule_ids, context=context) + for rule in rules: + model = rule.model_id.model + model_pool = self.pool.get(model) + last_run = False + if rule.last_run: + last_run = get_datetime(rule.last_run) + now = datetime.now() + for obj_id in model_pool.search(cr, uid, [], context=context): + obj = model_pool.browse(cr, uid, obj_id, context=context) + # Calculate when this action should next occur for this object + base = False + if rule.trg_date_type=='create' and hasattr(obj, 'create_date'): + base = obj.create_date + elif (rule.trg_date_type=='action_last' + and hasattr(obj, 'create_date')): + if hasattr(obj, 'date_action_last') and obj.date_action_last: + base = obj.date_action_last + else: + base = obj.create_date + elif (rule.trg_date_type=='deadline' + and hasattr(obj, 'date_deadline') + and obj.date_deadline): + base = obj.date_deadline + elif (rule.trg_date_type=='date' + and hasattr(obj, 'date') + and obj.date): + base = obj.date + if base: + fnct = { + 'minutes': lambda interval: timedelta(minutes=interval), + 'day': lambda interval: timedelta(days=interval), + 'hour': lambda interval: timedelta(hours=interval), + 'month': lambda interval: timedelta(months=interval), + } + base = get_datetime(base) + delay = fnct[rule.trg_date_range_type](rule.trg_date_range) + action_date = base + delay + if (not last_run or (last_run <= action_date < now)): + self._action(cr, uid, [rule.id], [obj], context=context) + rule_pool.write(cr, uid, [rule.id], {'last_run': now}, + context=context) def format_body(self, body): """ Foramat Action rule's body @@ -391,7 +442,6 @@ the rule to mark CC(mail to any other person defined in actions)."), if context is None: context = {} - context.update({'action': True}) if not scrit: scrit = [] @@ -403,41 +453,6 @@ the rule to mark CC(mail to any other person defined in actions)."), if not ok: continue - base = False - if action.trg_date_type=='create' and hasattr(obj, 'create_date'): - base = datetime.strptime(obj.create_date[:19], '%Y-%m-%d %H:%M:%S') - elif action.trg_date_type=='action_last' and hasattr(obj, 'create_date'): - if hasattr(obj, 'date_action_last') and obj.date_action_last: - base = datetime.strptime(obj.date_action_last, '%Y-%m-%d %H:%M:%S') - else: - base = datetime.strptime(obj.create_date[:19], '%Y-%m-%d %H:%M:%S') - elif action.trg_date_type=='deadline' and hasattr(obj, 'date_deadline') \ - and obj.date_deadline: - base = datetime.strptime(obj.date_deadline, '%Y-%m-%d %H:%M:%S') - elif action.trg_date_type=='date' and hasattr(obj, 'date') and obj.date: - base = datetime.strptime(obj.date, '%Y-%m-%d %H:%M:%S') - if base: - fnct = { - 'minutes': lambda interval: timedelta(minutes=interval), - 'day': lambda interval: timedelta(days=interval), - 'hour': lambda interval: timedelta(hours=interval), - 'month': lambda interval: timedelta(months=interval), - } - d = base + fnct[action.trg_date_range_type](action.trg_date_range) - dt = d.strftime('%Y-%m-%d %H:%M:%S') - ok = False - if hasattr(obj, 'date_action_last') and hasattr(obj, 'date_action_next'): - ok = (dt <= time.strftime('%Y-%m-%d %H:%M:%S')) and \ - ((not obj.date_action_next) or \ - (dt >= obj.date_action_next and \ - obj.date_action_last < obj.date_action_next)) - if not ok: - if not obj.date_action_next or dt < obj.date_action_next: - obj.date_action_next = dt - model_obj.write(cr, uid, [obj.id], {'date_action_next': dt}, context) - else: - ok = action.trg_date_type == 'none' - if ok: self.do_action(cr, uid, action, model_obj, obj, context) break diff --git a/addons/base_calendar/base_calendar.py b/addons/base_calendar/base_calendar.py index fa85b242f6a..0e57c7cfb66 100644 --- a/addons/base_calendar/base_calendar.py +++ b/addons/base_calendar/base_calendar.py @@ -1024,45 +1024,43 @@ class calendar_event(osv.osv): qry = "UPDATE \"%s\" set rrule_type=%%s " % self._table qry_args = [ rrule_type, ] + new_val = val.copy() + for k, v in val.items(): + if val['freq'] == 'weekly' and val.get('byday'): + for day in val['byday'].split(','): + new_val[day] = True + val.pop('byday') - if rrule_type == 'custom': - new_val = val.copy() - for k, v in val.items(): - if val['freq'] == 'weekly' and val.get('byday'): - for day in val['byday'].split(','): - new_val[day] = True - val.pop('byday') + if val.get('until'): + until = parser.parse(''.join((re.compile('\d')).findall(val.get('until')))) + new_val['end_date'] = until.strftime('%Y-%m-%d') + val.pop('until') + new_val.pop('until') - if val.get('until'): - until = parser.parse(''.join((re.compile('\d')).findall(val.get('until')))) - new_val['end_date'] = until.strftime('%Y-%m-%d') - val.pop('until') - new_val.pop('until') + if val.get('bymonthday'): + new_val['day'] = val.get('bymonthday') + val.pop('bymonthday') + new_val['select1'] = 'date' + new_val.pop('bymonthday') - if val.get('bymonthday'): - new_val['day'] = val.get('bymonthday') - val.pop('bymonthday') - new_val['select1'] = 'date' - new_val.pop('bymonthday') + if val.get('byday'): + d = val.get('byday') + if '-' in d: + new_val['byday'] = d[:2] + new_val['week_list'] = d[2:4].upper() + else: + new_val['byday'] = d[:1] + new_val['week_list'] = d[1:3].upper() + new_val['select1'] = 'day' - if val.get('byday'): - d = val.get('byday') - if '-' in d: - new_val['byday'] = d[:2] - new_val['week_list'] = d[2:4].upper() - else: - new_val['byday'] = d[:1] - new_val['week_list'] = d[1:3].upper() - new_val['select1'] = 'day' + if val.get('bymonth'): + new_val['month_list'] = val.get('bymonth') + val.pop('bymonth') + new_val.pop('bymonth') - if val.get('bymonth'): - new_val['month_list'] = val.get('bymonth') - val.pop('bymonth') - new_val.pop('bymonth') - - for k, v in new_val.items(): - qry += ", %s=%%s" % k - qry_args.append(v) + for k, v in new_val.items(): + qry += ", %s=%%s" % k + qry_args.append(v) qry = qry + " where id=%s" qry_args.append(id) @@ -1082,10 +1080,12 @@ class calendar_event(osv.osv): for datas in self.read(cr, uid, ids, context=context): event = datas['id'] if datas.get('rrule_type'): + if datas['rrule_type']=='daily_working': + datas.update({'rrule_type': 'weekly'}) if datas.get('rrule_type') == 'none': result[event] = False cr.execute("UPDATE %s set exrule=Null where id=%%s" % self._table,( event,)) - elif datas.get('rrule_type') == 'custom': + if datas.get('rrule_type') : if datas.get('interval', 0) < 0: raise osv.except_osv(_('Warning!'), _('Interval can not be Negative')) if datas.get('count', 0) < 0: @@ -1132,7 +1132,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ FREQ=MONTHLY;INTERVAL=2;COUNT=10;BYDAY=-1SU'), 'rrule_type': fields.selection([('none', ''), ('daily', 'Daily'), \ ('weekly', 'Weekly'), ('monthly', 'Monthly'), \ - ('yearly', 'Yearly'), ('custom', 'Custom')], + ('yearly', 'Yearly'),], 'Recurrency', states={'done': [('readonly', True)]}, help="Let the event automatically repeat at that interval"), 'alarm_id': fields.many2one('res.alarm', 'Alarm', states={'done': [('readonly', True)]}, @@ -1144,16 +1144,15 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ 'user_id': fields.many2one('res.users', 'Responsible', states={'done': [('readonly', True)]}), 'organizer': fields.char("Organizer", size=256, states={'done': [('readonly', True)]}), # Map with Organizer Attribure of VEvent. 'organizer_id': fields.many2one('res.users', 'Organizer', states={'done': [('readonly', True)]}), - 'freq': fields.selection([('None', 'No Repeat'), \ - ('hourly', 'Hours'), \ - ('daily', 'Days'), \ - ('weekly', 'Weeks'), \ - ('monthly', 'Months'), \ - ('yearly', 'Years'), \ - ('secondly', 'Seconds'), \ - ('minutely', 'Minutes') ], 'Frequency'), - 'interval': fields.integer('Interval', help="Repeat every x"), - 'count': fields.integer('Count', help="Repeat max that times"), + 'freq': fields.selection([('None', 'No Repeat'), + ('hourly', 'Hours'), + ('daily', 'Days'), + ('weekly', 'Weeks'), + ('monthly', 'Months'), + ('yearly', 'Years'), ], 'Frequency'), + + 'interval': fields.integer('Interval', help="Repeat every (Days/Week/Month/Year)"), + 'count': fields.integer('Repeat', help="Repeat x times"), 'mo': fields.boolean('Mon'), 'tu': fields.boolean('Tue'), 'we': fields.boolean('Wed'), @@ -1161,7 +1160,7 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ 'fr': fields.boolean('Fri'), 'sa': fields.boolean('Sat'), 'su': fields.boolean('Sun'), - 'select1': fields.selection([('date', 'Date of month'), \ + 'select1': fields.selection([('date', 'Date of month'), ('day', 'Day of month')], 'Option'), 'day': fields.integer('Date of month'), 'week_list': fields.selection([('MO', 'Monday'), ('TU', 'Tuesday'), \ @@ -1177,7 +1176,9 @@ e.g.: Every other month on the last Sunday of the month for 10 occurrences:\ 'event_id', 'attendee_id', 'Attendees'), 'allday': fields.boolean('All Day', states={'done': [('readonly', True)]}), 'active': fields.boolean('Active', help="If the active field is set to \ -true, it will allow you to hide the event alarm information without removing it.") + true, it will allow you to hide the event alarm information without removing it."), + 'recurrency': fields.boolean('Recurrent', help="Recurrent Meeting"), + 'edit_all': fields.boolean('Edit All', help="Edit all Occurrences of recurrent Meeting."), } def default_organizer(self, cr, uid, context=None): user_pool = self.pool.get('res.users') @@ -1199,45 +1200,15 @@ true, it will allow you to hide the event alarm information without removing it. 'organizer': default_organizer, } - def open_event(self, cr, uid, ids, context=None): - """ - Open Event From for Editing - @param cr: the current row, from the database cursor, - @param uid: the current user’s ID for security checks, - @param ids: List of event’s IDs - @param context: A standard dictionary for contextual values - @return: Dictionary value which open Crm Meeting form. - """ - if context is None: + def onchange_edit_all(self, cr, uid, ids, rrule_type,edit_all, context=None): + if not context: context = {} - data_obj = self.pool.get('ir.model.data') - value = {} - - id2 = data_obj._get_id(cr, uid, 'base_calendar', 'event_form_view') - id3 = data_obj._get_id(cr, uid, 'base_calendar', 'event_tree_view') - id4 = data_obj._get_id(cr, uid, 'base_calendar', 'event_calendar_view') - if id2: - id2 = data_obj.browse(cr, uid, id2, context=context).res_id - if id3: - id3 = data_obj.browse(cr, uid, id3, context=context).res_id - if id4: - id4 = data_obj.browse(cr, uid, id4, context=context).res_id - for id in ids: - value = { - 'name': _('Event'), - 'view_type': 'form', - 'view_mode': 'form,tree', - 'res_model': 'calendar.event', - 'view_id': False, - 'views': [(id2, 'form'), (id3, 'tree'), (id4, 'calendar')], - 'type': 'ir.actions.act_window', - 'res_id': base_calendar_id2real_id(id), - 'nodestroy': True - } - - return value + if edit_all and rrule_type: + for id in ids: + base_calendar_id2real_id(id) + return value def modify_all(self, cr, uid, event_ids, defaults, context=None, *args): """ @@ -1367,15 +1338,13 @@ true, it will allow you to hide the event alarm information without removing it. weekstring = '' monthstring = '' yearstring = '' - - freq = datas.get('freq') - if freq == 'None': + freq=datas.get('rrule_type') + if freq == 'none': return '' - + interval_srting = datas.get('interval') and (';INTERVAL=' + str(datas.get('interval'))) or '' if freq == 'weekly': - byday = map(lambda x: x.upper(), filter(lambda x: datas.get(x) and x in weekdays, datas)) if byday: weekstring = ';BYDAY=' + ','.join(byday) @@ -1388,16 +1357,7 @@ true, it will allow you to hide the event alarm information without removing it. elif datas.get('select1')=='date': monthstring = ';BYMONTHDAY=' + str(datas.get('day')) - elif freq == 'yearly': - if datas.get('select1')=='date' and (datas.get('day') < 1 or datas.get('day') > 31): - raise osv.except_osv(_('Error!'), ("Please select proper Day of month")) - bymonth = ';BYMONTH=' + str(datas.get('month_list')) - if datas.get('select1')=='day': - bystring = ';BYDAY=' + datas.get('byday') + datas.get('week_list') - elif datas.get('select1')=='date': - bystring = ';BYMONTHDAY=' + str(datas.get('day')) - yearstring = bymonth + bystring - + if datas.get('end_date'): datas['end_date'] = ''.join((re.compile('\d')).findall(datas.get('end_date'))) + 'T235959Z' enddate = (datas.get('count') and (';COUNT=' + str(datas.get('count'))) or '') +\ diff --git a/addons/base_calendar/base_calendar_view.xml b/addons/base_calendar/base_calendar_view.xml index 2280b5454b3..a1bd8db9d54 100644 --- a/addons/base_calendar/base_calendar_view.xml +++ b/addons/base_calendar/base_calendar_view.xml @@ -241,62 +241,9 @@ - -