diff --git a/addons/account/i18n/pl.po b/addons/account/i18n/pl.po index ef2849cd444..ef779200db0 100644 --- a/addons/account/i18n/pl.po +++ b/addons/account/i18n/pl.po @@ -7,14 +7,14 @@ msgstr "" "Project-Id-Version: OpenERP Server 6.0dev\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2012-12-21 17:04+0000\n" -"PO-Revision-Date: 2012-12-22 12:46+0000\n" -"Last-Translator: Grzegorz Grzelak (OpenGLOBE.pl) \n" +"PO-Revision-Date: 2014-04-04 19:18+0000\n" +"Last-Translator: Dariusz Żbikowski \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: 2014-03-27 06:26+0000\n" -"X-Generator: Launchpad (build 16967)\n" +"X-Launchpad-Export-Date: 2014-04-05 05:30+0000\n" +"X-Generator: Launchpad (build 16976)\n" #. module: account #: model:process.transition,name:account.process_transition_supplierreconcilepaid0 @@ -989,6 +989,8 @@ msgid "" " opening/closing fiscal " "year process." msgstr "" +"Nie możesz anulować uzgodnień pozycji dziennika jeśli zostały one " +"wygenerowane procesem zamykania/otwierania roku." #. module: account #: model:ir.actions.act_window,name:account.action_subscription_form_new diff --git a/addons/account/wizard/account_validate_account_move.py b/addons/account/wizard/account_validate_account_move.py index 297f3445606..7a7a74be04b 100644 --- a/addons/account/wizard/account_validate_account_move.py +++ b/addons/account/wizard/account_validate_account_move.py @@ -34,7 +34,7 @@ class validate_account_move(osv.osv_memory): if context is None: context = {} data = self.read(cr, uid, ids[0], context=context) - ids_move = obj_move.search(cr, uid, [('state','=','draft'),('journal_id','in',tuple(data['journal_ids'])),('period_id','in',tuple(data['period_ids']))]) + ids_move = obj_move.search(cr, uid, [('state','=','draft'),('journal_id','in',tuple(data['journal_ids'])),('period_id','in',tuple(data['period_ids']))], order='date') if not ids_move: raise osv.except_osv(_('Warning!'), _('Specified journals do not have any account move entries in draft state for the specified periods.')) obj_move.button_validate(cr, uid, ids_move, context=context) diff --git a/addons/account_analytic_analysis/account_analytic_analysis.py b/addons/account_analytic_analysis/account_analytic_analysis.py index ec5e2c56e6c..99890a5f239 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis.py +++ b/addons/account_analytic_analysis/account_analytic_analysis.py @@ -543,33 +543,40 @@ class account_analytic_account(osv.osv): 'nodestroy': True, } - def on_change_template(self, cr, uid, ids, template_id, context=None): + def on_change_template(self, cr, uid, ids, template_id, date_start=False, fix_price_invoices=False, invoice_on_timesheets=False, recurring_invoices=False, context=None): if not template_id: return {} obj_analytic_line = self.pool.get('account.analytic.invoice.line') - res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, context=context) + res = super(account_analytic_account, self).on_change_template(cr, uid, ids, template_id, date_start=date_start, context=context) template = self.browse(cr, uid, template_id, context=context) - invoice_line_ids = [] - for x in template.recurring_invoice_line_ids: - invoice_line_ids.append((0, 0, { - 'product_id': x.product_id.id, - 'uom_id': x.uom_id.id, - 'name': x.name, - 'quantity': x.quantity, - 'price_unit': x.price_unit, - 'analytic_account_id': x.analytic_account_id and x.analytic_account_id.id or False, - })) - res['value']['fix_price_invoices'] = template.fix_price_invoices - res['value']['invoice_on_timesheets'] = template.invoice_on_timesheets - res['value']['hours_qtt_est'] = template.hours_qtt_est - res['value']['amount_max'] = template.amount_max - res['value']['to_invoice'] = template.to_invoice.id - res['value']['pricelist_id'] = template.pricelist_id.id - res['value']['recurring_invoices'] = template.recurring_invoices - res['value']['recurring_interval'] = template.recurring_interval - res['value']['recurring_rule_type'] = template.recurring_rule_type - res['value']['recurring_invoice_line_ids'] = invoice_line_ids + + if not fix_price_invoices: + res['value']['fix_price_invoices'] = template.fix_price_invoices + res['value']['amount_max'] = template.amount_max + if not invoice_on_timesheets: + res['value']['invoice_on_timesheets'] = template.invoice_on_timesheets + res['value']['hours_qtt_est'] = template.hours_qtt_est + + if template.to_invoice.id: + res['value']['to_invoice'] = template.to_invoice.id + if template.pricelist_id.id: + res['value']['pricelist_id'] = template.pricelist_id.id + if not recurring_invoices: + invoice_line_ids = [] + for x in template.recurring_invoice_line_ids: + invoice_line_ids.append((0, 0, { + 'product_id': x.product_id.id, + 'uom_id': x.uom_id.id, + 'name': x.name, + 'quantity': x.quantity, + 'price_unit': x.price_unit, + 'analytic_account_id': x.analytic_account_id and x.analytic_account_id.id or False, + })) + res['value']['recurring_invoices'] = template.recurring_invoices + res['value']['recurring_interval'] = template.recurring_interval + res['value']['recurring_rule_type'] = template.recurring_rule_type + res['value']['recurring_invoice_line_ids'] = invoice_line_ids return res def onchange_recurring_invoices(self, cr, uid, ids, recurring_invoices, date_start=False, context=None): diff --git a/addons/account_analytic_analysis/account_analytic_analysis_view.xml b/addons/account_analytic_analysis/account_analytic_analysis_view.xml index f5b89db7089..d99be3db355 100644 --- a/addons/account_analytic_analysis/account_analytic_analysis_view.xml +++ b/addons/account_analytic_analysis/account_analytic_analysis_view.xml @@ -38,6 +38,9 @@ {'required': [('type','=','contract'),'|','|',('fix_price_invoices','=',True), ('invoice_on_timesheets', '=', True), ('recurring_invoices', '=', True)]} + + on_change_template(template_id, date_start, fix_price_invoices, invoice_on_timesheets, recurring_invoices) + diff --git a/addons/account_followup/i18n/pl.po b/addons/account_followup/i18n/pl.po index b851b85d5df..1a37b819f02 100644 --- a/addons/account_followup/i18n/pl.po +++ b/addons/account_followup/i18n/pl.po @@ -7,14 +7,14 @@ msgstr "" "Project-Id-Version: OpenERP Server 6.0dev\n" "Report-Msgid-Bugs-To: support@openerp.com\n" "POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2012-12-12 17:49+0000\n" -"Last-Translator: Grzegorz Grzelak (OpenGLOBE.pl) \n" +"PO-Revision-Date: 2014-04-04 19:44+0000\n" +"Last-Translator: Dariusz Żbikowski \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: 2014-03-27 06:16+0000\n" -"X-Generator: Launchpad (build 16967)\n" +"X-Launchpad-Export-Date: 2014-04-05 05:30+0000\n" +"X-Generator: Launchpad (build 16976)\n" #. module: account_followup #: model:email.template,subject:account_followup.email_template_account_followup_default @@ -109,7 +109,7 @@ msgstr "Kroki monitowania płatności" #. module: account_followup #: field:account_followup.print,email_body:0 msgid "Email Body" -msgstr "" +msgstr "Treść email" #. module: account_followup #: model:ir.actions.act_window,name:account_followup.action_account_followup_print @@ -403,7 +403,7 @@ msgstr "Monity o płatność" #. module: account_followup #: field:account_followup.followup.line,delay:0 msgid "Due Days" -msgstr "" +msgstr "Dni zwłoki" #. module: account_followup #: field:account.move.line,followup_line_id:0 @@ -419,7 +419,7 @@ msgstr "Ostatni monit o płatność" #. module: account_followup #: model:ir.ui.menu,name:account_followup.menu_manual_reconcile_followup msgid "Reconcile Invoices & Payments" -msgstr "" +msgstr "Uzgadnianie Faktur i Płatności" #. module: account_followup #: model:ir.ui.menu,name:account_followup.account_followup_s @@ -429,7 +429,7 @@ msgstr "Wykonaj manualnie monit o płatność" #. module: account_followup #: report:account_followup.followup.print:0 msgid "Li." -msgstr "" +msgstr "Sp." #. module: account_followup #: field:account_followup.print,email_conf:0 @@ -499,6 +499,7 @@ msgstr "Monitowanie płatności" #, python-format msgid "Email not sent because of email address of partner not filled in" msgstr "" +"Email nie został wysłany ponieważ adres email partnera nie został wypełniony" #. module: account_followup #: model:ir.model,name:account_followup.model_account_followup_followup @@ -511,6 +512,8 @@ msgid "" "Optionally you can assign a user to this field, which will make him " "responsible for the action." msgstr "" +"Opcjonalnie możesz przypisać użytkownika do tego pola, który stanie się " +"odpowiedzialny za tę akcję." #. module: account_followup #: model:ir.model,name:account_followup.model_account_followup_sending_results @@ -528,7 +531,7 @@ msgstr "" #: code:addons/account_followup/wizard/account_followup_print.py:172 #, python-format msgid " manual action(s) assigned:" -msgstr "" +msgstr " ręczna akcja przypisana do:" #. module: account_followup #: view:res.partner:0 @@ -548,13 +551,13 @@ msgstr "Przeszukaj monity o płatność" #. module: account_followup #: view:res.partner:0 msgid "Account Move line" -msgstr "" +msgstr "Pozycja zapisu" #. module: account_followup #: code:addons/account_followup/wizard/account_followup_print.py:237 #, python-format msgid "Send Letters and Emails: Actions Summary" -msgstr "" +msgstr "Listy i Email: Podsumowanie akcji" #. module: account_followup #: view:account_followup.print:0 @@ -916,7 +919,7 @@ msgstr "" #. module: account_followup #: view:res.partner:0 msgid "Responsible" -msgstr "" +msgstr "Odpowiedzialny" #. module: account_followup #: model:ir.ui.menu,name:account_followup.menu_finance_followup @@ -945,7 +948,7 @@ msgstr "Działanie monitowania płatności" #. module: account_followup #: view:account_followup.stat:0 msgid "Including journal entries marked as a litigation" -msgstr "" +msgstr "Załącz pozycje dziennika oznaczone jako sporne" #. module: account_followup #: report:account_followup.followup.print:0 diff --git a/addons/account_test/i18n/sv.po b/addons/account_test/i18n/sv.po new file mode 100644 index 00000000000..78dea50f511 --- /dev/null +++ b/addons/account_test/i18n/sv.po @@ -0,0 +1,266 @@ +# Swedish translation for openobject-addons +# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014 +# This file is distributed under the same license as the openobject-addons package. +# FIRST AUTHOR , 2014. +# +msgid "" +msgstr "" +"Project-Id-Version: openobject-addons\n" +"Report-Msgid-Bugs-To: FULL NAME \n" +"POT-Creation-Date: 2012-12-21 17:05+0000\n" +"PO-Revision-Date: 2014-03-31 21:13+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Swedish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2014-04-01 05:39+0000\n" +"X-Generator: Launchpad (build 16967)\n" + +#. module: account_test +#: view:accounting.assert.test:0 +msgid "" +"Code should always set a variable named `result` with the result of your " +"test, that can be a list or\n" +"a dictionary. If `result` is an empty list, it means that the test was " +"succesful. Otherwise it will\n" +"try to translate and print what is inside `result`.\n" +"\n" +"If the result of your test is a dictionary, you can set a variable named " +"`column_order` to choose in\n" +"what order you want to print `result`'s content.\n" +"\n" +"Should you need them, you can also use the following variables into your " +"code:\n" +" * cr: cursor to the database\n" +" * uid: ID of the current user\n" +"\n" +"In any ways, the code must be legal python statements with correct " +"indentation (if needed).\n" +"\n" +"Example: \n" +" sql = '''SELECT id, name, ref, date\n" +" FROM account_move_line \n" +" WHERE account_id IN (SELECT id FROM account_account WHERE type " +"= 'view')\n" +" '''\n" +" cr.execute(sql)\n" +" result = cr.dictfetchall()" +msgstr "" +"Kod ska alltid ställa en variabel med namnet `resultat` med resultatet av " +"ditt test, kan det vara en lista eller\n" +"en ordbok. Om `resultat` är en tom lista, betyder det att testet var lyckat. " +"Annars kommer\n" +"försöka översätta och skriva ut vad som finns i `resultat`.\n" +"\n" +"Om resultatet av testet är en ordbok kan du ställa in en variabel med namnet " +"`column_order` för att välja in\n" +"vilken ordning du vill skriva ut `resultat` s innehåll.\n" +"\n" +"Om du behöver dem, kan du även använda följande variabler i koden:\n" +" * Cr: markören till databasen\n" +" * Uid: ID för den aktuella användaren\n" +"\n" +"På något sätt måste koden vara lagliga python uttalanden med rätt indrag (om " +"det behövs).\n" +"\n" +"Exempel:\n" +" sql ='' 'SELECT id, namn, ref, datum\n" +" FRÅN account_move_line\n" +" VAR konto-IN (SELECT id FROM account_account WHERE typ = " +"\"Visa\")\n" +" '' '\n" +" cr.execute (SQL)\n" +" resultat = cr.dictfetchall ()" + +#. module: account_test +#: model:accounting.assert.test,name:account_test.account_test_02 +msgid "Test 2: Opening a fiscal year" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,desc:account_test.account_test_05 +msgid "" +"Check that reconciled invoice for Sales/Purchases has reconciled entries for " +"Payable and Receivable Accounts" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,desc:account_test.account_test_03 +msgid "" +"Check if movement lines are balanced and have the same date and period" +msgstr "" + +#. module: account_test +#: field:accounting.assert.test,name:0 +msgid "Test Name" +msgstr "Testnamn" + +#. module: account_test +#: report:account.test.assert.print:0 +msgid "Accouting tests on" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,name:account_test.account_test_01 +msgid "Test 1: General balance" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,desc:account_test.account_test_06 +msgid "Check that paid/reconciled invoices are not in 'Open' state" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,desc:account_test.account_test_05_2 +msgid "" +"Check that reconciled account moves, that define Payable and Receivable " +"accounts, are belonging to reconciled invoices" +msgstr "" + +#. module: account_test +#: view:accounting.assert.test:0 +msgid "Tests" +msgstr "Tester" + +#. module: account_test +#: field:accounting.assert.test,desc:0 +msgid "Test Description" +msgstr "" + +#. module: account_test +#: view:accounting.assert.test:0 +msgid "Description" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,desc:account_test.account_test_06_1 +msgid "Check that there's no move for any account with « View » account type" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,name:account_test.account_test_08 +msgid "Test 9 : Accounts and partners on account moves" +msgstr "" + +#. module: account_test +#: model:ir.actions.act_window,name:account_test.action_accounting_assert +#: model:ir.actions.report.xml,name:account_test.account_assert_test_report +#: model:ir.ui.menu,name:account_test.menu_action_license +msgid "Accounting Tests" +msgstr "" + +#. module: account_test +#: code:addons/account_test/report/account_test_report.py:74 +#, python-format +msgid "The test was passed successfully" +msgstr "" + +#. module: account_test +#: field:accounting.assert.test,active:0 +msgid "Active" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,name:account_test.account_test_06 +msgid "Test 6 : Invoices status" +msgstr "" + +#. module: account_test +#: model:ir.model,name:account_test.model_accounting_assert_test +msgid "accounting.assert.test" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,name:account_test.account_test_05 +msgid "" +"Test 5.1 : Payable and Receivable accountant lines of reconciled invoices" +msgstr "" + +#. module: account_test +#: field:accounting.assert.test,code_exec:0 +msgid "Python code" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,desc:account_test.account_test_07 +msgid "" +"Check on bank statement that the Closing Balance = Starting Balance + sum of " +"statement lines" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,name:account_test.account_test_07 +msgid "Test 8 : Closing balance on bank statements" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,name:account_test.account_test_03 +msgid "Test 3: Movement lines" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,name:account_test.account_test_05_2 +msgid "Test 5.2 : Reconcilied invoices and Payable/Receivable accounts" +msgstr "" + +#. module: account_test +#: view:accounting.assert.test:0 +msgid "Expression" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,name:account_test.account_test_04 +msgid "Test 4: Totally reconciled mouvements" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,desc:account_test.account_test_04 +msgid "Check if the totally reconciled movements are balanced" +msgstr "" + +#. module: account_test +#: field:accounting.assert.test,sequence:0 +msgid "Sequence" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,desc:account_test.account_test_02 +msgid "" +"Check if the balance of the new opened fiscal year matches with last year's " +"balance" +msgstr "" + +#. module: account_test +#: view:accounting.assert.test:0 +msgid "Python Code" +msgstr "" + +#. module: account_test +#: model:ir.actions.act_window,help:account_test.action_accounting_assert +msgid "" +"

