From cc46bf97a4e1bd438d170c36d53abd0bef1e3040 Mon Sep 17 00:00:00 2001 From: Nhomar Hernandez Date: Sun, 30 Sep 2018 08:09:48 +0000 Subject: [PATCH 1/7] [FIX] sale: Call the proper method in the test and not the partial one. With this we can test the invoices properlly in other environments where we do not depend on sale due to the fact of this incorrectly set test we hade collateral damage in the localizationsfor example (also related to doesn't have a new created field called correctly in invoice_open and the method action_date_assign was not called propperly. With this fix we do not need to make defensive programming in the localizations in order to allow us to test it properlly. closes odoo/odoo#27316 --- addons/sale/tests/test_sale_to_invoice_and_to_be_invoiced.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/sale/tests/test_sale_to_invoice_and_to_be_invoiced.py b/addons/sale/tests/test_sale_to_invoice_and_to_be_invoiced.py index cc4f9cfa438..b5a28a435d3 100644 --- a/addons/sale/tests/test_sale_to_invoice_and_to_be_invoiced.py +++ b/addons/sale/tests/test_sale_to_invoice_and_to_be_invoiced.py @@ -71,7 +71,7 @@ class TestSaleOrderInvoicing(AccountingTestCase): self.assertEqual(sum(order.order_line.mapped('amt_invoiced')), 0.0, 'Sale: the Amount Invoiced for the sale order should be 0.0.') # Now I validate invoice_1. - invoice_1.invoice_validate() + invoice_1.action_invoice_open() self.assertEqual(sum(order.order_line.mapped('amt_to_invoice')), 300.0, 'Sale: the Amount To Invoice for the sale order should be 300.0.') self.assertEqual(sum(order.order_line.mapped('amt_invoiced')), 500.0, 'Sale: the Amount Invoiced for the sale order should be 500.0.') From 8b9cb0565eff4c0d147c3748d653a0c520c21add Mon Sep 17 00:00:00 2001 From: Martin Geubelle Date: Mon, 5 Nov 2018 15:20:54 +0000 Subject: [PATCH 2/7] [FIX] mail: remove `mail_followers` widget support claim This widget claims to support one2many fields but it doesn't work in most cases. This was triggering warnings when this widget was set on another field or in another view (i.e. in Studio). opw-1905803 closes odoo/odoo#28413 --- addons/mail/static/src/js/followers.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/addons/mail/static/src/js/followers.js b/addons/mail/static/src/js/followers.js index 651165dde30..a0f8a8b7be3 100644 --- a/addons/mail/static/src/js/followers.js +++ b/addons/mail/static/src/js/followers.js @@ -28,7 +28,9 @@ var Followers = AbstractField.extend({ 'click .o_remove_follower': '_onRemoveFollower', 'click .o_mail_redirect': '_onRedirect', }, - supportedFieldTypes: ['one2many'], + // this widget only supports one2many but is not generic enough to claim + // that it supports all one2many fields + // supportedFieldTypes: ['one2many'], // inherited init: function(parent, name, record, options) { From 392a8d8f9eb739321ed0d0c1ca0c1d1e0e6a1cbf Mon Sep 17 00:00:00 2001 From: Adrian Torres Date: Mon, 5 Nov 2018 09:05:40 +0000 Subject: [PATCH 3/7] [FIX] base: handle models without associated xids at uninstall If all the planets are correctly aligned, it is possible for a model to not have any xids associated with it, if this happens then the computed field that calculates the records to be deleted during an uninstall may mistakingly add records of this xid-less model to the list of records to be deleted, even if the actual uninstallation won't remove these records. opw-1904139 closes odoo/odoo#28388 --- odoo/addons/base/module/wizard/base_module_uninstall.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/odoo/addons/base/module/wizard/base_module_uninstall.py b/odoo/addons/base/module/wizard/base_module_uninstall.py index 1168e57341c..46665ac1e4d 100644 --- a/odoo/addons/base/module/wizard/base_module_uninstall.py +++ b/odoo/addons/base/module/wizard/base_module_uninstall.py @@ -37,10 +37,12 @@ class BaseModuleUninstall(models.TransientModel): for wizard in self: if wizard.module_id: module_names = set(wizard._get_modules().mapped('name')) - # find the models that have all their XIDs in the given modules + def lost(model): - return all(xid.split('.')[0] in module_names - for xid in ir_models_xids.get(model.id, ())) + xids = ir_models_xids.get(model.id, ()) + return xids and all(xid.split('.')[0] in module_names for xid in xids) + + # find the models that have all their XIDs in the given modules self.model_ids = ir_models.filtered(lost).sorted('name') @api.onchange('module_id') From 69a0af9e8634ba3ad67c2d8368b6fead9b390fbe Mon Sep 17 00:00:00 2001 From: Goffin Simon Date: Tue, 6 Nov 2018 12:07:29 +0000 Subject: [PATCH 4/7] [FIX] account: Impossible to make a partial credit note Steps to reproduce the bug: - Create a credit note for an amount of 100$ - Validate it and register a payment - Let's pay an amount of 90$ and mark this credit note as fully paid Bug: An error message was raised saying: Wrong credit or debit value in accounting entry ! DO NOT FORWARD-PORT opw:1893570 closes odoo/odoo#28433 --- addons/account/models/account_payment.py | 18 +++++++++++++++- addons/account/tests/test_payment.py | 26 ++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) diff --git a/addons/account/models/account_payment.py b/addons/account/models/account_payment.py index 7d1231ece2e..0e19cd13b55 100644 --- a/addons/account/models/account_payment.py +++ b/addons/account/models/account_payment.py @@ -569,8 +569,24 @@ class account_payment(models.Model): # to avoid loss of precision during the currency rate computations. See revision 20935462a0cabeb45480ce70114ff2f4e91eaf79 for a detailed example. total_residual_company_signed = sum(invoice.residual_company_signed for invoice in self.invoice_ids) total_payment_company_signed = self.currency_id.with_context(date=self.payment_date).compute(self.amount, self.company_id.currency_id) - if self.invoice_ids[0].type in ['in_invoice', 'out_refund']: + # amout_wo must be positive for out_invoice and in_refund and negative for in_invoice and out_refund in standard use case + # | total_payment_company_signed | total_residual_company_signed | amount_wo + #---------------------------------------------------------------------------------------------------------------------- + # in_invoice | positive | positive | negative + #---------------------------------------------------------------------------------------------------------------------- + # in_refund | positive | negative | positive + #---------------------------------------------------------------------------------------------------------------------- + # out_invoice | positive | positive | positive + #---------------------------------------------------------------------------------------------------------------------- + # out_refund | positive | negative | negative + #---------------------------------------------------------------------------------------------------------------------- + # DO NOT FORWARD-PORT + if self.invoice_ids[0].type == 'in_invoice': amount_wo = total_payment_company_signed - total_residual_company_signed + elif self.invoice_ids[0].type == 'in_refund': + amount_wo = - total_payment_company_signed - total_residual_company_signed + elif self.invoice_ids[0].type == 'out_refund': + amount_wo = total_payment_company_signed + total_residual_company_signed else: amount_wo = total_residual_company_signed - total_payment_company_signed # Align the sign of the secondary currency writeoff amount with the sign of the writeoff diff --git a/addons/account/tests/test_payment.py b/addons/account/tests/test_payment.py index 9855452e209..8f671f957c9 100644 --- a/addons/account/tests/test_payment.py +++ b/addons/account/tests/test_payment.py @@ -370,3 +370,29 @@ class TestPayment(AccountingTestCase): {'account_id': self.account_payable.id, 'debit': 0.0, 'credit': 8.65, 'amount_currency': -13.22, 'currency_id': self.currency_usd_id}, {'account_id': self.account_receivable.id, 'debit': 0.0, 'credit': 7.7, 'amount_currency': -11.78, 'currency_id': self.currency_usd_id}, ]) + + def test_payment_and_writeoff_out_refund(self): + # Use case: + # Company is in EUR, create a credit note for 100 EUR and register payment of 90. + # Mark invoice as fully paid with a write_off + # Check that all the aml are correctly created. + invoice = self.create_invoice(amount=100, type='out_refund', currency_id=self.currency_eur_id, partner=self.partner_agrolait.id) + # register payment on invoice + payment = self.payment_model.create({'payment_type': 'outbound', + 'payment_method_id': self.env.ref('account.account_payment_method_manual_in').id, + 'partner_type': 'customer', + 'partner_id': self.partner_agrolait.id, + 'amount': 90, + 'payment_date': time.strftime('%Y') + '-07-15', + 'payment_difference_handling': 'reconcile', + 'writeoff_account_id': self.account_payable.id, + 'journal_id': self.bank_journal_euro.id, + 'invoice_ids': [(4, invoice.id, None)] + }) + payment.post() + self.check_journal_items(payment.move_line_ids, [ + {'account_id': self.account_eur.id, 'debit': 0.0, 'credit': 90.0, 'amount_currency': 0.0, 'currency_id': False}, + {'account_id': self.account_payable.id, 'debit': 0.0, 'credit': 10.0, 'amount_currency': 0.0, 'currency_id': False}, + {'account_id': self.account_receivable.id, 'debit': 100.0, 'credit': 0.0, 'amount_currency': 0.0, 'currency_id': False}, + ]) + self.assertEqual(invoice.state, 'paid') From c6b0d36622065f4eadc9f0b9da10a77f725fe5f5 Mon Sep 17 00:00:00 2001 From: Arnold Moyaux Date: Wed, 17 Oct 2018 14:32:03 +0000 Subject: [PATCH 5/7] [FIX] stock: quantity done not saved on pager On delivery order, it happens that when it contains more than 40 products and multiple pager. The quantity done are only saved on the first pager and on the other everythings is reset to 0. This issue is not deterministic. The reason is because on the picking view, both stock.move and stock.move.line are present. When the user write the quantity done on a stock.move it exists a function inverse that write qty_done on stock.move.line. However during an onchange, inverse function are not trigger and every field present in the view is returned to the client. It means that data after the onchange are inconsistent since the quantity done write on the move is different than the quantity on the move line. When the user save the form view, the write could be trigger in different order. If the write on stock.move is trigger first, it will write the qty_done with the inverse function but it will be erase by the write on stock.move.line that is trigger after. In order to fix it, we set the stock.move.line as readonly when they are not needed, so they are not send to the server. closes odoo/odoo#27903 --- addons/stock/views/stock_picking_views.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/addons/stock/views/stock_picking_views.xml b/addons/stock/views/stock_picking_views.xml index 090924b8fd4..1cf3a23377e 100644 --- a/addons/stock/views/stock_picking_views.xml +++ b/addons/stock/views/stock_picking_views.xml @@ -258,7 +258,7 @@ - + From 7a117b14dff65bb42c55f3ade4470d0be6ca2970 Mon Sep 17 00:00:00 2001 From: eco-odoo Date: Wed, 7 Nov 2018 08:09:55 +0000 Subject: [PATCH 6/7] [IMP] l10n_uk: rename menu item `England` to `United Kingdom` "British Statements" was wrongly renamed to "England" in a436645ae8016d54c32eadd7d3ec0acb2ae78d9f. closes odoo/odoo#28458 --- addons/l10n_uk/data/l10n_uk_chart_data.xml | 2 +- addons/l10n_uk/i18n/l10n_uk.pot | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/addons/l10n_uk/data/l10n_uk_chart_data.xml b/addons/l10n_uk/data/l10n_uk_chart_data.xml index fd180996726..6318875730e 100644 --- a/addons/l10n_uk/data/l10n_uk_chart_data.xml +++ b/addons/l10n_uk/data/l10n_uk_chart_data.xml @@ -1,6 +1,6 @@ - + Transfer Account diff --git a/addons/l10n_uk/i18n/l10n_uk.pot b/addons/l10n_uk/i18n/l10n_uk.pot index 61971d8a391..788aeef258d 100644 --- a/addons/l10n_uk/i18n/l10n_uk.pot +++ b/addons/l10n_uk/i18n/l10n_uk.pot @@ -17,7 +17,7 @@ msgstr "" #. module: l10n_uk #: model:ir.ui.menu,name:l10n_uk.account_reports_uk_statements_menu -msgid "British Statements" +msgid "United Kindom" msgstr "" #. module: l10n_uk From e5c8071484c883bf78478a39ef2120bcd8f2442d Mon Sep 17 00:00:00 2001 From: Nicolas Martinelli Date: Wed, 7 Nov 2018 13:24:53 +0000 Subject: [PATCH 7/7] [FIX] account: domain on reconciliation model When loading the Reconciliation Widget, all reconciliation models are retrieved. This is not correct: only the one matching the company and the journal should be retrieved. Fixes #28270 opw-1904475 closes odoo/odoo#28474 --- .../src/js/reconciliation/reconciliation_model.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/addons/account/static/src/js/reconciliation/reconciliation_model.js b/addons/account/static/src/js/reconciliation/reconciliation_model.js index 7c5134f8b9e..420897bdf9c 100644 --- a/addons/account/static/src/js/reconciliation/reconciliation_model.js +++ b/addons/account/static/src/js/reconciliation/reconciliation_model.js @@ -392,9 +392,17 @@ var StatementModel = BasicModel.extend({ }; }); }); + var domainReconcile = []; + if (context && context.company_ids) { + domainReconcile.push(['company_id', 'in', context.company_ids]); + } + if (context && context.active_model === 'account.journal' && context.active_ids) { + domainReconcile.push(['journal_id', 'in', [false].concat(context.active_ids)]); + } var def_reconcileModel = this._rpc({ model: 'account.reconcile.model', method: 'search_read', + domain: domainReconcile, }) .then(function (reconcileModels) { self.reconcileModels = reconcileModels; @@ -1171,9 +1179,14 @@ var ManualModel = StatementModel.extend({ self.accounts = _.object(self.account_ids, _.pluck(accounts, 'code')); }); + var domainReconcile = []; + if (context && context.company_ids) { + domainReconcile.push(['company_id', 'in', context.company_ids]); + } var def_reconcileModel = this._rpc({ model: 'account.reconcile.model', method: 'search_read', + domain: domainReconcile, }) .then(function (reconcileModels) { self.reconcileModels = reconcileModels;