diff --git a/addons/account/i18n/de.po b/addons/account/i18n/de.po index 749aa468bc0..451d39a8fd2 100644 --- a/addons/account/i18n/de.po +++ b/addons/account/i18n/de.po @@ -242,6 +242,50 @@ msgid "" "

\n" "" msgstr "" +"
\n" +"

Hallo ${object.partner_id.name}\n" +"% set access_action = object.with_context(force_website=True).get_access_action()\n" +"% set is_online = access_action and access_action['type'] == 'ir.actions.act_url'\n" +"% set access_url = object.get_mail_url()\n" +"\n" +"% if object.partner_id.parent_id:\n" +" (${object.partner_id.parent_id.name})\n" +"% endif\n" +",

\n" +"

hier im Anhang finden Sie Ihre\n" +"% if object.number:\n" +"Rechnung ${object.number}\n" +"% else:\n" +"Rechnung\n" +"% endif\n" +"% if object.origin:\n" +"(mit Referenz: ${object.origin})\n" +"% endif\n" +"mit einem Betrag von ${format_amount(object.amount_total, object.currency_id)}\n" +"from ${object.company_id.name}.\n" +"

\n" +"\n" +"% if is_online:\n" +"

\n" +"
\n" +" Rechnung anzeigen\n" +"
\n" +"% endif\n" +"

\n" +"\n" +"% if object.state=='paid':\n" +"

Diese Rechnung ist bereits bezahlt.

\n" +"% else:\n" +"

Bitte führen Sie die Zahlung so bald wie möglich durch.

\n" +"% endif\n" +"\n" +"

Danke,

\n" +"

\n" +"% if object.user_id and object.user_id.signature:\n" +" ${object.user_id.signature | safe}\n" +"% endif\n" +"

\n" +"
" #. module: account #: model:ir.ui.view,arch_db:account.portal_my_invoices diff --git a/addons/account/i18n/es.po b/addons/account/i18n/es.po index 27dea435cb4..5eabdf0a97c 100644 --- a/addons/account/i18n/es.po +++ b/addons/account/i18n/es.po @@ -77,6 +77,10 @@ msgid "" " * The 'Paid' status is set automatically when the invoice is paid. Its related journal entries may or may not be reconciled.\n" " * The 'Cancelled' status is used when user cancel invoice." msgstr "" +"* El estado de \"Borrador\" se usa cuando se codifica un factura nueva y no confirmada.\n" +"* El estado \"Abierto\" se usa cuando el usuario crea una factura, y se genera un número de factura. Este estado se mantiene hasta que el usuario paga la factura\n" +"* El Estado \"Pagado\" se establece automáticamente cuando la factura se paga. Sus entradas diarias relacionadas pueden estar o no conciliadas.\n" +"* El estado \"Cancelado\" se usa cuando el usuario cancela una factura" #. module: account #: model:ir.model.fields,field_description:account.field_account_chart_template__code_digits @@ -203,6 +207,16 @@ msgid "" "

\n" "" msgstr "" +"\n" +"Estimado ${object.partner_id.name},

\n" +"

Gracias por tu pago.
 Aquí está tu recibo de pago ${(object.name or '').replace('/','-')} por un monto de ${format_amount(object.amount, object.currency_id)} efectuado por ${object.company_id.name}.

\n" +"

Si tienes alguna pregunta, no dudes en contactarnos.

\n" +"

Cordiales saludos,\n" +"% if user and user.signature:\n" +"${user.signature | safe}\n" +"% endif\n" +"

\n" +"
" #. module: account #: model:mail.template,body_html:account.email_template_edi_invoice @@ -252,6 +266,50 @@ msgid "" "

\n" "" msgstr "" +"
\n" +"

Estimado ${object.partner_id.name}\n" +"% set access_action = object.with_context(force_website=True).get_access_action()\n" +"% set is_online = access_action and access_action['type'] == 'ir.actions.act_url'\n" +"% set access_url = object.get_mail_url()\n" +"\n" +"% if object.partner_id.parent_id:\n" +" (${object.partner_id.parent_id.name})\n" +"% endif\n" +",

\n" +"

Aquí está, en el archivo adjunto, tu \n" +"% if object.number:\n" +"factura ${object.number}\n" +"% else:\n" +"invoice\n" +"% endif\n" +"% if object.origin:\n" +"(with reference: ${object.origin})\n" +"% endif\n" +"por un monto de ${format_amount(object.amount_total, object.currency_id)}\n" +"efectuado por ${object.company_id.name}.\n" +"