\n" +" Click to create Accounting Test.\n" +"

\n" +" " +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,desc:account_test.account_test_01 +msgid "Check the balance: Debit sum = Credit sum" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,desc:account_test.account_test_08 +msgid "Check that general accounts and partners on account moves are active" +msgstr "" + +#. module: account_test +#: model:accounting.assert.test,name:account_test.account_test_06_1 +msgid "Test 7: « View  » account type" +msgstr "" + +#. module: account_test +#: view:accounting.assert.test:0 +msgid "Code Help" +msgstr "" diff --git a/addons/account_voucher/account_voucher.py b/addons/account_voucher/account_voucher.py index 5d0ed8297c2..771c6e15bd8 100644 --- a/addons/account_voucher/account_voucher.py +++ b/addons/account_voucher/account_voucher.py @@ -732,13 +732,17 @@ class account_voucher(osv.osv): total_credit = 0.0 total_debit = 0.0 - account_type = 'receivable' + account_type = None + if context.get('account_id'): + account_type = self.pool['account.account'].browse(cr, uid, context['account_id'], context=context).type if ttype == 'payment': - account_type = 'payable' + if not account_type: + account_type = 'payable' total_debit = price or 0.0 else: total_credit = price or 0.0 - account_type = 'receivable' + if not account_type: + account_type = 'receivable' if not context.get('move_line_ids', False): ids = move_line_pool.search(cr, uid, [('state','=','valid'), ('account_id.type', '=', account_type), ('reconcile_id', '=', False), ('partner_id', '=', partner_id)], context=context) @@ -827,9 +831,9 @@ class account_voucher(osv.osv): else: default['value']['line_dr_ids'].append(rs) - if ttype == 'payment' and len(default['value']['line_cr_ids']) > 0: + if len(default['value']['line_cr_ids']) > 0: default['value']['pre_line'] = 1 - elif ttype == 'receipt' and len(default['value']['line_dr_ids']) > 0: + elif len(default['value']['line_dr_ids']) > 0: default['value']['pre_line'] = 1 default['value']['writeoff_amount'] = self._compute_writeoff_amount(cr, uid, default['value']['line_dr_ids'], default['value']['line_cr_ids'], price, ttype) return default @@ -1662,7 +1666,7 @@ class account_bank_statement_line(osv.osv): def _check_amount(self, cr, uid, ids, context=None): for obj in self.browse(cr, uid, ids, context=context): if obj.voucher_id: - diff = abs(obj.amount) - obj.voucher_id.amount + diff = abs(obj.amount) - abs(obj.voucher_id.amount) if not self.pool.get('res.currency').is_zero(cr, uid, obj.statement_id.currency, diff): return False return True diff --git a/addons/account_voucher/account_voucher_view.xml b/addons/account_voucher/account_voucher_view.xml index 288f8ce9332..3e4f1635914 100644 --- a/addons/account_voucher/account_voucher_view.xml +++ b/addons/account_voucher/account_voucher_view.xml @@ -213,10 +213,10 @@ - + - + onchange_amount(amount) @@ -230,7 +230,7 @@ - + @@ -241,7 +241,7 @@ - + diff --git a/addons/analytic/analytic.py b/addons/analytic/analytic.py index 894a2a2d6c5..c1ea1f655d2 100644 --- a/addons/analytic/analytic.py +++ b/addons/analytic/analytic.py @@ -203,7 +203,7 @@ class account_analytic_account(osv.osv): }, string='Currency', type='many2one', relation='res.currency'), } - def on_change_template(self, cr, uid, ids, template_id, context=None): + def on_change_template(self, cr, uid, ids, template_id, date_start=False, context=None): if not template_id: return {} res = {'value':{}} @@ -213,7 +213,8 @@ class account_analytic_account(osv.osv): to_dt = datetime.strptime(template.date, tools.DEFAULT_SERVER_DATE_FORMAT) timedelta = to_dt - from_dt res['value']['date'] = datetime.strftime(datetime.now() + timedelta, tools.DEFAULT_SERVER_DATE_FORMAT) - res['value']['date_start'] = fields.date.today() + if not date_start: + res['value']['date_start'] = fields.date.today() res['value']['quantity_max'] = template.quantity_max res['value']['parent_id'] = template.parent_id and template.parent_id.id or False res['value']['description'] = template.description diff --git a/addons/analytic/analytic_view.xml b/addons/analytic/analytic_view.xml index 9a99552be13..5e65874a1d9 100644 --- a/addons/analytic/analytic_view.xml +++ b/addons/analytic/analytic_view.xml @@ -27,7 +27,7 @@ - + diff --git a/addons/analytic_contract_hr_expense/analytic_contract_hr_expense.py b/addons/analytic_contract_hr_expense/analytic_contract_hr_expense.py index a1bf43714ce..3682755b9c4 100644 --- a/addons/analytic_contract_hr_expense/analytic_contract_hr_expense.py +++ b/addons/analytic_contract_hr_expense/analytic_contract_hr_expense.py @@ -115,8 +115,8 @@ class account_analytic_account(osv.osv): digits_compute=dp.get_precision('Account')), } - def on_change_template(self, cr, uid, id, template_id, context=None): - res = super(account_analytic_account, self).on_change_template(cr, uid, id, template_id, context=context) + def on_change_template(self, cr, uid, id, template_id, date_start=False, context=None): + res = super(account_analytic_account, self).on_change_template(cr, uid, id, template_id, date_start=date_start, context=context) if template_id and 'value' in res: template = self.browse(cr, uid, template_id, context=context) res['value']['charge_expenses'] = template.charge_expenses diff --git a/addons/analytic_contract_hr_expense/i18n/sv.po b/addons/analytic_contract_hr_expense/i18n/sv.po new file mode 100644 index 00000000000..acad6977b6a --- /dev/null +++ b/addons/analytic_contract_hr_expense/i18n/sv.po @@ -0,0 +1,72 @@ +# Swedish translation for openobject-addons +# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014 +# This file is distributed under the same license as the openobject-addons package. +# FIRST AUTHOR , 2014. +# +msgid "" +msgstr "" +"Project-Id-Version: openobject-addons\n" +"Report-Msgid-Bugs-To: FULL NAME \n" +"POT-Creation-Date: 2012-12-21 17:05+0000\n" +"PO-Revision-Date: 2014-03-31 21:25+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Swedish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2014-04-01 05:39+0000\n" +"X-Generator: Launchpad (build 16967)\n" + +#. module: analytic_contract_hr_expense +#: view:account.analytic.account:0 +msgid "or view" +msgstr "eller visa" + +#. module: analytic_contract_hr_expense +#: view:account.analytic.account:0 +msgid "Nothing to invoice, create" +msgstr "Inget att fakturera, skapa" + +#. module: analytic_contract_hr_expense +#: view:account.analytic.account:0 +msgid "expenses" +msgstr "utlägg" + +#. module: analytic_contract_hr_expense +#: model:ir.model,name:analytic_contract_hr_expense.model_account_analytic_account +msgid "Analytic Account" +msgstr "Objektkonto" + +#. module: analytic_contract_hr_expense +#: code:addons/analytic_contract_hr_expense/analytic_contract_hr_expense.py:144 +#, python-format +msgid "Expenses to Invoice of %s" +msgstr "Utlägg att fakturera av %s" + +#. module: analytic_contract_hr_expense +#: code:addons/analytic_contract_hr_expense/analytic_contract_hr_expense.py:136 +#, python-format +msgid "Expenses of %s" +msgstr "Utlägg av %s" + +#. module: analytic_contract_hr_expense +#: field:account.analytic.account,expense_invoiced:0 +#: field:account.analytic.account,expense_to_invoice:0 +#: field:account.analytic.account,remaining_expense:0 +msgid "unknown" +msgstr "okänd" + +#. module: analytic_contract_hr_expense +#: field:account.analytic.account,est_expenses:0 +msgid "Estimation of Expenses to Invoice" +msgstr "Uppskattning av utlägg att fakturera" + +#. module: analytic_contract_hr_expense +#: field:account.analytic.account,charge_expenses:0 +msgid "Charge Expenses" +msgstr "Debitera utläggen" + +#. module: analytic_contract_hr_expense +#: view:account.analytic.account:0 +msgid "⇒ Invoice" +msgstr "⇒ Faktura" diff --git a/addons/auth_signup/i18n/pl.po b/addons/auth_signup/i18n/pl.po index ebbff79b333..a95f5b3738f 100644 --- a/addons/auth_signup/i18n/pl.po +++ b/addons/auth_signup/i18n/pl.po @@ -8,14 +8,14 @@ msgstr "" "Project-Id-Version: openobject-addons\n" "Report-Msgid-Bugs-To: FULL NAME \n" "POT-Creation-Date: 2012-12-21 17:05+0000\n" -"PO-Revision-Date: 2012-12-12 18:01+0000\n" -"Last-Translator: Grzegorz Grzelak (OpenGLOBE.pl) \n" +"PO-Revision-Date: 2014-04-04 19:12+0000\n" +"Last-Translator: Dariusz Żbikowski \n" "Language-Team: Polish \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Launchpad-Export-Date: 2014-03-27 07:32+0000\n" -"X-Generator: Launchpad (build 16967)\n" +"X-Launchpad-Export-Date: 2014-04-05 05:30+0000\n" +"X-Generator: Launchpad (build 16976)\n" #. module: auth_signup #: field:res.partner,signup_type:0 @@ -80,7 +80,7 @@ msgstr "Wprowadź hasło o potwierdź je" #. module: auth_signup #: view:res.users:0 msgid "Send an email to the user to (re)set their password." -msgstr "" +msgstr "Wyślij email do użytkownika w celu zresetowania hasła" #. module: auth_signup #. openerp-web @@ -99,7 +99,7 @@ msgstr "Nowy" #: code:addons/auth_signup/res_users.py:258 #, python-format msgid "Mail sent to:" -msgstr "" +msgstr "Mail wysłano do:" #. module: auth_signup #: field:res.users,state:0 @@ -191,7 +191,7 @@ msgstr "Proszę wprowadź nazwę użytkownika lub adres email." #. module: auth_signup #: selection:res.users,state:0 msgid "Resetting Password" -msgstr "" +msgstr "Resetowane hasło" #. module: auth_signup #. openerp-web diff --git a/addons/auth_signup/i18n/sv.po b/addons/auth_signup/i18n/sv.po new file mode 100644 index 00000000000..9acedf81abc --- /dev/null +++ b/addons/auth_signup/i18n/sv.po @@ -0,0 +1,279 @@ +# Swedish translation for openobject-addons +# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014 +# This file is distributed under the same license as the openobject-addons package. +# FIRST AUTHOR , 2014. +# +msgid "" +msgstr "" +"Project-Id-Version: openobject-addons\n" +"Report-Msgid-Bugs-To: FULL NAME \n" +"POT-Creation-Date: 2012-12-21 17:05+0000\n" +"PO-Revision-Date: 2014-03-27 12:30+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Swedish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2014-03-28 05:42+0000\n" +"X-Generator: Launchpad (build 16967)\n" + +#. module: auth_signup +#: field:res.partner,signup_type:0 +msgid "Signup Token Type" +msgstr "" + +#. module: auth_signup +#: field:base.config.settings,auth_signup_uninvited:0 +msgid "Allow external users to sign up" +msgstr "" + +#. module: auth_signup +#. openerp-web +#: code:addons/auth_signup/static/src/xml/auth_signup.xml:19 +#, python-format +msgid "Confirm Password" +msgstr "Bekräfta lösenord" + +#. module: auth_signup +#: help:base.config.settings,auth_signup_uninvited:0 +msgid "If unchecked, only invited users may sign up." +msgstr "" + +#. module: auth_signup +#: model:ir.model,name:auth_signup.model_base_config_settings +msgid "base.config.settings" +msgstr "base.config.settings" + +#. module: auth_signup +#: code:addons/auth_signup/res_users.py:266 +#, python-format +msgid "Cannot send email: user has no email address." +msgstr "" + +#. module: auth_signup +#. openerp-web +#: code:addons/auth_signup/static/src/xml/auth_signup.xml:27 +#: code:addons/auth_signup/static/src/xml/auth_signup.xml:31 +#, python-format +msgid "Reset password" +msgstr "Återställ lösenord" + +#. module: auth_signup +#: field:base.config.settings,auth_signup_template_user_id:0 +msgid "Template user for new users created through signup" +msgstr "" + +#. module: auth_signup +#: model:email.template,subject:auth_signup.reset_password_email +msgid "Password reset" +msgstr "" + +#. module: auth_signup +#. openerp-web +#: code:addons/auth_signup/static/src/js/auth_signup.js:120 +#, python-format +msgid "Please enter a password and confirm it." +msgstr "" + +#. module: auth_signup +#: view:res.users:0 +msgid "Send an email to the user to (re)set their password." +msgstr "" + +#. module: auth_signup +#. openerp-web +#: code:addons/auth_signup/static/src/xml/auth_signup.xml:26 +#: code:addons/auth_signup/static/src/xml/auth_signup.xml:29 +#, python-format +msgid "Sign Up" +msgstr "" + +#. module: auth_signup +#: selection:res.users,state:0 +msgid "New" +msgstr "" + +#. module: auth_signup +#: code:addons/auth_signup/res_users.py:258 +#, python-format +msgid "Mail sent to:" +msgstr "" + +#. module: auth_signup +#: field:res.users,state:0 +msgid "Status" +msgstr "" + +#. module: auth_signup +#: model:email.template,body_html:auth_signup.reset_password_email +msgid "" +"\n" +"

A password reset was requested for the OpenERP account linked to this " +"email.

\n" +"\n" +"

You may change your password by following this link.

\n" +"\n" +"

Note: If you do not expect this, you can safely ignore this email.

" +msgstr "" + +#. module: auth_signup +#. openerp-web +#: code:addons/auth_signup/static/src/js/auth_signup.js:114 +#, python-format +msgid "Please enter a name." +msgstr "" + +#. module: auth_signup +#: model:ir.model,name:auth_signup.model_res_users +msgid "Users" +msgstr "" + +#. module: auth_signup +#: field:res.partner,signup_url:0 +msgid "Signup URL" +msgstr "" + +#. module: auth_signup +#. openerp-web +#: code:addons/auth_signup/static/src/js/auth_signup.js:117 +#, python-format +msgid "Please enter a username." +msgstr "" + +#. module: auth_signup +#: selection:res.users,state:0 +msgid "Active" +msgstr "" + +#. module: auth_signup +#: code:addons/auth_signup/res_users.py:270 +#, python-format +msgid "" +"Cannot send email: no outgoing email server configured.\n" +"You can configure it under Settings/General Settings." +msgstr "" + +#. module: auth_signup +#. openerp-web +#: code:addons/auth_signup/static/src/xml/auth_signup.xml:12 +#, python-format +msgid "Username" +msgstr "" + +#. module: auth_signup +#. openerp-web +#: code:addons/auth_signup/static/src/xml/auth_signup.xml:8 +#, python-format +msgid "Name" +msgstr "" + +#. module: auth_signup +#. openerp-web +#: code:addons/auth_signup/static/src/js/auth_signup.js:173 +#, python-format +msgid "Please enter a username or email address." +msgstr "" + +#. module: auth_signup +#: selection:res.users,state:0 +msgid "Resetting Password" +msgstr "" + +#. module: auth_signup +#. openerp-web +#: code:addons/auth_signup/static/src/xml/auth_signup.xml:13 +#, python-format +msgid "Username (Email)" +msgstr "" + +#. module: auth_signup +#: field:res.partner,signup_expiration:0 +msgid "Signup Expiration" +msgstr "" + +#. module: auth_signup +#: help:base.config.settings,auth_signup_reset_password:0 +msgid "This allows users to trigger a password reset from the Login page." +msgstr "" + +#. module: auth_signup +#. openerp-web +#: code:addons/auth_signup/static/src/xml/auth_signup.xml:25 +#, python-format +msgid "Log in" +msgstr "" + +#. module: auth_signup +#: field:res.partner,signup_valid:0 +msgid "Signup Token is Valid" +msgstr "" + +#. module: auth_signup +#. openerp-web +#: code:addons/auth_signup/static/src/js/auth_signup.js:111 +#: code:addons/auth_signup/static/src/js/auth_signup.js:114 +#: code:addons/auth_signup/static/src/js/auth_signup.js:117 +#: code:addons/auth_signup/static/src/js/auth_signup.js:120 +#: code:addons/auth_signup/static/src/js/auth_signup.js:123 +#: code:addons/auth_signup/static/src/js/auth_signup.js:170 +#: code:addons/auth_signup/static/src/js/auth_signup.js:173 +#, python-format +msgid "Login" +msgstr "" + +#. module: auth_signup +#. openerp-web +#: code:addons/auth_signup/static/src/js/auth_signup.js:97 +#, python-format +msgid "Invalid signup token" +msgstr "" + +#. module: auth_signup +#. openerp-web +#: code:addons/auth_signup/static/src/js/auth_signup.js:123 +#, python-format +msgid "Passwords do not match; please retype them." +msgstr "" + +#. module: auth_signup +#. openerp-web +#: code:addons/auth_signup/static/src/js/auth_signup.js:111 +#: code:addons/auth_signup/static/src/js/auth_signup.js:170 +#, python-format +msgid "No database selected !" +msgstr "" + +#. module: auth_signup +#: view:res.users:0 +msgid "Reset Password" +msgstr "" + +#. module: auth_signup +#: field:base.config.settings,auth_signup_reset_password:0 +msgid "Enable password reset from Login page" +msgstr "" + +#. module: auth_signup +#. openerp-web +#: code:addons/auth_signup/static/src/xml/auth_signup.xml:30 +#, python-format +msgid "Back to Login" +msgstr "" + +#. module: auth_signup +#. openerp-web +#: code:addons/auth_signup/static/src/xml/auth_signup.xml:22 +#, python-format +msgid "Sign up" +msgstr "" + +#. module: auth_signup +#: model:ir.model,name:auth_signup.model_res_partner +msgid "Partner" +msgstr "" + +#. module: auth_signup +#: field:res.partner,signup_token:0 +msgid "Signup Token" +msgstr "" diff --git a/addons/base_gengo/gengo_sync_schedular_data.xml b/addons/base_gengo/gengo_sync_schedular_data.xml index baf2a639cff..e55066e0e74 100644 --- a/addons/base_gengo/gengo_sync_schedular_data.xml +++ b/addons/base_gengo/gengo_sync_schedular_data.xml @@ -4,7 +4,7 @@ Gengo Sync Translation (Response) - + 20 minutes -1 @@ -16,7 +16,7 @@ Gengo Sync Translation (Request) - + 20 minutes -1 diff --git a/addons/base_gengo/i18n/sv.po b/addons/base_gengo/i18n/sv.po new file mode 100644 index 00000000000..79d7d7dd96c --- /dev/null +++ b/addons/base_gengo/i18n/sv.po @@ -0,0 +1,249 @@ +# Swedish translation for openobject-addons +# Copyright (c) 2014 Rosetta Contributors and Canonical Ltd 2014 +# This file is distributed under the same license as the openobject-addons package. +# FIRST AUTHOR , 2014. +# +msgid "" +msgstr "" +"Project-Id-Version: openobject-addons\n" +"Report-Msgid-Bugs-To: FULL NAME \n" +"POT-Creation-Date: 2012-12-21 17:05+0000\n" +"PO-Revision-Date: 2014-03-31 16:36+0000\n" +"Last-Translator: FULL NAME \n" +"Language-Team: Swedish \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"X-Launchpad-Export-Date: 2014-04-01 05:39+0000\n" +"X-Generator: Launchpad (build 16967)\n" + +#. module: base_gengo +#: view:res.company:0 +msgid "Comments for Translator" +msgstr "" + +#. module: base_gengo +#: field:ir.translation,job_id:0 +msgid "Gengo Job ID" +msgstr "" + +#. module: base_gengo +#: code:addons/base_gengo/wizard/base_gengo_translations.py:114 +#, python-format +msgid "This language is not supported by the Gengo translation services." +msgstr "" + +#. module: base_gengo +#: field:res.company,gengo_comment:0 +msgid "Comments" +msgstr "Kommentarer" + +#. module: base_gengo +#: field:res.company,gengo_private_key:0 +msgid "Gengo Private Key" +msgstr "" + +#. module: base_gengo +#: model:ir.model,name:base_gengo.model_base_gengo_translations +msgid "base.gengo.translations" +msgstr "base.gengo.translations" + +#. module: base_gengo +#: help:res.company,gengo_auto_approve:0 +msgid "Jobs are Automatically Approved by Gengo." +msgstr "" + +#. module: base_gengo +#: field:base.gengo.translations,lang_id:0 +msgid "Language" +msgstr "" + +#. module: base_gengo +#: field:ir.translation,gengo_comment:0 +msgid "Comments & Activity Linked to Gengo" +msgstr "" + +#. module: base_gengo +#: code:addons/base_gengo/wizard/base_gengo_translations.py:124 +#, python-format +msgid "Gengo Sync Translation (Response)" +msgstr "" + +#. module: base_gengo +#: code:addons/base_gengo/wizard/base_gengo_translations.py:72 +#, python-format +msgid "" +"Gengo `Public Key` or `Private Key` are missing. Enter your Gengo " +"authentication parameters under `Settings > Companies > Gengo Parameters`." +msgstr "" + +#. module: base_gengo +#: selection:ir.translation,gengo_translation:0 +msgid "Translation By Machine" +msgstr "" + +#. module: base_gengo +#: code:addons/base_gengo/wizard/base_gengo_translations.py:155 +#, python-format +msgid "" +"%s\n" +"\n" +"--\n" +" Commented on %s by %s." +msgstr "" + +#. module: base_gengo +#: field:ir.translation,gengo_translation:0 +msgid "Gengo Translation Service Level" +msgstr "" + +#. module: base_gengo +#: constraint:ir.translation:0 +msgid "" +"The Gengo translation service selected is not supported for this language." +msgstr "" + +#. module: base_gengo +#: selection:ir.translation,gengo_translation:0 +msgid "Standard" +msgstr "" + +#. module: base_gengo +#: help:ir.translation,gengo_translation:0 +msgid "" +"You can select here the service level you want for an automatic translation " +"using Gengo." +msgstr "" + +#. module: base_gengo +#: field:base.gengo.translations,restart_send_job:0 +msgid "Restart Sending Job" +msgstr "" + +#. module: base_gengo +#: view:ir.translation:0 +msgid "To Approve In Gengo" +msgstr "" + +#. module: base_gengo +#: view:res.company:0 +msgid "Private Key" +msgstr "" + +#. module: base_gengo +#: view:res.company:0 +msgid "Public Key" +msgstr "" + +#. module: base_gengo +#: field:res.company,gengo_public_key:0 +msgid "Gengo Public Key" +msgstr "" + +#. module: base_gengo +#: code:addons/base_gengo/wizard/base_gengo_translations.py:123 +#, python-format +msgid "Gengo Sync Translation (Request)" +msgstr "" + +#. module: base_gengo +#: view:ir.translation:0 +msgid "Translations" +msgstr "" + +#. module: base_gengo +#: field:res.company,gengo_auto_approve:0 +msgid "Auto Approve Translation ?" +msgstr "" + +#. module: base_gengo +#: model:ir.actions.act_window,name:base_gengo.action_wizard_base_gengo_translations +#: model:ir.ui.menu,name:base_gengo.menu_action_wizard_base_gengo_translations +msgid "Gengo: Manual Request of Translation" +msgstr "" + +#. module: base_gengo +#: code:addons/base_gengo/ir_translation.py:62 +#: code:addons/base_gengo/wizard/base_gengo_translations.py:109 +#, python-format +msgid "Gengo Authentication Error" +msgstr "" + +#. module: base_gengo +#: model:ir.model,name:base_gengo.model_res_company +msgid "Companies" +msgstr "" + +#. module: base_gengo +#: view:ir.translation:0 +msgid "" +"Note: If the translation state is 'In Progress', it means that the " +"translation has to be approved to be uploaded in this system. You are " +"supposed to do that directly by using your Gengo Account" +msgstr "" + +#. module: base_gengo +#: code:addons/base_gengo/wizard/base_gengo_translations.py:82 +#, python-format +msgid "" +"Gengo connection failed with this message:\n" +"``%s``" +msgstr "" + +#. module: base_gengo +#: view:res.company:0 +msgid "Gengo Parameters" +msgstr "" + +#. module: base_gengo +#: view:base.gengo.translations:0 +msgid "Send" +msgstr "" + +#. module: base_gengo +#: selection:ir.translation,gengo_translation:0 +msgid "Ultra" +msgstr "" + +#. module: base_gengo +#: model:ir.model,name:base_gengo.model_ir_translation +msgid "ir.translation" +msgstr "" + +#. module: base_gengo +#: view:ir.translation:0 +msgid "Gengo Translation Service" +msgstr "" + +#. module: base_gengo +#: selection:ir.translation,gengo_translation:0 +msgid "Pro" +msgstr "" + +#. module: base_gengo +#: view:base.gengo.translations:0 +msgid "Gengo Request Form" +msgstr "" + +#. module: base_gengo +#: code:addons/base_gengo/wizard/base_gengo_translations.py:114 +#, python-format +msgid "Warning" +msgstr "" + +#. module: base_gengo +#: help:res.company,gengo_comment:0 +msgid "" +"This comment will be automatically be enclosed in each an every request sent " +"to Gengo" +msgstr "" + +#. module: base_gengo +#: view:base.gengo.translations:0 +msgid "Cancel" +msgstr "" + +#. module: base_gengo +#: view:base.gengo.translations:0 +msgid "or" +msgstr "" diff --git a/addons/base_gengo/ir_translation.py b/addons/base_gengo/ir_translation.py index 0ade9c54625..306516878cc 100644 --- a/addons/base_gengo/ir_translation.py +++ b/addons/base_gengo/ir_translation.py @@ -23,7 +23,7 @@ from openerp.osv import fields, osv from openerp.tools.translate import _ LANG_CODE_MAPPING = { - 'ar_SA': ('ar', 'Arabic'), + 'ar_SY': ('ar', 'Arabic'), 'id_ID': ('id', 'Indonesian'), 'nl_NL': ('nl', 'Dutch'), 'fr_CA': ('fr-ca', 'French (Canada)'), @@ -41,7 +41,19 @@ LANG_CODE_MAPPING = { 'fr_BE': ('fr', 'French'), 'ru_RU': ('ru', 'Russian'), 'it_IT': ('it', 'Italian'), - 'pt_BR': ('pt-br', 'Portuguese (Brazil)') + 'pt_BR': ('pt-br', 'Portuguese (Brazil)'), + 'th_TH': ('th', 'Thai'), + 'nb_NO': ('no', 'Norwegian'), + 'ro_RO': ('ro', 'Romanian'), + 'tr_TR': ('tr', 'Turkish'), + 'bg_BG': ('bg', 'Bulgarian'), + 'da_DK': ('da', 'Danish'), + 'en_GB': ('en-gb', 'English (British)'), + 'el_GR': ('el', 'Greek'), + 'vi_VN': ('vi', 'Vietnamese'), + 'he_IL': ('he', 'Hebrew'), + 'hu_HU': ('hu', 'Hungarian'), + 'fi_FI': ('fi', 'Finnish') } class ir_translation(osv.Model): @@ -71,18 +83,3 @@ class ir_translation(osv.Model): def _get_gengo_corresponding_language(cr, lang): return lang in LANG_CODE_MAPPING and LANG_CODE_MAPPING[lang][0] or lang - - def _check_lang_support(self, cr, uid, ids, context=None): - for term in self.browse(cr, uid, ids, context=context): - if term.gengo_translation: - supported_langs = self._get_all_supported_languages(cr, uid, context=context) - if supported_langs: - tier = "nonprofit" if term.gengo_translation == 'machine' else term.gengo_translation - language = self._get_gengo_corresponding_language(term.lang) - if tier not in supported_langs.get(language,[]): - return False - return True - - _constraints = [ - (_check_lang_support, 'The Gengo translation service selected is not supported for this language.', ['gengo_translation']) - ] diff --git a/addons/base_gengo/res_company.py b/addons/base_gengo/res_company.py index 3d038ac0813..1b083ecf5a2 100644 --- a/addons/base_gengo/res_company.py +++ b/addons/base_gengo/res_company.py @@ -30,6 +30,7 @@ class res_company(osv.Model): "gengo_public_key": fields.text("Gengo Public Key"), "gengo_comment": fields.text("Comments", help="This comment will be automatically be enclosed in each an every request sent to Gengo"), "gengo_auto_approve": fields.boolean("Auto Approve Translation ?", help="Jobs are Automatically Approved by Gengo."), + "gengo_sandbox": fields.boolean("Sandbox Mode", help="Check this box if you're using the sandbox mode of Gengo, mainly used for testing purpose."), } _defaults = { diff --git a/addons/base_gengo/res_company_view.xml b/addons/base_gengo/res_company_view.xml index 0f99efc8ad0..d08d809eb9c 100644 --- a/addons/base_gengo/res_company_view.xml +++ b/addons/base_gengo/res_company_view.xml @@ -17,8 +17,13 @@
- - + + + + + + + diff --git a/addons/base_gengo/wizard/base_gengo_translations.py b/addons/base_gengo/wizard/base_gengo_translations.py index bfd51480141..8cc7206e63e 100644 --- a/addons/base_gengo/wizard/base_gengo_translations.py +++ b/addons/base_gengo/wizard/base_gengo_translations.py @@ -40,22 +40,19 @@ except ImportError: GENGO_DEFAULT_LIMIT = 20 -DEFAULT_CRON_VALS = { - 'active': True, - 'interval_number': 20, - 'interval_type': 'minutes', - 'model': "'base.gengo.translations'", - 'args': "'(%s,)'" % (str(GENGO_DEFAULT_LIMIT)), -} - class base_gengo_translations(osv.osv_memory): _name = 'base.gengo.translations' _columns = { - 'restart_send_job': fields.boolean("Restart Sending Job"), + 'sync_type': fields.selection([('send', 'Send New Terms'), + ('receive', 'Receive Translation'), + ('both', 'Both')], "Sync Type"), 'lang_id': fields.many2one('res.lang', 'Language', required=True), + 'sync_limit': fields.integer("No. of terms to sync"), } - + _defaults = {'sync_type' : 'both', + 'sync_limit' : 20 + } def gengo_authentication(self, cr, uid, context=None): ''' This method tries to open a connection with Gengo. For that, it uses the Public and Private @@ -74,6 +71,7 @@ class base_gengo_translations(osv.osv_memory): gengo = MyGengo( public_key=user.company_id.gengo_public_key.encode('ascii'), private_key=user.company_id.gengo_private_key.encode('ascii'), + sandbox=user.company_id.gengo_sandbox, ) gengo.getAccountStats() return (True, gengo) @@ -81,27 +79,11 @@ class base_gengo_translations(osv.osv_memory): _logger.exception('Gengo connection failed') return (False, _("Gengo connection failed with this message:\n``%s``") % e) - def do_check_schedular(self, cr, uid, xml_id, name, fn, context=None): - """ - This function is used to reset a cron to its default values, or to recreate it if it was deleted. - """ - cron_pool = self.pool.get('ir.cron') - cron_vals = DEFAULT_CRON_VALS.copy() - cron_vals.update({'name': name, "function": fn}) - try: - res = [] - _, res = self.pool.get('ir.model.data').get_object_reference(cr, uid, 'base_gengo', xml_id) - cron_pool.write(cr, uid, [res], cron_vals, context=context) - except: - #the cron job was not found, probably deleted previously, so we create it again using default values - cron_vals.update({'numbercall': -1}) - return cron_pool.create(cr, uid, cron_vals, context=context) - def act_update(self, cr, uid, ids, context=None): ''' Function called by the wizard. ''' - if context == None: + if context is None: context = {} flag, gengo = self.gengo_authentication(cr, uid, context=context) @@ -113,21 +95,20 @@ class base_gengo_translations(osv.osv_memory): if language not in supported_langs: raise osv.except_osv(_("Warning"), _('This language is not supported by the Gengo translation services.')) - #send immediately a new request for the selected language (if any) ctx = context.copy() ctx['gengo_language'] = wizard.lang_id.id - self._sync_request(cr, uid, limit=GENGO_DEFAULT_LIMIT, context=ctx) - self._sync_response( cr, uid, limit=GENGO_DEFAULT_LIMIT, context=ctx) - #check the cron jobs and eventually restart/recreate them - if wizard.restart_send_job: - self.do_check_schedular(cr, uid, 'gengo_sync_send_request_scheduler', _('Gengo Sync Translation (Request)'), '_sync_request', context=context) - self.do_check_schedular(cr, uid, 'gengo_sync_receive_request_scheduler', _('Gengo Sync Translation (Response)'), '_sync_response', context=context) + if wizard.sync_limit > 200 or wizard.sync_limit < 1: + raise osv.except_osv(_("Warning"), _('Sync limit should between 1 to 200 for Gengo translation services.')) + if wizard.sync_type in ['send', 'both']: + self._sync_request(cr, uid, wizard.sync_limit, context=ctx) + if wizard.sync_type in ['receive', 'both']: + self._sync_response(cr, uid, wizard.sync_limit, context=ctx) return {'type': 'ir.actions.act_window_close'} def _sync_response(self, cr, uid, limit=GENGO_DEFAULT_LIMIT, context=None): """ This method will be called by cron services to get translations from - Gengo. It will read translated terms and comments from Gengo and will + Gengo. It will read translated terms and comments from Gengo and will update respective ir.translation in openerp. """ translation_pool = self.pool.get('ir.translation') @@ -135,31 +116,38 @@ class base_gengo_translations(osv.osv_memory): if not flag: _logger.warning("%s", gengo) else: - translation_id = translation_pool.search(cr, uid, [('state', '=', 'inprogress'), ('gengo_translation', 'in', ('machine','standard','pro','ultra'))], limit=limit, context=context) - for term in translation_pool.browse(cr, uid, translation_id, context=context): - up_term = up_comment = 0 - if term.job_id: - vals={} - job_response = gengo.getTranslationJob(id=term.job_id) - if job_response['opstat'] != 'ok': - _logger.warning("Invalid Response! Skipping translation Terms with `id` %s." % (term.job_id)) - continue - if job_response['response']['job']['status'] == 'approved': - vals.update({'state': 'translated', - 'value': job_response['response']['job']['body_tgt']}) - up_term += 1 - job_comment = gengo.getTranslationJobComments(id=term.job_id) - if job_comment['opstat']=='ok': - gengo_comments="" - for comment in job_comment['response']['thread']: - gengo_comments += _('%s\n\n--\n Commented on %s by %s.') % (comment['body'], time.ctime(comment['ctime']), comment['author']) - vals.update({'gengo_comment': gengo_comments}) - up_comment += 1 - if vals: - translation_pool.write(cr, uid, term.id, vals) - _logger.info("Successfully Updated `%d` terms and %d Comments." % (up_term, up_comment )) - else: - _logger.warning("%s", 'Cannot retrieve the Gengo job ID for translation %s: %s' % (term.id, term.src)) + offset = 0 + all_translation_ids = translation_pool.search(cr, uid, [('state', '=', 'inprogress'), ('gengo_translation', 'in', ('machine', 'standard', 'pro', 'ultra')), ('job_id', "!=", False)], context=context) + while True: + translation_ids = all_translation_ids[offset:offset + limit] + if translation_ids: + offset += limit + translation_terms = translation_pool.browse(cr, uid, translation_ids, context=context) + gengo_job_id = [term.job_id for term in translation_terms] + if gengo_job_id: + gengo_ids = ','.join(gengo_job_id) + job_response = gengo.getTranslationJobBatch(id=gengo_ids) + if job_response['opstat'] == 'ok': + job_response_dict = dict([(job['job_id'], job) for job in job_response['response']['jobs']]) + for term in translation_terms: + up_term = up_comment = 0 + vals = {} + if job_response_dict[term.job_id]['status'] == 'approved': + vals.update({'state': 'translated', + 'value': job_response_dict[term.job_id]['body_tgt']}) + up_term += 1 + job_comment = gengo.getTranslationJobComments(id=term.job_id) + if job_comment['opstat'] == 'ok': + gengo_comments = "" + for comment in job_comment['response']['thread']: + gengo_comments += _('%s\n-- Commented on %s by %s.\n\n') % (comment['body'], time.ctime(comment['ctime']), comment['author']) + vals.update({'gengo_comment': gengo_comments}) + up_comment += 1 + if vals: + translation_pool.write(cr, uid, term.id, vals) + _logger.info("Successfully Updated `%d` terms and %d Comments." % (up_term, up_comment)) + if not len(translation_ids) == limit: + break return True def _update_terms(self, cr, uid, response, context=None): @@ -200,12 +188,13 @@ class base_gengo_translations(osv.osv_memory): 'lc_src': 'en', 'lc_tgt': translation_pool._get_gengo_corresponding_language(term.lang), 'auto_approve': auto_approve, - 'comment': user.company_id.gengo_comment, + 'comment': user.company_id.gengo_comment and "%s %s"%(user.company_id.gengo_comment,term.gengo_comment) or term.gengo_comment, + 'callback_url': self.pool.get('ir.config_parameter').get_param(cr, uid,'web.base.url') + '/website/gengo_callback/' + str(term.id) } return {'jobs': jobs} - def _send_translation_terms(self, cr, uid, term_ids, context=None): + def _send_translation_terms(self, cr, uid, term_ids, context=None): """ Send a request to Gengo with all the term_ids in a different job, get the response and update the terms in database accordingly. @@ -241,13 +230,17 @@ class base_gengo_translations(osv.osv_memory): #but if this specific key is given, then we restrict the request on terms of this language only lang_ids = [context.get('gengo_language')] langs = [lang.code for lang in language_pool.browse(cr, uid, lang_ids, context=context)] - #search for the n first terms to translate - term_ids = translation_pool.search(cr, uid, [('state', '=', 'to_translate'), ('gengo_translation', 'in', ('machine','standard','pro','ultra')), ('lang', 'in', langs)], limit=limit, context=context) - if term_ids: - self._send_translation_terms(cr, uid, term_ids, context=context) - _logger.info("%s Translation terms have been posted to Gengo successfully", len(term_ids)) - else: - _logger.info('No Translation terms to process.') + offset = 0 + all_term_ids = translation_pool.search(cr, uid, [('state', '=', 'to_translate'), ('gengo_translation', 'in', ('machine', 'standard', 'pro', 'ultra')), ('lang', 'in', langs), ('job_id', "=", False)], context=context) + while True: + #search for the n first terms to translate + term_ids = all_term_ids[offset:offset + limit] + if term_ids: + offset += limit + self._send_translation_terms(cr, uid, term_ids, context=context) + _logger.info("%s Translation terms have been posted to Gengo successfully", len(term_ids)) + if not len(term_ids) == limit: + break except Exception, e: _logger.error("%s", e) diff --git a/addons/base_gengo/wizard/base_gengo_translations_view.xml b/addons/base_gengo/wizard/base_gengo_translations_view.xml index 7b6be31d042..f1d77730c47 100644 --- a/addons/base_gengo/wizard/base_gengo_translations_view.xml +++ b/addons/base_gengo/wizard/base_gengo_translations_view.xml @@ -8,7 +8,14 @@
- + + + + + + + +