\n" +"\n" +"% if is_online:\n" +"

\n" +"
\n" +" Ver factura\n" +"
\n" +"% endif\n" +"

\n" +"\n" +"% if object.state=='paid':\n" +"

Esta factura ya se encuentra pagada.

\n" +"% else:\n" +"

Por favor remita el pago a su más pronta conveniencia.

\n" +"% endif\n" +"\n" +"

Gracias,

\n" +"

\n" +"% if object.user_id and object.user_id.signature:\n" +" ${object.user_id.signature | safe}\n" +"% endif\n" +"

\n" +"
" #. module: account #: model:ir.ui.view,arch_db:account.portal_my_invoices @@ -9304,6 +9362,8 @@ msgstr "La referencia de asociado para esta factura." msgid "" "The partners of the journal's company and the related bank account mismatch." msgstr "" +"La empresa del diario de la compañía y el de la cuenta del banco " +"relacionada, no coinciden" #. module: account #: code:addons/account/models/account_payment.py:61 @@ -10607,6 +10667,7 @@ msgid "" "You cannot change the currency of the company since some journal items " "already exist" msgstr "" +"No puede cambiar la moneda de la compañía ya que contiene asientos contables" #. module: account #: code:addons/account/models/account.py:271 diff --git a/addons/account/i18n/fr.po b/addons/account/i18n/fr.po index 7e8c4811412..6103e3d269d 100644 --- a/addons/account/i18n/fr.po +++ b/addons/account/i18n/fr.po @@ -65,13 +65,14 @@ # Fabri Yohann , 2017 # Jérôme Tanché , 2017 # e2f , 2018 +# Schreiner Grégory , 2018 msgid "" msgstr "" "Project-Id-Version: Odoo Server saas~11.2\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2018-03-22 14:10+0000\n" "PO-Revision-Date: 2018-03-22 14:10+0000\n" -"Last-Translator: e2f , 2018\n" +"Last-Translator: Schreiner Grégory , 2018\n" "Language-Team: French (https://www.transifex.com/odoo/teams/41243/fr/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -87,6 +88,10 @@ msgid "" " * The 'Paid' status is set automatically when the invoice is paid. Its related journal entries may or may not be reconciled.\n" " * The 'Cancelled' status is used when user cancel invoice." msgstr "" +"* L'état \"Brouillon\" est utilisé lorsqu'un utilisateur est en train de saisir ou de modifier une nouvelle facture non confirmée.\n" +"* L'état 'Ouvert' est utilisé lorsque l'utilisateur crée une facture, celle-ci a alors un numéro de facture La facture reste dans ce statut \"Ouvert\" jusqu'à ce qu'elle soit payée.\n" +"* L'état 'Payé' est affecté automatiquement lorsque la facture est payée. Ses écritures dans les journaux connexes peuvent ou non être réconciliées.\n" +"* L'état \"Annulé\" est utilisé lorsque l'utilisateur annule la facture." #. module: account #: model:ir.model.fields,field_description:account.field_account_chart_template__code_digits @@ -213,6 +218,16 @@ msgid "" "

\n" "" msgstr "" +"\n" +"

Chèr(e) ${object.partner_id.name},

\n" +"

Merci pour votre règlement.
Voici le reçu de votre paiement ${(object.name or '').replace('/','-')} d'un montant de ${format_amount(object.amount, object.currency_id)} de ${object.company_id.name}.

\n" +"

Si vous avez des questions, pensez à nous contacter.

\n" +"

Sincères salutations,\n" +"% if user and user.signature:\n" +"${user.signature | safe}\n" +"% endif\n" +"

\n" +"
" #. module: account #: model:mail.template,body_html:account.email_template_edi_invoice @@ -262,6 +277,50 @@ msgid "" "

\n" "" msgstr "" +"
\n" +"

Cher ${object.partner_id.name}\n" +"% set access_action = object.with_context(force_website=True).get_access_action()\n" +"% set is_online = access_action and access_action['type'] == 'ir.actions.act_url'\n" +"% set access_url = object.get_mail_url()\n" +"\n" +"% if object.partner_id.parent_id:\n" +" (${object.partner_id.parent_id.name})\n" +"% endif\n" +",

\n" +"

Voici, en pièce jointe, votre \n" +"% if object.number:\n" +"facture ${object.number}\n" +"% else:\n" +"facture\n" +"% endif\n" +"% if object.origin:\n" +"(avec la référence ${object.origin})\n" +"% endif\n" +", son montant s'élève à ${format_amount(object.amount_total, object.currency_id)}\n" +"émis par ${object.company_id.name}.\n" +"

\n" +"\n" +"% if is_online:\n" +"

\n" +"
\n" +" Voir la facture\n" +"
\n" +"% endif\n" +"

\n" +"\n" +"% if object.state=='paid':\n" +"

Cette facture est déjà payée.

\n" +"% else:\n" +"

Merci de procéder au payement dès que possible.

\n" +"% endif\n" +"\n" +"

Merci,

\n" +"

\n" +"% if object.user_id and object.user_id.signature:\n" +" ${object.user_id.signature | safe}\n" +"% endif\n" +"

\n" +"
" #. module: account #: model:ir.ui.view,arch_db:account.portal_my_invoices @@ -9347,6 +9406,8 @@ msgstr "La référence donnée par le partenaire pour cette facture." msgid "" "The partners of the journal's company and the related bank account mismatch." msgstr "" +"Les partenaires du journal de la société et le compte bancaire lié ne " +"correspondent pas" #. module: account #: code:addons/account/models/account_payment.py:61 @@ -10649,6 +10710,8 @@ msgid "" "You cannot change the currency of the company since some journal items " "already exist" msgstr "" +"Vous ne pouvez pas modifier la devise de l'entreprise car certains articles " +"de journal existent déjà" #. module: account #: code:addons/account/models/account.py:271 diff --git a/addons/account/i18n/hu.po b/addons/account/i18n/hu.po index ce84d003539..93bec440716 100644 --- a/addons/account/i18n/hu.po +++ b/addons/account/i18n/hu.po @@ -9207,6 +9207,8 @@ msgid "" "There are still unposted entries in the period you want to lock. You should " "either post or delete them." msgstr "" +"Könyveletlen tételek vannak a zárolni tervezett periódusban. Kérjük " +"könyvelje vagy törölje ezen tételeket." #. module: account #: code:addons/account/models/account_bank_statement.py:179 @@ -10351,6 +10353,7 @@ msgstr "Nem törölhet olyan fizetést, amit már lekönyvelt" #, python-format msgid "You can only delete an invoice line if the invoice is in draft state." msgstr "" +"Számlatétel csak akkor törölhető, ha a számla piszkozat állapotban van." #. module: account #: code:addons/account/models/account_payment.py:142 @@ -10406,6 +10409,7 @@ msgid "" "You cannot change the currency of the company since some journal items " "already exist" msgstr "" +"A vállalat pénzneme nem változtatható, mivel már vannak könyvelési tételek." #. module: account #: code:addons/account/models/account.py:271 @@ -10591,7 +10595,7 @@ msgstr "Önnek van" #: code:addons/account/models/account_payment.py:500 #, python-format msgid "You have to define a sequence for %s in your company." -msgstr "" +msgstr "Meg kell adni egy szekvenciát %s számára a vállalatban." #. module: account #: code:addons/account/wizard/account_report_general_ledger.py:21 diff --git a/addons/account/i18n/ru.po b/addons/account/i18n/ru.po index 5909ba5757d..a3f724f574f 100644 --- a/addons/account/i18n/ru.po +++ b/addons/account/i18n/ru.po @@ -1361,7 +1361,7 @@ msgstr "Разрешить печать чеков и депозиты" #. module: account #: model:res.groups,name:account.group_cash_rounding msgid "Allow the cash rounding management" -msgstr "" +msgstr "Разрешает управление округлением наличности" #. module: account #: model:ir.ui.view,arch_db:account.res_config_settings_view_form @@ -2278,19 +2278,19 @@ msgstr "Кассы" #. module: account #: model:ir.model.fields,field_description:account.field_res_config_settings__group_cash_rounding msgid "Cash Rounding" -msgstr "" +msgstr "Округление наличных денег" #. module: account #: model:ir.model.fields,field_description:account.field_account_invoice__cash_rounding_id msgid "Cash Rounding Method" -msgstr "" +msgstr "Способ округления наличности" #. module: account #: model:ir.actions.act_window,name:account.rounding_list_action #: model:ir.ui.menu,name:account.menu_action_rounding_form_view #: model:ir.ui.view,arch_db:account.res_config_settings_view_form msgid "Cash Roundings" -msgstr "" +msgstr "Округления наличности" #. module: account #: model:ir.ui.view,arch_db:account.account_journal_dashboard_kanban_view @@ -2683,7 +2683,7 @@ msgstr "Написать письмо" #. module: account #: model:ir.ui.view,arch_db:account.res_config_settings_view_form msgid "Compute tax rates based on U.S. ZIP codes" -msgstr "" +msgstr "Рассчитывать налоги на основании почтовых кодов (только для США)" #. module: account #: model:ir.model.fields,help:account.field_account_move_line__counterpart @@ -2973,7 +2973,7 @@ msgstr "Создать модель" #. module: account #: model:ir.actions.act_window,help:account.rounding_list_action msgid "Create the first cash rounding" -msgstr "" +msgstr "Создайте первое округление наличности" #. module: account #: model:ir.model.fields,field_description:account.field_account_account__create_uid @@ -3535,7 +3535,7 @@ msgstr "Налоги по умолчанию" #. module: account #: model:ir.ui.view,arch_db:account.res_config_settings_view_form msgid "Default taxes applied to local transactions" -msgstr "" +msgstr "Налоги, применяемые по умолчанию к местным сделкам" #. module: account #: model:ir.ui.view,arch_db:account.res_config_settings_view_form @@ -3551,6 +3551,7 @@ msgstr "" #: model:ir.ui.view,arch_db:account.res_config_settings_view_form msgid "Define the smallest coinage of the currency used to pay by cash." msgstr "" +"Определите самую маленькую монетку(размерность) при расчетах наличными" #. module: account #: model:ir.model.fields,help:account.field_account_invoice__cash_rounding_id @@ -3558,6 +3559,7 @@ msgid "" "Defines the smallest coinage of the currency that can be used to pay by " "cash." msgstr "" +"Определяет самую маленькую монетку(размерность) при расчетах наличными" #. module: account #: model:ir.ui.view,arch_db:account.view_account_tax_template_form @@ -3903,7 +3905,7 @@ msgstr "" #. module: account #: model:ir.model.fields,field_description:account.field_res_config_settings__module_l10n_eu_service msgid "EU Digital Goods VAT" -msgstr "" +msgstr "НДС на цифровые товары по правилам ЕС" #. module: account #: code:addons/account/models/chart_template.py:171 @@ -4138,7 +4140,7 @@ msgstr "Налогово-бюджетная информация" #. module: account #: model:ir.ui.view,arch_db:account.res_config_settings_view_form msgid "Fiscal Localization" -msgstr "" +msgstr "Налоговая локализация" #. module: account #: model:ir.model.fields,field_description:account.field_account_fiscal_position_account_template__position_id @@ -4285,7 +4287,7 @@ msgstr "Все операции по этому счету принудител #: code:addons/account/report/account_tax.py:13 #, python-format msgid "Form content is missing, this report cannot be printed." -msgstr "" +msgstr "Не найдены данные в форме, отчет не сформирован" #. module: account #: code:addons/account/models/account_invoice.py:100 @@ -4380,6 +4382,7 @@ msgstr "" #: model:ir.ui.view,arch_db:account.res_config_settings_view_form msgid "Get warnings when invoicing specific customers" msgstr "" +"Получайте уведомления при фактурировании счетов по определенным клиентам" #. module: account #: model:ir.ui.view,arch_db:account.res_config_settings_view_form @@ -4530,7 +4533,7 @@ msgstr "" #. module: account #: model:ir.ui.view,arch_db:account.res_config_settings_view_form msgid "How total tax amount is computed in orders and invoices" -msgstr "" +msgstr "Как рассчитывается сумма налогов в заказах и счетах" #. module: account #: model:ir.model.fields,field_description:account.field_account_abstract_payment__id @@ -5182,7 +5185,7 @@ msgstr "" #. module: account #: model:ir.model.fields,help:account.field_account_invoice_line__is_rounding_line msgid "Is a rounding line in case of cash rounding." -msgstr "" +msgstr "Позиция к округлению в случае наличного расчета" #. module: account #: model:ir.model.fields,field_description:account.field_account_bank_statement__is_difference_zero @@ -5880,7 +5883,7 @@ msgstr "РАЗНОЕ" #. module: account #: model:ir.ui.view,arch_db:account.res_config_settings_view_form msgid "Mail your invoices in one-click using" -msgstr "" +msgstr "Отправляйте ваши счета в один клик, используя " #. module: account #: model:ir.ui.view,arch_db:account.res_config_settings_view_form @@ -5900,7 +5903,7 @@ msgstr "Основная валюта компании." #. module: account #: model:ir.ui.view,arch_db:account.res_config_settings_view_form msgid "Main currency of your company" -msgstr "" +msgstr "Основная валюта вашей компании" #. module: account #: model:ir.ui.menu,name:account.account_management_menu @@ -5970,7 +5973,7 @@ msgstr "Март" #. module: account #: model:ir.ui.view,arch_db:account.res_config_settings_view_form msgid "Margin Analysis" -msgstr "" +msgstr "Анализ прибыли" #. module: account #: model:ir.ui.view,arch_db:account.setup_bank_journal_form @@ -6111,7 +6114,7 @@ msgstr "" #. module: account #: model:ir.ui.view,arch_db:account.res_config_settings_view_form msgid "Monitor your product margins from invoices" -msgstr "" +msgstr "Следите за маржинальностью ваших продуктов по инвойсам" #. module: account #: model:ir.actions.act_window,name:account.act_account_invoice_partner_relation @@ -6804,7 +6807,7 @@ msgstr "Прошлые" #. module: account #: model:ir.ui.view,arch_db:account.res_config_settings_view_form msgid "Pay your bills in one-click using Euro SEPA service" -msgstr "" +msgstr "Оплачивайте ваши счета в один клик, используя сервис Euro SEPA" #. module: account #: model:account.account.type,name:account.data_account_type_payable @@ -7814,12 +7817,12 @@ msgstr "Округление по Строке" #. module: account #: model:ir.ui.view,arch_db:account.rounding_form_view msgid "Rounding Form" -msgstr "" +msgstr "Округление" #. module: account #: model:ir.model.fields,field_description:account.field_account_invoice_line__is_rounding_line msgid "Rounding Line" -msgstr "" +msgstr "Округление по строкам" #. module: account #: model:ir.model.fields,field_description:account.field_account_cash_rounding__rounding_method @@ -7835,12 +7838,12 @@ msgstr "Точность округления" #. module: account #: model:ir.model.fields,field_description:account.field_account_cash_rounding__strategy msgid "Rounding Strategy" -msgstr "" +msgstr "Стратегия округления" #. module: account #: model:ir.ui.view,arch_db:account.rounding_tree_view msgid "Rounding Tree" -msgstr "" +msgstr "Дерево округления" #. module: account #: model:ir.model.fields,field_description:account.field_res_config_settings__module_account_sepa @@ -8633,6 +8636,7 @@ msgid "" "Taxes, fiscal positions, chart of accounts & legal statements for your " "country" msgstr "" +"Налоги, фискальные позиции план счетов и правовые особенности вашей страны" #. module: account #: model:ir.model.fields,help:account.field_account_move_line__balance @@ -8935,6 +8939,9 @@ msgid "" "The cash rounding cannot be computed because the difference must be added on the biggest tax found and no tax are specified.\n" "Please set up a tax or change the cash rounding method." msgstr "" +"Невозможно рассчитать округления, потому что разница должна быть отнесена к " +"самому большому налогу, но налоги не указаны. Пожалуйста, укажите " +"применяемый налог или измените правило денежного округления." #. module: account #: model:ir.model.fields,help:account.field_res_company__chart_template_id @@ -9208,7 +9215,7 @@ msgstr "Последовательность журнала%s дезактиви #. module: account #: model:ir.model.fields,help:account.field_account_cash_rounding__rounding_method msgid "The tie-breaking rule used for float rounding operations" -msgstr "" +msgstr "Правило округления, используемое в операциях с дробными числами" #. module: account #: model:ir.ui.view,arch_db:account.portal_my_invoices @@ -9714,12 +9721,12 @@ msgstr "Итоговая сумма долга покупателя перед #. module: account #: model:ir.model.fields,help:account.field_account_invoice_line__price_total msgid "Total amount with taxes" -msgstr "" +msgstr "Итого с налогами" #. module: account #: model:ir.model.fields,help:account.field_account_invoice_line__price_subtotal msgid "Total amount without taxes" -msgstr "" +msgstr "Итого без налогов" #. module: account #: model:ir.model.fields,help:account.field_res_partner__debit diff --git a/addons/account/i18n/tr.po b/addons/account/i18n/tr.po index 1a1c436c45c..0d387c800f4 100644 --- a/addons/account/i18n/tr.po +++ b/addons/account/i18n/tr.po @@ -30,6 +30,10 @@ msgid "" " * The 'Paid' status is set automatically when the invoice is paid. Its related journal entries may or may not be reconciled.\n" " * The 'Cancelled' status is used when user cancel invoice." msgstr "" +" * 'Taslak' durumu, bir kullanıcı yeni yada onaylanmamış bir fatura hazırlıyorsa kullanılır.\n" +" * 'Açık' durumu, kullanıcı bir fatura oluştururken kullanılır, fatura numarası oluşturulur. Kullanıcı faturayı ödeyinceye kadar açık durumdadır.\n" +" * 'Ödendi' durumu, fatura ödenince otomatik olarak ayarlanır. Yevmiye girişlerinin uzlaştırılımış yada uzlaştırılmamış olmasıyla ilgilidir.\n" +" * 'İptal edildi' durumu kullanıcı bir faturayı iptal ettiğinde kullanılır." #. module: account #: model:ir.model.fields,field_description:account.field_account_chart_template__code_digits @@ -9271,6 +9275,8 @@ msgid "" "This %s has been created from: %s" msgstr "" +"Bu %s şu adresten oluşturuldu: %s" #. module: account #: model:ir.ui.view,arch_db:account.view_account_invoice_report_search diff --git a/addons/account/models/account.py b/addons/account/models/account.py index 0ece2b7c87c..87b4ffc2765 100644 --- a/addons/account/models/account.py +++ b/addons/account/models/account.py @@ -805,7 +805,7 @@ class AccountTax(models.Model): tag_ids = fields.Many2many('account.account.tag', 'account_tax_account_tag', string='Tags', help="Optional tags you may want to assign for custom reporting") tax_group_id = fields.Many2one('account.tax.group', string="Tax Group", default=_default_tax_group, required=True) # Technical field to make the 'tax_exigibility' field invisible if the same named field is set to false in 'res.company' model - hide_tax_exigibility = fields.Boolean(string='Hide Use Cash Basis Option', related='company_id.tax_exigibility') + hide_tax_exigibility = fields.Boolean(string='Hide Use Cash Basis Option', related='company_id.tax_exigibility', readonly=True) tax_exigibility = fields.Selection( [('on_invoice', 'Based on Invoice'), ('on_payment', 'Based on Payment'), diff --git a/addons/account/models/account_invoice.py b/addons/account/models/account_invoice.py index f6b6f9ed104..a4407c557af 100644 --- a/addons/account/models/account_invoice.py +++ b/addons/account/models/account_invoice.py @@ -619,7 +619,8 @@ class AccountInvoice(models.Model): for invoice in self: # Delete non-manual tax lines self._cr.execute("DELETE FROM account_invoice_tax WHERE invoice_id=%s AND manual is False", (invoice.id,)) - self.invalidate_cache() + if self._cr.rowcount: + self.invalidate_cache() # Generate one tax line per tax, however many invoice lines it's applied to tax_grouped = invoice.get_taxes_values() diff --git a/addons/account/models/account_move.py b/addons/account/models/account_move.py index 4f44203b5c5..e50cc97fb24 100644 --- a/addons/account/models/account_move.py +++ b/addons/account/models/account_move.py @@ -55,7 +55,8 @@ class AccountMove(models.Model): total_amount += amount for partial_line in (line.matched_debit_ids + line.matched_credit_ids): total_reconciled += partial_line.amount - if float_is_zero(total_amount, precision_rounding=move.currency_id.rounding): + precision_currency = move.currency_id or move.company_id.currency_id + if float_is_zero(total_amount, precision_rounding=precision_currency.rounding): move.matched_percentage = 1.0 else: move.matched_percentage = total_reconciled / total_amount @@ -102,8 +103,7 @@ class AccountMove(models.Model): partner_id = fields.Many2one('res.partner', compute='_compute_partner_id', string="Partner", store=True, readonly=True) amount = fields.Monetary(compute='_amount_compute', store=True) narration = fields.Text(string='Internal Note') - company_id = fields.Many2one('res.company', related='journal_id.company_id', string='Company', store=True, readonly=True, - default=lambda self: self.env.user.company_id) + company_id = fields.Many2one('res.company', related='journal_id.company_id', string='Company', store=True, readonly=True) matched_percentage = fields.Float('Percentage Matched', compute='_compute_matched_percentage', digits=0, store=True, readonly=True, help="Technical field used in cash basis method") # Dummy Account field to search on account.move by account_id dummy_account_id = fields.Many2one('account.account', related='line_ids.account_id', string='Account', store=False, readonly=True) @@ -746,8 +746,6 @@ class AccountMoveLine(models.Model): raise UserError(_('Entries are not from the same account.')) if not (all_accounts[0].reconcile or all_accounts[0].internal_type == 'liquidity'): raise UserError(_('Account %s (%s) does not allow reconciliation. First change the configuration of this account to allow it.') % (all_accounts[0].name, all_accounts[0].code)) - if len(partners) > 1: - raise UserError(_('The partner has to be the same on all lines for receivable and payable accounts.')) #reconcile everything that can be remaining_moves = self.auto_reconcile_lines() @@ -873,8 +871,9 @@ class AccountMoveLine(models.Model): rec_move_ids += account_move_line.matched_credit_ids if self.env.context.get('invoice_id'): current_invoice = self.env['account.invoice'].browse(self.env.context['invoice_id']) + aml_to_keep = current_invoice.move_id.line_ids | current_invoice.move_id.line_ids.mapped('full_reconcile_id.exchange_move_id.line_ids') rec_move_ids = rec_move_ids.filtered( - lambda r: (r.debit_move_id + r.credit_move_id) & current_invoice.move_id.line_ids + lambda r: (r.debit_move_id + r.credit_move_id) & aml_to_keep ) return rec_move_ids.unlink() @@ -1099,7 +1098,7 @@ class AccountMoveLine(models.Model): 'move_id': self.id, 'user_id': self.invoice_id.user_id.id or self._uid, 'partner_id': self.partner_id.id, - 'company_id': self.env.user.company_id.id, + 'company_id': self.analytic_account_id.company_id.id or self.env.user.company_id.id, } def _prepare_analytic_distribution_line(self, distribution): @@ -1122,7 +1121,7 @@ class AccountMoveLine(models.Model): 'ref': self.ref, 'move_id': self.id, 'user_id': self.invoice_id.user_id.id or self._uid, - 'company_id': self.env.user.company_id.id + 'company_id': distribution.account_id.company_id.id or self.env.user.company_id.id, } @api.model diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py index 86654f1de32..0cbb74dd7a4 100644 --- a/addons/account/models/account_payment.py +++ b/addons/account/models/account_payment.py @@ -447,12 +447,17 @@ class account_payment(models.Model): @api.multi def button_invoices(self): + if self.partner_type == 'supplier': + views = [(self.env.ref('account.invoice_supplier_tree').id, 'tree'), (self.env.ref('account.invoice_supplier_form').id, 'form')] + else: + views = [(self.env.ref('account.invoice_tree').id, 'tree'), (self.env.ref('account.invoice_form').id, 'form')] return { 'name': _('Paid Invoices'), 'view_type': 'form', 'view_mode': 'tree,form', 'res_model': 'account.invoice', 'view_id': False, + 'views': views, 'type': 'ir.actions.act_window', 'domain': [('id', 'in', [x.id for x in self.reconciled_invoice_ids])], } diff --git a/addons/account/models/partner.py b/addons/account/models/partner.py index eb92576d9f8..75d74a2cbc0 100644 --- a/addons/account/models/partner.py +++ b/addons/account/models/partner.py @@ -394,8 +394,7 @@ class ResPartner(models.Model): required=True) property_account_position_id = fields.Many2one('account.fiscal.position', company_dependent=True, string="Fiscal Position", - help="The fiscal position will determine taxes and accounts used for the partner.", oldname="property_account_position", - domain="[('company_id', 'in', [company_id, False])]") + help="The fiscal position will determine taxes and accounts used for the partner.", oldname="property_account_position") property_payment_term_id = fields.Many2one('account.payment.term', company_dependent=True, string='Customer Payment Terms', help="This payment term will be used instead of the default one for sales orders and customer invoices", oldname="property_payment_term") @@ -445,8 +444,12 @@ class ResPartner(models.Model): @api.onchange('company_id') def _onchange_company_id(self): + company = self.env['res.company'] if self.company_id: - return {'domain': {'property_account_position_id': [('company_id', 'in', [self.company_id.id, False])]}} + company = self.company_id + else: + company = self.env.user.company_id + return {'domain': {'property_account_position_id': [('company_id', 'in', [company.id, False])]}} def can_edit_vat(self): can_edit_vat = super(ResPartner, self).can_edit_vat() diff --git a/addons/account/static/src/js/reconciliation/reconciliation_model.js b/addons/account/static/src/js/reconciliation/reconciliation_model.js index ce086a6370a..15a80780709 100644 --- a/addons/account/static/src/js/reconciliation/reconciliation_model.js +++ b/addons/account/static/src/js/reconciliation/reconciliation_model.js @@ -804,6 +804,7 @@ var StatementModel = BasicModel.extend({ model: 'account.tax', method: 'json_friendly_compute_all', args: args, + context: $.extend(self.context || {}, {'round': true}), }) .then(function (result) { _.each(result.taxes, function(tax){ @@ -988,6 +989,7 @@ var StatementModel = BasicModel.extend({ var formatOptions = { currency_id: line.st_line.currency_id, }; + var amount = values.amount !== undefined ? values.amount : line.balance.amount; var prop = { 'id': _.uniqueId('createLine'), 'label': values.label || line.st_line.name, @@ -1000,8 +1002,7 @@ var StatementModel = BasicModel.extend({ 'debit': 0, 'credit': 0, 'base_amount': values.amount_type !== "percentage" ? - (values.amount || line.balance.amount) : - line.balance.amount * values.amount / 100, + (amount) : line.balance.amount * values.amount / 100, 'percent': values.amount_type === "percentage" ? values.amount : null, 'link': values.link, 'display': true, diff --git a/addons/account/tests/test_reconciliation.py b/addons/account/tests/test_reconciliation.py index 725a207d3a2..9a3e816efce 100644 --- a/addons/account/tests/test_reconciliation.py +++ b/addons/account/tests/test_reconciliation.py @@ -663,6 +663,54 @@ class TestReconciliation(AccountingTestCase): self.assertAlmostEquals(inv1.residual, 10) self.assertAlmostEquals(inv2.residual, 20) + def test_unreconcile_exchange(self): + # Use case: + # - Company currency in EUR + # - Create 2 rates for USD: + # 1.0 on 2018-01-01 + # 0.5 on 2018-02-01 + # - Create an invoice on 2018-01-02 of 111 USD + # - Register a payment on 2018-02-02 of 111 USD + # - Unreconcile the payment + + self.env['res.currency.rate'].create({ + 'name': time.strftime('%Y') + '-07-01', + 'rate': 1.0, + 'currency_id': self.currency_usd_id, + 'company_id': self.env.ref('base.main_company').id + }) + self.env['res.currency.rate'].create({ + 'name': time.strftime('%Y') + '-08-01', + 'rate': 0.5, + 'currency_id': self.currency_usd_id, + 'company_id': self.env.ref('base.main_company').id + }) + inv = self.create_invoice(invoice_amount=111, currency_id=self.currency_usd_id) + payment = self.env['account.payment'].create({ + 'payment_type': 'inbound', + 'payment_method_id': self.env.ref('account.account_payment_method_manual_in').id, + 'partner_type': 'customer', + 'partner_id': self.partner_agrolait_id, + 'amount': 111, + 'currency_id': self.currency_usd_id, + 'journal_id': self.bank_journal_usd.id, + 'payment_date': time.strftime('%Y') + '-08-01', + }) + payment.post() + credit_aml = payment.move_line_ids.filtered('credit') + + # Check residual before assignation + self.assertAlmostEquals(inv.residual, 111) + + # Assign credit, check exchange move and residual + inv.assign_outstanding_credit(credit_aml.id) + self.assertEqual(len(payment.move_line_ids.mapped('full_reconcile_id').exchange_move_id), 1) + self.assertAlmostEquals(inv.residual, 0) + + # Unreconcile invoice and check residual + credit_aml.with_context(invoice_id=inv.id).remove_move_reconcile() + self.assertAlmostEquals(inv.residual, 111) + def test_partial_reconcile_currencies_02(self): #### # Day 1: Invoice Cust/001 to customer (expressed in USD) diff --git a/addons/account/views/account_portal_templates.xml b/addons/account/views/account_portal_templates.xml index a83d9e05f83..c9d25b95aa9 100644 --- a/addons/account/views/account_portal_templates.xml +++ b/addons/account/views/account_portal_templates.xml @@ -22,9 +22,9 @@