summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulien Castiaux <juc@odoo.com>2019-09-11 09:45:31 +0000
committerJulien Castiaux <juc@odoo.com>2019-09-17 11:36:42 +0000
commit4f03a5f136ab928ae74322bf1c34a1b6a6baf979 (patch)
treee0e0c0653888751c165b9ffb269d3b70853badef
parent6c948c36bbf72dd896e0bff03aa7fbddadcbb0cd (diff)
[FIX] *: remove old deprecated modules/functions
PEP-594 is deprecating a bunch of modules. As part of the cleanup, we are also dealing with long deprecated modules, functions and aliases. * `assert_` -> `assertTrue` * `assertEquals` -> `assertEqual` * `assertNotEquals` -> `assertNotEqual` * `assertAlmostEquals` -> `assertAlmostEqual` * `assertRaisesRegexp` -> `assertRaisesRegex` * `assertRegexpMatches` -> `assertRegex` * `base64.encodestring` -> `base64.encodebytes` * `base64.decodestring` -> `base64.decodebytes` * `inspect.getargspec` -> `inspect.signature` * `inspect.formatargspec` -> `inspect.signature` * `logging.warn` -> `logging.warning` closes odoo/odoo#36863 Task: 2003936 Signed-off-by: Raphael Collet (rco) <rco@openerp.com>
-rw-r--r--addons/account/models/account_bank_statement.py2
-rw-r--r--addons/account/tests/account_test_classes.py2
-rw-r--r--addons/account/tests/test_account_journal_dashboard.py18
-rw-r--r--addons/account/tests/test_fiscal_position.py2
-rw-r--r--addons/account/tests/test_payment.py6
-rw-r--r--addons/account/tests/test_reconciliation.py60
-rw-r--r--addons/base_import/models/base_import.py6
-rw-r--r--addons/base_import_module/models/base_import_module.py2
-rw-r--r--addons/calendar/tests/test_calendar.py2
-rw-r--r--addons/crm/tests/test_crm_pls.py4
-rw-r--r--addons/delivery/tests/test_packing_delivery.py4
-rw-r--r--addons/hr_contract/tests/test_auto_status.py22
-rw-r--r--addons/hr_expense/tests/test_expenses.py86
-rw-r--r--addons/hr_expense/tests/test_expenses_mail_subjects.py52
-rw-r--r--addons/hr_recruitment/tests/test_recruitment_process.py6
-rw-r--r--addons/hr_timesheet/tests/test_timesheet.py38
-rw-r--r--addons/l10n_be_edi/tests/test_ubl.py2
-rw-r--r--addons/l10n_fr_fec/wizard/account_fr_fec.py2
-rw-r--r--addons/l10n_it_edi/models/account_invoice.py2
-rw-r--r--addons/l10n_it_edi/models/ir_mail_server.py2
-rw-r--r--addons/maintenance/tests/test_maintenance.py4
-rw-r--r--addons/maintenance/tests/test_maintenance_multicompany.py12
-rw-r--r--addons/mrp/tests/test_procurement.py2
-rw-r--r--addons/mrp/tests/test_stock.py8
-rw-r--r--addons/mrp/tests/test_warehouse_multistep_manufacturing.py2
-rw-r--r--addons/mrp/tests/test_workorder_operation.py12
-rw-r--r--addons/mrp_account/tests/test_bom_price.py4
-rw-r--r--addons/mrp_subcontracting/tests/test_subcontracting.py68
-rw-r--r--addons/payment_stripe/models/payment.py2
-rw-r--r--addons/pos_cache/models/pos_cache.py4
-rw-r--r--addons/project_timesheet_holidays/tests/test_timesheet_holidays.py6
-rw-r--r--addons/purchase/tests/test_purchase_order_report.py8
-rw-r--r--addons/purchase_mrp/tests/test_purchase_mrp_flow.py38
-rw-r--r--addons/purchase_stock/tests/test_create_picking.py4
-rw-r--r--addons/purchase_stock/tests/test_fifo_price.py14
-rw-r--r--addons/purchase_stock/tests/test_move_cancel_propagation.py2
-rw-r--r--addons/purchase_stock/tests/test_onchange_product.py8
-rw-r--r--addons/purchase_stock/tests/test_stockvaluation.py56
-rw-r--r--addons/sale/tests/test_access_rights.py2
-rw-r--r--addons/sale/tests/test_onchange.py6
-rw-r--r--addons/sale/tests/test_reinvoice.py50
-rw-r--r--addons/sale/tests/test_sale_order.py10
-rw-r--r--addons/sale/tests/test_sale_pricelist.py18
-rw-r--r--addons/sale/tests/test_sale_refund.py222
-rw-r--r--addons/sale/tests/test_sale_to_invoice.py76
-rw-r--r--addons/sale_expense/tests/test_reinvoice.py54
-rw-r--r--addons/sale_mrp/tests/test_sale_mrp_flow.py120
-rw-r--r--addons/sale_stock/tests/test_sale_order_dates.py6
-rw-r--r--addons/sale_stock/tests/test_sale_stock.py12
-rw-r--r--addons/sale_stock/tests/test_sale_stock_lead_time.py8
-rw-r--r--addons/sale_timesheet/tests/test_project_billing.py2
-rw-r--r--addons/sale_timesheet/tests/test_reinvoice.py58
-rw-r--r--addons/stock/tests/test_move2.py40
-rw-r--r--addons/stock/tests/test_packing.py28
-rw-r--r--addons/stock/tests/test_proc_rule.py14
-rw-r--r--addons/stock/tests/test_stock_flow.py36
-rw-r--r--addons/stock/tests/test_stock_location_search.py4
-rw-r--r--addons/stock_dropshipping/tests/test_dropship.py6
-rw-r--r--addons/survey/tests/test_certification_badge.py38
-rw-r--r--addons/test_mail/tests/test_message_management.py4
-rw-r--r--addons/test_mail_full/tests/test_sms_composer.py8
-rw-r--r--addons/test_website/tests/test_controller_args.py24
-rw-r--r--addons/test_website/tests/test_views_during_module_operation.py4
-rw-r--r--addons/uom/tests/test_uom.py10
-rw-r--r--addons/web/controllers/main.py2
-rw-r--r--addons/web_editor/models/ir_qweb.py2
-rw-r--r--addons/website/models/ir_http.py4
-rw-r--r--addons/website/models/website.py13
-rw-r--r--addons/website_form/controllers/main.py2
-rw-r--r--addons/website_mail_channel/tests/test_unsubscribe.py2
-rw-r--r--addons/website_sale/tests/test_website_sale_pricelist.py6
-rw-r--r--addons/website_sale_comparison/tests/test_website_sale_comparison.py6
-rw-r--r--addons/website_theme_install/tests/test_views.py12
-rw-r--r--odoo/addons/base/models/ir_actions_report.py4
-rw-r--r--odoo/addons/base/models/ir_model.py2
-rw-r--r--odoo/addons/base/models/ir_ui_menu.py2
-rw-r--r--odoo/addons/base/models/ir_ui_view.py2
-rw-r--r--odoo/addons/base/models/res_users.py6
-rw-r--r--odoo/addons/base/tests/test_acl.py14
-rw-r--r--odoo/addons/base/tests/test_base.py18
-rw-r--r--odoo/addons/base/tests/test_basecase.py2
-rw-r--r--odoo/addons/base/tests/test_mail.py2
-rw-r--r--odoo/addons/base/tests/test_mimetypes.py2
-rw-r--r--odoo/addons/base/tests/test_osv.py12
-rw-r--r--odoo/addons/base/tests/test_qweb.py4
-rw-r--r--odoo/addons/base/tests/test_res_partner_bank.py22
-rw-r--r--odoo/addons/base/tests/test_translate.py40
-rw-r--r--odoo/addons/base/wizard/base_export_language.py2
-rw-r--r--odoo/addons/base/wizard/base_import_language.py2
-rw-r--r--odoo/addons/test_assetsbundle/tests/test_assetsbundle.py124
-rw-r--r--odoo/addons/test_lint/tests/test_pylint.py3
-rw-r--r--odoo/addons/test_performance/tests/test_performance.py2
-rw-r--r--odoo/addons/test_testing_utilities/tests/test_form_impl.py2
-rw-r--r--odoo/addons/test_translation_import/tests/test_term_count.py6
-rw-r--r--odoo/api.py4
-rw-r--r--odoo/exceptions.py2
-rw-r--r--odoo/http.py25
-rw-r--r--odoo/models.py2
-rw-r--r--odoo/modules/module.py2
-rw-r--r--odoo/service/server.py2
-rw-r--r--odoo/tools/cache.py18
-rw-r--r--odoo/tools/convert.py4
102 files changed, 911 insertions, 904 deletions
diff --git a/addons/account/models/account_bank_statement.py b/addons/account/models/account_bank_statement.py
index 8ddf1b6000a..e9fab122292 100644
--- a/addons/account/models/account_bank_statement.py
+++ b/addons/account/models/account_bank_statement.py
@@ -300,7 +300,7 @@ class AccountBankStatement(models.Model):
self.env['ir.attachment'].create({
'name': statement.name and _("Bank Statement %s.pdf") % statement.name or _("Bank Statement.pdf"),
'type': 'binary',
- 'datas': base64.encodestring(content),
+ 'datas': base64.encodebytes(content),
'res_model': statement._name,
'res_id': statement.id
})
diff --git a/addons/account/tests/account_test_classes.py b/addons/account/tests/account_test_classes.py
index 3bf7d53f970..00267faddd6 100644
--- a/addons/account/tests/account_test_classes.py
+++ b/addons/account/tests/account_test_classes.py
@@ -17,7 +17,7 @@ class AccountingTestCase(HttpCase):
super(AccountingTestCase, self).setUp()
domain = [('company_id', '=', self.env.ref('base.main_company').id)]
if not self.env['account.account'].search_count(domain):
- _logger.warn('Test skipped because there is no chart of account defined ...')
+ _logger.warning('Test skipped because there is no chart of account defined ...')
self.skipTest("No Chart of account found")
def ensure_account_property(self, property_name):
diff --git a/addons/account/tests/test_account_journal_dashboard.py b/addons/account/tests/test_account_journal_dashboard.py
index ef7f8fad3a1..0d6e88e30bc 100644
--- a/addons/account/tests/test_account_journal_dashboard.py
+++ b/addons/account/tests/test_account_journal_dashboard.py
@@ -49,30 +49,30 @@ class TestAccountJournalDashboard(AccountTestUsers):
# Check Draft
dashboard_data = journal.get_journal_dashboard_datas()
- self.assertEquals(dashboard_data['number_draft'], 2)
+ self.assertEqual(dashboard_data['number_draft'], 2)
self.assertIn('68.42', dashboard_data['sum_draft'])
- self.assertEquals(dashboard_data['number_waiting'], 0)
+ self.assertEqual(dashboard_data['number_waiting'], 0)
self.assertIn('0.00', dashboard_data['sum_waiting'])
# Check Both
invoice.post()
dashboard_data = journal.get_journal_dashboard_datas()
- self.assertEquals(dashboard_data['number_draft'], 1)
+ self.assertEqual(dashboard_data['number_draft'], 1)
self.assertIn('-13.30', dashboard_data['sum_draft'])
- self.assertEquals(dashboard_data['number_waiting'], 1)
+ self.assertEqual(dashboard_data['number_waiting'], 1)
self.assertIn('81.72', dashboard_data['sum_waiting'])
# Check waiting payment
refund.post()
dashboard_data = journal.get_journal_dashboard_datas()
- self.assertEquals(dashboard_data['number_draft'], 0)
+ self.assertEqual(dashboard_data['number_draft'], 0)
self.assertIn('0.00', dashboard_data['sum_draft'])
- self.assertEquals(dashboard_data['number_waiting'], 2)
+ self.assertEqual(dashboard_data['number_waiting'], 2)
self.assertIn('68.42', dashboard_data['sum_waiting'])
# Check partial
@@ -96,13 +96,13 @@ class TestAccountJournalDashboard(AccountTestUsers):
refund.js_assign_outstanding_line(payment_move_line.id)
dashboard_data = journal.get_journal_dashboard_datas()
- self.assertEquals(dashboard_data['number_draft'], 0)
+ self.assertEqual(dashboard_data['number_draft'], 0)
self.assertIn('0.00', dashboard_data['sum_draft'])
- self.assertEquals(dashboard_data['number_waiting'], 2)
+ self.assertEqual(dashboard_data['number_waiting'], 2)
self.assertIn('78.42', dashboard_data['sum_waiting'])
with patch('odoo.fields.Date.today', patched_today):
dashboard_data = journal.get_journal_dashboard_datas()
- self.assertEquals(dashboard_data['number_late'], 2)
+ self.assertEqual(dashboard_data['number_late'], 2)
self.assertIn('78.42', dashboard_data['sum_late'])
diff --git a/addons/account/tests/test_fiscal_position.py b/addons/account/tests/test_fiscal_position.py
index f9d5ddd4b27..4b19431806b 100644
--- a/addons/account/tests/test_fiscal_position.py
+++ b/addons/account/tests/test_fiscal_position.py
@@ -58,7 +58,7 @@ class TestFiscalPosition(common.TransactionCase):
def test_10_fp_country(self):
def assert_fp(partner, expected_pos, message):
- self.assertEquals(
+ self.assertEqual(
self.fp.get_fiscal_position(partner.id),
expected_pos.id,
message)
diff --git a/addons/account/tests/test_payment.py b/addons/account/tests/test_payment.py
index ade019768ea..eafe7b856ed 100644
--- a/addons/account/tests/test_payment.py
+++ b/addons/account/tests/test_payment.py
@@ -88,7 +88,7 @@ class TestPayment(AccountingTestCase):
})
payment = self.payment_model.browse(register_payments.create_payments()['res_id'])
- self.assertAlmostEquals(payment.amount, 300)
+ self.assertAlmostEqual(payment.amount, 300)
self.assertEqual(payment.state, 'posted')
self.assertEqual(payment.state, 'posted')
self.assertEqual(inv_1.invoice_payment_state, 'paid')
@@ -161,7 +161,7 @@ class TestPayment(AccountingTestCase):
self.assertEqual(len(payment), 1)
self.assertEqual(payment.invoice_ids[0].id, inv_1.id)
- self.assertAlmostEquals(payment.amount, 550)
+ self.assertAlmostEqual(payment.amount, 550)
self.assertEqual(payment.payment_type, 'inbound')
self.assertEqual(payment.partner_id, self.partner_agrolait)
self.assertEqual(payment.partner_type, 'customer')
@@ -180,7 +180,7 @@ class TestPayment(AccountingTestCase):
self.assertEqual(len(payment), 1)
self.assertEqual(payment.invoice_ids[0].id, inv_2.id)
- self.assertAlmostEquals(payment.amount, 300)
+ self.assertAlmostEqual(payment.amount, 300)
self.assertEqual(payment.payment_type, 'outbound')
self.assertEqual(payment.partner_id, self.partner_china_exp)
self.assertEqual(payment.partner_type, 'supplier')
diff --git a/addons/account/tests/test_reconciliation.py b/addons/account/tests/test_reconciliation.py
index 94e5e69bee4..c23f4b048da 100644
--- a/addons/account/tests/test_reconciliation.py
+++ b/addons/account/tests/test_reconciliation.py
@@ -370,11 +370,11 @@ class TestReconciliationExec(TestReconciliation):
])
# The invoice should be paid, as the payments totally cover its total
- self.assertEquals(move.invoice_payment_state, 'paid', 'The invoice should be paid by now')
+ self.assertEqual(move.invoice_payment_state, 'paid', 'The invoice should be paid by now')
self.assertTrue(receivable_line.reconciled, 'The invoice should be totally reconciled')
self.assertTrue(receivable_line.full_reconcile_id, 'The invoice should have a full reconcile number')
- self.assertEquals(receivable_line.amount_residual, 0, 'The invoice should be totally reconciled')
- self.assertEquals(receivable_line.amount_residual_currency, 0, 'The invoice should be totally reconciled')
+ self.assertEqual(receivable_line.amount_residual, 0, 'The invoice should be totally reconciled')
+ self.assertEqual(receivable_line.amount_residual_currency, 0, 'The invoice should be totally reconciled')
@unittest.skip('adapt to new accounting')
def test_balanced_exchanges_gain_loss(self):
@@ -440,7 +440,7 @@ class TestReconciliationExec(TestReconciliation):
])
# The invoice should be paid, as the payments totally cover its total
- self.assertEquals(invoice.state, 'paid', 'The invoice should be paid by now')
+ self.assertEqual(invoice.state, 'paid', 'The invoice should be paid by now')
reconcile = None
for payment in invoice.payment_ids:
reconcile = payment.reconcile_model_id
@@ -460,8 +460,8 @@ class TestReconciliationExec(TestReconciliation):
self.assertTrue(exchange_loss_line, 'There should be one move line of 0.01 EUR in credit')
# The journal items of the reconciliation should have their debit and credit total equal
# Besides, the total debit and total credit should be 60.61 EUR (2.00 USD)
- self.assertEquals(sum(res['debit'] for res in result.values()), 60.61)
- self.assertEquals(sum(res['credit'] for res in result.items()), 60.61)
+ self.assertEqual(sum(res['debit'] for res in result.values()), 60.61)
+ self.assertEqual(sum(res['credit'] for res in result.items()), 60.61)
counterpart_exchange_loss_line = None
for line in exchange_loss_line.move_id.line_id:
if line.account_id.id == self.account_fx_expense_id:
@@ -505,8 +505,8 @@ class TestReconciliationExec(TestReconciliation):
aml_recs.reconcile()
for aml in aml_recs:
self.assertTrue(aml.reconciled, 'The journal item should be totally reconciled')
- self.assertEquals(aml.amount_residual, 0, 'The journal item should be totally reconciled')
- self.assertEquals(aml.amount_residual_currency, 0, 'The journal item should be totally reconciled')
+ self.assertEqual(aml.amount_residual, 0, 'The journal item should be totally reconciled')
+ self.assertEqual(aml.amount_residual_currency, 0, 'The journal item should be totally reconciled')
move_list_vals = [
('2', 728.35, 795.05, self.currency_swiss_id),
@@ -522,8 +522,8 @@ class TestReconciliationExec(TestReconciliation):
aml_recs.reconcile(self.account_rsa, self.bank_journal_usd)
for aml in aml_recs:
self.assertTrue(aml.reconciled, 'The journal item should be totally reconciled')
- self.assertEquals(aml.amount_residual, 0, 'The journal item should be totally reconciled')
- self.assertEquals(aml.amount_residual_currency, 0, 'The journal item should be totally reconciled')
+ self.assertEqual(aml.amount_residual, 0, 'The journal item should be totally reconciled')
+ self.assertEqual(aml.amount_residual_currency, 0, 'The journal item should be totally reconciled')
def test_manual_reconcile_wizard_same_account(self):
move_ids = self.env['account.move']
@@ -582,7 +582,7 @@ class TestReconciliationExec(TestReconciliation):
}]
writeoff_line = account_move_line._create_writeoff(writeoff_vals)
(account_move_line + writeoff_line).reconcile()
- self.assertEquals(len(writeoff_line), 1, "The writeoff_line (balance_line) should have only one moves line")
+ self.assertEqual(len(writeoff_line), 1, "The writeoff_line (balance_line) should have only one moves line")
self.assertTrue(all(l.reconciled for l in writeoff_line), 'The balance lines should be totally reconciled')
self.assertTrue(all(l.reconciled for l in account_move_line), 'The move lines should be totally reconciled')
@@ -630,7 +630,7 @@ class TestReconciliationExec(TestReconciliation):
# Check that move lines associated to bank_statement are correct
bank_stmt_aml = self.env['account.move.line'].search([('statement_id', '=', bank_stmt.id)])
bank_stmt_aml |= bank_stmt_aml.mapped('move_id').mapped('line_ids')
- self.assertEquals(len(bank_stmt_aml), 4, "The bank statement should have 4 moves lines")
+ self.assertEqual(len(bank_stmt_aml), 4, "The bank statement should have 4 moves lines")
lines = {
self.account_usd.id: [
{'debit': 3.27, 'credit': 0.0, 'amount_currency': 5, 'currency_id': self.currency_usd_id},
@@ -655,10 +655,10 @@ class TestReconciliationExec(TestReconciliation):
line = line[0]
else:
line = line[1]
- self.assertEquals(round(aml.debit, 2), line['debit'])
- self.assertEquals(round(aml.credit, 2), line['credit'])
- self.assertEquals(round(aml.amount_currency, 2), line['amount_currency'])
- self.assertEquals(aml.currency_id.id, line['currency_id'])
+ self.assertEqual(round(aml.debit, 2), line['debit'])
+ self.assertEqual(round(aml.credit, 2), line['credit'])
+ self.assertEqual(round(aml.amount_currency, 2), line['amount_currency'])
+ self.assertEqual(aml.currency_id.id, line['currency_id'])
def test_partial_reconcile_currencies_01(self):
# client Account (payable, rsa)
@@ -809,19 +809,19 @@ class TestReconciliationExec(TestReconciliation):
credit_aml = payment.move_line_ids.filtered('credit')
# Check residual before assignation
- self.assertAlmostEquals(inv1.amount_residual, 10)
- self.assertAlmostEquals(inv2.amount_residual, 20)
+ self.assertAlmostEqual(inv1.amount_residual, 10)
+ self.assertAlmostEqual(inv2.amount_residual, 20)
# Assign credit and residual
inv1.js_assign_outstanding_line(credit_aml.id)
inv2.js_assign_outstanding_line(credit_aml.id)
- self.assertAlmostEquals(inv1.amount_residual, 0)
- self.assertAlmostEquals(inv2.amount_residual, 0)
+ self.assertAlmostEqual(inv1.amount_residual, 0)
+ self.assertAlmostEqual(inv2.amount_residual, 0)
# Unreconcile one invoice at a time and check residual
credit_aml.remove_move_reconcile()
- self.assertAlmostEquals(inv1.amount_residual, 10)
- self.assertAlmostEquals(inv2.amount_residual, 20)
+ self.assertAlmostEqual(inv1.amount_residual, 10)
+ self.assertAlmostEqual(inv2.amount_residual, 20)
def test_unreconcile_exchange(self):
# Use case:
@@ -860,16 +860,16 @@ class TestReconciliationExec(TestReconciliation):
credit_aml = payment.move_line_ids.filtered('credit')
# Check residual before assignation
- self.assertAlmostEquals(inv.amount_residual, 111)
+ self.assertAlmostEqual(inv.amount_residual, 111)
# Assign credit, check exchange move and residual
inv.js_assign_outstanding_line(credit_aml.id)
self.assertEqual(len(payment.move_line_ids.mapped('full_reconcile_id').exchange_move_id), 1)
- self.assertAlmostEquals(inv.amount_residual, 0)
+ self.assertAlmostEqual(inv.amount_residual, 0)
# Unreconcile invoice and check residual
credit_aml.with_context(invoice_id=inv.id).remove_move_reconcile()
- self.assertAlmostEquals(inv.amount_residual, 111)
+ self.assertAlmostEqual(inv.amount_residual, 111)
def test_revert_payment_and_reconcile(self):
payment = self.env['account.payment'].create({
@@ -1224,14 +1224,14 @@ class TestReconciliationExec(TestReconciliation):
self.env["account.reconciliation.widget"].process_move_lines(data_for_reconciliation)
self.assertTrue(inv1_receivable.full_reconcile_id.exists())
- self.assertEquals(inv1_receivable.full_reconcile_id, inv2_receivable.full_reconcile_id)
- self.assertEquals(inv1_receivable.full_reconcile_id, pay_receivable.full_reconcile_id)
+ self.assertEqual(inv1_receivable.full_reconcile_id, inv2_receivable.full_reconcile_id)
+ self.assertEqual(inv1_receivable.full_reconcile_id, pay_receivable.full_reconcile_id)
self.assertTrue(all(l.reconciled for l in inv1_receivable))
self.assertTrue(all(l.reconciled for l in inv2_receivable))
- self.assertEquals(inv1.invoice_payment_state, 'paid')
- self.assertEquals(inv2.invoice_payment_state, 'paid')
+ self.assertEqual(inv1.invoice_payment_state, 'paid')
+ self.assertEqual(inv2.invoice_payment_state, 'paid')
def test_multiple_term_reconciliation_opw_1906665(self):
'''Test that when registering a payment to an invoice with multiple
@@ -2145,4 +2145,4 @@ class TestReconciliationExec(TestReconciliation):
}])
writeoff_line = self.env['account.move.line'].search([('name', '=', 'writeoff')])
- self.assertEquals(writeoff_line.credit, 15.0)
+ self.assertEqual(writeoff_line.credit, 15.0)
diff --git a/addons/base_import/models/base_import.py b/addons/base_import/models/base_import.py
index 9fc3feff1bd..9094bbabf16 100644
--- a/addons/base_import/models/base_import.py
+++ b/addons/base_import/models/base_import.py
@@ -236,7 +236,7 @@ class Import(models.TransientModel):
try:
return getattr(self, '_read_' + file_extension)(options)
except Exception:
- _logger.warn("Failed to read file '%s' (transient id %d) using guessed mimetype %s", self.file_name or '<unknown>', self.id, mimetype)
+ _logger.warning("Failed to read file '%s' (transient id %d) using guessed mimetype %s", self.file_name or '<unknown>', self.id, mimetype)
# try reading with user-provided mimetype
(file_extension, handler, req) = FILE_TYPE_DICT.get(self.file_type, (None, None, None))
@@ -244,7 +244,7 @@ class Import(models.TransientModel):
try:
return getattr(self, '_read_' + file_extension)(options)
except Exception:
- _logger.warn("Failed to read file '%s' (transient id %d) using user-provided mimetype %s", self.file_name or '<unknown>', self.id, self.file_type)
+ _logger.warning("Failed to read file '%s' (transient id %d) using user-provided mimetype %s", self.file_name or '<unknown>', self.id, self.file_type)
# fallback on file extensions as mime types can be unreliable (e.g.
# software setting incorrect mime types, or non-installed software
@@ -255,7 +255,7 @@ class Import(models.TransientModel):
try:
return getattr(self, '_read_' + ext[1:])(options)
except Exception:
- _logger.warn("Failed to read file '%s' (transient id %s) using file extension", self.file_name, self.id)
+ _logger.warning("Failed to read file '%s' (transient id %s) using file extension", self.file_name, self.id)
if req:
raise ImportError(_("Unable to load \"{extension}\" file: requires Python module \"{modname}\"").format(extension=file_extension, modname=req))
diff --git a/addons/base_import_module/models/base_import_module.py b/addons/base_import_module/models/base_import_module.py
index 84510330ab6..985f3e45a7b 100644
--- a/addons/base_import_module/models/base_import_module.py
+++ b/addons/base_import_module/models/base_import_module.py
@@ -17,7 +17,7 @@ class BaseImportModule(models.TransientModel):
def import_module(self):
self.ensure_one()
IrModule = self.env['ir.module.module']
- zip_data = base64.decodestring(self.module_file)
+ zip_data = base64.decodebytes(self.module_file)
fp = BytesIO()
fp.write(zip_data)
res = IrModule.import_zipfile(fp, force=self.force)
diff --git a/addons/calendar/tests/test_calendar.py b/addons/calendar/tests/test_calendar.py
index 6b7d7f1a550..ba7d3e840a2 100644
--- a/addons/calendar/tests/test_calendar.py
+++ b/addons/calendar/tests/test_calendar.py
@@ -159,7 +159,7 @@ class TestCalendar(TransactionCase):
(str(m.start_datetime), str(m.stop_datetime)),
('2017-07-12 14:30:00', u'2017-07-12 15:00:00'),
)
- self.assertEquals(
+ self.assertEqual(
(str(records.start_datetime), str(records.stop_datetime)),
(u'2017-07-10 15:30:00', u'2017-07-10 16:00:00'),
)
diff --git a/addons/crm/tests/test_crm_pls.py b/addons/crm/tests/test_crm_pls.py
index ef3a7cdba15..304bdce8868 100644
--- a/addons/crm/tests/test_crm_pls.py
+++ b/addons/crm/tests/test_crm_pls.py
@@ -78,5 +78,5 @@ class TestCRMPLS(TransactionCase):
# As the cron is computing and writing in SQL queries, we need to invalidate the cache
leads.invalidate_cache()
- self.assertEquals(tools.float_compare(leads[3].automated_probability, 33.49, 2), 0)
- self.assertEquals(tools.float_compare(leads[7].automated_probability, 7.74, 2), 0)
+ self.assertEqual(tools.float_compare(leads[3].automated_probability, 33.49, 2), 0)
+ self.assertEqual(tools.float_compare(leads[7].automated_probability, 7.74, 2), 0)
diff --git a/addons/delivery/tests/test_packing_delivery.py b/addons/delivery/tests/test_packing_delivery.py
index 84e694a530d..89630390cd4 100644
--- a/addons/delivery/tests/test_packing_delivery.py
+++ b/addons/delivery/tests/test_packing_delivery.py
@@ -66,9 +66,9 @@ class TestPacking(TestPacking):
pack_action_model = pack_action['res_model']
# We make sure the correct action was returned
- self.assertEquals(pack_action_model, 'choose.delivery.package')
+ self.assertEqual(pack_action_model, 'choose.delivery.package')
# We instanciate the wizard with the context of the action and check that the
# default weight was set.
pack_wiz = self.env['choose.delivery.package'].with_context(pack_action_ctx).create({})
- self.assertEquals(pack_wiz.shipping_weight, 13.5)
+ self.assertEqual(pack_wiz.shipping_weight, 13.5)
diff --git a/addons/hr_contract/tests/test_auto_status.py b/addons/hr_contract/tests/test_auto_status.py
index fcff8621bb9..847e6fb9ca0 100644
--- a/addons/hr_contract/tests/test_auto_status.py
+++ b/addons/hr_contract/tests/test_auto_status.py
@@ -13,7 +13,7 @@ class TestHrContracts(TestContractBase):
self.test_contract = dict(name='Test', wage=1, employee_id=self.employee.id, state='open')
def test_employee_contractwarning(self):
- self.assertEquals(self.employee.contract_warning, True)
+ self.assertEqual(self.employee.contract_warning, True)
def apply_cron(self):
self.env.ref('hr_contract.ir_cron_data_contract_update_state').method_direct_trigger()
@@ -22,15 +22,15 @@ class TestHrContracts(TestContractBase):
self.test_contract.update(dict(date_end=datetime.now() + relativedelta(days=100)))
self.contract = self.contracts.create(self.test_contract)
self.apply_cron()
- self.assertEquals(self.contract.state, 'open')
- self.assertEquals(self.contract.kanban_state, 'normal')
- self.assertEquals(self.employee.contract_warning, False)
+ self.assertEqual(self.contract.state, 'open')
+ self.assertEqual(self.contract.kanban_state, 'normal')
+ self.assertEqual(self.employee.contract_warning, False)
self.test_contract.update(dict(date_end=datetime.now() + relativedelta(days=5)))
self.contract.write(self.test_contract)
self.apply_cron()
- self.assertEquals(self.contract.state, 'open')
- self.assertEquals(self.contract.kanban_state, 'blocked')
+ self.assertEqual(self.contract.state, 'open')
+ self.assertEqual(self.contract.kanban_state, 'blocked')
self.test_contract.update({
'date_start': datetime.now() + relativedelta(days=-50),
@@ -40,15 +40,15 @@ class TestHrContracts(TestContractBase):
})
self.contract.write(self.test_contract)
self.apply_cron()
- self.assertEquals(self.contract.state, 'close')
+ self.assertEqual(self.contract.state, 'close')
def test_contract_pending_visa_expire(self):
self.employee.visa_expire = date.today() + relativedelta(days=30)
self.test_contract.update(dict(date_end=False))
self.contract = self.contracts.create(self.test_contract)
self.apply_cron()
- self.assertEquals(self.contract.state, 'open')
- self.assertEquals(self.contract.kanban_state, 'blocked')
+ self.assertEqual(self.contract.state, 'open')
+ self.assertEqual(self.contract.kanban_state, 'blocked')
self.employee.visa_expire = date.today() + relativedelta(days=-5)
self.test_contract.update({
@@ -58,10 +58,10 @@ class TestHrContracts(TestContractBase):
})
self.contract.write(self.test_contract)
self.apply_cron()
- self.assertEquals(self.contract.state, 'close')
+ self.assertEqual(self.contract.state, 'close')
def test_contract_start_date(self):
self.test_contract.update(dict(date_start=datetime.now(), state='draft', kanban_state='done'))
self.contract = self.contracts.create(self.test_contract)
self.apply_cron()
- self.assertEquals(self.contract.state, 'open')
+ self.assertEqual(self.contract.state, 'open')
diff --git a/addons/hr_expense/tests/test_expenses.py b/addons/hr_expense/tests/test_expenses.py
index c4958f41108..809ed23079c 100644
--- a/addons/hr_expense/tests/test_expenses.py
+++ b/addons/hr_expense/tests/test_expenses.py
@@ -44,39 +44,39 @@ class TestAccountEntry(TestExpenseCommon):
})
expense_line._onchange_product_id()
# State should default to draft
- self.assertEquals(expense.state, 'draft', 'Expense should be created in Draft state')
+ self.assertEqual(expense.state, 'draft', 'Expense should be created in Draft state')
# Submitted to Manager
expense.action_submit_sheet()
- self.assertEquals(expense.state, 'submit', 'Expense is not in Reported state')
+ self.assertEqual(expense.state, 'submit', 'Expense is not in Reported state')
# Approve
expense.approve_expense_sheets()
- self.assertEquals(expense.state, 'approve', 'Expense is not in Approved state')
+ self.assertEqual(expense.state, 'approve', 'Expense is not in Approved state')
# Create Expense Entries
expense.action_sheet_move_create()
- self.assertEquals(expense.state, 'post', 'Expense is not in Waiting Payment state')
+ self.assertEqual(expense.state, 'post', 'Expense is not in Waiting Payment state')
self.assertTrue(expense.account_move_id.id, 'Expense Journal Entry is not created')
# [(line.debit, line.credit, line.tax_line_id.id) for line in self.expense.expense_line_ids.account_move_id.line_ids]
# should git this result [(0.0, 700.0, False), (63.64, 0.0, 179), (636.36, 0.0, False)]
for line in expense.account_move_id.line_ids:
if line.credit:
- self.assertAlmostEquals(line.credit, 700.00)
- self.assertEquals(len(line.analytic_line_ids), 0, "The credit move line should not have analytic lines")
+ self.assertAlmostEqual(line.credit, 700.00)
+ self.assertEqual(len(line.analytic_line_ids), 0, "The credit move line should not have analytic lines")
self.assertFalse(line.product_id, "Product of credit move line should be false")
else:
if not line.tax_line_id == self.tax:
- self.assertAlmostEquals(line.debit, 636.36)
- self.assertEquals(len(line.analytic_line_ids), 1, "The debit move line should have 1 analytic lines")
- self.assertEquals(line.product_id, self.product_expense, "Product of debit move line should be the one from the expense")
+ self.assertAlmostEqual(line.debit, 636.36)
+ self.assertEqual(len(line.analytic_line_ids), 1, "The debit move line should have 1 analytic lines")
+ self.assertEqual(line.product_id, self.product_expense, "Product of debit move line should be the one from the expense")
else:
- self.assertAlmostEquals(line.debit, 63.64)
- self.assertEquals(len(line.analytic_line_ids), 0, "The tax move line should not have analytic lines")
+ self.assertAlmostEqual(line.debit, 63.64)
+ self.assertEqual(len(line.analytic_line_ids), 0, "The tax move line should not have analytic lines")
self.assertFalse(line.product_id, "Product of tax move line should be false")
- self.assertEquals(self.analytic_account.line_ids, expense.account_move_id.mapped('line_ids.analytic_line_ids'))
- self.assertEquals(len(self.analytic_account.line_ids), 1, "Analytic Account should have only one line")
- self.assertAlmostEquals(self.analytic_account.line_ids[0].amount, -636.36, "Amount on the only AAL is wrong")
- self.assertEquals(self.analytic_account.line_ids[0].product_id, self.product_expense, "Product of AAL should be the one from the expense")
+ self.assertEqual(self.analytic_account.line_ids, expense.account_move_id.mapped('line_ids.analytic_line_ids'))
+ self.assertEqual(len(self.analytic_account.line_ids), 1, "Analytic Account should have only one line")
+ self.assertAlmostEqual(self.analytic_account.line_ids[0].amount, -636.36, "Amount on the only AAL is wrong")
+ self.assertEqual(self.analytic_account.line_ids[0].product_id, self.product_expense, "Product of AAL should be the one from the expense")
def test_account_entry_multi_currency(self):
""" Checking accounting move entries and analytic entries when submitting expense. With
@@ -108,42 +108,42 @@ class TestAccountEntry(TestExpenseCommon):
})
expense_line._onchange_product_id()
# State should default to draft
- self.assertEquals(expense.state, 'draft', 'Expense should be created in Draft state')
+ self.assertEqual(expense.state, 'draft', 'Expense should be created in Draft state')
# Submitted to Manager
expense.action_submit_sheet()
- self.assertEquals(expense.state, 'submit', 'Expense is not in Reported state')
+ self.assertEqual(expense.state, 'submit', 'Expense is not in Reported state')
# Approve
expense.approve_expense_sheets()
- self.assertEquals(expense.state, 'approve', 'Expense is not in Approved state')
+ self.assertEqual(expense.state, 'approve', 'Expense is not in Approved state')
# Create Expense Entries
expense.action_sheet_move_create()
- self.assertEquals(expense.state, 'post', 'Expense is not in Waiting Payment state')
+ self.assertEqual(expense.state, 'post', 'Expense is not in Waiting Payment state')
self.assertTrue(expense.account_move_id.id, 'Expense Journal Entry is not created')
# Should get this result [(0.0, 350.0, -700.0), (318.18, 0.0, 636.36), (31.82, 0.0, 63.64)]
for line in expense.account_move_id.line_ids:
if line.credit:
- self.assertAlmostEquals(line.credit, 350.0)
- self.assertAlmostEquals(line.amount_currency, -700.0)
- self.assertEquals(len(line.analytic_line_ids), 0, "The credit move line should not have analytic lines")
+ self.assertAlmostEqual(line.credit, 350.0)
+ self.assertAlmostEqual(line.amount_currency, -700.0)
+ self.assertEqual(len(line.analytic_line_ids), 0, "The credit move line should not have analytic lines")
self.assertFalse(line.product_id, "Product of credit move line should be false")
else:
if not line.tax_line_id == self.tax:
- self.assertAlmostEquals(line.debit, 318.18)
- self.assertAlmostEquals(line.amount_currency, 636.36)
- self.assertEquals(len(line.analytic_line_ids), 1, "The debit move line should have 1 analytic lines")
- self.assertEquals(line.product_id, self.product_expense, "Product of debit move line should be the one from the expense")
+ self.assertAlmostEqual(line.debit, 318.18)
+ self.assertAlmostEqual(line.amount_currency, 636.36)
+ self.assertEqual(len(line.analytic_line_ids), 1, "The debit move line should have 1 analytic lines")
+ self.assertEqual(line.product_id, self.product_expense, "Product of debit move line should be the one from the expense")
else:
- self.assertAlmostEquals(line.debit, 31.82)
- self.assertAlmostEquals(line.amount_currency, 63.64)
- self.assertEquals(len(line.analytic_line_ids), 0, "The tax move line should not have analytic lines")
+ self.assertAlmostEqual(line.debit, 31.82)
+ self.assertAlmostEqual(line.amount_currency, 63.64)
+ self.assertEqual(len(line.analytic_line_ids), 0, "The tax move line should not have analytic lines")
self.assertFalse(line.product_id, "Product of tax move line should be false")
- self.assertEquals(self.analytic_account.line_ids, expense.account_move_id.mapped('line_ids.analytic_line_ids'))
- self.assertEquals(len(self.analytic_account.line_ids), 1, "Analytic Account should have only one line")
- self.assertAlmostEquals(self.analytic_account.line_ids[0].amount, -318.18, "Amount on the only AAL is wrong")
- self.assertAlmostEquals(self.analytic_account.line_ids[0].currency_id, self.env.company.currency_id, "Currency on the only AAL is wrong")
- self.assertEquals(self.analytic_account.line_ids[0].product_id, self.product_expense, "Product of AAL should be the one from the expense")
+ self.assertEqual(self.analytic_account.line_ids, expense.account_move_id.mapped('line_ids.analytic_line_ids'))
+ self.assertEqual(len(self.analytic_account.line_ids), 1, "Analytic Account should have only one line")
+ self.assertAlmostEqual(self.analytic_account.line_ids[0].amount, -318.18, "Amount on the only AAL is wrong")
+ self.assertAlmostEqual(self.analytic_account.line_ids[0].currency_id, self.env.company.currency_id, "Currency on the only AAL is wrong")
+ self.assertEqual(self.analytic_account.line_ids[0].product_id, self.product_expense, "Product of AAL should be the one from the expense")
def test_expense_from_email(self):
user_demo = self.env.ref('base.user_demo')
@@ -161,9 +161,9 @@ class TestAccountEntry(TestExpenseCommon):
expense = self.env['hr.expense'].message_new(message_parsed)
air_ticket = self.env.ref("hr_expense.air_ticket")
- self.assertEquals(expense.product_id, air_ticket)
- self.assertEquals(expense.tax_ids.ids, [])
- self.assertEquals(expense.total_amount, 9876.0)
+ self.assertEqual(expense.product_id, air_ticket)
+ self.assertEqual(expense.tax_ids.ids, [])
+ self.assertEqual(expense.total_amount, 9876.0)
self.assertTrue(expense.employee_id in user_demo.employee_ids)
def test_expense_from_email_without_product(self):
@@ -183,8 +183,8 @@ class TestAccountEntry(TestExpenseCommon):
air_ticket = self.env.ref("hr_expense.air_ticket")
self.assertFalse(expense.product_id, "No product should be linked")
- self.assertEquals(expense.tax_ids.ids, [])
- self.assertEquals(expense.total_amount, 9876.0)
+ self.assertEqual(expense.tax_ids.ids, [])
+ self.assertEqual(expense.total_amount, 9876.0)
self.assertTrue(expense.employee_id in user_demo.employee_ids)
def test_partial_payment_multiexpense(self):
@@ -222,7 +222,7 @@ class TestAccountEntry(TestExpenseCommon):
exp_move_lines = expense.account_move_id.line_ids
payable_move_lines = exp_move_lines.filtered(lambda l: l.account_id.internal_type == 'payable')
- self.assertEquals(len(payable_move_lines), 2)
+ self.assertEqual(len(payable_move_lines), 2)
WizardRegister = self.env["hr.expense.sheet.register.payment.wizard"].with_context(
active_model=expense._name, active_id=expense.id, active_ids=expense.ids
@@ -237,7 +237,7 @@ class TestAccountEntry(TestExpenseCommon):
exp_move_lines = expense.account_move_id.line_ids
payable_move_lines = exp_move_lines.filtered(lambda l: l.account_id.internal_type == 'payable')
- self.assertEquals(len(payable_move_lines.filtered(lambda l: l.reconciled)), 1)
+ self.assertEqual(len(payable_move_lines.filtered(lambda l: l.reconciled)), 1)
register_pay2 = WizardRegister.create({
'journal_id': bank_journal.id,
@@ -247,10 +247,10 @@ class TestAccountEntry(TestExpenseCommon):
register_pay2.expense_post_payment()
exp_move_lines = expense.account_move_id.line_ids
payable_move_lines = exp_move_lines.filtered(lambda l: l.account_id.internal_type == 'payable')
- self.assertEquals(len(payable_move_lines.filtered(lambda l: l.reconciled)), 2)
+ self.assertEqual(len(payable_move_lines.filtered(lambda l: l.reconciled)), 2)
full_reconcile = payable_move_lines.mapped('full_reconcile_id')
- self.assertEquals(len(full_reconcile), 1)
+ self.assertEqual(len(full_reconcile), 1)
class TestExpenseRights(TestExpenseCommon):
diff --git a/addons/hr_expense/tests/test_expenses_mail_subjects.py b/addons/hr_expense/tests/test_expenses_mail_subjects.py
index 134726e32cf..0500050a39e 100644
--- a/addons/hr_expense/tests/test_expenses_mail_subjects.py
+++ b/addons/hr_expense/tests/test_expenses_mail_subjects.py
@@ -31,16 +31,16 @@ class TestExpenseSubject(TestExpenseCommon):
subject = 'EXP-PHONE bar %s1205.91 electro wizard' % (company_currency.symbol,)
product, price, currency_id, expense_description = parse_subject(subject, company_currency)
- self.assertEquals(expense_description, 'bar electro wizard', "Should be remove price and product from subject")
- self.assertAlmostEquals(price, 1205.91, "Price is not fetched correctly")
- self.assertEquals(currency_id, company_currency, "Should fetch currency correctly")
- self.assertEquals(product, self.product_expense, "Should fetch product correctly")
+ self.assertEqual(expense_description, 'bar electro wizard', "Should be remove price and product from subject")
+ self.assertAlmostEqual(price, 1205.91, "Price is not fetched correctly")
+ self.assertEqual(currency_id, company_currency, "Should fetch currency correctly")
+ self.assertEqual(product, self.product_expense, "Should fetch product correctly")
# subject having other currency then company currency, it should ignore other currency then company currency
subject = 'foo bar %s1406.91 royal giant' % (alternate_currency.symbol,)
product, price, currency_id, expense_description = parse_subject(subject, company_currency)
- self.assertEquals(expense_description, 'foo bar %s royal giant' % (alternate_currency.symbol,), "Should be remove price and product from subject but not currency symbol")
- self.assertEquals(currency_id, company_currency, "Should fetch currency correctly")
+ self.assertEqual(expense_description, 'foo bar %s royal giant' % (alternate_currency.symbol,), "Should be remove price and product from subject but not currency symbol")
+ self.assertEqual(currency_id, company_currency, "Should fetch currency correctly")
# With Multi currency access
group_multi_currency = self.env.ref('base.group_multi_currency')
@@ -50,55 +50,55 @@ class TestExpenseSubject(TestExpenseCommon):
subject = 'EXP-PHONE foo bar %s2205.92 elite barbarians' % (company_currency.symbol,) # with product code at start
product, price, currency_id, expense_description = parse_subject(subject, company_currency)
- self.assertEquals(expense_description, 'foo bar elite barbarians', "Should be remove price and product from subject")
- self.assertAlmostEquals(price, 2205.92, "Price is not fetched correctly")
- self.assertEquals(currency_id, company_currency, "Should fetch currency correctly")
- self.assertEquals(product, self.product_expense, "Should fetch product correctly")
+ self.assertEqual(expense_description, 'foo bar elite barbarians', "Should be remove price and product from subject")
+ self.assertAlmostEqual(price, 2205.92, "Price is not fetched correctly")
+ self.assertEqual(currency_id, company_currency, "Should fetch currency correctly")
+ self.assertEqual(product, self.product_expense, "Should fetch product correctly")
# subject having other currency then company currency, it should accept other currency because multi currency is activated
subject = 'EXP-PHONE %s2510.90 chhota bheem' % (alternate_currency.symbol,)
product, price, currency_id, expense_description = parse_subject(subject, company_currency | alternate_currency)
- self.assertEquals(expense_description, 'chhota bheem', "Should be remove price and product from subject but not currency symbol")
- self.assertAlmostEquals(price, 2510.90, "Price is not fetched correctly")
- self.assertEquals(currency_id, alternate_currency, "Should fetch currency correctly")
- self.assertEquals(product, self.product_expense, "Should fetch product correctly")
+ self.assertEqual(expense_description, 'chhota bheem', "Should be remove price and product from subject but not currency symbol")
+ self.assertAlmostEqual(price, 2510.90, "Price is not fetched correctly")
+ self.assertEqual(currency_id, alternate_currency, "Should fetch currency correctly")
+ self.assertEqual(product, self.product_expense, "Should fetch product correctly")
# subject without product and currency, should take company currency and default product
subject = 'foo bar 109.96 spear goblins'
product, price, currency_id, expense_description = parse_subject(subject, company_currency | alternate_currency)
- self.assertEquals(expense_description, 'foo bar spear goblins', "Should remove price")
- self.assertAlmostEquals(price, 109.96, "Price is not fetched correctly")
+ self.assertEqual(expense_description, 'foo bar spear goblins', "Should remove price")
+ self.assertAlmostEqual(price, 109.96, "Price is not fetched correctly")
self.assertIn(currency_id, company_currency | alternate_currency, "Should fetch company currency")
self.assertFalse(product, "Should not have parsed any product")
# subject with currency symbol at end
subject = 'EXP-PHONE foo bar 2910.94%s inferno dragon' % (company_currency.symbol,)
product, price, currency_id, expense_description = parse_subject(subject, company_currency | alternate_currency)
- self.assertEquals(expense_description, 'foo bar inferno dragon', "Should be remove price and product from subject")
- self.assertAlmostEquals(price, 2910.94, "Price is not fetched correctly")
- self.assertEquals(currency_id, company_currency, "Should fetch currency correctly")
- self.assertEquals(product, self.product_expense, "Should fetch product correctly")
+ self.assertEqual(expense_description, 'foo bar inferno dragon', "Should be remove price and product from subject")
+ self.assertAlmostEqual(price, 2910.94, "Price is not fetched correctly")
+ self.assertEqual(currency_id, company_currency, "Should fetch currency correctly")
+ self.assertEqual(product, self.product_expense, "Should fetch product correctly")
# subject with no amount and product
subject = 'foo bar mega knight'
product, price, currency_id, expense_description = parse_subject(subject, company_currency | alternate_currency)
- self.assertEquals(expense_description, 'foo bar mega knight', "Should be same as subject")
- self.assertAlmostEquals(price, 0.0, "Price is not fetched correctly")
+ self.assertEqual(expense_description, 'foo bar mega knight', "Should be same as subject")
+ self.assertAlmostEqual(price, 0.0, "Price is not fetched correctly")
self.assertIn(currency_id, company_currency | alternate_currency, "Should fetch currency correctly")
self.assertFalse(product, "Should fetch product correctly")
# price with a comma
subject = 'foo bar 291,56%s mega knight' % (company_currency.symbol,)
product, price, currency_id, expense_description = parse_subject(subject, company_currency | alternate_currency)
- self.assertAlmostEquals(price, 291.56, "Price is not fetched correctly")
- self.assertEquals(currency_id, company_currency, "Should fetch currency correctly")
+ self.assertAlmostEqual(price, 291.56, "Price is not fetched correctly")
+ self.assertEqual(currency_id, company_currency, "Should fetch currency correctly")
# price without decimals
subject = 'foo bar 291%s mega knight' % (company_currency.symbol,)
product, price, currency_id, expense_description = parse_subject(subject, company_currency | alternate_currency)
- self.assertAlmostEquals(price, 291.0, "Price is not fetched correctly")
+ self.assertAlmostEqual(price, 291.0, "Price is not fetched correctly")
subject = 'EXP-PHONE 2 foo bar 291.5%s mega knight' % (company_currency.symbol,)
product, price, currency_id, expense_description = parse_subject(subject, company_currency | alternate_currency)
print(price)
- self.assertAlmostEquals(price, 291.5, "Price is not fetched correctly")
+ self.assertAlmostEqual(price, 291.5, "Price is not fetched correctly")
diff --git a/addons/hr_recruitment/tests/test_recruitment_process.py b/addons/hr_recruitment/tests/test_recruitment_process.py
index 03f411bb371..0eebc5fe5f8 100644
--- a/addons/hr_recruitment/tests/test_recruitment_process.py
+++ b/addons/hr_recruitment/tests/test_recruitment_process.py
@@ -33,13 +33,13 @@ class TestRecruitmentProcess(common.TransactionCase):
('name', '=', 'resume.pdf'),
('res_model', '=', self.env['hr.applicant']._name),
('res_id', '=', applicant.id)])
- self.assertEquals(applicant.name, 'Application for the post of Jr.application Programmer.', 'Applicant name does not match.')
- self.assertEquals(applicant.stage_id, self.env.ref('hr_recruitment.stage_job1'),
+ self.assertEqual(applicant.name, 'Application for the post of Jr.application Programmer.', 'Applicant name does not match.')
+ self.assertEqual(applicant.stage_id, self.env.ref('hr_recruitment.stage_job1'),
"Stage should be 'Initial qualification' and is '%s'." % (applicant.stage_id.name))
self.assertTrue(resume_ids, 'Resume is not attached.')
# I assign the Job position to the applicant
applicant.write({'job_id': self.env.ref('hr.job_developer').id})
# I schedule meeting with applicant for interview.
applicant_meeting = applicant.action_makeMeeting()
- self.assertEquals(applicant_meeting['context']['default_name'], 'Application for the post of Jr.application Programmer.',
+ self.assertEqual(applicant_meeting['context']['default_name'], 'Application for the post of Jr.application Programmer.',
'Applicant name does not match.')
diff --git a/addons/hr_timesheet/tests/test_timesheet.py b/addons/hr_timesheet/tests/test_timesheet.py
index c2bfab9e8bd..fed0c53b953 100644
--- a/addons/hr_timesheet/tests/test_timesheet.py
+++ b/addons/hr_timesheet/tests/test_timesheet.py
@@ -89,10 +89,10 @@ class TestTimesheet(TestCommonTimesheet):
'name': 'my first timesheet',
'unit_amount': 4,
})
- self.assertEquals(timesheet1.account_id, self.project_customer.analytic_account_id, 'Analytic account should be the same as the project')
- self.assertEquals(timesheet1.employee_id, self.empl_employee, 'Employee should be the one of the current user')
- self.assertEquals(timesheet1.partner_id, self.task1.partner_id, 'Customer of task should be the same of the one set on new timesheet')
- self.assertEquals(timesheet1.product_uom_id, timesheet_uom, "The UoM of the timesheet should be the one set on the company of the analytic account.")
+ self.assertEqual(timesheet1.account_id, self.project_customer.analytic_account_id, 'Analytic account should be the same as the project')
+ self.assertEqual(timesheet1.employee_id, self.empl_employee, 'Employee should be the one of the current user')
+ self.assertEqual(timesheet1.partner_id, self.task1.partner_id, 'Customer of task should be the same of the one set on new timesheet')
+ self.assertEqual(timesheet1.product_uom_id, timesheet_uom, "The UoM of the timesheet should be the one set on the company of the analytic account.")
# employee 1 cannot log timesheet for employee 2
with self.assertRaises(AccessError):
@@ -113,8 +113,8 @@ class TestTimesheet(TestCommonTimesheet):
'employee_id': self.empl_employee2.id,
})
timesheet3._onchange_employee_id()
- self.assertEquals(timesheet3.user_id, self.user_employee2, 'Timesheet user should be the one linked to the given employee')
- self.assertEquals(timesheet3.product_uom_id, timesheet_uom, "The UoM of the timesheet 3 should be the one set on the company of the analytic account.")
+ self.assertEqual(timesheet3.user_id, self.user_employee2, 'Timesheet user should be the one linked to the given employee')
+ self.assertEqual(timesheet3.product_uom_id, timesheet_uom, "The UoM of the timesheet 3 should be the one set on the company of the analytic account.")
# employee 1 log some timesheet on project (no task)
timesheet4 = Timesheet.with_user(self.user_employee).create({
@@ -122,7 +122,7 @@ class TestTimesheet(TestCommonTimesheet):
'name': 'my first timesheet',
'unit_amount': 4,
})
- self.assertEquals(timesheet4.partner_id, self.project_customer.partner_id, 'Customer of new timesheet should be the same of the one set project (since no task on timesheet)')
+ self.assertEqual(timesheet4.partner_id, self.project_customer.partner_id, 'Customer of new timesheet should be the same of the one set project (since no task on timesheet)')
def test_log_access_rights(self):
""" Test access rights : user can update its own timesheets only, and manager can change all """
@@ -145,7 +145,7 @@ class TestTimesheet(TestCommonTimesheet):
'unit_amount': 8,
'employee_id': self.empl_employee2.id,
})
- self.assertEquals(timesheet1.user_id, self.user_employee2, 'Changing timesheet employee should change the related user')
+ self.assertEqual(timesheet1.user_id, self.user_employee2, 'Changing timesheet employee should change the related user')
def test_create_unlink_project(self):
""" Check project creation, and if necessary the analytic account generated when project should track time. """
@@ -165,9 +165,9 @@ class TestTimesheet(TestCommonTimesheet):
})
self.assertTrue(tracked_project.analytic_account_id, "A time-tracked project should generate an analytic account")
self.assertTrue(tracked_project.analytic_account_id.active, "A time-tracked project should generate an active analytic account")
- self.assertEquals(tracked_project.partner_id, tracked_project.analytic_account_id.partner_id, "The generated AA should have the same partner as the project")
- self.assertEquals(tracked_project.name, tracked_project.analytic_account_id.name, "The generated AA should have the same name as the project")
- self.assertEquals(tracked_project.analytic_account_id.project_count, 1, "The generated AA should be linked to the project")
+ self.assertEqual(tracked_project.partner_id, tracked_project.analytic_account_id.partner_id, "The generated AA should have the same partner as the project")
+ self.assertEqual(tracked_project.name, tracked_project.analytic_account_id.name, "The generated AA should have the same name as the project")
+ self.assertEqual(tracked_project.analytic_account_id.project_count, 1, "The generated AA should be linked to the project")
# create a project without tracking time, but with analytic account
analytic_project = self.env['project.project'].create({
@@ -176,8 +176,8 @@ class TestTimesheet(TestCommonTimesheet):
'partner_id': self.partner.id,
'analytic_account_id': tracked_project.analytic_account_id.id,
})
- self.assertNotEquals(analytic_project.name, tracked_project.analytic_account_id.name, "The name of the associated AA can be different from the project")
- self.assertEquals(tracked_project.analytic_account_id.project_count, 2, "The AA should be linked to 2 project")
+ self.assertNotEqual(analytic_project.name, tracked_project.analytic_account_id.name, "The name of the associated AA can be different from the project")
+ self.assertEqual(tracked_project.analytic_account_id.project_count, 2, "The AA should be linked to 2 project")
# analytic linked to projects containing tasks can not be removed
task = self.env['project.task'].create({
@@ -211,9 +211,9 @@ class TestTimesheet(TestCommonTimesheet):
timesheet_count1 = Timesheet.search_count([('project_id', '=', self.project_customer.id)])
timesheet_count2 = Timesheet.search_count([('project_id', '=', self.project_customer2.id)])
- self.assertEquals(timesheet_count1, 1, "One timesheet in project 1")
- self.assertEquals(timesheet_count2, 0, "No timesheet in project 2")
- self.assertEquals(len(self.task1.timesheet_ids), 1, "The timesheet should be linked to task 1")
+ self.assertEqual(timesheet_count1, 1, "One timesheet in project 1")
+ self.assertEqual(timesheet_count2, 0, "No timesheet in project 2")
+ self.assertEqual(len(self.task1.timesheet_ids), 1, "The timesheet should be linked to task 1")
# change project of task 1
self.task1.write({
@@ -222,9 +222,9 @@ class TestTimesheet(TestCommonTimesheet):
timesheet_count1 = Timesheet.search_count([('project_id', '=', self.project_customer.id)])
timesheet_count2 = Timesheet.search_count([('project_id', '=', self.project_customer2.id)])
- self.assertEquals(timesheet_count1, 1, "Still one timesheet in project 1")
- self.assertEquals(timesheet_count2, 0, "No timesheet in project 2")
- self.assertEquals(len(self.task1.timesheet_ids), 1, "The timesheet still should be linked to task 1")
+ self.assertEqual(timesheet_count1, 1, "Still one timesheet in project 1")
+ self.assertEqual(timesheet_count2, 0, "No timesheet in project 2")
+ self.assertEqual(len(self.task1.timesheet_ids), 1, "The timesheet still should be linked to task 1")
# it is forbidden to set a task with timesheet without project
with self.assertRaises(UserError):
diff --git a/addons/l10n_be_edi/tests/test_ubl.py b/addons/l10n_be_edi/tests/test_ubl.py
index 0fa29858416..37ef7bd9984 100644
--- a/addons/l10n_be_edi/tests/test_ubl.py
+++ b/addons/l10n_be_edi/tests/test_ubl.py
@@ -20,7 +20,7 @@ class TestUBL(common.TransactionCase):
attachment_id = self.env['ir.attachment'].create({
'name': 'efff_test.xml',
- 'datas': base64.encodestring(xml_file),
+ 'datas': base64.encodebytes(xml_file),
'res_id': invoice.id,
'res_model': 'account.move',
})
diff --git a/addons/l10n_fr_fec/wizard/account_fr_fec.py b/addons/l10n_fr_fec/wizard/account_fr_fec.py
index 8adab17adea..476905a42e2 100644
--- a/addons/l10n_fr_fec/wizard/account_fr_fec.py
+++ b/addons/l10n_fr_fec/wizard/account_fr_fec.py
@@ -357,7 +357,7 @@ class AccountFrFec(models.TransientModel):
suffix = '-NONOFFICIAL'
self.write({
- 'fec_data': base64.encodestring(fecvalue),
+ 'fec_data': base64.encodebytes(fecvalue),
# Filename = <siren>FECYYYYMMDD where YYYMMDD is the closing date
'filename': '%sFEC%s%s.csv' % (company_legal_data['siren'], end_date, suffix),
})
diff --git a/addons/l10n_it_edi/models/account_invoice.py b/addons/l10n_it_edi/models/account_invoice.py
index 2938c6630ff..5c0090165b3 100644
--- a/addons/l10n_it_edi/models/account_invoice.py
+++ b/addons/l10n_it_edi/models/account_invoice.py
@@ -160,7 +160,7 @@ class AccountMove(models.Model):
'name': report_name,
'res_id': invoice.id,
'res_model': invoice._name,
- 'datas': base64.encodestring(data),
+ 'datas': base64.encodebytes(data),
'description': description,
'type': 'binary',
})
diff --git a/addons/l10n_it_edi/models/ir_mail_server.py b/addons/l10n_it_edi/models/ir_mail_server.py
index 51e4a0a23a3..580635dfc3d 100644
--- a/addons/l10n_it_edi/models/ir_mail_server.py
+++ b/addons/l10n_it_edi/models/ir_mail_server.py
@@ -134,7 +134,7 @@ class FetchmailServer(models.Model):
invoice_attachment = self.env['ir.attachment'].create({
'name': att_name,
- 'datas': base64.encodestring(att_content),
+ 'datas': base64.encodebytes(att_content),
'type': 'binary',
})
diff --git a/addons/maintenance/tests/test_maintenance.py b/addons/maintenance/tests/test_maintenance.py
index 82909496691..e4decedb583 100644
--- a/addons/maintenance/tests/test_maintenance.py
+++ b/addons/maintenance/tests/test_maintenance.py
@@ -68,13 +68,13 @@ class TestEquipment(TransactionCase):
assert maintenance_request_01, "Maintenance Request not created"
# I check that Initially maintenance request is in the "New Request" stage
- self.assertEquals(maintenance_request_01.stage_id.id, self.ref('maintenance.stage_0'))
+ self.assertEqual(maintenance_request_01.stage_id.id, self.ref('maintenance.stage_0'))
# I check that change the maintenance_request stage on click statusbar
maintenance_request_01.with_user(self.user).write({'stage_id': self.ref('maintenance.stage_1')})
# I check that maintenance request is in the "In Progress" stage
- self.assertEquals(maintenance_request_01.stage_id.id, self.ref('maintenance.stage_1'))
+ self.assertEqual(maintenance_request_01.stage_id.id, self.ref('maintenance.stage_1'))
def test_20_cron(self):
""" Check the cron creates the necessary preventive maintenance requests"""
diff --git a/addons/maintenance/tests/test_maintenance_multicompany.py b/addons/maintenance/tests/test_maintenance_multicompany.py
index f535e7f4ce3..7c615921f4b 100644
--- a/addons/maintenance/tests/test_maintenance_multicompany.py
+++ b/addons/maintenance/tests/test_maintenance_multicompany.py
@@ -98,8 +98,8 @@ class TestEquipmentMulticompany(TransactionCase):
})
# Check category for user equipment_manager and user
- self.assertEquals(Category.with_user(equipment_manager).with_context(allowed_company_ids=cids).search_count([]), 3)
- self.assertEquals(Category.with_user(user).search_count([]), 2)
+ self.assertEqual(Category.with_user(equipment_manager).with_context(allowed_company_ids=cids).search_count([]), 3)
+ self.assertEqual(Category.with_user(user).search_count([]), 2)
# User should not able to create equipment.
with self.assertRaises(AccessError):
@@ -128,10 +128,10 @@ class TestEquipmentMulticompany(TransactionCase):
'owner_user_id': equipment_manager.id,
})
# Now there are total 2 equipments created and can view by equipment_manager user
- self.assertEquals(Equipment.with_user(equipment_manager).with_context(allowed_company_ids=cids).search_count([]), 2)
+ self.assertEqual(Equipment.with_user(equipment_manager).with_context(allowed_company_ids=cids).search_count([]), 2)
# And there is total 1 equipment can be view by Normal User ( Which user is followers)
- self.assertEquals(Equipment.with_user(user).search_count([]), 1)
+ self.assertEqual(Equipment.with_user(user).search_count([]), 1)
# create an equipment team BY user
with self.assertRaises(AccessError):
@@ -171,5 +171,5 @@ class TestEquipmentMulticompany(TransactionCase):
})
# Now here is total 1 maintenance request can be view by Normal User
- self.assertEquals(MaintenanceRequest.with_user(equipment_manager).with_context(allowed_company_ids=cids).search_count([]), 2)
- self.assertEquals(MaintenanceRequest.with_user(user).search_count([]), 1)
+ self.assertEqual(MaintenanceRequest.with_user(equipment_manager).with_context(allowed_company_ids=cids).search_count([]), 2)
+ self.assertEqual(MaintenanceRequest.with_user(user).search_count([]), 1)
diff --git a/addons/mrp/tests/test_procurement.py b/addons/mrp/tests/test_procurement.py
index 1b4f711b856..7c40b0f73d2 100644
--- a/addons/mrp/tests/test_procurement.py
+++ b/addons/mrp/tests/test_procurement.py
@@ -116,7 +116,7 @@ class TestProcurement(TestMrpCommon):
# set the product of `self.bom_1` to this child category
for bom_line_id in self.bom_1.bom_line_ids:
# check that no routes are defined on the product
- self.assertEquals(len(bom_line_id.product_id.route_ids), 0)
+ self.assertEqual(len(bom_line_id.product_id.route_ids), 0)
# set the category of the product to a child category
bom_line_id.product_id.categ_id = child_categ_id
diff --git a/addons/mrp/tests/test_stock.py b/addons/mrp/tests/test_stock.py
index 9a58cdc22cb..c80e2bdf420 100644
--- a/addons/mrp/tests/test_stock.py
+++ b/addons/mrp/tests/test_stock.py
@@ -348,9 +348,9 @@ class TestKitPicking(common.TestMrpCommon):
picking.button_validate()
# We check that the picking has the correct quantities after its move were splitted.
- self.assertEquals(len(picking.move_lines), 7)
+ self.assertEqual(len(picking.move_lines), 7)
for move_line in picking.move_lines:
- self.assertEquals(move_line.quantity_done, self.expected_quantities[move_line.product_id])
+ self.assertEqual(move_line.quantity_done, self.expected_quantities[move_line.product_id])
def test_kit_planned_transfer(self):
""" Make sure a kit is split in the corrects product_qty by components in case of a
@@ -376,6 +376,6 @@ class TestKitPicking(common.TestMrpCommon):
picking.action_confirm()
# We check that the picking has the correct quantities after its move were splitted.
- self.assertEquals(len(picking.move_lines), 7)
+ self.assertEqual(len(picking.move_lines), 7)
for move_line in picking.move_lines:
- self.assertEquals(move_line.product_qty, self.expected_quantities[move_line.product_id])
+ self.assertEqual(move_line.product_qty, self.expected_quantities[move_line.product_id])
diff --git a/addons/mrp/tests/test_warehouse_multistep_manufacturing.py b/addons/mrp/tests/test_warehouse_multistep_manufacturing.py
index 000701be638..7402d2495b3 100644
--- a/addons/mrp/tests/test_warehouse_multistep_manufacturing.py
+++ b/addons/mrp/tests/test_warehouse_multistep_manufacturing.py
@@ -252,6 +252,6 @@ class TestMultistepManufacturingWarehouse(TestMrpCommon):
self.assertEqual(move_stock_postprod.state, 'waiting')
move_stock_preprod._action_cancel()
- self.assertEquals(production_order.state, 'confirmed')
+ self.assertEqual(production_order.state, 'confirmed')
production_order.action_cancel()
self.assertTrue(move_stock_postprod.state, 'cancel')
diff --git a/addons/mrp/tests/test_workorder_operation.py b/addons/mrp/tests/test_workorder_operation.py
index 68635a5bb21..e4efa917e7c 100644
--- a/addons/mrp/tests/test_workorder_operation.py
+++ b/addons/mrp/tests/test_workorder_operation.py
@@ -539,8 +539,8 @@ class TestWorkOrderProcess(TestMrpCommon):
charger_done_move = mo_custom_laptop.move_raw_ids.filtered(lambda x: x.product_id.id == product_charger.id and x.state == 'done')
keybord_done_move = mo_custom_laptop.move_raw_ids.filtered(lambda x: x.product_id.id == product_keybord.id and x.state == 'done')
- self.assertEquals(charger_done_move.product_uom_qty, 12)
- self.assertEquals(keybord_done_move.product_uom_qty, 12)
+ self.assertEqual(charger_done_move.product_uom_qty, 12)
+ self.assertEqual(keybord_done_move.product_uom_qty, 12)
# Produce remaining 4 quantity
# ----------------------------
@@ -552,13 +552,13 @@ class TestWorkOrderProcess(TestMrpCommon):
laptop_lot_002 = self.env['stock.production.lot'].create({'product_id': custom_laptop.id, 'company_id': self.env.company.id})
produce_form.finished_lot_id = laptop_lot_002
product_consume = produce_form.save()
- self.assertEquals(len(product_consume._workorder_line_ids()), 2)
+ self.assertEqual(len(product_consume._workorder_line_ids()), 2)
product_consume._workorder_line_ids()[0].qty_done = 8
product_consume.do_produce()
charger_move = mo_custom_laptop.move_raw_ids.filtered(lambda x: x.product_id.id == product_charger.id and x.state != 'done')
keybord_move = mo_custom_laptop.move_raw_ids.filtered(lambda x: x.product_id.id == product_keybord.id and x.state !='done')
- self.assertEquals(charger_move.quantity_done, 8, "Wrong consumed quantity of %s" % charger_move.product_id.name)
- self.assertEquals(keybord_move.quantity_done, 8, "Wrong consumed quantity of %s" % keybord_move.product_id.name)
+ self.assertEqual(charger_move.quantity_done, 8, "Wrong consumed quantity of %s" % charger_move.product_id.name)
+ self.assertEqual(keybord_move.quantity_done, 8, "Wrong consumed quantity of %s" % keybord_move.product_id.name)
# Post Inventory of production order.
mo_custom_laptop.post_inventory()
@@ -690,7 +690,7 @@ class TestWorkOrderProcess(TestMrpCommon):
produce_form.finished_lot_id = lot_a
product_consume = produce_form.save()
# laptop_lot_002 = self.env['stock.production.lot'].create({'product_id': custom_laptop.id})
- self.assertEquals(len(product_consume._workorder_line_ids()), 2)
+ self.assertEqual(len(product_consume._workorder_line_ids()), 2)
product_consume._workorder_line_ids().filtered(lambda x: x.product_id == product_C).write({'qty_done': 3000})
product_consume._workorder_line_ids().filtered(lambda x: x.product_id == product_B).write({'qty_done': 20})
product_consume.do_produce()
diff --git a/addons/mrp_account/tests/test_bom_price.py b/addons/mrp_account/tests/test_bom_price.py
index c91f6203bca..1273e3ecdba 100644
--- a/addons/mrp_account/tests/test_bom_price.py
+++ b/addons/mrp_account/tests/test_bom_price.py
@@ -178,10 +178,10 @@ class TestBom(common.TransactionCase):
self.assertEqual(self.dining_table.standard_price, 1000, "Initial price of the Product should be 1000")
self.dining_table.button_bom_cost()
# Total cost of Dining Table = (550) + Total cost of operations (125) = 675.0
- self.assertEquals(float_round(self.dining_table.standard_price, precision_digits=2), 675.0, "After computing price from BoM price should be 612.5")
+ self.assertEqual(float_round(self.dining_table.standard_price, precision_digits=2), 675.0, "After computing price from BoM price should be 612.5")
self.Product.browse([self.dining_table.id, self.table_head.id]).action_bom_cost()
# Total cost of Dining Table = (718.75) + Total cost of all operations (125 + 10.42) = 854.17
- self.assertEquals(float_compare(self.dining_table.standard_price, 854.17, precision_digits=2), 0, "After computing price from BoM price should be 786.46")
+ self.assertEqual(float_compare(self.dining_table.standard_price, 854.17, precision_digits=2), 0, "After computing price from BoM price should be 786.46")
def test_01_compute_price_inventory_valuation(self):
"""Test update cost from bom in list view when inventory valuation is real time."""
diff --git a/addons/mrp_subcontracting/tests/test_subcontracting.py b/addons/mrp_subcontracting/tests/test_subcontracting.py
index 029d9e3a71f..148f99e1816 100644
--- a/addons/mrp_subcontracting/tests/test_subcontracting.py
+++ b/addons/mrp_subcontracting/tests/test_subcontracting.py
@@ -46,7 +46,7 @@ class TestSubcontractingFlows(TestMrpSubcontractingCommon):
self.assertEqual(len(mo), 1)
self.assertEqual(len(mo.picking_ids), 0)
wh = picking_receipt.picking_type_id.warehouse_id
- self.assertEquals(mo.picking_type_id, wh.subcontracting_type_id)
+ self.assertEqual(mo.picking_type_id, wh.subcontracting_type_id)
self.assertFalse(mo.picking_type_id.active)
# Create a RR
@@ -64,18 +64,18 @@ class TestSubcontractingFlows(TestMrpSubcontractingCommon):
self.env['procurement.group'].run_scheduler()
picking = self.env['stock.picking'].search([('group_id', '=', pg1.id)])
self.assertEqual(len(picking), 1)
- self.assertEquals(picking.picking_type_id, wh.out_type_id)
+ self.assertEqual(picking.picking_type_id, wh.out_type_id)
picking_receipt.move_lines.quantity_done = 1
picking_receipt.button_validate()
- self.assertEquals(mo.state, 'done')
+ self.assertEqual(mo.state, 'done')
# Available quantities should be negative at the subcontracting location for each components
avail_qty_comp1 = self.env['stock.quant']._get_available_quantity(self.comp1, self.subcontractor_partner1.property_stock_subcontractor, allow_negative=True)
avail_qty_comp2 = self.env['stock.quant']._get_available_quantity(self.comp2, self.subcontractor_partner1.property_stock_subcontractor, allow_negative=True)
avail_qty_finished = self.env['stock.quant']._get_available_quantity(self.finished, wh.lot_stock_id)
- self.assertEquals(avail_qty_comp1, -1)
- self.assertEquals(avail_qty_comp2, -1)
- self.assertEquals(avail_qty_finished, 1)
+ self.assertEqual(avail_qty_comp1, -1)
+ self.assertEqual(avail_qty_comp2, -1)
+ self.assertEqual(avail_qty_finished, 1)
# Ensure returns to subcontractor location
return_form = Form(self.env['stock.return.picking'].with_context(active_id=picking_receipt.id, active_model='stock.picking'))
@@ -126,16 +126,16 @@ class TestSubcontractingFlows(TestMrpSubcontractingCommon):
# Pickings should directly be created
mo = self.env['mrp.production'].search([('bom_id', '=', self.bom.id)])
self.assertEqual(len(mo.picking_ids), 1)
- self.assertEquals(mo.state, 'confirmed')
+ self.assertEqual(mo.state, 'confirmed')
self.assertEqual(len(mo.picking_ids.move_lines), 2)
picking = mo.picking_ids
wh = picking.picking_type_id.warehouse_id
# The picking should be a delivery order
- self.assertEquals(picking.picking_type_id, wh.out_type_id)
+ self.assertEqual(picking.picking_type_id, wh.out_type_id)
- self.assertEquals(mo.picking_type_id, wh.subcontracting_type_id)
+ self.assertEqual(mo.picking_type_id, wh.subcontracting_type_id)
self.assertFalse(mo.picking_type_id.active)
# No manufacturing order for `self.comp2`
@@ -144,15 +144,15 @@ class TestSubcontractingFlows(TestMrpSubcontractingCommon):
picking_receipt.move_lines.quantity_done = 1
picking_receipt.button_validate()
- self.assertEquals(mo.state, 'done')
+ self.assertEqual(mo.state, 'done')
# Available quantities should be negative at the subcontracting location for each components
avail_qty_comp1 = self.env['stock.quant']._get_available_quantity(self.comp1, self.subcontractor_partner1.property_stock_subcontractor, allow_negative=True)
avail_qty_comp2 = self.env['stock.quant']._get_available_quantity(self.comp2, self.subcontractor_partner1.property_stock_subcontractor, allow_negative=True)
avail_qty_finished = self.env['stock.quant']._get_available_quantity(self.finished, wh.lot_stock_id)
- self.assertEquals(avail_qty_comp1, -1)
- self.assertEquals(avail_qty_comp2, -1)
- self.assertEquals(avail_qty_finished, 1)
+ self.assertEqual(avail_qty_comp1, -1)
+ self.assertEqual(avail_qty_comp2, -1)
+ self.assertEqual(avail_qty_finished, 1)
avail_qty_comp1_in_global_location = self.env['stock.quant']._get_available_quantity(self.comp1, self.env.company.subcontracting_location_id, allow_negative=True)
avail_qty_comp2_in_global_location = self.env['stock.quant']._get_available_quantity(self.comp2, self.env.company.subcontracting_location_id, allow_negative=True)
@@ -190,19 +190,19 @@ class TestSubcontractingFlows(TestMrpSubcontractingCommon):
# Pickings should directly be created
mo = self.env['mrp.production'].search([('bom_id', '=', self.bom.id)])
- self.assertEquals(mo.state, 'confirmed')
+ self.assertEqual(mo.state, 'confirmed')
picking_delivery = mo.picking_ids
self.assertEqual(len(picking_delivery), 1)
self.assertEqual(len(picking_delivery.move_lines), 2)
- self.assertEquals(picking_delivery.origin, picking_receipt.name)
- self.assertEquals(picking_delivery.partner_id, picking_receipt.partner_id)
+ self.assertEqual(picking_delivery.origin, picking_receipt.name)
+ self.assertEqual(picking_delivery.partner_id, picking_receipt.partner_id)
# The picking should be a delivery order
wh = picking_receipt.picking_type_id.warehouse_id
- self.assertEquals(mo.picking_ids.picking_type_id, wh.out_type_id)
+ self.assertEqual(mo.picking_ids.picking_type_id, wh.out_type_id)
- self.assertEquals(mo.picking_type_id, wh.subcontracting_type_id)
+ self.assertEqual(mo.picking_type_id, wh.subcontracting_type_id)
self.assertFalse(mo.picking_type_id.active)
# As well as a manufacturing order for `self.comp2`
@@ -210,15 +210,15 @@ class TestSubcontractingFlows(TestMrpSubcontractingCommon):
self.assertEqual(len(comp2mo), 1)
picking_receipt.move_lines.quantity_done = 1
picking_receipt.button_validate()
- self.assertEquals(mo.state, 'done')
+ self.assertEqual(mo.state, 'done')
# Available quantities should be negative at the subcontracting location for each components
avail_qty_comp1 = self.env['stock.quant']._get_available_quantity(self.comp1, self.subcontractor_partner1.property_stock_subcontractor, allow_negative=True)
avail_qty_comp2 = self.env['stock.quant']._get_available_quantity(self.comp2, self.subcontractor_partner1.property_stock_subcontractor, allow_negative=True)
avail_qty_finished = self.env['stock.quant']._get_available_quantity(self.finished, wh.lot_stock_id)
- self.assertEquals(avail_qty_comp1, -1)
- self.assertEquals(avail_qty_comp2, -1)
- self.assertEquals(avail_qty_finished, 1)
+ self.assertEqual(avail_qty_comp1, -1)
+ self.assertEqual(avail_qty_comp2, -1)
+ self.assertEqual(avail_qty_finished, 1)
def test_flow_4(self):
""" Tick "Manufacture" and "MTO" on the components and trigger the
@@ -254,7 +254,7 @@ class TestSubcontractingFlows(TestMrpSubcontractingCommon):
# Pickings should directly be created
mo = self.env['mrp.production'].search([('bom_id', '=', self.bom.id)])
- self.assertEquals(mo.state, 'confirmed')
+ self.assertEqual(mo.state, 'confirmed')
picking_delivery = mo.picking_ids
self.assertFalse(picking_delivery)
@@ -340,10 +340,10 @@ class TestSubcontractingFlows(TestMrpSubcontractingCommon):
mo_pick1 = picking_receipt1.move_lines.mapped('move_orig_ids.production_id')
mo_pick2 = picking_receipt2.move_lines.mapped('move_orig_ids.production_id')
- self.assertEquals(len(mo_pick1), 1)
- self.assertEquals(len(mo_pick2), 1)
- self.assertEquals(mo_pick1.bom_id, self.bom)
- self.assertEquals(mo_pick2.bom_id, bom2)
+ self.assertEqual(len(mo_pick1), 1)
+ self.assertEqual(len(mo_pick2), 1)
+ self.assertEqual(mo_pick1.bom_id, self.bom)
+ self.assertEqual(mo_pick2.bom_id, bom2)
def test_flow_6(self):
""" Extra quantity on the move.
@@ -573,10 +573,10 @@ class TestSubcontractingTracking(TransactionCase):
# Check the created manufacturing order
mo = self.env['mrp.production'].search([('bom_id', '=', self.bom_tracked.id)])
self.assertEqual(len(mo), 1)
- self.assertEquals(mo.state, 'confirmed')
+ self.assertEqual(mo.state, 'confirmed')
self.assertEqual(len(mo.picking_ids), 0)
wh = picking_receipt.picking_type_id.warehouse_id
- self.assertEquals(mo.picking_type_id, wh.subcontracting_type_id)
+ self.assertEqual(mo.picking_type_id, wh.subcontracting_type_id)
self.assertFalse(mo.picking_type_id.active)
# Create a RR
@@ -594,7 +594,7 @@ class TestSubcontractingTracking(TransactionCase):
self.env['procurement.group'].run_scheduler()
picking = self.env['stock.picking'].search([('group_id', '=', pg1.id)])
self.assertEqual(len(picking), 1)
- self.assertEquals(picking.picking_type_id, wh.out_type_id)
+ self.assertEqual(picking.picking_type_id, wh.out_type_id)
lot_id = self.env['stock.production.lot'].create({
'name': 'lot1',
@@ -621,12 +621,12 @@ class TestSubcontractingTracking(TransactionCase):
picking_receipt.move_lines.quantity_done = 1
picking_receipt.move_lines.move_line_ids.lot_id = lot_id.id
picking_receipt.button_validate()
- self.assertEquals(mo.state, 'done')
+ self.assertEqual(mo.state, 'done')
# Available quantities should be negative at the subcontracting location for each components
avail_qty_comp1 = self.env['stock.quant']._get_available_quantity(self.comp1_sn, self.subcontractor_partner1.property_stock_subcontractor, allow_negative=True)
avail_qty_comp2 = self.env['stock.quant']._get_available_quantity(self.comp2, self.subcontractor_partner1.property_stock_subcontractor, allow_negative=True)
avail_qty_finished = self.env['stock.quant']._get_available_quantity(self.finished_lot, wh.lot_stock_id)
- self.assertEquals(avail_qty_comp1, -1)
- self.assertEquals(avail_qty_comp2, -1)
- self.assertEquals(avail_qty_finished, 1)
+ self.assertEqual(avail_qty_comp1, -1)
+ self.assertEqual(avail_qty_comp2, -1)
+ self.assertEqual(avail_qty_finished, 1)
diff --git a/addons/payment_stripe/models/payment.py b/addons/payment_stripe/models/payment.py
index 9272f194cbf..4e68d122bc1 100644
--- a/addons/payment_stripe/models/payment.py
+++ b/addons/payment_stripe/models/payment.py
@@ -246,7 +246,7 @@ class PaymentTransactionStripe(models.Model):
return True
else:
error = tree.get('failure_message')
- _logger.warn(error)
+ _logger.warning(error)
vals.update({'state_message': error})
self.write(vals)
self._set_transaction_cancel()
diff --git a/addons/pos_cache/models/pos_cache.py b/addons/pos_cache/models/pos_cache.py
index 8987907f981..74e2a99019b 100644
--- a/addons/pos_cache/models/pos_cache.py
+++ b/addons/pos_cache/models/pos_cache.py
@@ -30,7 +30,7 @@ class pos_cache(models.Model):
display_default_code=False, lang=cache.compute_user_id.lang)
res = prod_ctx.read(cache.get_product_fields())
cache.write({
- 'cache': base64.encodestring(json.dumps(res).encode('utf-8')),
+ 'cache': base64.encodebytes(json.dumps(res).encode('utf-8')),
})
@api.model
@@ -48,7 +48,7 @@ class pos_cache(models.Model):
self.product_fields = str(fields)
self.refresh_cache()
- return json.loads(base64.decodestring(self.cache).decode('utf-8'))
+ return json.loads(base64.decodebytes(self.cache).decode('utf-8'))
class pos_config(models.Model):
diff --git a/addons/project_timesheet_holidays/tests/test_timesheet_holidays.py b/addons/project_timesheet_holidays/tests/test_timesheet_holidays.py
index 6aad4f1e51a..84c80cb133a 100644
--- a/addons/project_timesheet_holidays/tests/test_timesheet_holidays.py
+++ b/addons/project_timesheet_holidays/tests/test_timesheet_holidays.py
@@ -98,11 +98,11 @@ class TestTimesheetHolidays(TestCommonTimesheet):
'number_of_days': number_of_days,
})
holiday.with_user(SUPERUSER_ID).action_validate()
- self.assertEquals(len(holiday.timesheet_ids), number_of_days, 'Number of generated timesheets should be the same as the leave duration (1 per day between %s and %s)' % (fields.Datetime.to_string(self.leave_start_datetime), fields.Datetime.to_string(self.leave_end_datetime)))
+ self.assertEqual(len(holiday.timesheet_ids), number_of_days, 'Number of generated timesheets should be the same as the leave duration (1 per day between %s and %s)' % (fields.Datetime.to_string(self.leave_start_datetime), fields.Datetime.to_string(self.leave_end_datetime)))
# manager refuse the leave
holiday.with_user(SUPERUSER_ID).action_refuse()
- self.assertEquals(len(holiday.timesheet_ids), 0, 'Number of linked timesheets should be zero, since the leave is refused.')
+ self.assertEqual(len(holiday.timesheet_ids), 0, 'Number of linked timesheets should be zero, since the leave is refused.')
def test_validate_without_timesheet(self):
# employee creates a leave request
@@ -116,4 +116,4 @@ class TestTimesheetHolidays(TestCommonTimesheet):
'number_of_days': number_of_days,
})
holiday.with_user(SUPERUSER_ID).action_validate()
- self.assertEquals(len(holiday.timesheet_ids), 0, 'Number of generated timesheets should be zero since the leave type does not generate timesheet')
+ self.assertEqual(len(holiday.timesheet_ids), 0, 'Number of generated timesheets should be zero since the leave type does not generate timesheet')
diff --git a/addons/purchase/tests/test_purchase_order_report.py b/addons/purchase/tests/test_purchase_order_report.py
index 9497348e3ab..163df4bc3ec 100644
--- a/addons/purchase/tests/test_purchase_order_report.py
+++ b/addons/purchase/tests/test_purchase_order_report.py
@@ -67,14 +67,14 @@ class TestPurchaseOrderReport(common.TransactionCase):
('order_id', '=', po.id), ('product_id', '=', self.product1.id)])
# check that report will convert dozen to unit or not
- self.assertEquals(res_product1.qty_ordered, 12.0, 'UoM conversion is not working')
+ self.assertEqual(res_product1.qty_ordered, 12.0, 'UoM conversion is not working')
# report should show in company currency (amount/rate) = (100/2)
- self.assertEquals(res_product1.price_total, 50.0, 'Currency conversion is not working')
+ self.assertEqual(res_product1.price_total, 50.0, 'Currency conversion is not working')
res_product2 = self.PurchaseReport.search([
('order_id', '=', po.id), ('product_id', '=', self.product2.id)])
# Check that repost should show 6 unit of product
- self.assertEquals(res_product2.qty_ordered, 12.0, 'UoM conversion is not working')
+ self.assertEqual(res_product2.qty_ordered, 12.0, 'UoM conversion is not working')
# report should show in company currency (amount/rate) = (200/2)
- self.assertEquals(res_product2.price_total, 100.0, 'Currency conversion is not working')
+ self.assertEqual(res_product2.price_total, 100.0, 'Currency conversion is not working')
diff --git a/addons/purchase_mrp/tests/test_purchase_mrp_flow.py b/addons/purchase_mrp/tests/test_purchase_mrp_flow.py
index ea99478a93b..03f17161fe8 100644
--- a/addons/purchase_mrp/tests/test_purchase_mrp_flow.py
+++ b/addons/purchase_mrp/tests/test_purchase_mrp_flow.py
@@ -177,7 +177,7 @@ class TestSaleMrpFlow(TransactionCase):
"""
moves_to_process = moves.filtered(lambda m: m.product_id in quantities_to_process.keys())
for move in moves_to_process:
- self.assertEquals(move.product_uom_qty, quantities_to_process[move.product_id])
+ self.assertEqual(move.product_uom_qty, quantities_to_process[move.product_id])
def _create_move_quantities(self, qty_to_process, components, warehouse):
""" Helper to creates moves in order to update the quantities of components
@@ -237,7 +237,7 @@ class TestSaleMrpFlow(TransactionCase):
# Check picking creation, its move lines should concern
# only components. Also checks that the quantities are corresponding
# to the PO
- self.assertEquals(len(po.picking_ids), 1)
+ self.assertEqual(len(po.picking_ids), 1)
order_line = po.order_line[0]
picking_original = po.picking_ids[0]
move_lines = picking_original.move_lines
@@ -255,7 +255,7 @@ class TestSaleMrpFlow(TransactionCase):
self.component_g: 28.0
}
- self.assertEquals(len(move_lines), 7)
+ self.assertEqual(len(move_lines), 7)
self.assertTrue(not any(kit in products for kit in kits))
self.assertTrue(all(component in products for component in components))
self._assert_quantities(move_lines, expected_quantities)
@@ -269,13 +269,13 @@ class TestSaleMrpFlow(TransactionCase):
backorder_wizard.process()
# Check that a backorded is created
- self.assertEquals(len(po.picking_ids), 2)
+ self.assertEqual(len(po.picking_ids), 2)
backorder_1 = po.picking_ids - picking_original
- self.assertEquals(backorder_1.backorder_id.id, picking_original.id)
+ self.assertEqual(backorder_1.backorder_id.id, picking_original.id)
# Even if some components are received completely,
# no KitParent should be received
- self.assertEquals(order_line.qty_received, 0)
+ self.assertEqual(order_line.qty_received, 0)
# Process just enough components to make 1 kit_parent
qty_to_process = {
@@ -289,12 +289,12 @@ class TestSaleMrpFlow(TransactionCase):
backorder_wizard.process()
# Only 1 kit_parent should be received at this point
- self.assertEquals(order_line.qty_received, 1)
+ self.assertEqual(order_line.qty_received, 1)
# Check that the second backorder is created
- self.assertEquals(len(po.picking_ids), 3)
+ self.assertEqual(len(po.picking_ids), 3)
backorder_2 = po.picking_ids - picking_original - backorder_1
- self.assertEquals(backorder_2.backorder_id.id, backorder_1.id)
+ self.assertEqual(backorder_2.backorder_id.id, backorder_1.id)
# Set the components quantities that backorder_2 should have
expected_quantities = {
@@ -309,7 +309,7 @@ class TestSaleMrpFlow(TransactionCase):
# Check that the computed quantities are matching the theorical ones.
# Since component_e was totally processed, this componenent shouldn't be
# present in backorder_2
- self.assertEquals(len(backorder_2.move_lines), 6)
+ self.assertEqual(len(backorder_2.move_lines), 6)
move_comp_e = backorder_2.move_lines.filtered(lambda m: m.product_id.id == self.component_e.id)
self.assertFalse(move_comp_e)
self._assert_quantities(backorder_2.move_lines, expected_quantities)
@@ -328,12 +328,12 @@ class TestSaleMrpFlow(TransactionCase):
backorder_wizard.process()
# Check that x3 kit_parents are indeed received
- self.assertEquals(order_line.qty_received, 3)
+ self.assertEqual(order_line.qty_received, 3)
# Check that the third backorder is created
- self.assertEquals(len(po.picking_ids), 4)
+ self.assertEqual(len(po.picking_ids), 4)
backorder_3 = po.picking_ids - (picking_original + backorder_1 + backorder_2)
- self.assertEquals(backorder_3.backorder_id.id, backorder_2.id)
+ self.assertEqual(backorder_3.backorder_id.id, backorder_2.id)
# Check the components quantities that backorder_3 should have
expected_quantities = {
@@ -352,7 +352,7 @@ class TestSaleMrpFlow(TransactionCase):
# Validating the last backorder now it's complete.
# All kits should be received
backorder_3.button_validate()
- self.assertEquals(order_line.qty_received, 7.0)
+ self.assertEqual(order_line.qty_received, 7.0)
# Return all components processed by backorder_3
stock_return_picking_form = Form(self.env['stock.return.picking']
@@ -373,7 +373,7 @@ class TestSaleMrpFlow(TransactionCase):
wiz.process()
# Now quantity received should be 3 again
- self.assertEquals(order_line.qty_received, 3)
+ self.assertEqual(order_line.qty_received, 3)
stock_return_picking_form = Form(self.env['stock.return.picking']
.with_context(active_ids=return_pick.ids, active_id=return_pick.ids[0],
@@ -395,14 +395,14 @@ class TestSaleMrpFlow(TransactionCase):
backorder_wizard.process()
# As one of each component is missing, only 6 kit_parents should be received
- self.assertEquals(order_line.qty_received, 6)
+ self.assertEqual(order_line.qty_received, 6)
# Check that the 4th backorder is created.
- self.assertEquals(len(po.picking_ids), 7)
+ self.assertEqual(len(po.picking_ids), 7)
backorder_4 = po.picking_ids - (
picking_original + backorder_1 + backorder_2 + backorder_3 + return_of_return_pick + return_pick)
- self.assertEquals(backorder_4.backorder_id.id, return_of_return_pick.id)
+ self.assertEqual(backorder_4.backorder_id.id, return_of_return_pick.id)
# Check the components quantities that backorder_4 should have
for move in backorder_4.move_lines:
- self.assertEquals(move.product_qty, 1)
+ self.assertEqual(move.product_qty, 1)
diff --git a/addons/purchase_stock/tests/test_create_picking.py b/addons/purchase_stock/tests/test_create_picking.py
index de209d06319..c042167d164 100644
--- a/addons/purchase_stock/tests/test_create_picking.py
+++ b/addons/purchase_stock/tests/test_create_picking.py
@@ -446,7 +446,7 @@ class TestCreatePicking(common.TestProductCommon):
purchase_order_line.write({'date_planned': purchase_order_line.date_planned + timedelta(days=5)})
# Now check scheduled date of delivery order is changed or not.
- self.assertEquals(purchase_order_line.date_planned, delivery_order.scheduled_date,
+ self.assertEqual(purchase_order_line.date_planned, delivery_order.scheduled_date,
'Delivery order schedule date should be changed as we have set date propagate.')
def test_06_no_propagate_date(self):
@@ -466,5 +466,5 @@ class TestCreatePicking(common.TestProductCommon):
purchase_order_line.write({'date_planned': purchase_order_line.date_planned + timedelta(days=5)})
# Now check scheduled date of delivery order is changed or not.
- self.assertNotEquals(purchase_order_line.date_planned, delivery_order.scheduled_date,
+ self.assertNotEqual(purchase_order_line.date_planned, delivery_order.scheduled_date,
'Delivery order schedule date should not changed.')
diff --git a/addons/purchase_stock/tests/test_fifo_price.py b/addons/purchase_stock/tests/test_fifo_price.py
index 7ea86d55720..39f83213cb7 100644
--- a/addons/purchase_stock/tests/test_fifo_price.py
+++ b/addons/purchase_stock/tests/test_fifo_price.py
@@ -47,7 +47,7 @@ class TestFifoPrice(TestPurchase):
purchase_order_1.button_confirm()
# Check the "Purchase" status of purchase order 1
- self.assertEquals(purchase_order_1.state, 'purchase')
+ self.assertEqual(purchase_order_1.state, 'purchase')
# Process the reception of purchase order 1 and set date
picking = purchase_order_1.picking_ids[0]
@@ -55,8 +55,8 @@ class TestFifoPrice(TestPurchase):
# Check the standard price of the product (fifo icecream), that should have not changed
# because the standard price is supposed to be updated only when goods are going out of the stock
- self.assertEquals(product_cable_management_box.standard_price, 70.0, 'Standard price should not have changed')
- self.assertEquals(product_cable_management_box.value_svl, 500.0, 'Wrong stock value')
+ self.assertEqual(product_cable_management_box.standard_price, 70.0, 'Standard price should not have changed')
+ self.assertEqual(product_cable_management_box.value_svl, 500.0, 'Wrong stock value')
# I create a draft Purchase Order for second shipment for 30 kg at 80 euro
purchase_order_2 = self.env['purchase.order'].create({
@@ -79,8 +79,8 @@ class TestFifoPrice(TestPurchase):
# Check the standard price of the product, that should have not changed because the
# standard price is supposed to be updated only when goods are going out of the stock
- self.assertEquals(product_cable_management_box.standard_price, 70.0, 'Standard price as fifo price of second reception incorrect!')
- self.assertEquals(product_cable_management_box.value_svl, 2900.0, 'Stock valuation should be 2900')
+ self.assertEqual(product_cable_management_box.standard_price, 70.0, 'Standard price as fifo price of second reception incorrect!')
+ self.assertEqual(product_cable_management_box.value_svl, 2900.0, 'Stock valuation should be 2900')
# Let us send some goods
outgoing_shipment = self.env['stock.picking'].create({
@@ -313,5 +313,5 @@ class TestFifoPrice(TestPurchase):
self.env['stock.immediate.transfer'].create({'pick_ids': [(4, picking.id)]}).process()
original_out_move = outgoing_shipment_neg.move_lines[0]
- self.assertEquals(original_out_move.product_id.value_svl, 12000.0, 'Value of the move should be 12000')
- self.assertEquals(original_out_move.product_id.qty_available, 150.0, 'Qty available should be 150')
+ self.assertEqual(original_out_move.product_id.value_svl, 12000.0, 'Value of the move should be 12000')
+ self.assertEqual(original_out_move.product_id.qty_available, 150.0, 'Qty available should be 150')
diff --git a/addons/purchase_stock/tests/test_move_cancel_propagation.py b/addons/purchase_stock/tests/test_move_cancel_propagation.py
index 2c7aeda0719..9203927c470 100644
--- a/addons/purchase_stock/tests/test_move_cancel_propagation.py
+++ b/addons/purchase_stock/tests/test_move_cancel_propagation.py
@@ -95,7 +95,7 @@ class TestMoveCancelPropagation(TestPurchase):
purchase_order .button_cancel()
# Check the status of picking after canceling po.
- self.assertEquals(picking_in.state, 'cancel')
+ self.assertEqual(picking_in.state, 'cancel')
self.assertNotEqual(self.picking_out.state, 'cancel')
def test_03_cancel_draft_purchase_order_two_steps(self):
diff --git a/addons/purchase_stock/tests/test_onchange_product.py b/addons/purchase_stock/tests/test_onchange_product.py
index 74361778fd5..3628d75affe 100644
--- a/addons/purchase_stock/tests/test_onchange_product.py
+++ b/addons/purchase_stock/tests/test_onchange_product.py
@@ -72,16 +72,16 @@ class TestOnchangeProductId(TransactionCase):
po_line = po.order_line[0]
po_line.onchange_product_id()
- self.assertEquals(100, po_line.price_unit, "The included tax must be subtracted to the price")
+ self.assertEqual(100, po_line.price_unit, "The included tax must be subtracted to the price")
supplierinfo.write({'min_qty': 24})
po_line.write({'product_qty': 20})
po_line._onchange_quantity()
- self.assertEquals(0, po_line.price_unit, "Unit price should be reset to 0 since the supplier supplies minimum of 24 quantities")
+ self.assertEqual(0, po_line.price_unit, "Unit price should be reset to 0 since the supplier supplies minimum of 24 quantities")
po_line.write({'product_qty': 3, 'product_uom': self.ref("uom.product_uom_dozen")})
po_line._onchange_quantity()
- self.assertEquals(1200, po_line.price_unit, "Unit price should be 1200 for one Dozen")
+ self.assertEqual(1200, po_line.price_unit, "Unit price should be 1200 for one Dozen")
product_ipad = self.env.ref('product.product_product_4')
po_line2 = self.po_line_model.create({
@@ -94,4 +94,4 @@ class TestOnchangeProductId(TransactionCase):
'date_planned': fields.Date().today()
})
po_line2.onchange_product_id()
- self.assertEquals(0, po_line2.price_unit, "No vendor supplies this product, hence unit price should be set to 0")
+ self.assertEqual(0, po_line2.price_unit, "No vendor supplies this product, hence unit price should be set to 0")
diff --git a/addons/purchase_stock/tests/test_stockvaluation.py b/addons/purchase_stock/tests/test_stockvaluation.py
index 9490d218f17..24937f6d1d9 100644
--- a/addons/purchase_stock/tests/test_stockvaluation.py
+++ b/addons/purchase_stock/tests/test_stockvaluation.py
@@ -74,13 +74,13 @@ class TestStockValuation(TransactionCase):
move1 = picking1.move_lines[0]
# the unit price of the purchase order line is copied to the in move
- self.assertEquals(move1.price_unit, 100)
+ self.assertEqual(move1.price_unit, 100)
# update the unit price on the purchase order line
po1.order_line.price_unit = 200
# the unit price on the stock move is not directly updated
- self.assertEquals(move1.price_unit, 100)
+ self.assertEqual(move1.price_unit, 100)
# validate the receipt
res_dict = picking1.button_validate()
@@ -88,9 +88,9 @@ class TestStockValuation(TransactionCase):
wizard.process()
# the unit price of the valuationlayer used the latest value
- self.assertEquals(move1.stock_valuation_layer_ids.unit_cost, 200)
+ self.assertEqual(move1.stock_valuation_layer_ids.unit_cost, 200)
- self.assertEquals(self.product1.value_svl, 2000)
+ self.assertEqual(self.product1.value_svl, 2000)
def test_standard_price_change_1(self):
""" Confirm a purchase order and create the associated receipt, change the unit cost of the
@@ -122,13 +122,13 @@ class TestStockValuation(TransactionCase):
# the move's unit price reflects the purchase order line's cost even if it's useless when
# the product's cost method is standard
- self.assertEquals(move1.price_unit, 11)
+ self.assertEqual(move1.price_unit, 11)
# set a new standard price
self.product1.product_tmpl_id.standard_price = 12
# the unit price on the stock move is not directly updated
- self.assertEquals(move1.price_unit, 11)
+ self.assertEqual(move1.price_unit, 11)
# validate the receipt
res_dict = picking1.button_validate()
@@ -136,9 +136,9 @@ class TestStockValuation(TransactionCase):
wizard.process()
# the unit price of the valuation layer used the latest value
- self.assertEquals(move1.stock_valuation_layer_ids.unit_cost, 12)
+ self.assertEqual(move1.stock_valuation_layer_ids.unit_cost, 12)
- self.assertEquals(self.product1.value_svl, 120)
+ self.assertEqual(self.product1.value_svl, 120)
def test_change_currency_rate_average_1(self):
""" Confirm a purchase order in another currency and create the associated receipt, change
@@ -460,17 +460,17 @@ class TestStockValuationWithCOA(AccountingTestCase):
# Check what was posted in the price difference account
price_diff_aml = self.env['account.move.line'].search([('account_id','=', self.price_diff_account.id)])
- self.assertEquals(len(price_diff_aml), 1, "Only one line should have been generated in the price difference account.")
- self.assertAlmostEquals(price_diff_aml.debit, 5, "Price difference should be equal to 5 (15-10)")
+ self.assertEqual(len(price_diff_aml), 1, "Only one line should have been generated in the price difference account.")
+ self.assertAlmostEqual(price_diff_aml.debit, 5, "Price difference should be equal to 5 (15-10)")
# Check what was posted in stock input account
input_aml = self.env['account.move.line'].search([('account_id','=',self.stock_input_account.id)])
- self.assertEquals(len(input_aml), 3, "Only three lines should have been generated in stock input account: one when receiving the product, one when making the invoice.")
+ self.assertEqual(len(input_aml), 3, "Only three lines should have been generated in stock input account: one when receiving the product, one when making the invoice.")
invoice_amls = input_aml.filtered(lambda l: l.move_id == invoice)
picking_aml = input_aml - invoice_amls
- self.assertAlmostEquals(sum(invoice_amls.mapped('debit')), 15, "Total debit value on stock input account should be equal to the original PO price of the product.")
- self.assertAlmostEquals(sum(invoice_amls.mapped('credit')), 5, "Total debit value on stock input account should be equal to the original PO price of the product.")
- self.assertAlmostEquals(sum(picking_aml.mapped('credit')), 10, "Total credit value on stock input account should be equal to the original PO price of the product.")
+ self.assertAlmostEqual(sum(invoice_amls.mapped('debit')), 15, "Total debit value on stock input account should be equal to the original PO price of the product.")
+ self.assertAlmostEqual(sum(invoice_amls.mapped('credit')), 5, "Total debit value on stock input account should be equal to the original PO price of the product.")
+ self.assertAlmostEqual(sum(picking_aml.mapped('credit')), 10, "Total credit value on stock input account should be equal to the original PO price of the product.")
def test_valuation_from_increasing_tax(self):
""" Check that a tax without account will increment the stock value.
@@ -1207,14 +1207,14 @@ class TestStockValuationWithCOA(AccountingTestCase):
# Check what was posted in the price difference account
price_diff_aml = self.env['account.move.line'].search([('account_id','=', self.price_diff_account.id)])
- self.assertEquals(len(price_diff_aml), 1, "Only one line should have been generated in the price difference account.")
- self.assertAlmostEquals(price_diff_aml.credit, 20, "Price difference should be equal to 20 (110-90)")
+ self.assertEqual(len(price_diff_aml), 1, "Only one line should have been generated in the price difference account.")
+ self.assertAlmostEqual(price_diff_aml.credit, 20, "Price difference should be equal to 20 (110-90)")
# Check what was posted in stock input account
input_aml = self.env['account.move.line'].search([('account_id','=', self.stock_input_account.id)])
- self.assertEquals(len(input_aml), 3, "Only two lines should have been generated in stock input account: one when receiving the product, two when making the invoice.")
- self.assertAlmostEquals(sum(input_aml.mapped('debit')), 110, "Total debit value on stock input account should be equal to the original PO price of the product.")
- self.assertAlmostEquals(sum(input_aml.mapped('credit')), 110, "Total credit value on stock input account should be equal to the original PO price of the product.")
+ self.assertEqual(len(input_aml), 3, "Only two lines should have been generated in stock input account: one when receiving the product, two when making the invoice.")
+ self.assertAlmostEqual(sum(input_aml.mapped('debit')), 110, "Total debit value on stock input account should be equal to the original PO price of the product.")
+ self.assertAlmostEqual(sum(input_aml.mapped('credit')), 110, "Total credit value on stock input account should be equal to the original PO price of the product.")
def test_anglosaxon_valuation_discount(self):
"""
@@ -1254,14 +1254,14 @@ class TestStockValuationWithCOA(AccountingTestCase):
# Check what was posted in the price difference account
price_diff_aml = self.env['account.move.line'].search([('account_id', '=', self.price_diff_account.id)])
- self.assertEquals(len(price_diff_aml), 1, "Only one line should have been generated in the price difference account.")
- self.assertAlmostEquals(price_diff_aml.credit, 10, "Price difference should be equal to 10 (100-90)")
+ self.assertEqual(len(price_diff_aml), 1, "Only one line should have been generated in the price difference account.")
+ self.assertAlmostEqual(price_diff_aml.credit, 10, "Price difference should be equal to 10 (100-90)")
# Check what was posted in stock input account
input_aml = self.env['account.move.line'].search([('account_id', '=', self.stock_input_account.id)])
- self.assertEquals(len(input_aml), 3, "Three lines generated in stock input account: one when receiving the product, two when making the invoice.")
- self.assertAlmostEquals(sum(input_aml.mapped('debit')), 100, "Total debit value on stock input account should be equal to the original PO price of the product.")
- self.assertAlmostEquals(sum(input_aml.mapped('credit')), 100, "Total credit value on stock input account should be equal to the original PO price of the product.")
+ self.assertEqual(len(input_aml), 3, "Three lines generated in stock input account: one when receiving the product, two when making the invoice.")
+ self.assertAlmostEqual(sum(input_aml.mapped('debit')), 100, "Total debit value on stock input account should be equal to the original PO price of the product.")
+ self.assertAlmostEqual(sum(input_aml.mapped('credit')), 100, "Total credit value on stock input account should be equal to the original PO price of the product.")
def test_anglosaxon_valuation_price_unit_diff_discount(self):
"""
@@ -1301,10 +1301,10 @@ class TestStockValuationWithCOA(AccountingTestCase):
# Check if something was posted in the price difference account
price_diff_aml = self.env['account.move.line'].search([('account_id','=', self.price_diff_account.id)])
- self.assertEquals(len(price_diff_aml), 0, "No line should have been generated in the price difference account.")
+ self.assertEqual(len(price_diff_aml), 0, "No line should have been generated in the price difference account.")
# Check what was posted in stock input account
input_aml = self.env['account.move.line'].search([('account_id','=', self.stock_input_account.id)])
- self.assertEquals(len(input_aml), 2, "Only two lines should have been generated in stock input account: one when receiving the product, one when making the invoice.")
- self.assertAlmostEquals(sum(input_aml.mapped('debit')), 90, "Total debit value on stock input account should be equal to the original PO price of the product.")
- self.assertAlmostEquals(sum(input_aml.mapped('credit')), 90, "Total credit value on stock input account should be equal to the original PO price of the product.")
+ self.assertEqual(len(input_aml), 2, "Only two lines should have been generated in stock input account: one when receiving the product, one when making the invoice.")
+ self.assertAlmostEqual(sum(input_aml.mapped('debit')), 90, "Total debit value on stock input account should be equal to the original PO price of the product.")
+ self.assertAlmostEqual(sum(input_aml.mapped('credit')), 90, "Total credit value on stock input account should be equal to the original PO price of the product.")
diff --git a/addons/sale/tests/test_access_rights.py b/addons/sale/tests/test_access_rights.py
index 492ff640ce3..cc6f66556b1 100644
--- a/addons/sale/tests/test_access_rights.py
+++ b/addons/sale/tests/test_access_rights.py
@@ -87,7 +87,7 @@ class TestAccessRights(TestCommonSaleNoChart):
self.assertIn(india_channel.id, self.env['crm.team'].search([]).ids, 'Sales manager should be able to create a Sales Team')
# Manager can edit a Sales Team
india_channel.with_user(self.user_manager).write({'name': 'new_india'})
- self.assertEquals(india_channel.name, 'new_india', 'Sales manager should be able to edit a Sales Team')
+ self.assertEqual(india_channel.name, 'new_india', 'Sales manager should be able to edit a Sales Team')
# Manager can delete a Sales Team
india_channel.with_user(self.user_manager).unlink()
self.assertNotIn(india_channel.id, self.env['crm.team'].search([]).ids, 'Sales manager should be able to delete a Sales Team')
diff --git a/addons/sale/tests/test_onchange.py b/addons/sale/tests/test_onchange.py
index 978cde5321a..ffb2dbd09d2 100644
--- a/addons/sale/tests/test_onchange.py
+++ b/addons/sale/tests/test_onchange.py
@@ -63,7 +63,7 @@ class TestOnchangeProductId(TransactionCase):
sale_order = order_form.save()
# Check the unit price of SO line
- self.assertEquals(100, sale_order.order_line[0].price_unit, "The included tax must be subtracted to the price")
+ self.assertEqual(100, sale_order.order_line[0].price_unit, "The included tax must be subtracted to the price")
def test_pricelist_application(self):
""" Test different prices are correctly applied based on dates """
@@ -102,7 +102,7 @@ class TestOnchangeProductId(TransactionCase):
so = order_form.save()
# Check the unit price and subtotal of SO line
self.assertEqual(so.order_line[0].price_unit, 80, "First date pricelist rule not applied")
- self.assertEquals(so.order_line[0].price_subtotal, so.order_line[0].price_unit * so.order_line[0].product_uom_qty, 'Total of SO line should be a multiplication of unit price and ordered quantity')
+ self.assertEqual(so.order_line[0].price_subtotal, so.order_line[0].price_unit * so.order_line[0].product_uom_qty, 'Total of SO line should be a multiplication of unit price and ordered quantity')
# Change order date of the SO and check the unit price and subtotal of SO line
with Form(so) as order:
@@ -111,7 +111,7 @@ class TestOnchangeProductId(TransactionCase):
line.product_id = support_product
self.assertEqual(so.order_line[0].price_unit, 50, "Second date pricelist rule not applied")
- self.assertEquals(so.order_line[0].price_subtotal, so.order_line[0].price_unit * so.order_line[0].product_uom_qty, 'Total of SO line should be a multiplication of unit price and ordered quantity')
+ self.assertEqual(so.order_line[0].price_subtotal, so.order_line[0].price_unit * so.order_line[0].product_uom_qty, 'Total of SO line should be a multiplication of unit price and ordered quantity')
def test_pricelist_uom_discount(self):
""" Test prices and discounts are correctly applied based on date and uom"""
diff --git a/addons/sale/tests/test_reinvoice.py b/addons/sale/tests/test_reinvoice.py
index b7640fd23e9..0fb5747ecde 100644
--- a/addons/sale/tests/test_reinvoice.py
+++ b/addons/sale/tests/test_reinvoice.py
@@ -78,17 +78,17 @@ class TestReInvoice(TestCommonSaleNoChart):
self.assertTrue(sale_order_line3, "A new sale line should have been created with ordered product")
self.assertTrue(sale_order_line4, "A new sale line should have been created with delivered product")
- self.assertEquals(len(self.sale_order.order_line), 4, "There should be 4 lines on the SO (2 vendor bill lines created)")
- self.assertEquals(len(self.sale_order.order_line.filtered(lambda sol: sol.is_expense)), 2, "There should be 4 lines on the SO (2 vendor bill lines created)")
+ self.assertEqual(len(self.sale_order.order_line), 4, "There should be 4 lines on the SO (2 vendor bill lines created)")
+ self.assertEqual(len(self.sale_order.order_line.filtered(lambda sol: sol.is_expense)), 2, "There should be 4 lines on the SO (2 vendor bill lines created)")
- self.assertEquals(sale_order_line1.qty_delivered, 1, "Exising SO line 1 should not be impacted by reinvoicing product at cost")
- self.assertEquals(sale_order_line2.qty_delivered, 1, "Exising SO line 2 should not be impacted by reinvoicing product at cost")
+ self.assertEqual(sale_order_line1.qty_delivered, 1, "Exising SO line 1 should not be impacted by reinvoicing product at cost")
+ self.assertEqual(sale_order_line2.qty_delivered, 1, "Exising SO line 2 should not be impacted by reinvoicing product at cost")
- self.assertEquals((sale_order_line3.price_unit, sale_order_line3.qty_delivered, sale_order_line3.product_uom_qty, sale_order_line3.qty_invoiced), (self.product_ordered_cost.standard_price, 3, 0, 0), 'Sale line is wrong after confirming vendor invoice')
- self.assertEquals((sale_order_line4.price_unit, sale_order_line4.qty_delivered, sale_order_line4.product_uom_qty, sale_order_line4.qty_invoiced), (self.product_deliver_cost.standard_price, 3, 0, 0), 'Sale line is wrong after confirming vendor invoice')
+ self.assertEqual((sale_order_line3.price_unit, sale_order_line3.qty_delivered, sale_order_line3.product_uom_qty, sale_order_line3.qty_invoiced), (self.product_ordered_cost.standard_price, 3, 0, 0), 'Sale line is wrong after confirming vendor invoice')
+ self.assertEqual((sale_order_line4.price_unit, sale_order_line4.qty_delivered, sale_order_line4.product_uom_qty, sale_order_line4.qty_invoiced), (self.product_deliver_cost.standard_price, 3, 0, 0), 'Sale line is wrong after confirming vendor invoice')
- self.assertEquals(sale_order_line3.qty_delivered_method, 'analytic', "Delivered quantity of 'expense' SO line should be computed by analytic amount")
- self.assertEquals(sale_order_line4.qty_delivered_method, 'analytic', "Delivered quantity of 'expense' SO line should be computed by analytic amount")
+ self.assertEqual(sale_order_line3.qty_delivered_method, 'analytic', "Delivered quantity of 'expense' SO line should be computed by analytic amount")
+ self.assertEqual(sale_order_line4.qty_delivered_method, 'analytic', "Delivered quantity of 'expense' SO line should be computed by analytic amount")
# create second invoice lines and validate it
move_form = Form(self.AccountMove)
@@ -110,11 +110,11 @@ class TestReInvoice(TestCommonSaleNoChart):
self.assertTrue(sale_order_line5, "A new sale line should have been created with ordered product")
self.assertTrue(sale_order_line6, "A new sale line should have been created with delivered product")
- self.assertEquals(len(self.sale_order.order_line), 6, "There should be still 4 lines on the SO, no new created")
- self.assertEquals(len(self.sale_order.order_line.filtered(lambda sol: sol.is_expense)), 4, "There should be still 2 expenses lines on the SO")
+ self.assertEqual(len(self.sale_order.order_line), 6, "There should be still 4 lines on the SO, no new created")
+ self.assertEqual(len(self.sale_order.order_line.filtered(lambda sol: sol.is_expense)), 4, "There should be still 2 expenses lines on the SO")
- self.assertEquals((sale_order_line5.price_unit, sale_order_line5.qty_delivered, sale_order_line5.product_uom_qty, sale_order_line5.qty_invoiced), (self.product_ordered_cost.standard_price, 2, 0, 0), 'Sale line 5 is wrong after confirming 2e vendor invoice')
- self.assertEquals((sale_order_line6.price_unit, sale_order_line6.qty_delivered, sale_order_line6.product_uom_qty, sale_order_line6.qty_invoiced), (self.product_deliver_cost.standard_price, 2, 0, 0), 'Sale line 6 is wrong after confirming 2e vendor invoice')
+ self.assertEqual((sale_order_line5.price_unit, sale_order_line5.qty_delivered, sale_order_line5.product_uom_qty, sale_order_line5.qty_invoiced), (self.product_ordered_cost.standard_price, 2, 0, 0), 'Sale line 5 is wrong after confirming 2e vendor invoice')
+ self.assertEqual((sale_order_line6.price_unit, sale_order_line6.qty_delivered, sale_order_line6.product_uom_qty, sale_order_line6.qty_invoiced), (self.product_deliver_cost.standard_price, 2, 0, 0), 'Sale line 6 is wrong after confirming 2e vendor invoice')
def test_sales_price(self):
""" Test invoicing vendor bill at sales price for products based on delivered and ordered quantities. Check no existing SO line is incremented, but when invoicing a
@@ -163,17 +163,17 @@ class TestReInvoice(TestCommonSaleNoChart):
self.assertTrue(sale_order_line3, "A new sale line should have been created with ordered product")
self.assertTrue(sale_order_line4, "A new sale line should have been created with delivered product")
- self.assertEquals(len(self.sale_order.order_line), 4, "There should be 4 lines on the SO (2 vendor bill lines created)")
- self.assertEquals(len(self.sale_order.order_line.filtered(lambda sol: sol.is_expense)), 2, "There should be 4 lines on the SO (2 vendor bill lines created)")
+ self.assertEqual(len(self.sale_order.order_line), 4, "There should be 4 lines on the SO (2 vendor bill lines created)")
+ self.assertEqual(len(self.sale_order.order_line.filtered(lambda sol: sol.is_expense)), 2, "There should be 4 lines on the SO (2 vendor bill lines created)")
- self.assertEquals(sale_order_line1.qty_delivered, 1, "Exising SO line 1 should not be impacted by reinvoicing product at cost")
- self.assertEquals(sale_order_line2.qty_delivered, 1, "Exising SO line 2 should not be impacted by reinvoicing product at cost")
+ self.assertEqual(sale_order_line1.qty_delivered, 1, "Exising SO line 1 should not be impacted by reinvoicing product at cost")
+ self.assertEqual(sale_order_line2.qty_delivered, 1, "Exising SO line 2 should not be impacted by reinvoicing product at cost")
- self.assertEquals((sale_order_line3.price_unit, sale_order_line3.qty_delivered, sale_order_line3.product_uom_qty, sale_order_line3.qty_invoiced), (self.product_deliver_sales_price.list_price, 3, 0, 0), 'Sale line is wrong after confirming vendor invoice')
- self.assertEquals((sale_order_line4.price_unit, sale_order_line4.qty_delivered, sale_order_line4.product_uom_qty, sale_order_line4.qty_invoiced), (self.product_order_sales_price.list_price, 3, 0, 0), 'Sale line is wrong after confirming vendor invoice')
+ self.assertEqual((sale_order_line3.price_unit, sale_order_line3.qty_delivered, sale_order_line3.product_uom_qty, sale_order_line3.qty_invoiced), (self.product_deliver_sales_price.list_price, 3, 0, 0), 'Sale line is wrong after confirming vendor invoice')
+ self.assertEqual((sale_order_line4.price_unit, sale_order_line4.qty_delivered, sale_order_line4.product_uom_qty, sale_order_line4.qty_invoiced), (self.product_order_sales_price.list_price, 3, 0, 0), 'Sale line is wrong after confirming vendor invoice')
- self.assertEquals(sale_order_line3.qty_delivered_method, 'analytic', "Delivered quantity of 'expense' SO line 3 should be computed by analytic amount")
- self.assertEquals(sale_order_line4.qty_delivered_method, 'analytic', "Delivered quantity of 'expense' SO line 4 should be computed by analytic amount")
+ self.assertEqual(sale_order_line3.qty_delivered_method, 'analytic', "Delivered quantity of 'expense' SO line 3 should be computed by analytic amount")
+ self.assertEqual(sale_order_line4.qty_delivered_method, 'analytic', "Delivered quantity of 'expense' SO line 4 should be computed by analytic amount")
# create second invoice lines and validate it
move_form = Form(self.AccountMove)
@@ -195,10 +195,10 @@ class TestReInvoice(TestCommonSaleNoChart):
self.assertFalse(sale_order_line5, "No new sale line should have been created with delivered product !!")
self.assertTrue(sale_order_line6, "A new sale line should have been created with ordered product")
- self.assertEquals(len(self.sale_order.order_line), 5, "There should be 5 lines on the SO, 1 new created and 1 incremented")
- self.assertEquals(len(self.sale_order.order_line.filtered(lambda sol: sol.is_expense)), 3, "There should be 3 expenses lines on the SO")
+ self.assertEqual(len(self.sale_order.order_line), 5, "There should be 5 lines on the SO, 1 new created and 1 incremented")
+ self.assertEqual(len(self.sale_order.order_line.filtered(lambda sol: sol.is_expense)), 3, "There should be 3 expenses lines on the SO")
- self.assertEquals((sale_order_line6.price_unit, sale_order_line6.qty_delivered, sale_order_line4.product_uom_qty, sale_order_line6.qty_invoiced), (self.product_order_sales_price.list_price, 2, 0, 0), 'Sale line is wrong after confirming 2e vendor invoice')
+ self.assertEqual((sale_order_line6.price_unit, sale_order_line6.qty_delivered, sale_order_line4.product_uom_qty, sale_order_line6.qty_invoiced), (self.product_order_sales_price.list_price, 2, 0, 0), 'Sale line is wrong after confirming 2e vendor invoice')
def test_no_expense(self):
""" Test invoicing vendor bill with no policy. Check nothing happen. """
@@ -229,6 +229,6 @@ class TestReInvoice(TestCommonSaleNoChart):
})
invoice_a.post()
- self.assertEquals(len(self.sale_order.order_line), 1, "No SO line should have been created (or removed) when validating vendor bill")
- self.assertEquals(sale_order_line.qty_delivered, 1, "The delivered quantity of SO line should not have been incremented")
+ self.assertEqual(len(self.sale_order.order_line), 1, "No SO line should have been created (or removed) when validating vendor bill")
+ self.assertEqual(sale_order_line.qty_delivered, 1, "The delivered quantity of SO line should not have been incremented")
self.assertTrue(invoice_a.mapped('line_ids.analytic_line_ids'), "Analytic lines should be generated")
diff --git a/addons/sale/tests/test_sale_order.py b/addons/sale/tests/test_sale_order.py
index 0b30a9c0aa0..e491f7e5c87 100644
--- a/addons/sale/tests/test_sale_order.py
+++ b/addons/sale/tests/test_sale_order.py
@@ -212,7 +212,7 @@ class TestSaleOrder(TestCommonSaleNoChart):
inv.post()
sol = so.order_line.filtered(lambda l: l.product_id == serv_cost)
self.assertTrue(sol, 'Sale: cost invoicing does not add lines when confirming vendor invoice')
- self.assertEquals((sol.price_unit, sol.qty_delivered, sol.product_uom_qty, sol.qty_invoiced), (160, 2, 0, 0), 'Sale: line is wrong after confirming vendor invoice')
+ self.assertEqual((sol.price_unit, sol.qty_delivered, sol.product_uom_qty, sol.qty_invoiced), (160, 2, 0, 0), 'Sale: line is wrong after confirming vendor invoice')
def test_sale_with_taxes(self):
""" Test SO with taxes applied on its lines and check subtotal applied on its lines and total applied on the SO """
@@ -245,9 +245,9 @@ class TestSaleOrder(TestCommonSaleNoChart):
else:
price = line.price_unit * line.product_uom_qty
- self.assertEquals(float_compare(line.price_subtotal, price, precision_digits=2), 0)
+ self.assertEqual(float_compare(line.price_subtotal, price, precision_digits=2), 0)
- self.assertEquals(self.sale_order.amount_total,
+ self.assertEqual(self.sale_order.amount_total,
self.sale_order.amount_untaxed + self.sale_order.amount_tax,
'Taxes should be applied')
@@ -353,8 +353,8 @@ class TestSaleOrder(TestCommonSaleNoChart):
# Call again for st_line_2, it should find sale_order
res = self.env['account.reconciliation.widget'].get_bank_statement_line_data([st_line2.id])
line = res.get('lines', [{}])[0]
- self.assertEquals(line.get('sale_order_ids', []), [so.id])
+ self.assertEqual(line.get('sale_order_ids', []), [so.id])
# Call again for st_line_3, it should find sale_order based on reference
res = self.env['account.reconciliation.widget'].get_bank_statement_line_data([st_line3.id])
line = res.get('lines', [{}])[0]
- self.assertEquals(line.get('sale_order_ids', []), [so.id])
+ self.assertEqual(line.get('sale_order_ids', []), [so.id])
diff --git a/addons/sale/tests/test_sale_pricelist.py b/addons/sale/tests/test_sale_pricelist.py
index 3fc37a5a2a8..6f655db4eb0 100644
--- a/addons/sale/tests/test_sale_pricelist.py
+++ b/addons/sale/tests/test_sale_pricelist.py
@@ -125,7 +125,7 @@ class TestSaleOrder(TestCommonSaleNoChart):
line._onchange_discount()
# Check that pricelist of the SO has been applied on the sale order lines or not
for line in self.sale_order.order_line:
- self.assertEquals(line.price_unit, line.product_id.list_price, 'Pricelist of the SO should not be applied on an order line %s' % (line.name,))
+ self.assertEqual(line.price_unit, line.product_id.list_price, 'Pricelist of the SO should not be applied on an order line %s' % (line.name,))
def test_sale_with_pricelist_discount_included(self):
""" Test SO with the pricelist and check unit price appeared on its lines """
@@ -138,11 +138,11 @@ class TestSaleOrder(TestCommonSaleNoChart):
# Check that pricelist of the SO has been applied on the sale order lines or not
for line in self.sale_order.order_line:
if line.product_id == self.product_order:
- self.assertEquals(line.price_unit, self.pricelist_discount_incl_item3.fixed_price, 'Price of product_order should be %s applied on the order line' % (self.pricelist_discount_incl_item3.fixed_price,))
+ self.assertEqual(line.price_unit, self.pricelist_discount_incl_item3.fixed_price, 'Price of product_order should be %s applied on the order line' % (self.pricelist_discount_incl_item3.fixed_price,))
else: # only services (service_order and service_deliver)
for item in self.sale_order.pricelist_id.item_ids.filtered(lambda l: l.product_tmpl_id == line.product_id.product_tmpl_id):
price = item.percent_price
- self.assertEquals(price, (line.product_id.list_price - line.price_unit) / line.product_id.list_price * 100, 'Pricelist of the SO should be applied on an order line %s' % (line.product_id.name,))
+ self.assertEqual(price, (line.product_id.list_price - line.price_unit) / line.product_id.list_price * 100, 'Pricelist of the SO should be applied on an order line %s' % (line.product_id.name,))
def test_sale_with_pricelist_discount_excluded(self):
""" Test SO with the pricelist 'discount displayed' and check discount and unit price appeared on its lines """
@@ -164,12 +164,12 @@ class TestSaleOrder(TestCommonSaleNoChart):
for line in self.sale_order.order_line:
if line.product_id.categ_id in self.sale_order.pricelist_id.item_ids.mapped('categ_id'): # reduction per category (consummable only)
for item in self.sale_order.pricelist_id.item_ids.filtered(lambda l: l.categ_id == line.product_id.categ_id):
- self.assertEquals(line.discount, item.price_discount, "Discount should be displayed on order line %s since its category get some discount" % (line.name,))
- self.assertEquals(line.price_unit, line.product_id.standard_price, "Price unit should be the cost price for product %s" % (line.name,))
+ self.assertEqual(line.discount, item.price_discount, "Discount should be displayed on order line %s since its category get some discount" % (line.name,))
+ self.assertEqual(line.price_unit, line.product_id.standard_price, "Price unit should be the cost price for product %s" % (line.name,))
else:
if line.product_id == self.service_order: # reduction for this product
- self.assertEquals(line.discount, 20.0, "Discount for product %s should be 20 percent with pricelist %s" % (line.name, self.pricelist_discount_excl.name))
- self.assertEquals(line.price_unit, line.product_id.list_price, 'Unit price of order line should be a sale price as the pricelist not applied on the other category\'s product')
+ self.assertEqual(line.discount, 20.0, "Discount for product %s should be 20 percent with pricelist %s" % (line.name, self.pricelist_discount_excl.name))
+ self.assertEqual(line.price_unit, line.product_id.list_price, 'Unit price of order line should be a sale price as the pricelist not applied on the other category\'s product')
else: # no discount for the rest
- self.assertEquals(line.discount, 0.0, 'Pricelist of SO should not be applied on an order line')
- self.assertEquals(line.price_unit, line.product_id.list_price, 'Unit price of order line should be a sale price as the pricelist not applied on the other category\'s product')
+ self.assertEqual(line.discount, 0.0, 'Pricelist of SO should not be applied on an order line')
+ self.assertEqual(line.price_unit, line.product_id.list_price, 'Unit price of order line should be a sale price as the pricelist not applied on the other category\'s product')
diff --git a/addons/sale/tests/test_sale_refund.py b/addons/sale/tests/test_sale_refund.py
index 07446ec33a1..5788ed2a648 100644
--- a/addons/sale/tests/test_sale_refund.py
+++ b/addons/sale/tests/test_sale_refund.py
@@ -83,21 +83,21 @@ class TestSaleToInvoice(TestCommonSaleNoChart):
# Check quantity to invoice on SO lines
for line in self.sale_order.order_line:
if line.product_id.invoice_policy == 'delivery':
- self.assertEquals(line.qty_to_invoice, 0.0, "Quantity to invoice should be same as ordered quantity")
- self.assertEquals(line.qty_invoiced, 0.0, "Invoiced quantity should be zero as no any invoice created for SO")
- self.assertEquals(line.untaxed_amount_to_invoice, 0.0, "The amount to invoice should be zero, as the line based on delivered quantity")
- self.assertEquals(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as the line based on delivered quantity")
+ self.assertEqual(line.qty_to_invoice, 0.0, "Quantity to invoice should be same as ordered quantity")
+ self.assertEqual(line.qty_invoiced, 0.0, "Invoiced quantity should be zero as no any invoice created for SO")
+ self.assertEqual(line.untaxed_amount_to_invoice, 0.0, "The amount to invoice should be zero, as the line based on delivered quantity")
+ self.assertEqual(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as the line based on delivered quantity")
self.assertFalse(line.invoice_lines, "The line based on delivered qty are not invoiced, so they should not be linked to invoice line")
else:
if line == self.sol_prod_order:
- self.assertEquals(line.qty_to_invoice, 0.0, "The ordered sale line are totally invoiced (qty to invoice is zero)")
- self.assertEquals(line.qty_invoiced, 5.0, "The ordered (prod) sale line are totally invoiced (qty invoiced come from the invoice lines)")
+ self.assertEqual(line.qty_to_invoice, 0.0, "The ordered sale line are totally invoiced (qty to invoice is zero)")
+ self.assertEqual(line.qty_invoiced, 5.0, "The ordered (prod) sale line are totally invoiced (qty invoiced come from the invoice lines)")
else:
- self.assertEquals(line.qty_to_invoice, 0.0, "The ordered sale line are totally invoiced (qty to invoice is zero)")
- self.assertEquals(line.qty_invoiced, 3.0, "The ordered (serv) sale line are totally invoiced (qty invoiced = the invoice lines)")
- self.assertEquals(line.untaxed_amount_to_invoice, line.price_unit * line.qty_to_invoice, "Amount to invoice is now set as qty to invoice * unit price since no price change on invoice, for ordered products")
- self.assertEquals(line.untaxed_amount_invoiced, line.price_unit * line.qty_invoiced, "Amount invoiced is now set as qty invoiced * unit price since no price change on invoice, for ordered products")
- self.assertEquals(len(line.invoice_lines), 1, "The lines 'ordered' qty are invoiced, so it should be linked to 1 invoice lines")
+ self.assertEqual(line.qty_to_invoice, 0.0, "The ordered sale line are totally invoiced (qty to invoice is zero)")
+ self.assertEqual(line.qty_invoiced, 3.0, "The ordered (serv) sale line are totally invoiced (qty invoiced = the invoice lines)")
+ self.assertEqual(line.untaxed_amount_to_invoice, line.price_unit * line.qty_to_invoice, "Amount to invoice is now set as qty to invoice * unit price since no price change on invoice, for ordered products")
+ self.assertEqual(line.untaxed_amount_invoiced, line.price_unit * line.qty_invoiced, "Amount invoiced is now set as qty invoiced * unit price since no price change on invoice, for ordered products")
+ self.assertEqual(len(line.invoice_lines), 1, "The lines 'ordered' qty are invoiced, so it should be linked to 1 invoice lines")
# Make a credit note
credit_note_wizard = self.env['account.move.reversal'].with_context({'active_ids': [self.invoice.id], 'active_id': self.invoice.id}).create({
@@ -108,58 +108,58 @@ class TestSaleToInvoice(TestCommonSaleNoChart):
invoice_refund = self.sale_order.invoice_ids.sorted(key=lambda inv: inv.id, reverse=False)[-1] # the first invoice, its refund, and the new invoice
# Check invoice's type and number
- self.assertEquals(invoice_refund.type, 'out_refund', 'The last created invoiced should be a refund')
- self.assertEquals(invoice_refund.state, 'draft', 'Last Customer invoices should be in draft')
- self.assertEquals(self.sale_order.invoice_count, 2, "The SO should have 2 related invoices: the original, the new refund")
- self.assertEquals(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.type == 'out_refund')), 1, "The SO should be linked to only one refund")
- self.assertEquals(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.type == 'out_invoice')), 1, "The SO should be linked to only one customer invoices")
+ self.assertEqual(invoice_refund.type, 'out_refund', 'The last created invoiced should be a refund')
+ self.assertEqual(invoice_refund.state, 'draft', 'Last Customer invoices should be in draft')
+ self.assertEqual(self.sale_order.invoice_count, 2, "The SO should have 2 related invoices: the original, the new refund")
+ self.assertEqual(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.type == 'out_refund')), 1, "The SO should be linked to only one refund")
+ self.assertEqual(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.type == 'out_invoice')), 1, "The SO should be linked to only one customer invoices")
# At this time, the invoice 1 is opend (validated) and its refund is in draft, so the amounts invoiced are not zero for
# invoiced sale line. The amounts only take validated invoice/refund into account.
for line in self.sale_order.order_line:
if line.product_id.invoice_policy == 'delivery':
- self.assertEquals(line.qty_to_invoice, 0.0, "Quantity to invoice should be same as ordered quantity")
- self.assertEquals(line.qty_invoiced, 0.0, "Invoiced quantity should be zero as no any invoice created for SO line based on delivered qty")
- self.assertEquals(line.untaxed_amount_to_invoice, 0.0, "The amount to invoice should be zero, as the line based on delivered quantity")
- self.assertEquals(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as the line based on delivered quantity")
+ self.assertEqual(line.qty_to_invoice, 0.0, "Quantity to invoice should be same as ordered quantity")
+ self.assertEqual(line.qty_invoiced, 0.0, "Invoiced quantity should be zero as no any invoice created for SO line based on delivered qty")
+ self.assertEqual(line.untaxed_amount_to_invoice, 0.0, "The amount to invoice should be zero, as the line based on delivered quantity")
+ self.assertEqual(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as the line based on delivered quantity")
self.assertFalse(line.invoice_lines, "The line based on delivered are not invoiced, so they should not be linked to invoice line")
else:
if line == self.sol_prod_order:
- self.assertEquals(line.qty_to_invoice, 5.0, "As the refund is created, the invoiced quantity cancel each other (consu ordered)")
- self.assertEquals(line.qty_invoiced, 0.0, "The qty to invoice should have decreased as the refund is created for ordered consu SO line")
- self.assertEquals(line.untaxed_amount_to_invoice, 0.0, "Amount to invoice is zero as the refund is not validated")
- self.assertEquals(line.untaxed_amount_invoiced, line.price_unit * 5, "Amount invoiced is now set as unit price * ordered qty - refund qty) even if the ")
- self.assertEquals(len(line.invoice_lines), 2, "The line 'ordered consumable' is invoiced, so it should be linked to 2 invoice lines (invoice and refund)")
+ self.assertEqual(line.qty_to_invoice, 5.0, "As the refund is created, the invoiced quantity cancel each other (consu ordered)")
+ self.assertEqual(line.qty_invoiced, 0.0, "The qty to invoice should have decreased as the refund is created for ordered consu SO line")
+ self.assertEqual(line.untaxed_amount_to_invoice, 0.0, "Amount to invoice is zero as the refund is not validated")
+ self.assertEqual(line.untaxed_amount_invoiced, line.price_unit * 5, "Amount invoiced is now set as unit price * ordered qty - refund qty) even if the ")
+ self.assertEqual(len(line.invoice_lines), 2, "The line 'ordered consumable' is invoiced, so it should be linked to 2 invoice lines (invoice and refund)")
else:
- self.assertEquals(line.qty_to_invoice, 3.0, "As the refund is created, the invoiced quantity cancel each other (consu ordered)")
- self.assertEquals(line.qty_invoiced, 0.0, "The qty to invoice should have decreased as the refund is created for ordered service SO line")
- self.assertEquals(line.untaxed_amount_to_invoice, 0.0, "Amount to invoice is zero as the refund is not validated")
- self.assertEquals(line.untaxed_amount_invoiced, line.price_unit * 3, "Amount invoiced is now set as unit price * ordered qty - refund qty) even if the ")
- self.assertEquals(len(line.invoice_lines), 2, "The line 'ordered service' is invoiced, so it should be linked to 2 invoice lines (invoice and refund)")
+ self.assertEqual(line.qty_to_invoice, 3.0, "As the refund is created, the invoiced quantity cancel each other (consu ordered)")
+ self.assertEqual(line.qty_invoiced, 0.0, "The qty to invoice should have decreased as the refund is created for ordered service SO line")
+ self.assertEqual(line.untaxed_amount_to_invoice, 0.0, "Amount to invoice is zero as the refund is not validated")
+ self.assertEqual(line.untaxed_amount_invoiced, line.price_unit * 3, "Amount invoiced is now set as unit price * ordered qty - refund qty) even if the ")
+ self.assertEqual(len(line.invoice_lines), 2, "The line 'ordered service' is invoiced, so it should be linked to 2 invoice lines (invoice and refund)")
# Validate the refund
invoice_refund.post()
for line in self.sale_order.order_line:
if line.product_id.invoice_policy == 'delivery':
- self.assertEquals(line.qty_to_invoice, 0.0, "Quantity to invoice should be same as ordered quantity")
- self.assertEquals(line.qty_invoiced, 0.0, "Invoiced quantity should be zero as no any invoice created for SO")
- self.assertEquals(line.untaxed_amount_to_invoice, 0.0, "The amount to invoice should be zero, as the line based on delivered quantity")
- self.assertEquals(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as the line based on delivered quantity")
+ self.assertEqual(line.qty_to_invoice, 0.0, "Quantity to invoice should be same as ordered quantity")
+ self.assertEqual(line.qty_invoiced, 0.0, "Invoiced quantity should be zero as no any invoice created for SO")
+ self.assertEqual(line.untaxed_amount_to_invoice, 0.0, "The amount to invoice should be zero, as the line based on delivered quantity")
+ self.assertEqual(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as the line based on delivered quantity")
self.assertFalse(line.invoice_lines, "The line based on delivered are not invoiced, so they should not be linked to invoice line")
else:
if line == self.sol_prod_order:
- self.assertEquals(line.qty_to_invoice, 5.0, "As the refund still exists, the quantity to invoice is the ordered quantity")
- self.assertEquals(line.qty_invoiced, 0.0, "The qty to invoice should be zero as, with the refund, the quantities cancel each other")
- self.assertEquals(line.untaxed_amount_to_invoice, line.price_unit * 5, "Amount to invoice is now set as qty to invoice * unit price since no price change on invoice, as refund is validated")
- self.assertEquals(line.untaxed_amount_invoiced, 0.0, "Amount invoiced decreased as the refund is now confirmed")
- self.assertEquals(len(line.invoice_lines), 2, "The line 'ordered consumable' is invoiced, so it should be linked to 2 invoice lines (invoice and refund)")
+ self.assertEqual(line.qty_to_invoice, 5.0, "As the refund still exists, the quantity to invoice is the ordered quantity")
+ self.assertEqual(line.qty_invoiced, 0.0, "The qty to invoice should be zero as, with the refund, the quantities cancel each other")
+ self.assertEqual(line.untaxed_amount_to_invoice, line.price_unit * 5, "Amount to invoice is now set as qty to invoice * unit price since no price change on invoice, as refund is validated")
+ self.assertEqual(line.untaxed_amount_invoiced, 0.0, "Amount invoiced decreased as the refund is now confirmed")
+ self.assertEqual(len(line.invoice_lines), 2, "The line 'ordered consumable' is invoiced, so it should be linked to 2 invoice lines (invoice and refund)")
else:
- self.assertEquals(line.qty_to_invoice, 3.0, "As the refund still exists, the quantity to invoice is the ordered quantity")
- self.assertEquals(line.qty_invoiced, 0.0, "The qty to invoice should be zero as, with the refund, the quantities cancel each other")
- self.assertEquals(line.untaxed_amount_to_invoice, line.price_unit * 3, "Amount to invoice is now set as qty to invoice * unit price since no price change on invoice, as refund is validated")
- self.assertEquals(line.untaxed_amount_invoiced, 0.0, "Amount invoiced decreased as the refund is now confirmed")
- self.assertEquals(len(line.invoice_lines), 2, "The line 'ordered service' is invoiced, so it should be linked to 2 invoice lines (invoice and refund)")
+ self.assertEqual(line.qty_to_invoice, 3.0, "As the refund still exists, the quantity to invoice is the ordered quantity")
+ self.assertEqual(line.qty_invoiced, 0.0, "The qty to invoice should be zero as, with the refund, the quantities cancel each other")
+ self.assertEqual(line.untaxed_amount_to_invoice, line.price_unit * 3, "Amount to invoice is now set as qty to invoice * unit price since no price change on invoice, as refund is validated")
+ self.assertEqual(line.untaxed_amount_invoiced, 0.0, "Amount invoiced decreased as the refund is now confirmed")
+ self.assertEqual(len(line.invoice_lines), 2, "The line 'ordered service' is invoiced, so it should be linked to 2 invoice lines (invoice and refund)")
def test_refund_cancel(self):
""" Test invoice with a refund in 'cancel' mode, meaning a refund will be created and auto confirm to completely cancel the first
@@ -177,18 +177,18 @@ class TestSaleToInvoice(TestCommonSaleNoChart):
# Check quantity to invoice on SO lines
for line in self.sale_order.order_line:
if line.product_id.invoice_policy == 'delivery':
- self.assertEquals(line.qty_to_invoice, 0.0, "Quantity to invoice should be same as ordered quantity")
- self.assertEquals(line.qty_invoiced, 0.0, "Invoiced quantity should be zero as no any invoice created for SO")
- self.assertEquals(line.untaxed_amount_to_invoice, 0.0, "The amount to invoice should be zero, as the line based on delivered quantity")
- self.assertEquals(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as the line based on delivered quantity")
+ self.assertEqual(line.qty_to_invoice, 0.0, "Quantity to invoice should be same as ordered quantity")
+ self.assertEqual(line.qty_invoiced, 0.0, "Invoiced quantity should be zero as no any invoice created for SO")
+ self.assertEqual(line.untaxed_amount_to_invoice, 0.0, "The amount to invoice should be zero, as the line based on delivered quantity")
+ self.assertEqual(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as the line based on delivered quantity")
self.assertFalse(line.invoice_lines, "The line based on delivered qty are not invoiced, so they should not be linked to invoice line")
else:
- self.assertEquals(line.untaxed_amount_to_invoice, line.price_unit * line.qty_to_invoice, "Amount to invoice is now set as qty to invoice * unit price since no price change on invoice, for ordered products")
- self.assertEquals(line.untaxed_amount_invoiced, line.price_unit * line.qty_invoiced, "Amount invoiced is now set as qty invoiced * unit price since no price change on invoice, for ordered products")
- self.assertEquals(len(line.invoice_lines), 1, "The lines 'ordered' qty are invoiced, so it should be linked to 1 invoice lines")
+ self.assertEqual(line.untaxed_amount_to_invoice, line.price_unit * line.qty_to_invoice, "Amount to invoice is now set as qty to invoice * unit price since no price change on invoice, for ordered products")
+ self.assertEqual(line.untaxed_amount_invoiced, line.price_unit * line.qty_invoiced, "Amount invoiced is now set as qty invoiced * unit price since no price change on invoice, for ordered products")
+ self.assertEqual(len(line.invoice_lines), 1, "The lines 'ordered' qty are invoiced, so it should be linked to 1 invoice lines")
- self.assertEquals(line.qty_invoiced, line.product_uom_qty + 1, "The quantity invoiced is +1 unit from the one of the sale line, as we modified invoice lines (%s)" % (line.name,))
- self.assertEquals(line.qty_to_invoice, -1, "The quantity to invoice is negative as we invoice more than ordered")
+ self.assertEqual(line.qty_invoiced, line.product_uom_qty + 1, "The quantity invoiced is +1 unit from the one of the sale line, as we modified invoice lines (%s)" % (line.name,))
+ self.assertEqual(line.qty_to_invoice, -1, "The quantity to invoice is negative as we invoice more than ordered")
# Make a credit note
credit_note_wizard = self.env['account.move.reversal'].with_context({'active_ids': self.invoice.ids, 'active_id': self.invoice.id}).create({
@@ -198,28 +198,28 @@ class TestSaleToInvoice(TestCommonSaleNoChart):
invoice_refund = self.env['account.move'].browse(credit_note_wizard.reverse_moves()['res_id'])
# Check invoice's type and number
- self.assertEquals(invoice_refund.type, 'out_refund', 'The last created invoiced should be a customer invoice')
- self.assertEquals(invoice_refund.invoice_payment_state, 'paid', 'Last Customer creadit note should be in paid state')
- self.assertEquals(self.sale_order.invoice_count, 2, "The SO should have 3 related invoices: the original, the refund, and the new one")
- self.assertEquals(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.type == 'out_refund')), 1, "The SO should be linked to only one refund")
- self.assertEquals(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.type == 'out_invoice')), 1, "The SO should be linked to only one customer invoices")
+ self.assertEqual(invoice_refund.type, 'out_refund', 'The last created invoiced should be a customer invoice')
+ self.assertEqual(invoice_refund.invoice_payment_state, 'paid', 'Last Customer creadit note should be in paid state')
+ self.assertEqual(self.sale_order.invoice_count, 2, "The SO should have 3 related invoices: the original, the refund, and the new one")
+ self.assertEqual(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.type == 'out_refund')), 1, "The SO should be linked to only one refund")
+ self.assertEqual(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.type == 'out_invoice')), 1, "The SO should be linked to only one customer invoices")
# At this time, the invoice 1 is opened (validated) and its refund validated too, so the amounts invoiced are zero for
# all sale line. All invoiceable Sale lines have
for line in self.sale_order.order_line:
if line.product_id.invoice_policy == 'delivery':
- self.assertEquals(line.qty_to_invoice, 0.0, "Quantity to invoice should be same as ordered quantity")
- self.assertEquals(line.qty_invoiced, 0.0, "Invoiced quantity should be zero as no any invoice created for SO line based on delivered qty")
- self.assertEquals(line.untaxed_amount_to_invoice, 0.0, "The amount to invoice should be zero, as the line based on delivered quantity")
- self.assertEquals(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as the line based on delivered quantity")
+ self.assertEqual(line.qty_to_invoice, 0.0, "Quantity to invoice should be same as ordered quantity")
+ self.assertEqual(line.qty_invoiced, 0.0, "Invoiced quantity should be zero as no any invoice created for SO line based on delivered qty")
+ self.assertEqual(line.untaxed_amount_to_invoice, 0.0, "The amount to invoice should be zero, as the line based on delivered quantity")
+ self.assertEqual(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as the line based on delivered quantity")
self.assertFalse(line.invoice_lines, "The line based on delivered are not invoiced, so they should not be linked to invoice line")
else:
- self.assertEquals(line.qty_to_invoice, line.product_uom_qty, "The quantity to invoice should be the ordered quantity")
- self.assertEquals(line.qty_invoiced, 0, "The quantity invoiced is zero as the refund (paid) completely cancel the first invoice")
+ self.assertEqual(line.qty_to_invoice, line.product_uom_qty, "The quantity to invoice should be the ordered quantity")
+ self.assertEqual(line.qty_invoiced, 0, "The quantity invoiced is zero as the refund (paid) completely cancel the first invoice")
- self.assertEquals(line.untaxed_amount_to_invoice, line.price_unit * line.qty_to_invoice, "Amount to invoice is now set as qty to invoice * unit price since no price change on invoice, for ordered products")
- self.assertEquals(line.untaxed_amount_invoiced, line.price_unit * line.qty_invoiced, "Amount invoiced is now set as qty invoiced * unit price since no price change on invoice, for ordered products")
- self.assertEquals(len(line.invoice_lines), 2, "The lines 'ordered' qty are invoiced, so it should be linked to 1 invoice lines")
+ self.assertEqual(line.untaxed_amount_to_invoice, line.price_unit * line.qty_to_invoice, "Amount to invoice is now set as qty to invoice * unit price since no price change on invoice, for ordered products")
+ self.assertEqual(line.untaxed_amount_invoiced, line.price_unit * line.qty_invoiced, "Amount invoiced is now set as qty invoiced * unit price since no price change on invoice, for ordered products")
+ self.assertEqual(len(line.invoice_lines), 2, "The lines 'ordered' qty are invoiced, so it should be linked to 1 invoice lines")
def test_refund_modify(self):
""" Test invoice with a refund in 'modify' mode, and check customer invoices credit note is created from respective invoice """
@@ -236,21 +236,21 @@ class TestSaleToInvoice(TestCommonSaleNoChart):
# Check quantity to invoice on SO lines
for line in self.sale_order.order_line:
if line.product_id.invoice_policy == 'delivery':
- self.assertEquals(line.qty_to_invoice, 0.0, "Quantity to invoice should be same as ordered quantity")
- self.assertEquals(line.qty_invoiced, 0.0, "Invoiced quantity should be zero as no any invoice created for SO")
- self.assertEquals(line.untaxed_amount_to_invoice, 0.0, "The amount to invoice should be zero, as the line based on delivered quantity")
- self.assertEquals(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as the line based on delivered quantity")
+ self.assertEqual(line.qty_to_invoice, 0.0, "Quantity to invoice should be same as ordered quantity")
+ self.assertEqual(line.qty_invoiced, 0.0, "Invoiced quantity should be zero as no any invoice created for SO")
+ self.assertEqual(line.untaxed_amount_to_invoice, 0.0, "The amount to invoice should be zero, as the line based on delivered quantity")
+ self.assertEqual(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as the line based on delivered quantity")
self.assertFalse(line.invoice_lines, "The line based on delivered qty are not invoiced, so they should not be linked to invoice line")
else:
if line == self.sol_prod_order:
- self.assertEquals(line.qty_to_invoice, 2.0, "The ordered sale line are totally invoiced (qty to invoice is zero)")
- self.assertEquals(line.qty_invoiced, 3.0, "The ordered (prod) sale line are totally invoiced (qty invoiced come from the invoice lines)")
+ self.assertEqual(line.qty_to_invoice, 2.0, "The ordered sale line are totally invoiced (qty to invoice is zero)")
+ self.assertEqual(line.qty_invoiced, 3.0, "The ordered (prod) sale line are totally invoiced (qty invoiced come from the invoice lines)")
else:
- self.assertEquals(line.qty_to_invoice, 1.0, "The ordered sale line are totally invoiced (qty to invoice is zero)")
- self.assertEquals(line.qty_invoiced, 2.0, "The ordered (serv) sale line are totally invoiced (qty invoiced = the invoice lines)")
- self.assertEquals(line.untaxed_amount_to_invoice, line.price_unit * line.qty_to_invoice, "Amount to invoice is now set as qty to invoice * unit price since no price change on invoice, for ordered products")
- self.assertEquals(line.untaxed_amount_invoiced, line.price_unit * line.qty_invoiced, "Amount invoiced is now set as qty invoiced * unit price since no price change on invoice, for ordered products")
- self.assertEquals(len(line.invoice_lines), 1, "The lines 'ordered' qty are invoiced, so it should be linked to 1 invoice lines")
+ self.assertEqual(line.qty_to_invoice, 1.0, "The ordered sale line are totally invoiced (qty to invoice is zero)")
+ self.assertEqual(line.qty_invoiced, 2.0, "The ordered (serv) sale line are totally invoiced (qty invoiced = the invoice lines)")
+ self.assertEqual(line.untaxed_amount_to_invoice, line.price_unit * line.qty_to_invoice, "Amount to invoice is now set as qty to invoice * unit price since no price change on invoice, for ordered products")
+ self.assertEqual(line.untaxed_amount_invoiced, line.price_unit * line.qty_invoiced, "Amount invoiced is now set as qty invoiced * unit price since no price change on invoice, for ordered products")
+ self.assertEqual(len(line.invoice_lines), 1, "The lines 'ordered' qty are invoiced, so it should be linked to 1 invoice lines")
# Make a credit note
credit_note_wizard = self.env['account.move.reversal'].with_context({'active_ids': [self.invoice.id], 'active_id': self.invoice.id}).create({
@@ -260,34 +260,34 @@ class TestSaleToInvoice(TestCommonSaleNoChart):
invoice_refund = self.env['account.move'].browse(credit_note_wizard.reverse_moves()['res_id'])
# Check invoice's type and number
- self.assertEquals(invoice_refund.type, 'out_invoice', 'The last created invoiced should be a customer invoice')
- self.assertEquals(invoice_refund.state, 'draft', 'Last Customer invoices should be in draft')
- self.assertEquals(self.sale_order.invoice_count, 3, "The SO should have 3 related invoices: the original, the refund, and the new one")
- self.assertEquals(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.type == 'out_refund')), 1, "The SO should be linked to only one refund")
- self.assertEquals(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.type == 'out_invoice')), 2, "The SO should be linked to two customer invoices")
+ self.assertEqual(invoice_refund.type, 'out_invoice', 'The last created invoiced should be a customer invoice')
+ self.assertEqual(invoice_refund.state, 'draft', 'Last Customer invoices should be in draft')
+ self.assertEqual(self.sale_order.invoice_count, 3, "The SO should have 3 related invoices: the original, the refund, and the new one")
+ self.assertEqual(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.type == 'out_refund')), 1, "The SO should be linked to only one refund")
+ self.assertEqual(len(self.sale_order.invoice_ids.filtered(lambda inv: inv.type == 'out_invoice')), 2, "The SO should be linked to two customer invoices")
# At this time, the invoice 1 and its refund are confirmed, so the amounts invoiced are zero. The third invoice
# (2nd customer inv) is in draft state.
for line in self.sale_order.order_line:
if line.product_id.invoice_policy == 'delivery':
- self.assertEquals(line.qty_to_invoice, 0.0, "Quantity to invoice should be same as ordered quantity")
- self.assertEquals(line.qty_invoiced, 0.0, "Invoiced quantity should be zero as no any invoice created for SO")
- self.assertEquals(line.untaxed_amount_to_invoice, 0.0, "The amount to invoice should be zero, as the line based on delivered quantity")
- self.assertEquals(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as the line based on delivered quantity")
+ self.assertEqual(line.qty_to_invoice, 0.0, "Quantity to invoice should be same as ordered quantity")
+ self.assertEqual(line.qty_invoiced, 0.0, "Invoiced quantity should be zero as no any invoice created for SO")
+ self.assertEqual(line.untaxed_amount_to_invoice, 0.0, "The amount to invoice should be zero, as the line based on delivered quantity")
+ self.assertEqual(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as the line based on delivered quantity")
self.assertFalse(line.invoice_lines, "The line based on delivered are not invoiced, so they should not be linked to invoice line")
else:
if line == self.sol_prod_order:
- self.assertEquals(line.qty_to_invoice, 2.0, "The qty to invoice does not change when confirming the new invoice (2)")
- self.assertEquals(line.qty_invoiced, 3.0, "The ordered (prod) sale line does not change on invoice 2 confirmation")
- self.assertEquals(line.untaxed_amount_to_invoice, line.price_unit * 5, "Amount to invoice is now set as qty to invoice * unit price since no price change on invoice, for ordered products")
- self.assertEquals(line.untaxed_amount_invoiced, 0.0, "Amount invoiced is zero as the invoice 1 and its refund are reconcilied")
- self.assertEquals(len(line.invoice_lines), 3, "The line 'ordered consumable' is invoiced, so it should be linked to 3 invoice lines (invoice and refund)")
+ self.assertEqual(line.qty_to_invoice, 2.0, "The qty to invoice does not change when confirming the new invoice (2)")
+ self.assertEqual(line.qty_invoiced, 3.0, "The ordered (prod) sale line does not change on invoice 2 confirmation")
+ self.assertEqual(line.untaxed_amount_to_invoice, line.price_unit * 5, "Amount to invoice is now set as qty to invoice * unit price since no price change on invoice, for ordered products")
+ self.assertEqual(line.untaxed_amount_invoiced, 0.0, "Amount invoiced is zero as the invoice 1 and its refund are reconcilied")
+ self.assertEqual(len(line.invoice_lines), 3, "The line 'ordered consumable' is invoiced, so it should be linked to 3 invoice lines (invoice and refund)")
else:
- self.assertEquals(line.qty_to_invoice, 1.0, "The qty to invoice does not change when confirming the new invoice (2)")
- self.assertEquals(line.qty_invoiced, 2.0, "The ordered (serv) sale line does not change on invoice 2 confirmation")
- self.assertEquals(line.untaxed_amount_to_invoice, line.price_unit * 3, "Amount to invoice is now set as unit price * ordered qty - refund qty) even if the ")
- self.assertEquals(line.untaxed_amount_invoiced, 0.0, "Amount invoiced is zero as the invoice 1 and its refund are reconcilied")
- self.assertEquals(len(line.invoice_lines), 3, "The line 'ordered service' is invoiced, so it should be linked to 3 invoice lines (invoice and refund)")
+ self.assertEqual(line.qty_to_invoice, 1.0, "The qty to invoice does not change when confirming the new invoice (2)")
+ self.assertEqual(line.qty_invoiced, 2.0, "The ordered (serv) sale line does not change on invoice 2 confirmation")
+ self.assertEqual(line.untaxed_amount_to_invoice, line.price_unit * 3, "Amount to invoice is now set as unit price * ordered qty - refund qty) even if the ")
+ self.assertEqual(line.untaxed_amount_invoiced, 0.0, "Amount invoiced is zero as the invoice 1 and its refund are reconcilied")
+ self.assertEqual(len(line.invoice_lines), 3, "The line 'ordered service' is invoiced, so it should be linked to 3 invoice lines (invoice and refund)")
# Change unit of ordered product on refund lines
move_form = Form(invoice_refund)
@@ -302,21 +302,21 @@ class TestSaleToInvoice(TestCommonSaleNoChart):
for line in self.sale_order.order_line:
if line.product_id.invoice_policy == 'delivery':
- self.assertEquals(line.qty_to_invoice, 0.0, "Quantity to invoice should be same as ordered quantity")
- self.assertEquals(line.qty_invoiced, 0.0, "Invoiced quantity should be zero as no any invoice created for SO")
- self.assertEquals(line.untaxed_amount_to_invoice, 0.0, "The amount to invoice should be zero, as the line based on delivered quantity")
- self.assertEquals(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as the line based on delivered quantity")
+ self.assertEqual(line.qty_to_invoice, 0.0, "Quantity to invoice should be same as ordered quantity")
+ self.assertEqual(line.qty_invoiced, 0.0, "Invoiced quantity should be zero as no any invoice created for SO")
+ self.assertEqual(line.untaxed_amount_to_invoice, 0.0, "The amount to invoice should be zero, as the line based on delivered quantity")
+ self.assertEqual(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as the line based on delivered quantity")
self.assertFalse(line.invoice_lines, "The line based on delivered are not invoiced, so they should not be linked to invoice line, even after validation")
else:
if line == self.sol_prod_order:
- self.assertEquals(line.qty_to_invoice, 2.0, "The qty to invoice does not change when confirming the new invoice (3)")
- self.assertEquals(line.qty_invoiced, 3.0, "The ordered sale line are totally invoiced (qty invoiced = ordered qty)")
- self.assertEquals(line.untaxed_amount_to_invoice, 1100.0, "")
- self.assertEquals(line.untaxed_amount_invoiced, 300.0, "")
- self.assertEquals(len(line.invoice_lines), 3, "The line 'ordered consumable' is invoiced, so it should be linked to 2 invoice lines (invoice and refund), even after validation")
+ self.assertEqual(line.qty_to_invoice, 2.0, "The qty to invoice does not change when confirming the new invoice (3)")
+ self.assertEqual(line.qty_invoiced, 3.0, "The ordered sale line are totally invoiced (qty invoiced = ordered qty)")
+ self.assertEqual(line.untaxed_amount_to_invoice, 1100.0, "")
+ self.assertEqual(line.untaxed_amount_invoiced, 300.0, "")
+ self.assertEqual(len(line.invoice_lines), 3, "The line 'ordered consumable' is invoiced, so it should be linked to 2 invoice lines (invoice and refund), even after validation")
else:
- self.assertEquals(line.qty_to_invoice, 1.0, "The qty to invoice does not change when confirming the new invoice (3)")
- self.assertEquals(line.qty_invoiced, 2.0, "The ordered sale line are totally invoiced (qty invoiced = ordered qty)")
- self.assertEquals(line.untaxed_amount_to_invoice, 170.0, "")
- self.assertEquals(line.untaxed_amount_invoiced, 100.0, "")
- self.assertEquals(len(line.invoice_lines), 3, "The line 'ordered service' is invoiced, so it should be linked to 2 invoice lines (invoice and refund), even after validation")
+ self.assertEqual(line.qty_to_invoice, 1.0, "The qty to invoice does not change when confirming the new invoice (3)")
+ self.assertEqual(line.qty_invoiced, 2.0, "The ordered sale line are totally invoiced (qty invoiced = ordered qty)")
+ self.assertEqual(line.untaxed_amount_to_invoice, 170.0, "")
+ self.assertEqual(line.untaxed_amount_invoiced, 100.0, "")
+ self.assertEqual(len(line.invoice_lines), 3, "The line 'ordered service' is invoiced, so it should be linked to 2 invoice lines (invoice and refund), even after validation")
diff --git a/addons/sale/tests/test_sale_to_invoice.py b/addons/sale/tests/test_sale_to_invoice.py
index 5df778af1fe..a67158a3d11 100644
--- a/addons/sale/tests/test_sale_to_invoice.py
+++ b/addons/sale/tests/test_sale_to_invoice.py
@@ -83,9 +83,9 @@ class TestSaleToInvoice(TestCommonSaleNoChart):
})
payment.create_invoices()
- self.assertEquals(len(self.sale_order.invoice_ids), 1, 'Invoice should be created for the SO')
+ self.assertEqual(len(self.sale_order.invoice_ids), 1, 'Invoice should be created for the SO')
downpayment_line = self.sale_order.order_line.filtered(lambda l: l.is_downpayment)
- self.assertEquals(len(downpayment_line), 1, 'SO line downpayment should be created on SO')
+ self.assertEqual(len(downpayment_line), 1, 'SO line downpayment should be created on SO')
# Update delivered quantity of SO lines
self.sol_serv_deliver.write({'qty_delivered': 4.0})
@@ -97,11 +97,11 @@ class TestSaleToInvoice(TestCommonSaleNoChart):
})
payment.create_invoices()
- self.assertEquals(len(self.sale_order.invoice_ids), 2, 'Invoice should be created for the SO')
+ self.assertEqual(len(self.sale_order.invoice_ids), 2, 'Invoice should be created for the SO')
invoice = self.sale_order.invoice_ids.sorted()[0]
- self.assertEquals(len(invoice.invoice_line_ids), len(self.sale_order.order_line), 'All lines should be invoiced')
- self.assertEquals(invoice.amount_total, self.sale_order.amount_total - downpayment_line.price_unit, 'Downpayment should be applied')
+ self.assertEqual(len(invoice.invoice_line_ids), len(self.sale_order.order_line), 'All lines should be invoiced')
+ self.assertEqual(invoice.amount_total, self.sale_order.amount_total - downpayment_line.price_unit, 'Downpayment should be applied')
def test_invoice_with_discount(self):
""" Test invoice with a discount and check discount applied on both SO lines and an invoice lines """
@@ -113,7 +113,7 @@ class TestSaleToInvoice(TestCommonSaleNoChart):
for line in self.sale_order.order_line.filtered(lambda l: l.discount):
product_price = line.price_unit * line.product_uom_qty
- self.assertEquals(line.discount, (product_price - line.price_subtotal) / product_price * 100, 'Discount should be applied on order line')
+ self.assertEqual(line.discount, (product_price - line.price_subtotal) / product_price * 100, 'Discount should be applied on order line')
# lines are in draft
for line in self.sale_order.order_line:
@@ -125,9 +125,9 @@ class TestSaleToInvoice(TestCommonSaleNoChart):
for line in self.sale_order.order_line:
self.assertTrue(float_is_zero(line.untaxed_amount_invoiced, precision_digits=2), "The invoiced amount should be zero, as the line is in draft state")
- self.assertEquals(self.sol_serv_order.untaxed_amount_to_invoice, 297, "The untaxed amount to invoice is wrong")
- self.assertEquals(self.sol_serv_deliver.untaxed_amount_to_invoice, self.sol_serv_deliver.qty_delivered * self.sol_serv_deliver.price_reduce, "The untaxed amount to invoice should be qty deli * price reduce, so 4 * (180 - 36)")
- self.assertEquals(self.sol_prod_deliver.untaxed_amount_to_invoice, 140, "The untaxed amount to invoice should be qty deli * price reduce, so 4 * (180 - 36)")
+ self.assertEqual(self.sol_serv_order.untaxed_amount_to_invoice, 297, "The untaxed amount to invoice is wrong")
+ self.assertEqual(self.sol_serv_deliver.untaxed_amount_to_invoice, self.sol_serv_deliver.qty_delivered * self.sol_serv_deliver.price_reduce, "The untaxed amount to invoice should be qty deli * price reduce, so 4 * (180 - 36)")
+ self.assertEqual(self.sol_prod_deliver.untaxed_amount_to_invoice, 140, "The untaxed amount to invoice should be qty deli * price reduce, so 4 * (180 - 36)")
# Let's do an invoice with invoiceable lines
payment = self.env['sale.advance.payment.inv'].with_context(self.context).create({
@@ -139,7 +139,7 @@ class TestSaleToInvoice(TestCommonSaleNoChart):
# Check discount appeared on both SO lines and invoice lines
for line, inv_line in zip(self.sale_order.order_line, invoice.invoice_line_ids):
- self.assertEquals(line.discount, inv_line.discount, 'Discount on lines of order and invoice should be same')
+ self.assertEqual(line.discount, inv_line.discount, 'Discount on lines of order and invoice should be same')
def test_invoice(self):
""" Test create and invoice from the SO, and check qty invoice/to invoice, and the related amounts """
@@ -154,15 +154,15 @@ class TestSaleToInvoice(TestCommonSaleNoChart):
# Check ordered quantity, quantity to invoice and invoiced quantity of SO lines
for line in self.sale_order.order_line:
if line.product_id.invoice_policy == 'delivery':
- self.assertEquals(line.qty_to_invoice, 0.0, 'Quantity to invoice should be same as ordered quantity')
- self.assertEquals(line.qty_invoiced, 0.0, 'Invoiced quantity should be zero as no any invoice created for SO')
- self.assertEquals(line.untaxed_amount_to_invoice, 0.0, "The amount to invoice should be zero, as the line based on delivered quantity")
- self.assertEquals(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as the line based on delivered quantity")
+ self.assertEqual(line.qty_to_invoice, 0.0, 'Quantity to invoice should be same as ordered quantity')
+ self.assertEqual(line.qty_invoiced, 0.0, 'Invoiced quantity should be zero as no any invoice created for SO')
+ self.assertEqual(line.untaxed_amount_to_invoice, 0.0, "The amount to invoice should be zero, as the line based on delivered quantity")
+ self.assertEqual(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as the line based on delivered quantity")
else:
- self.assertEquals(line.qty_to_invoice, line.product_uom_qty, 'Quantity to invoice should be same as ordered quantity')
- self.assertEquals(line.qty_invoiced, 0.0, 'Invoiced quantity should be zero as no any invoice created for SO')
- self.assertEquals(line.untaxed_amount_to_invoice, line.product_uom_qty * line.price_unit, "The amount to invoice should the total of the line, as the line is confirmed")
- self.assertEquals(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as the line is confirmed")
+ self.assertEqual(line.qty_to_invoice, line.product_uom_qty, 'Quantity to invoice should be same as ordered quantity')
+ self.assertEqual(line.qty_invoiced, 0.0, 'Invoiced quantity should be zero as no any invoice created for SO')
+ self.assertEqual(line.untaxed_amount_to_invoice, line.product_uom_qty * line.price_unit, "The amount to invoice should the total of the line, as the line is confirmed")
+ self.assertEqual(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as the line is confirmed")
# Let's do an invoice with invoiceable lines
payment = self.env['sale.advance.payment.inv'].with_context(self.context).create({
@@ -183,35 +183,35 @@ class TestSaleToInvoice(TestCommonSaleNoChart):
# amount to invoice / invoiced should not have changed (amounts take only confirmed invoice into account)
for line in self.sale_order.order_line:
if line.product_id.invoice_policy == 'delivery':
- self.assertEquals(line.qty_to_invoice, 0.0, "Quantity to invoice should be zero")
- self.assertEquals(line.qty_invoiced, 0.0, "Invoiced quantity should be zero as delivered lines are not delivered yet")
- self.assertEquals(line.untaxed_amount_to_invoice, 0.0, "The amount to invoice should be zero, as the line based on delivered quantity (no confirmed invoice)")
- self.assertEquals(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as no invoice are validated for now")
+ self.assertEqual(line.qty_to_invoice, 0.0, "Quantity to invoice should be zero")
+ self.assertEqual(line.qty_invoiced, 0.0, "Invoiced quantity should be zero as delivered lines are not delivered yet")
+ self.assertEqual(line.untaxed_amount_to_invoice, 0.0, "The amount to invoice should be zero, as the line based on delivered quantity (no confirmed invoice)")
+ self.assertEqual(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as no invoice are validated for now")
else:
if line == self.sol_prod_order:
- self.assertEquals(self.sol_prod_order.qty_to_invoice, 2.0, "Changing the quantity on draft invoice update the qty to invoice on SO lines")
- self.assertEquals(self.sol_prod_order.qty_invoiced, 3.0, "Changing the quantity on draft invoice update the invoiced qty on SO lines")
+ self.assertEqual(self.sol_prod_order.qty_to_invoice, 2.0, "Changing the quantity on draft invoice update the qty to invoice on SO lines")
+ self.assertEqual(self.sol_prod_order.qty_invoiced, 3.0, "Changing the quantity on draft invoice update the invoiced qty on SO lines")
else:
- self.assertEquals(self.sol_serv_order.qty_to_invoice, 1.0, "Changing the quantity on draft invoice update the qty to invoice on SO lines")
- self.assertEquals(self.sol_serv_order.qty_invoiced, 2.0, "Changing the quantity on draft invoice update the invoiced qty on SO lines")
- self.assertEquals(line.untaxed_amount_to_invoice, line.product_uom_qty * line.price_unit, "The amount to invoice should the total of the line, as the line is confirmed (no confirmed invoice)")
- self.assertEquals(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as no invoice are validated for now")
+ self.assertEqual(self.sol_serv_order.qty_to_invoice, 1.0, "Changing the quantity on draft invoice update the qty to invoice on SO lines")
+ self.assertEqual(self.sol_serv_order.qty_invoiced, 2.0, "Changing the quantity on draft invoice update the invoiced qty on SO lines")
+ self.assertEqual(line.untaxed_amount_to_invoice, line.product_uom_qty * line.price_unit, "The amount to invoice should the total of the line, as the line is confirmed (no confirmed invoice)")
+ self.assertEqual(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as no invoice are validated for now")
invoice.post()
# Check quantity to invoice on SO lines
for line in self.sale_order.order_line:
if line.product_id.invoice_policy == 'delivery':
- self.assertEquals(line.qty_to_invoice, 0.0, "Quantity to invoice should be same as ordered quantity")
- self.assertEquals(line.qty_invoiced, 0.0, "Invoiced quantity should be zero as no any invoice created for SO")
- self.assertEquals(line.untaxed_amount_to_invoice, 0.0, "The amount to invoice should be zero, as the line based on delivered quantity")
- self.assertEquals(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as the line based on delivered quantity")
+ self.assertEqual(line.qty_to_invoice, 0.0, "Quantity to invoice should be same as ordered quantity")
+ self.assertEqual(line.qty_invoiced, 0.0, "Invoiced quantity should be zero as no any invoice created for SO")
+ self.assertEqual(line.untaxed_amount_to_invoice, 0.0, "The amount to invoice should be zero, as the line based on delivered quantity")
+ self.assertEqual(line.untaxed_amount_invoiced, 0.0, "The invoiced amount should be zero, as the line based on delivered quantity")
else:
if line == self.sol_prod_order:
- self.assertEquals(line.qty_to_invoice, 2.0, "The ordered sale line are totally invoiced (qty to invoice is zero)")
- self.assertEquals(line.qty_invoiced, 3.0, "The ordered (prod) sale line are totally invoiced (qty invoiced come from the invoice lines)")
+ self.assertEqual(line.qty_to_invoice, 2.0, "The ordered sale line are totally invoiced (qty to invoice is zero)")
+ self.assertEqual(line.qty_invoiced, 3.0, "The ordered (prod) sale line are totally invoiced (qty invoiced come from the invoice lines)")
else:
- self.assertEquals(line.qty_to_invoice, 1.0, "The ordered sale line are totally invoiced (qty to invoice is zero)")
- self.assertEquals(line.qty_invoiced, 2.0, "The ordered (serv) sale line are totally invoiced (qty invoiced = the invoice lines)")
- self.assertEquals(line.untaxed_amount_to_invoice, line.price_unit * line.qty_to_invoice, "Amount to invoice is now set as qty to invoice * unit price since no price change on invoice, for ordered products")
- self.assertEquals(line.untaxed_amount_invoiced, line.price_unit * line.qty_invoiced, "Amount invoiced is now set as qty invoiced * unit price since no price change on invoice, for ordered products")
+ self.assertEqual(line.qty_to_invoice, 1.0, "The ordered sale line are totally invoiced (qty to invoice is zero)")
+ self.assertEqual(line.qty_invoiced, 2.0, "The ordered (serv) sale line are totally invoiced (qty invoiced = the invoice lines)")
+ self.assertEqual(line.untaxed_amount_to_invoice, line.price_unit * line.qty_to_invoice, "Amount to invoice is now set as qty to invoice * unit price since no price change on invoice, for ordered products")
+ self.assertEqual(line.untaxed_amount_invoiced, line.price_unit * line.qty_invoiced, "Amount invoiced is now set as qty invoiced * unit price since no price change on invoice, for ordered products")
diff --git a/addons/sale_expense/tests/test_reinvoice.py b/addons/sale_expense/tests/test_reinvoice.py
index 0a7fa507c53..bae15f23017 100644
--- a/addons/sale_expense/tests/test_reinvoice.py
+++ b/addons/sale_expense/tests/test_reinvoice.py
@@ -74,24 +74,24 @@ class TestReInvoice(TestExpenseCommon, TestCommonSaleNoChart):
self.expense_sheet.approve_expense_sheets()
self.expense_sheet.action_sheet_move_create()
- self.assertEquals(len(self.sale_order.order_line), 3, "There should be 3 lines on the SO")
- self.assertEquals(sale_order_line.qty_delivered, 0, "Exising SO line should not be impacted by reinvoicing product at cost")
+ self.assertEqual(len(self.sale_order.order_line), 3, "There should be 3 lines on the SO")
+ self.assertEqual(sale_order_line.qty_delivered, 0, "Exising SO line should not be impacted by reinvoicing product at cost")
sol_ordered = self.sale_order.order_line.filtered(lambda sol: sol.product_id == self.product_ordered_cost and sol != sale_order_line)
self.assertTrue(sol_ordered.is_expense, "The new SOL should be flag as coming from an expense")
- self.assertEquals(sol_ordered.qty_delivered_method, 'analytic', 'Delivered quantity of expense SO line should be computed by analytic amount')
+ self.assertEqual(sol_ordered.qty_delivered_method, 'analytic', 'Delivered quantity of expense SO line should be computed by analytic amount')
self.assertTrue(sol_ordered, "A new line with ordered expense should have been created on expense report posting")
- self.assertEquals(sol_ordered.price_unit, expense1.unit_amount, "The unit price of new SO line should be the one from the expense (at cost)")
- self.assertEquals(sol_ordered.product_uom_qty, 0, "The ordered quantity of new SO line should be zero")
- self.assertEquals(sol_ordered.qty_delivered, expense1.quantity, "The delivered quantity of new SO line should be the one from the expense")
+ self.assertEqual(sol_ordered.price_unit, expense1.unit_amount, "The unit price of new SO line should be the one from the expense (at cost)")
+ self.assertEqual(sol_ordered.product_uom_qty, 0, "The ordered quantity of new SO line should be zero")
+ self.assertEqual(sol_ordered.qty_delivered, expense1.quantity, "The delivered quantity of new SO line should be the one from the expense")
sol_deliver = self.sale_order.order_line.filtered(lambda sol: sol.product_id == self.product_deliver_cost and sol != sale_order_line)
self.assertTrue(sol_deliver.is_expense, "The new SOL should be flag as coming from an expense")
- self.assertEquals(sol_deliver.qty_delivered_method, 'analytic', 'Delivered quantity of expense SO line should be computed by analytic amount')
+ self.assertEqual(sol_deliver.qty_delivered_method, 'analytic', 'Delivered quantity of expense SO line should be computed by analytic amount')
self.assertTrue(sol_deliver, "A new line with delivered expense should have been created on expense report posting")
- self.assertEquals(sol_deliver.price_unit, expense2.unit_amount, "The unit price of new SO line should be the one from the expense (at cost)")
- self.assertEquals(sol_deliver.product_uom_qty, 0, "The ordered quantity of new SO line should be zero")
- self.assertEquals(sol_deliver.qty_delivered, expense2.quantity, "The delivered quantity of new SO line should be the one from the expense")
+ self.assertEqual(sol_deliver.price_unit, expense2.unit_amount, "The unit price of new SO line should be the one from the expense (at cost)")
+ self.assertEqual(sol_deliver.product_uom_qty, 0, "The ordered quantity of new SO line should be zero")
+ self.assertEqual(sol_deliver.qty_delivered, expense2.quantity, "The delivered quantity of new SO line should be the one from the expense")
def test_sales_price_ordered(self):
""" Test invoicing expenses at sales price for product based on ordered quantities. """
@@ -118,15 +118,15 @@ class TestReInvoice(TestExpenseCommon, TestCommonSaleNoChart):
self.expense_sheet.action_sheet_move_create()
self.assertTrue(self.sale_order.analytic_account_id, "Posting expense with an expense product should trigger the analytic account creation on SO")
- self.assertEquals(self.sale_order.analytic_account_id, expense1.analytic_account_id, "SO analytic account should be the same for the expense")
- self.assertEquals(len(self.sale_order.order_line), 1, "A new So line should have been created on expense report posting")
+ self.assertEqual(self.sale_order.analytic_account_id, expense1.analytic_account_id, "SO analytic account should be the same for the expense")
+ self.assertEqual(len(self.sale_order.order_line), 1, "A new So line should have been created on expense report posting")
sol_ordered = self.sale_order.order_line.filtered(lambda sol: sol.product_id == expense1.product_id)
self.assertTrue(sol_ordered.is_expense, "The new SOL should be flag as coming from an expense")
self.assertTrue(sol_ordered, "A new line with ordered expense should have been created on expense report posting")
- self.assertEquals(sol_ordered.price_unit, 10, "The unit price of new SO line should be the one from the expense (at sales price)")
- self.assertEquals(sol_ordered.product_uom_qty, 0, "The ordered quantity of new SO line should be zero")
- self.assertEquals(sol_ordered.qty_delivered, expense1.quantity, "The delivered quantity of new SO line should be the one from the expense")
+ self.assertEqual(sol_ordered.price_unit, 10, "The unit price of new SO line should be the one from the expense (at sales price)")
+ self.assertEqual(sol_ordered.product_uom_qty, 0, "The ordered quantity of new SO line should be zero")
+ self.assertEqual(sol_ordered.qty_delivered, expense1.quantity, "The delivered quantity of new SO line should be the one from the expense")
def test_sales_price_delivered(self):
""" Test invoicing expenses at sales price for product based on delivered quantities. Check the existing SO line is not incremented, but a new
@@ -164,13 +164,13 @@ class TestReInvoice(TestExpenseCommon, TestCommonSaleNoChart):
self.expense_sheet.approve_expense_sheets()
self.expense_sheet.action_sheet_move_create()
- self.assertEquals(len(self.sale_order.order_line), 2, "A new expense SOL should have been created.")
+ self.assertEqual(len(self.sale_order.order_line), 2, "A new expense SOL should have been created.")
sale_order_line2 = self.sale_order.order_line.filtered(lambda sol: sol != sale_order_line1)
self.assertTrue(sale_order_line2.is_expense, "The new SOL should be flag as coming from an expense")
- self.assertEquals(sale_order_line2.price_unit, 10, "The unit price of SO line should be the same")
- self.assertEquals(sale_order_line2.product_uom_qty, 0, "The ordered quantity of new SO line should be zero")
- self.assertEquals(sale_order_line2.qty_delivered, expense1.quantity, "The delivered quantity of SO line should have be the same of the expense")
+ self.assertEqual(sale_order_line2.price_unit, 10, "The unit price of SO line should be the same")
+ self.assertEqual(sale_order_line2.product_uom_qty, 0, "The ordered quantity of new SO line should be zero")
+ self.assertEqual(sale_order_line2.qty_delivered, expense1.quantity, "The delivered quantity of SO line should have be the same of the expense")
# create 2nd expense lines
expense2 = self.env['hr.expense'].create({
@@ -189,11 +189,11 @@ class TestReInvoice(TestExpenseCommon, TestCommonSaleNoChart):
self.expense_sheet2.approve_expense_sheets()
self.expense_sheet2.action_sheet_move_create()
- self.assertEquals(len(self.sale_order.order_line), 2, "No new expense SOL should have been created.")
+ self.assertEqual(len(self.sale_order.order_line), 2, "No new expense SOL should have been created.")
- self.assertEquals(sale_order_line2.price_unit, 10, "The unit price of SO line should be the same")
- self.assertEquals(sale_order_line2.product_uom_qty, 0, "The ordered quantity of new SO line should remains zero")
- self.assertEquals(sale_order_line2.qty_delivered, expense1.quantity + expense2.quantity, "The delivered quantity of SO line should have been incremented")
+ self.assertEqual(sale_order_line2.price_unit, 10, "The unit price of SO line should be the same")
+ self.assertEqual(sale_order_line2.product_uom_qty, 0, "The ordered quantity of new SO line should remains zero")
+ self.assertEqual(sale_order_line2.qty_delivered, expense1.quantity + expense2.quantity, "The delivered quantity of SO line should have been incremented")
def test_no_expense(self):
""" Test invoicing expenses with no policy. Check nothing happen. """
@@ -234,7 +234,7 @@ class TestReInvoice(TestExpenseCommon, TestCommonSaleNoChart):
self.assertFalse(expense1.sale_order_id, "None reinvoicable expense can not be linked to SO")
self.assertFalse(self.sale_order.analytic_account_id, "Posting expense with an non expense product should not trigger analytic Account creation from SO, since non reinvoicable expense can not be linked to SO")
- self.assertEquals(len(self.sale_order.order_line), 1, "No SO line should have been created (or removed) on expense report posting")
- self.assertEquals(sale_order_line.price_unit, self.product_no_expense.list_price, "The unit price of SO line should be the same")
- self.assertEquals(sale_order_line.product_uom_qty, 2, "The ordered quantity of SO line should be two")
- self.assertEquals(sale_order_line.qty_delivered, 0, "The delivered quantity of SO line should have been incremented")
+ self.assertEqual(len(self.sale_order.order_line), 1, "No SO line should have been created (or removed) on expense report posting")
+ self.assertEqual(sale_order_line.price_unit, self.product_no_expense.list_price, "The unit price of SO line should be the same")
+ self.assertEqual(sale_order_line.product_uom_qty, 2, "The ordered quantity of SO line should be two")
+ self.assertEqual(sale_order_line.qty_delivered, 0, "The delivered quantity of SO line should have been incremented")
diff --git a/addons/sale_mrp/tests/test_sale_mrp_flow.py b/addons/sale_mrp/tests/test_sale_mrp_flow.py
index 274ed6b90a3..bcad55c50ea 100644
--- a/addons/sale_mrp/tests/test_sale_mrp_flow.py
+++ b/addons/sale_mrp/tests/test_sale_mrp_flow.py
@@ -201,7 +201,7 @@ class TestSaleMrpFlow(common.SavepointCase):
"""
moves_to_process = moves.filtered(lambda m: m.product_id in quantities_to_process.keys())
for move in moves_to_process:
- self.assertEquals(move.product_uom_qty, quantities_to_process[move.product_id])
+ self.assertEqual(move.product_uom_qty, quantities_to_process[move.product_id])
def _create_move_quantities(self, qty_to_process, components, warehouse):
""" Helper to creates moves in order to update the quantities of components
@@ -703,24 +703,24 @@ class TestSaleMrpFlow(common.SavepointCase):
so.action_confirm()
# Check picking creation
- self.assertEquals(len(so.picking_ids), 1)
+ self.assertEqual(len(so.picking_ids), 1)
picking_original = so.picking_ids[0]
move_lines = picking_original.move_lines
# Check if the correct amount of stock.moves are created
- self.assertEquals(len(move_lines), 3)
+ self.assertEqual(len(move_lines), 3)
# Check if BoM is created and is for a 'Kit'
bom_from_k1 = self.env['mrp.bom']._bom_find(product=self.kit_1)
- self.assertEquals(self.bom_kit_1.id, bom_from_k1.id)
- self.assertEquals(bom_from_k1.type, 'phantom')
+ self.assertEqual(self.bom_kit_1.id, bom_from_k1.id)
+ self.assertEqual(bom_from_k1.type, 'phantom')
# Check there's only 1 order line on the SO and it's for x10 'kit_1'
order_lines = so.order_line
- self.assertEquals(len(order_lines), 1)
+ self.assertEqual(len(order_lines), 1)
order_line = order_lines[0]
- self.assertEquals(order_line.product_id.id, self.kit_1.id)
- self.assertEquals(order_line.product_uom_qty, 10.0)
+ self.assertEqual(order_line.product_id.id, self.kit_1.id)
+ self.assertEqual(order_line.product_uom_qty, 10.0)
# Check if correct qty is ordered for each component of the kit
expected_quantities = {
@@ -736,10 +736,10 @@ class TestSaleMrpFlow(common.SavepointCase):
backorder_wizard.process()
# Check that the backorder was created, no kit should be delivered at this point
- self.assertEquals(len(so.picking_ids), 2)
+ self.assertEqual(len(so.picking_ids), 2)
backorder_1 = so.picking_ids - picking_original
- self.assertEquals(backorder_1.backorder_id.id, picking_original.id)
- self.assertEquals(order_line.qty_delivered, 0)
+ self.assertEqual(backorder_1.backorder_id.id, picking_original.id)
+ self.assertEqual(order_line.qty_delivered, 0)
# Process only x6 each componenent in the picking
# Then create a backorder for the missing components
@@ -748,13 +748,13 @@ class TestSaleMrpFlow(common.SavepointCase):
backorder_wizard.process()
# Check that a backorder is created
- self.assertEquals(len(so.picking_ids), 3)
+ self.assertEqual(len(so.picking_ids), 3)
backorder_2 = so.picking_ids - picking_original - backorder_1
- self.assertEquals(backorder_2.backorder_id.id, backorder_1.id)
+ self.assertEqual(backorder_2.backorder_id.id, backorder_1.id)
# With x6 unit of each components, we can only make 2 kits.
# So only 2 kits should be delivered
- self.assertEquals(order_line.qty_delivered, 2)
+ self.assertEqual(order_line.qty_delivered, 2)
# Process x3 more unit of each components :
# - Now only 3 kits should be delivered
@@ -764,10 +764,10 @@ class TestSaleMrpFlow(common.SavepointCase):
backorder_wizard = self.env['stock.backorder.confirmation'].create({'pick_ids': [(4, backorder_2.id)]})
backorder_wizard.process()
- self.assertEquals(len(so.picking_ids), 4)
+ self.assertEqual(len(so.picking_ids), 4)
backorder_3 = so.picking_ids - picking_original - backorder_2 - backorder_1
- self.assertEquals(backorder_3.backorder_id.id, backorder_2.id)
- self.assertEquals(order_line.qty_delivered, 3)
+ self.assertEqual(backorder_3.backorder_id.id, backorder_2.id)
+ self.assertEqual(order_line.qty_delivered, 3)
# Adding missing components
qty_to_process = {
@@ -782,7 +782,7 @@ class TestSaleMrpFlow(common.SavepointCase):
order_line._compute_qty_delivered()
# All kits should be delivered
- self.assertEquals(order_line.qty_delivered, 10)
+ self.assertEqual(order_line.qty_delivered, 10)
def test_04_sale_mrp_kit_qty_delivered(self):
""" Test that the quantities delivered are correct when
@@ -827,7 +827,7 @@ class TestSaleMrpFlow(common.SavepointCase):
# Check picking creation, its move lines should concern
# only components. Also checks that the quantities are corresponding
# to the SO
- self.assertEquals(len(so.picking_ids), 1)
+ self.assertEqual(len(so.picking_ids), 1)
order_line = so.order_line[0]
picking_original = so.picking_ids[0]
move_lines = picking_original.move_lines
@@ -844,7 +844,7 @@ class TestSaleMrpFlow(common.SavepointCase):
self.component_g: 28.0
}
- self.assertEquals(len(move_lines), 7)
+ self.assertEqual(len(move_lines), 7)
self.assertTrue(not any(kit in products for kit in kits))
self.assertTrue(all(component in products for component in components))
self._assert_quantities(move_lines, expected_quantities)
@@ -858,13 +858,13 @@ class TestSaleMrpFlow(common.SavepointCase):
backorder_wizard.process()
# Check that a backorded is created
- self.assertEquals(len(so.picking_ids), 2)
+ self.assertEqual(len(so.picking_ids), 2)
backorder_1 = so.picking_ids - picking_original
- self.assertEquals(backorder_1.backorder_id.id, picking_original.id)
+ self.assertEqual(backorder_1.backorder_id.id, picking_original.id)
# Even if some components are delivered completely,
# no KitParent should be delivered
- self.assertEquals(order_line.qty_delivered, 0)
+ self.assertEqual(order_line.qty_delivered, 0)
# Process just enough components to make 1 kit_parent
qty_to_process = {
@@ -878,12 +878,12 @@ class TestSaleMrpFlow(common.SavepointCase):
backorder_wizard.process()
# Only 1 kit_parent should be delivered at this point
- self.assertEquals(order_line.qty_delivered, 1)
+ self.assertEqual(order_line.qty_delivered, 1)
# Check that the second backorder is created
- self.assertEquals(len(so.picking_ids), 3)
+ self.assertEqual(len(so.picking_ids), 3)
backorder_2 = so.picking_ids - picking_original - backorder_1
- self.assertEquals(backorder_2.backorder_id.id, backorder_1.id)
+ self.assertEqual(backorder_2.backorder_id.id, backorder_1.id)
# Set the components quantities that backorder_2 should have
expected_quantities = {
@@ -898,7 +898,7 @@ class TestSaleMrpFlow(common.SavepointCase):
# Check that the computed quantities are matching the theorical ones.
# Since component_e was totally processed, this componenent shouldn't be
# present in backorder_2
- self.assertEquals(len(backorder_2.move_lines), 6)
+ self.assertEqual(len(backorder_2.move_lines), 6)
move_comp_e = backorder_2.move_lines.filtered(lambda m: m.product_id.id == self.component_e.id)
self.assertFalse(move_comp_e)
self._assert_quantities(backorder_2.move_lines, expected_quantities)
@@ -917,12 +917,12 @@ class TestSaleMrpFlow(common.SavepointCase):
backorder_wizard.process()
# Check that x3 kit_parents are indeed delivered
- self.assertEquals(order_line.qty_delivered, 3)
+ self.assertEqual(order_line.qty_delivered, 3)
# Check that the third backorder is created
- self.assertEquals(len(so.picking_ids), 4)
+ self.assertEqual(len(so.picking_ids), 4)
backorder_3 = so.picking_ids - (picking_original + backorder_1 + backorder_2)
- self.assertEquals(backorder_3.backorder_id.id, backorder_2.id)
+ self.assertEqual(backorder_3.backorder_id.id, backorder_2.id)
# Check the components quantities that backorder_3 should have
expected_quantities = {
@@ -941,7 +941,7 @@ class TestSaleMrpFlow(common.SavepointCase):
# Validating the last backorder now it's complete.
# All kits should be delivered
backorder_3.button_validate()
- self.assertEquals(order_line.qty_delivered, 7.0)
+ self.assertEqual(order_line.qty_delivered, 7.0)
# Return all components processed by backorder_3
stock_return_picking_form = Form(self.env['stock.return.picking']
@@ -962,7 +962,7 @@ class TestSaleMrpFlow(common.SavepointCase):
wiz.process()
# Now quantity delivered should be 3 again
- self.assertEquals(order_line.qty_delivered, 3)
+ self.assertEqual(order_line.qty_delivered, 3)
stock_return_picking_form = Form(self.env['stock.return.picking']
.with_context(active_ids=return_pick.ids, active_id=return_pick.ids[0],
@@ -984,16 +984,16 @@ class TestSaleMrpFlow(common.SavepointCase):
backorder_wizard.process()
# As one of each component is missing, only 6 kit_parents should be delivered
- self.assertEquals(order_line.qty_delivered, 6)
+ self.assertEqual(order_line.qty_delivered, 6)
# Check that the 4th backorder is created.
- self.assertEquals(len(so.picking_ids), 7)
+ self.assertEqual(len(so.picking_ids), 7)
backorder_4 = so.picking_ids - (picking_original + backorder_1 + backorder_2 + backorder_3 + return_of_return_pick + return_pick)
- self.assertEquals(backorder_4.backorder_id.id, return_of_return_pick.id)
+ self.assertEqual(backorder_4.backorder_id.id, return_of_return_pick.id)
# Check the components quantities that backorder_4 should have
for move in backorder_4.move_lines:
- self.assertEquals(move.product_qty, 1)
+ self.assertEqual(move.product_qty, 1)
@mute_logger('odoo.tests.common.onchange')
def test_05_mrp_sale_kit_availability(self):
@@ -1051,8 +1051,8 @@ class TestSaleMrpFlow(common.SavepointCase):
# Check that not enough enough quantities are available in the warehouse set in the SO
# but there are enough quantities in Warehouse 1 for 1 kit_parent
- self.assertEquals(kit_parent_wh_order.virtual_available, 0)
- self.assertEquals(kit_parent_wh1.virtual_available, 1)
+ self.assertEqual(kit_parent_wh_order.virtual_available, 0)
+ self.assertEqual(kit_parent_wh1.virtual_available, 1)
# Check there arn't enough quantities available for the sale order
self.assertTrue(float_compare(order_line.virtual_available_at_date - order_line.product_uom_qty, 0, precision_rounding=line.product_uom.rounding) == -1)
@@ -1073,8 +1073,8 @@ class TestSaleMrpFlow(common.SavepointCase):
# But the quantity available in Warehouse 1 should stay 1
kit_parent_wh_order = self.kit_parent.with_context(warehouse=so.warehouse_id.id)
kit_parent_wh1 = self.kit_parent.with_context(warehouse=warehouse_1.id)
- self.assertEquals(kit_parent_wh_order.virtual_available, 3)
- self.assertEquals(kit_parent_wh1.virtual_available, 1)
+ self.assertEqual(kit_parent_wh_order.virtual_available, 3)
+ self.assertEqual(kit_parent_wh1.virtual_available, 1)
# Check there arn't enough quantities available for the sale order
self.assertTrue(float_compare(order_line.virtual_available_at_date - order_line.product_uom_qty, 0, precision_rounding=line.product_uom.rounding) == -1)
@@ -1093,7 +1093,7 @@ class TestSaleMrpFlow(common.SavepointCase):
# Enough quantities should be available, no warning message should be displayed
kit_parent_wh_order = self.kit_parent.with_context(warehouse=so.warehouse_id.id)
- self.assertEquals(kit_parent_wh_order.virtual_available, 7)
+ self.assertEqual(kit_parent_wh_order.virtual_available, 7)
def test_06_kit_qty_delivered_mixed_uom(self):
"""
@@ -1162,7 +1162,7 @@ class TestSaleMrpFlow(common.SavepointCase):
for ml in move_lines:
corr_bom_line = bom_kit_uom_1.bom_line_ids.filtered(lambda b: b.product_id.id == ml.product_id.id)
computed_qty = ml.product_uom._compute_quantity(ml.product_uom_qty, corr_bom_line.product_uom_id)
- self.assertEquals(computed_qty, order_line.product_uom_qty * corr_bom_line.product_qty)
+ self.assertEqual(computed_qty, order_line.product_uom_qty * corr_bom_line.product_qty)
# Processe enough componenents in the picking to make 2 kit_uom_1
# Then create a backorder for the missing components
@@ -1177,12 +1177,12 @@ class TestSaleMrpFlow(common.SavepointCase):
backorder_wizard.process()
# Check that a backorder is created
- self.assertEquals(len(so.picking_ids), 2)
+ self.assertEqual(len(so.picking_ids), 2)
backorder_1 = so.picking_ids - picking_original
- self.assertEquals(backorder_1.backorder_id.id, picking_original.id)
+ self.assertEqual(backorder_1.backorder_id.id, picking_original.id)
# Only 2 kits should be delivered
- self.assertEquals(order_line.qty_delivered, 2)
+ self.assertEqual(order_line.qty_delivered, 2)
# Adding missing components
qty_to_process = {
@@ -1196,7 +1196,7 @@ class TestSaleMrpFlow(common.SavepointCase):
backorder_1.button_validate()
order_line._compute_qty_delivered()
# All kits should be delivered
- self.assertEquals(order_line.qty_delivered, 10)
+ self.assertEqual(order_line.qty_delivered, 10)
@mute_logger('odoo.tests.common.onchange')
def test_07_kit_availability_mixed_uom(self):
@@ -1288,7 +1288,7 @@ class TestSaleMrpFlow(common.SavepointCase):
# but there are enough quantities in Warehouse 1 for 1 kit_parent
kit_uom_in_kit.with_context(warehouse=warehouse_1.id)._compute_quantities()
virtual_available_wh_order = kit_uom_in_kit.virtual_available
- self.assertEquals(virtual_available_wh_order, 1)
+ self.assertEqual(virtual_available_wh_order, 1)
# Check there arn't enough quantities available for the sale order
self.assertTrue(float_compare(order_line.virtual_available_at_date - order_line.product_uom_qty, 0, precision_rounding=line.product_uom.rounding) == -1)
@@ -1307,14 +1307,14 @@ class TestSaleMrpFlow(common.SavepointCase):
self.assertTrue(float_compare(order_line.virtual_available_at_date - order_line.product_uom_qty, 0, precision_rounding=line.product_uom.rounding) == -1)
kit_uom_in_kit.with_context(warehouse=warehouse_1.id)._compute_quantities()
virtual_available_wh_order = kit_uom_in_kit.virtual_available
- self.assertEquals(virtual_available_wh_order, 3)
+ self.assertEqual(virtual_available_wh_order, 3)
# We process enough quantities to have enough kit_uom_in_kit available for the sale order.
self._create_move_quantities(qty_to_process, components, warehouse_1)
# We check that enough quantities were processed to sell 5 kit_uom_in_kit
kit_uom_in_kit.with_context(warehouse=warehouse_1.id)._compute_quantities()
- self.assertEquals(kit_uom_in_kit.virtual_available, 5)
+ self.assertEqual(kit_uom_in_kit.virtual_available, 5)
def test_10_sale_mrp_kits_routes(self):
@@ -1388,16 +1388,16 @@ class TestSaleMrpFlow(common.SavepointCase):
# Now we check that the routes of the components were applied, in order to make sure the routes set
# on the kit itself are ignored
- self.assertEquals(len(order.picking_ids), 2)
- self.assertEquals(len(order.picking_ids[0].move_lines), 1)
- self.assertEquals(len(order.picking_ids[1].move_lines), 1)
+ self.assertEqual(len(order.picking_ids), 2)
+ self.assertEqual(len(order.picking_ids[0].move_lines), 1)
+ self.assertEqual(len(order.picking_ids[1].move_lines), 1)
moves = order.picking_ids.mapped('move_lines')
move_shelf1 = moves.filtered(lambda m: m.product_id == component_shelf1)
move_shelf2 = moves.filtered(lambda m: m.product_id == component_shelf2)
- self.assertEquals(move_shelf1.location_id.id, self.ref('stock.stock_location_components'))
- self.assertEquals(move_shelf1.location_dest_id.id, self.ref('stock.stock_location_customers'))
- self.assertEquals(move_shelf2.location_id.id, self.ref('stock.stock_location_14'))
- self.assertEquals(move_shelf2.location_dest_id.id, self.ref('stock.stock_location_customers'))
+ self.assertEqual(move_shelf1.location_id.id, self.ref('stock.stock_location_components'))
+ self.assertEqual(move_shelf1.location_dest_id.id, self.ref('stock.stock_location_customers'))
+ self.assertEqual(move_shelf2.location_id.id, self.ref('stock.stock_location_14'))
+ self.assertEqual(move_shelf2.location_dest_id.id, self.ref('stock.stock_location_customers'))
def test_11_sale_mrp_explode_kits_uom_quantities(self):
@@ -1447,14 +1447,14 @@ class TestSaleMrpFlow(common.SavepointCase):
# Now we check that the routes of the components were applied, in order to make sure the routes set
# on the kit itself are ignored
- self.assertEquals(len(order.picking_ids), 1)
- self.assertEquals(len(order.picking_ids[0].move_lines), 2)
+ self.assertEqual(len(order.picking_ids), 1)
+ self.assertEqual(len(order.picking_ids[0].move_lines), 2)
# Finally, we check the quantities for each component on the picking
move_component_unit = order.picking_ids[0].move_lines.filtered(lambda m: m.product_id == component_unit)
move_component_kg = order.picking_ids[0].move_lines - move_component_unit
- self.assertEquals(move_component_unit.product_uom_qty, 0.5)
- self.assertEquals(move_component_kg.product_uom_qty, 0.583)
+ self.assertEqual(move_component_unit.product_uom_qty, 0.5)
+ self.assertEqual(move_component_kg.product_uom_qty, 0.583)
def test_product_type_service_1(self):
route_manufacture = self.warehouse.manufacture_pull_id.route_id.id
diff --git a/addons/sale_stock/tests/test_sale_order_dates.py b/addons/sale_stock/tests/test_sale_order_dates.py
index 4cf0ae8823a..c58e4d2debe 100644
--- a/addons/sale_stock/tests/test_sale_order_dates.py
+++ b/addons/sale_stock/tests/test_sale_order_dates.py
@@ -55,7 +55,7 @@ class TestSaleExpectedDate(common.TransactionCase):
# current date + longest lead time from all of it's order lines
sale_order.write({'picking_policy': 'one'})
expected_date = fields.Datetime.now() + timedelta(days=15)
- self.assertAlmostEquals(expected_date, sale_order.expected_date,
+ self.assertAlmostEqual(expected_date, sale_order.expected_date,
msg="Wrong expected date on sale order!", delta=timedelta(seconds=1))
sale_order.action_confirm()
@@ -83,8 +83,8 @@ class TestSaleExpectedDate(common.TransactionCase):
for ml in picking.move_line_ids:
ml.qty_done = ml.product_uom_qty
picking.action_done()
- self.assertEquals(picking.state, 'done', "Picking not processed correctly!")
- self.assertEquals(fields.Date.today(), sale_order.effective_date, "Wrong effective date on sale order!")
+ self.assertEqual(picking.state, 'done', "Picking not processed correctly!")
+ self.assertEqual(fields.Date.today(), sale_order.effective_date, "Wrong effective date on sale order!")
def test_sale_order_commitment_date(self):
diff --git a/addons/sale_stock/tests/test_sale_stock.py b/addons/sale_stock/tests/test_sale_stock.py
index 2dd0250c33b..686fc854330 100644
--- a/addons/sale_stock/tests/test_sale_stock.py
+++ b/addons/sale_stock/tests/test_sale_stock.py
@@ -291,7 +291,7 @@ class TestSaleStock(TestSale):
# storable product, thus is unavailable. Hitting `button_validate` will first ask to
# process all the reserved quantities and, if the user chose to process, a second wizard
# will ask to create a backorder for the unavailable product.
- self.assertEquals(len(self.so.picking_ids), 1)
+ self.assertEqual(len(self.so.picking_ids), 1)
res_dict = self.so.picking_ids.sorted()[0].button_validate()
wizard = self.env[(res_dict.get('res_model'))].browse(res_dict.get('res_id'))
self.assertEqual(wizard._name, 'stock.immediate.transfer')
@@ -301,7 +301,7 @@ class TestSaleStock(TestSale):
wizard.process()
# Now, the original picking is done and there is a new one (the backorder).
- self.assertEquals(len(self.so.picking_ids), 2)
+ self.assertEqual(len(self.so.picking_ids), 2)
for picking in self.so.picking_ids:
move = picking.move_lines
if picking.backorder_id:
@@ -319,7 +319,7 @@ class TestSaleStock(TestSale):
]
})
# a single picking should be created for the new delivery
- self.assertEquals(len(self.so.picking_ids), 2)
+ self.assertEqual(len(self.so.picking_ids), 2)
backorder = self.so.picking_ids.filtered(lambda p: p.backorder_id)
self.assertEqual(len(backorder.move_lines), 2)
for backorder_move in backorder.move_lines:
@@ -347,11 +347,11 @@ class TestSaleStock(TestSale):
self.so.action_confirm()
# deliver them
- self.assertEquals(len(self.so.picking_ids), 1)
+ self.assertEqual(len(self.so.picking_ids), 1)
res_dict = self.so.picking_ids.sorted()[0].button_validate()
wizard = self.env[(res_dict.get('res_model'))].browse(res_dict.get('res_id'))
wizard.process()
- self.assertEquals(self.so.picking_ids.sorted()[0].state, "done")
+ self.assertEqual(self.so.picking_ids.sorted()[0].state, "done")
# update the two original sale order lines
self.so.write({
@@ -361,7 +361,7 @@ class TestSaleStock(TestSale):
]
})
# a single picking should be created for the new delivery
- self.assertEquals(len(self.so.picking_ids), 2)
+ self.assertEqual(len(self.so.picking_ids), 2)
def test_05_confirm_cancel_confirm(self):
""" Confirm a sale order, cancel it, set to quotation, change the
diff --git a/addons/sale_stock/tests/test_sale_stock_lead_time.py b/addons/sale_stock/tests/test_sale_stock_lead_time.py
index 58d912b0215..fbf6080059d 100644
--- a/addons/sale_stock/tests/test_sale_stock_lead_time.py
+++ b/addons/sale_stock/tests/test_sale_stock_lead_time.py
@@ -178,9 +178,9 @@ class TestSaleStockLeadTime(TestStockCommon):
pick.write({'scheduled_date': pick_min_date + timedelta(days=5)})
# Now check scheduled_date of pack and out are changed or not based on propagate is true on rules?
- self.assertEquals(pack.scheduled_date, (pack_min_date + timedelta(days=5)),
+ self.assertEqual(pack.scheduled_date, (pack_min_date + timedelta(days=5)),
'Schedule date of pack should be changed based on delay.')
- self.assertEquals(out.scheduled_date, (out_min_date + timedelta(days=5)),
+ self.assertEqual(out.scheduled_date, (out_min_date + timedelta(days=5)),
'Schedule date of out should be changed based on delay.')
def test_03_no_propagate_date(self):
@@ -256,5 +256,5 @@ class TestSaleStockLeadTime(TestStockCommon):
pick.write({'scheduled_date': pick_min_date + timedelta(days=5)})
# Now check scheduled_date of pack and out are changed or not based on propagate is false on rules?
- self.assertEquals(pack.scheduled_date, pack_min_date, 'Schedule date of pack should not be changed.')
- self.assertEquals(out.scheduled_date, out_min_date, 'Schedule date of out should not be changed.')
+ self.assertEqual(pack.scheduled_date, pack_min_date, 'Schedule date of pack should not be changed.')
+ self.assertEqual(out.scheduled_date, out_min_date, 'Schedule date of out should not be changed.')
diff --git a/addons/sale_timesheet/tests/test_project_billing.py b/addons/sale_timesheet/tests/test_project_billing.py
index 7f0d533af8c..a7c1514a8d5 100644
--- a/addons/sale_timesheet/tests/test_project_billing.py
+++ b/addons/sale_timesheet/tests/test_project_billing.py
@@ -337,7 +337,7 @@ class TestProjectBilling(TestCommonSaleTimesheetNoChart):
'employee_id': self.employee_tde.id,
})
- self.assertEquals(timesheet4.so_line, self.so1_line_deliver_no_task, "The timesheet should be linked to SOL on the project, as no entry for TDE in project map and no SOL on task")
+ self.assertEqual(timesheet4.so_line, self.so1_line_deliver_no_task, "The timesheet should be linked to SOL on the project, as no entry for TDE in project map and no SOL on task")
def test_billing_task_rate(self):
""" Check task and subtask creation, and timesheeting in a project billed at 'task rate'. Then move the task into a 'employee rate' project then, 'non billable'. """
diff --git a/addons/sale_timesheet/tests/test_reinvoice.py b/addons/sale_timesheet/tests/test_reinvoice.py
index 5b3058ce5ef..2f3c6677207 100644
--- a/addons/sale_timesheet/tests/test_reinvoice.py
+++ b/addons/sale_timesheet/tests/test_reinvoice.py
@@ -73,8 +73,8 @@ class TestReInvoice(TestCommonSaleTimesheetNoChart):
self.sale_order._compute_tax_id()
self.sale_order.action_confirm()
- self.assertEquals(sale_order_line1.qty_delivered_method, 'timesheet', "Delivered quantity of 'service' SO line should be computed by timesheet amount")
- self.assertEquals(sale_order_line2.qty_delivered_method, 'timesheet', "Delivered quantity of 'service' SO line should be computed by timesheet amount")
+ self.assertEqual(sale_order_line1.qty_delivered_method, 'timesheet', "Delivered quantity of 'service' SO line should be computed by timesheet amount")
+ self.assertEqual(sale_order_line2.qty_delivered_method, 'timesheet', "Delivered quantity of 'service' SO line should be computed by timesheet amount")
# let's log some timesheets (on the project created by sale_order_line1)
task_sol1 = sale_order_line1.task_id
@@ -104,21 +104,21 @@ class TestReInvoice(TestCommonSaleTimesheetNoChart):
self.assertTrue(sale_order_line3, "A new sale line should have been created with ordered product")
self.assertTrue(sale_order_line4, "A new sale line should have been created with delivered product")
- self.assertEquals(len(self.sale_order.order_line), 4, "There should be 4 lines on the SO (2 vendor bill lines created)")
- self.assertEquals(len(self.sale_order.order_line.filtered(lambda sol: sol.is_expense)), 2, "There should be 4 lines on the SO (2 vendor bill lines created)")
+ self.assertEqual(len(self.sale_order.order_line), 4, "There should be 4 lines on the SO (2 vendor bill lines created)")
+ self.assertEqual(len(self.sale_order.order_line.filtered(lambda sol: sol.is_expense)), 2, "There should be 4 lines on the SO (2 vendor bill lines created)")
- self.assertEquals(sale_order_line1.qty_delivered, 1, "Exising SO line 1 should not be impacted by reinvoicing product at cost")
- self.assertEquals(sale_order_line2.qty_delivered, 0, "Exising SO line 2 should not be impacted by reinvoicing product at cost")
+ self.assertEqual(sale_order_line1.qty_delivered, 1, "Exising SO line 1 should not be impacted by reinvoicing product at cost")
+ self.assertEqual(sale_order_line2.qty_delivered, 0, "Exising SO line 2 should not be impacted by reinvoicing product at cost")
self.assertFalse(sale_order_line3.task_id, "Adding a new expense SO line should not create a task (sol3)")
self.assertFalse(sale_order_line4.task_id, "Adding a new expense SO line should not create a task (sol4)")
- self.assertEquals(len(self.sale_order.project_ids), 1, "SO create only one project with its service line. Adding new expense SO line should not impact that")
+ self.assertEqual(len(self.sale_order.project_ids), 1, "SO create only one project with its service line. Adding new expense SO line should not impact that")
- self.assertEquals((sale_order_line3.price_unit, sale_order_line3.qty_delivered, sale_order_line3.product_uom_qty, sale_order_line3.qty_invoiced), (self.product_ordered_cost.standard_price, 3.0, 0, 0), 'Sale line is wrong after confirming vendor invoice')
- self.assertEquals((sale_order_line4.price_unit, sale_order_line4.qty_delivered, sale_order_line4.product_uom_qty, sale_order_line4.qty_invoiced), (self.product_deliver_cost.standard_price, 3.0, 0, 0), 'Sale line is wrong after confirming vendor invoice')
+ self.assertEqual((sale_order_line3.price_unit, sale_order_line3.qty_delivered, sale_order_line3.product_uom_qty, sale_order_line3.qty_invoiced), (self.product_ordered_cost.standard_price, 3.0, 0, 0), 'Sale line is wrong after confirming vendor invoice')
+ self.assertEqual((sale_order_line4.price_unit, sale_order_line4.qty_delivered, sale_order_line4.product_uom_qty, sale_order_line4.qty_invoiced), (self.product_deliver_cost.standard_price, 3.0, 0, 0), 'Sale line is wrong after confirming vendor invoice')
- self.assertEquals(sale_order_line3.qty_delivered_method, 'analytic', "Delivered quantity of 'expense' SO line should be computed by analytic amount")
- self.assertEquals(sale_order_line4.qty_delivered_method, 'analytic', "Delivered quantity of 'expense' SO line should be computed by analytic amount")
+ self.assertEqual(sale_order_line3.qty_delivered_method, 'analytic', "Delivered quantity of 'expense' SO line should be computed by analytic amount")
+ self.assertEqual(sale_order_line4.qty_delivered_method, 'analytic', "Delivered quantity of 'expense' SO line should be computed by analytic amount")
# create second invoice lines and validate it
move_form = Form(self.env['account.move'].with_context(default_type='in_invoice'))
@@ -140,11 +140,11 @@ class TestReInvoice(TestCommonSaleTimesheetNoChart):
self.assertTrue(sale_order_line5, "A new sale line should have been created with ordered product")
self.assertTrue(sale_order_line6, "A new sale line should have been created with delivered product")
- self.assertEquals(len(self.sale_order.order_line), 6, "There should be still 4 lines on the SO, no new created")
- self.assertEquals(len(self.sale_order.order_line.filtered(lambda sol: sol.is_expense)), 4, "There should be still 2 expenses lines on the SO")
+ self.assertEqual(len(self.sale_order.order_line), 6, "There should be still 4 lines on the SO, no new created")
+ self.assertEqual(len(self.sale_order.order_line.filtered(lambda sol: sol.is_expense)), 4, "There should be still 2 expenses lines on the SO")
- self.assertEquals((sale_order_line5.price_unit, sale_order_line5.qty_delivered, sale_order_line5.product_uom_qty, sale_order_line5.qty_invoiced), (self.product_ordered_cost.standard_price, 2.0, 0, 0), 'Sale line 5 is wrong after confirming 2e vendor invoice')
- self.assertEquals((sale_order_line6.price_unit, sale_order_line6.qty_delivered, sale_order_line6.product_uom_qty, sale_order_line6.qty_invoiced), (self.product_deliver_cost.standard_price, 2.0, 0, 0), 'Sale line 6 is wrong after confirming 2e vendor invoice')
+ self.assertEqual((sale_order_line5.price_unit, sale_order_line5.qty_delivered, sale_order_line5.product_uom_qty, sale_order_line5.qty_invoiced), (self.product_ordered_cost.standard_price, 2.0, 0, 0), 'Sale line 5 is wrong after confirming 2e vendor invoice')
+ self.assertEqual((sale_order_line6.price_unit, sale_order_line6.qty_delivered, sale_order_line6.product_uom_qty, sale_order_line6.qty_invoiced), (self.product_deliver_cost.standard_price, 2.0, 0, 0), 'Sale line 6 is wrong after confirming 2e vendor invoice')
def test_sales_price(self):
""" Test invoicing vendor bill at sales price for products based on delivered and ordered quantities. Check no existing SO line is incremented, but when invoicing a
@@ -203,21 +203,21 @@ class TestReInvoice(TestCommonSaleTimesheetNoChart):
self.assertTrue(sale_order_line3, "A new sale line should have been created with ordered product")
self.assertTrue(sale_order_line4, "A new sale line should have been created with delivered product")
- self.assertEquals(len(self.sale_order.order_line), 4, "There should be 4 lines on the SO (2 vendor bill lines created)")
- self.assertEquals(len(self.sale_order.order_line.filtered(lambda sol: sol.is_expense)), 2, "There should be 4 lines on the SO (2 vendor bill lines created)")
+ self.assertEqual(len(self.sale_order.order_line), 4, "There should be 4 lines on the SO (2 vendor bill lines created)")
+ self.assertEqual(len(self.sale_order.order_line.filtered(lambda sol: sol.is_expense)), 2, "There should be 4 lines on the SO (2 vendor bill lines created)")
- self.assertEquals(sale_order_line1.qty_delivered, 1, "Exising SO line 1 should not be impacted by reinvoicing product at cost")
- self.assertEquals(sale_order_line2.qty_delivered, 0, "Exising SO line 2 should not be impacted by reinvoicing product at cost")
+ self.assertEqual(sale_order_line1.qty_delivered, 1, "Exising SO line 1 should not be impacted by reinvoicing product at cost")
+ self.assertEqual(sale_order_line2.qty_delivered, 0, "Exising SO line 2 should not be impacted by reinvoicing product at cost")
self.assertFalse(sale_order_line3.task_id, "Adding a new expense SO line should not create a task (sol3)")
self.assertFalse(sale_order_line4.task_id, "Adding a new expense SO line should not create a task (sol4)")
- self.assertEquals(len(self.sale_order.project_ids), 1, "SO create only one project with its service line. Adding new expense SO line should not impact that")
+ self.assertEqual(len(self.sale_order.project_ids), 1, "SO create only one project with its service line. Adding new expense SO line should not impact that")
- self.assertEquals((sale_order_line3.price_unit, sale_order_line3.qty_delivered, sale_order_line3.product_uom_qty, sale_order_line3.qty_invoiced), (self.product_deliver_sales_price.list_price, 3.0, 0, 0), 'Sale line is wrong after confirming vendor invoice')
- self.assertEquals((sale_order_line4.price_unit, sale_order_line4.qty_delivered, sale_order_line4.product_uom_qty, sale_order_line4.qty_invoiced), (self.product_order_sales_price.list_price, 3.0, 0, 0), 'Sale line is wrong after confirming vendor invoice')
+ self.assertEqual((sale_order_line3.price_unit, sale_order_line3.qty_delivered, sale_order_line3.product_uom_qty, sale_order_line3.qty_invoiced), (self.product_deliver_sales_price.list_price, 3.0, 0, 0), 'Sale line is wrong after confirming vendor invoice')
+ self.assertEqual((sale_order_line4.price_unit, sale_order_line4.qty_delivered, sale_order_line4.product_uom_qty, sale_order_line4.qty_invoiced), (self.product_order_sales_price.list_price, 3.0, 0, 0), 'Sale line is wrong after confirming vendor invoice')
- self.assertEquals(sale_order_line3.qty_delivered_method, 'analytic', "Delivered quantity of 'expense' SO line 3 should be computed by analytic amount")
- self.assertEquals(sale_order_line4.qty_delivered_method, 'analytic', "Delivered quantity of 'expense' SO line 4 should be computed by analytic amount")
+ self.assertEqual(sale_order_line3.qty_delivered_method, 'analytic', "Delivered quantity of 'expense' SO line 3 should be computed by analytic amount")
+ self.assertEqual(sale_order_line4.qty_delivered_method, 'analytic', "Delivered quantity of 'expense' SO line 4 should be computed by analytic amount")
# create second invoice lines and validate it
move_form = Form(self.env['account.move'].with_context(default_type='in_invoice'))
@@ -239,10 +239,10 @@ class TestReInvoice(TestCommonSaleTimesheetNoChart):
self.assertFalse(sale_order_line5, "No new sale line should have been created with delivered product !!")
self.assertTrue(sale_order_line6, "A new sale line should have been created with ordered product")
- self.assertEquals(len(self.sale_order.order_line), 5, "There should be 5 lines on the SO, 1 new created and 1 incremented")
- self.assertEquals(len(self.sale_order.order_line.filtered(lambda sol: sol.is_expense)), 3, "There should be 3 expenses lines on the SO")
+ self.assertEqual(len(self.sale_order.order_line), 5, "There should be 5 lines on the SO, 1 new created and 1 incremented")
+ self.assertEqual(len(self.sale_order.order_line.filtered(lambda sol: sol.is_expense)), 3, "There should be 3 expenses lines on the SO")
- self.assertEquals((sale_order_line6.price_unit, sale_order_line6.qty_delivered, sale_order_line4.product_uom_qty, sale_order_line6.qty_invoiced), (self.product_order_sales_price.list_price, 2.0, 0, 0), 'Sale line is wrong after confirming 2e vendor invoice')
+ self.assertEqual((sale_order_line6.price_unit, sale_order_line6.qty_delivered, sale_order_line4.product_uom_qty, sale_order_line6.qty_invoiced), (self.product_order_sales_price.list_price, 2.0, 0, 0), 'Sale line is wrong after confirming 2e vendor invoice')
def test_no_expense(self):
""" Test invoicing vendor bill with no policy. Check nothing happen. """
@@ -279,6 +279,6 @@ class TestReInvoice(TestCommonSaleTimesheetNoChart):
'employee_id': self.employee_user.id,
})
- self.assertEquals(len(self.sale_order.order_line), 1, "No SO line should have been created (or removed) when validating vendor bill")
- self.assertEquals(sale_order_line.qty_delivered, 1, "The delivered quantity of SO line should not have been incremented")
+ self.assertEqual(len(self.sale_order.order_line), 1, "No SO line should have been created (or removed) when validating vendor bill")
+ self.assertEqual(sale_order_line.qty_delivered, 1, "The delivered quantity of SO line should not have been incremented")
self.assertTrue(invoice_a.mapped('line_ids.analytic_line_ids'), "Analytic lines should be generated")
diff --git a/addons/stock/tests/test_move2.py b/addons/stock/tests/test_move2.py
index e1380a8ec28..934841081ad 100644
--- a/addons/stock/tests/test_move2.py
+++ b/addons/stock/tests/test_move2.py
@@ -902,8 +902,8 @@ class TestSinglePicking(TestStockCommon):
# No backorder should be created and the move corresponding to the missing product should be cancelled
backorder = self.env['stock.picking'].search([('backorder_id', '=', delivery_order.id)])
self.assertFalse(backorder)
- self.assertEquals(delivery_order.state, 'done')
- self.assertEquals(delivery_order.move_lines[1].state, 'cancel')
+ self.assertEqual(delivery_order.state, 'done')
+ self.assertEqual(delivery_order.move_lines[1].state, 'cancel')
def test_extra_move_1(self):
""" Check the good behavior of creating an extra move in a delivery order. This usecase
@@ -2161,16 +2161,16 @@ class TestRoutes(TestStockCommon):
# 3 pickings should be created.
picking_ids = self.env['stock.picking'].search([('group_id', '=', pg.id)])
- self.assertEquals(len(picking_ids), 3)
+ self.assertEqual(len(picking_ids), 3)
for picking in picking_ids:
# Only the picking from Stock to Pack should be MTS
if picking.location_id == warehouse.lot_stock_id:
- self.assertEquals(picking.move_lines.procure_method, 'make_to_stock')
+ self.assertEqual(picking.move_lines.procure_method, 'make_to_stock')
else:
- self.assertEquals(picking.move_lines.procure_method, 'make_to_order')
+ self.assertEqual(picking.move_lines.procure_method, 'make_to_order')
- self.assertEquals(len(picking.move_lines), 1)
- self.assertEquals(picking.move_lines.product_uom_qty, 5, 'The quantity of the move should be the same as on the SO')
+ self.assertEqual(len(picking.move_lines), 1)
+ self.assertEqual(picking.move_lines.product_uom_qty, 5, 'The quantity of the move should be the same as on the SO')
self.assertEqual(qty_available, 4, 'The 4 products should still be available')
def test_mtso_mts(self):
@@ -2213,11 +2213,11 @@ class TestRoutes(TestStockCommon):
# A picking should be created with its move having MTS as procure method.
picking_ids = self.env['stock.picking'].search([('group_id', '=', pg.id)])
- self.assertEquals(len(picking_ids), 1)
+ self.assertEqual(len(picking_ids), 1)
picking = picking_ids
- self.assertEquals(picking.move_lines.procure_method, 'make_to_stock')
- self.assertEquals(len(picking.move_lines), 1)
- self.assertEquals(picking.move_lines.product_uom_qty, 4)
+ self.assertEqual(picking.move_lines.procure_method, 'make_to_stock')
+ self.assertEqual(len(picking.move_lines), 1)
+ self.assertEqual(picking.move_lines.product_uom_qty, 4)
def test_mtso_multi_pg(self):
""" Run 3 procurements for 2 products at the same times when there are 4 in stock then
@@ -2291,23 +2291,23 @@ class TestRoutes(TestStockCommon):
# The 2 first procurements should have create only 1 picking since enough quantities
# are left in the delivery location
- self.assertEquals(len(pickings_pg1), 1)
- self.assertEquals(len(pickings_pg2), 1)
- self.assertEquals(pickings_pg1.move_lines.procure_method, 'make_to_stock')
- self.assertEquals(pickings_pg2.move_lines.procure_method, 'make_to_stock')
+ self.assertEqual(len(pickings_pg1), 1)
+ self.assertEqual(len(pickings_pg2), 1)
+ self.assertEqual(pickings_pg1.move_lines.procure_method, 'make_to_stock')
+ self.assertEqual(pickings_pg2.move_lines.procure_method, 'make_to_stock')
# The last one should have 3 pickings as there's nothing left in the delivery location
- self.assertEquals(len(pickings_pg3), 3)
+ self.assertEqual(len(pickings_pg3), 3)
for picking in pickings_pg3:
# Only the picking from Stock to Pack should be MTS
if picking.location_id == warehouse.lot_stock_id:
- self.assertEquals(picking.move_lines.procure_method, 'make_to_stock')
+ self.assertEqual(picking.move_lines.procure_method, 'make_to_stock')
else:
- self.assertEquals(picking.move_lines.procure_method, 'make_to_order')
+ self.assertEqual(picking.move_lines.procure_method, 'make_to_order')
# All the moves should be should have the same quantity as it is on each procurements
- self.assertEquals(len(picking.move_lines), 1)
- self.assertEquals(picking.move_lines.product_uom_qty, 2)
+ self.assertEqual(len(picking.move_lines), 1)
+ self.assertEqual(picking.move_lines.product_uom_qty, 2)
def test_delay_alert_1(self):
""" On a pick pack ship scenario, enable the delay alert flag on the pack rule. Edit the
diff --git a/addons/stock/tests/test_packing.py b/addons/stock/tests/test_packing.py
index 4f135c70cb7..cc7b9efb895 100644
--- a/addons/stock/tests/test_packing.py
+++ b/addons/stock/tests/test_packing.py
@@ -74,8 +74,8 @@ class TestPacking(SavepointCase):
pick_picking.move_line_ids.filtered(lambda ml: ml.product_id == self.productB).qty_done = 2.0
first_pack = pick_picking.put_in_pack()
- self.assertEquals(len(pick_picking.package_level_ids), 1, 'Put some products in pack should create a package_level')
- self.assertEquals(pick_picking.package_level_ids[0].state, 'new', 'A new pack should be in state "new"')
+ self.assertEqual(len(pick_picking.package_level_ids), 1, 'Put some products in pack should create a package_level')
+ self.assertEqual(pick_picking.package_level_ids[0].state, 'new', 'A new pack should be in state "new"')
pick_picking.move_line_ids.filtered(lambda ml: ml.product_id == self.productA and ml.qty_done == 0.0).qty_done = 4.0
pick_picking.move_line_ids.filtered(lambda ml: ml.product_id == self.productB and ml.qty_done == 0.0).qty_done = 3.0
second_pack = pick_picking.put_in_pack()
@@ -106,42 +106,42 @@ class TestPacking(SavepointCase):
'location_dest_id': self.stock_location.id,
'company_id': picking.company_id.id,
})
- self.assertEquals(package_level.state, 'draft',
+ self.assertEqual(package_level.state, 'draft',
'The package_level should be in draft as it has no moves, move lines and is not confirmed')
picking.action_confirm()
self.assertEqual(len(picking.move_ids_without_package), 0)
self.assertEqual(len(picking.move_lines), 1,
'One move should be created when the package_level has been confirmed')
- self.assertEquals(len(package_level.move_ids), 1,
+ self.assertEqual(len(package_level.move_ids), 1,
'The move should be in the package level')
- self.assertEquals(package_level.state, 'confirmed',
+ self.assertEqual(package_level.state, 'confirmed',
'The package level must be state confirmed when picking is confirmed')
picking.action_assign()
self.assertEqual(len(picking.move_lines), 1,
'You still have only one move when the picking is assigned')
self.assertEqual(len(picking.move_lines.move_line_ids), 1,
'The move should have one move line which is the reservation')
- self.assertEquals(picking.move_line_ids.package_level_id.id, package_level.id,
+ self.assertEqual(picking.move_line_ids.package_level_id.id, package_level.id,
'The move line created should be linked to the package level')
- self.assertEquals(picking.move_line_ids.package_id.id, pack.id,
+ self.assertEqual(picking.move_line_ids.package_id.id, pack.id,
'The move line must have been reserved on the package of the package_level')
- self.assertEquals(picking.move_line_ids.result_package_id.id, pack.id,
+ self.assertEqual(picking.move_line_ids.result_package_id.id, pack.id,
'The move line must have the same package as result package')
- self.assertEquals(package_level.state, 'assigned', 'The package level must be in state assigned')
+ self.assertEqual(package_level.state, 'assigned', 'The package level must be in state assigned')
package_level.write({'is_done': True})
- self.assertEquals(len(package_level.move_line_ids), 1,
+ self.assertEqual(len(package_level.move_line_ids), 1,
'The package level should still keep one move line after have been set to "done"')
- self.assertEquals(package_level.move_line_ids[0].qty_done, 20.0,
+ self.assertEqual(package_level.move_line_ids[0].qty_done, 20.0,
'All quantity in package must be procesed in move line')
picking.button_validate()
self.assertEqual(len(picking.move_lines), 1,
'You still have only one move when the picking is assigned')
self.assertEqual(len(picking.move_lines.move_line_ids), 1,
'The move should have one move line which is the reservation')
- self.assertEquals(package_level.state, 'done', 'The package level must be in state done')
- self.assertEquals(pack.location_id.id, picking.location_dest_id.id,
+ self.assertEqual(package_level.state, 'done', 'The package level must be in state done')
+ self.assertEqual(pack.location_id.id, picking.location_dest_id.id,
'The quant package must be in the destination location')
- self.assertEquals(pack.quant_ids[0].location_id.id, picking.location_dest_id.id,
+ self.assertEqual(pack.quant_ids[0].location_id.id, picking.location_dest_id.id,
'The quant must be in the destination location')
def test_multi_pack_reservation(self):
diff --git a/addons/stock/tests/test_proc_rule.py b/addons/stock/tests/test_proc_rule.py
index 7789563ad21..8d33bfb85fa 100644
--- a/addons/stock/tests/test_proc_rule.py
+++ b/addons/stock/tests/test_proc_rule.py
@@ -101,13 +101,13 @@ class TestProcRule(TransactionCase):
# change above the minimum delta
move_orig.date_expected += timedelta(days=6)
- self.assertAlmostEquals(move_dest.date_expected, move_dest_initial_date + timedelta(days=6), delta=timedelta(seconds=10), msg='date should be propagated as the minimum delta is below')
+ self.assertAlmostEqual(move_dest.date_expected, move_dest_initial_date + timedelta(days=6), delta=timedelta(seconds=10), msg='date should be propagated as the minimum delta is below')
# change below the minimum delta
move_dest_initial_date = move_dest.date_expected
move_orig.date_expected += timedelta(days=4)
- self.assertAlmostEquals(move_dest.date_expected, move_dest_initial_date, delta=timedelta(seconds=10), msg='date should not be propagated as the minimum delta is above')
+ self.assertAlmostEqual(move_dest.date_expected, move_dest_initial_date, delta=timedelta(seconds=10), msg='date should not be propagated as the minimum delta is above')
def test_rule_propagate_2(self):
move_dest = self.env['stock.move'].create({
@@ -133,11 +133,11 @@ class TestProcRule(TransactionCase):
# change below the minimum delta
move_orig.date_expected += timedelta(days=4)
- self.assertAlmostEquals(move_dest.date_expected, move_dest_initial_date, delta=timedelta(seconds=10), msg='date should not be propagated')
+ self.assertAlmostEqual(move_dest.date_expected, move_dest_initial_date, delta=timedelta(seconds=10), msg='date should not be propagated')
# change above the minimum delta
move_orig.date_expected += timedelta(days=2)
- self.assertAlmostEquals(move_dest.date_expected, move_dest_initial_date, delta=timedelta(seconds=10), msg='date should not be propagated')
+ self.assertAlmostEqual(move_dest.date_expected, move_dest_initial_date, delta=timedelta(seconds=10), msg='date should not be propagated')
def test_rule_propagate_3(self):
move_dest = self.env['stock.move'].create({
@@ -163,6 +163,6 @@ class TestProcRule(TransactionCase):
move_dest_initial_date = move_dest.date_expected
move_orig_initial_date = move_orig.date_expected
move_orig._action_done()
- self.assertAlmostEquals(move_orig.date_expected, move_orig_initial_date, delta=timedelta(seconds=10), msg='schedule date should not be impacted by action_done')
- self.assertAlmostEquals(move_orig.date, datetime.now(), delta=timedelta(seconds=10), msg='date should be now')
- self.assertAlmostEquals(move_dest.date_expected, move_dest_initial_date + timedelta(days=6), delta=timedelta(seconds=10), msg='date should be propagated')
+ self.assertAlmostEqual(move_orig.date_expected, move_orig_initial_date, delta=timedelta(seconds=10), msg='schedule date should not be impacted by action_done')
+ self.assertAlmostEqual(move_orig.date, datetime.now(), delta=timedelta(seconds=10), msg='date should be now')
+ self.assertAlmostEqual(move_dest.date_expected, move_dest_initial_date + timedelta(days=6), delta=timedelta(seconds=10), msg='date should be propagated')
diff --git a/addons/stock/tests/test_stock_flow.py b/addons/stock/tests/test_stock_flow.py
index 27990338ad3..5f8de5e40d8 100644
--- a/addons/stock/tests/test_stock_flow.py
+++ b/addons/stock/tests/test_stock_flow.py
@@ -1542,7 +1542,7 @@ class TestStockFlow(TestStockCommon):
'location_dest_id': self.customer_location})
# validate this delivery order, it should be in the waiting state
picking_out.action_assign()
- self.assertEquals(picking_out.state, "confirmed")
+ self.assertEqual(picking_out.state, "confirmed")
# receive one product in stock
inventory = self.env['stock.inventory'].create({
@@ -1558,9 +1558,9 @@ class TestStockFlow(TestStockCommon):
inventory.action_validate()
# recheck availability of the delivery order, it should be assigned
picking_out.action_assign()
- self.assertEquals(len(picking_out.move_lines), 1.0)
- self.assertEquals(picking_out.move_lines.product_qty, 2.0)
- self.assertEquals(picking_out.state, "assigned")
+ self.assertEqual(len(picking_out.move_lines), 1.0)
+ self.assertEqual(picking_out.move_lines.product_qty, 2.0)
+ self.assertEqual(picking_out.state, "assigned")
def test_71_picking_state_all_at_once_force_assign(self):
""" This test will check that the state of the picking is correctly computed according
@@ -1590,7 +1590,7 @@ class TestStockFlow(TestStockCommon):
# validate this delivery order, it should be in the waiting state
picking_out.action_assign()
- self.assertEquals(picking_out.state, "confirmed")
+ self.assertEqual(picking_out.state, "confirmed")
def test_72_picking_state_partial_reserve(self):
""" This test will check that the state of the picking is correctly computed according
@@ -1633,7 +1633,7 @@ class TestStockFlow(TestStockCommon):
# validate this delivery order, it should be in partially available
picking_out.action_assign()
- self.assertEquals(picking_out.state, "assigned")
+ self.assertEqual(picking_out.state, "assigned")
# receive one product in stock
inventory = self.env['stock.inventory'].create({
@@ -1650,7 +1650,7 @@ class TestStockFlow(TestStockCommon):
# recheck availability of the delivery order, it should be assigned
picking_out.action_assign()
- self.assertEquals(picking_out.state, "assigned")
+ self.assertEqual(picking_out.state, "assigned")
def test_73_picking_state_partial_force_assign(self):
""" This test will check that the state of the picking is correctly computed according
@@ -1679,7 +1679,7 @@ class TestStockFlow(TestStockCommon):
# validate this delivery order, it should be in the waiting state
picking_out.action_assign()
- self.assertEquals(picking_out.state, "confirmed")
+ self.assertEqual(picking_out.state, "confirmed")
def test_74_move_state_waiting_mto(self):
""" This test will check that when a move is unreserved, its state changes to 'waiting' if
@@ -1734,9 +1734,9 @@ class TestStockFlow(TestStockCommon):
move_with_ancestors._do_unreserve()
other_move._do_unreserve()
- self.assertEquals(move_mto_alone.state, "draft")
- self.assertEquals(move_with_ancestors.state, "waiting")
- self.assertEquals(other_move.state, "confirmed")
+ self.assertEqual(move_mto_alone.state, "draft")
+ self.assertEqual(move_with_ancestors.state, "waiting")
+ self.assertEqual(other_move.state, "confirmed")
def test_80_partial_picking_without_backorder(self):
""" This test will create a picking with an initial demand for a product
@@ -1769,19 +1769,19 @@ class TestStockFlow(TestStockCommon):
self.assertFalse(picking.backorder_id)
# Checking that the original move is still in the same picking
- self.assertEquals(move_a.picking_id.id, picking.id)
+ self.assertEqual(move_a.picking_id.id, picking.id)
move_lines = picking.move_lines
move_done = move_lines.browse(move_a.id)
move_canceled = move_lines - move_done
# Checking that the original move was set to done
- self.assertEquals(move_done.product_uom_qty, 4)
- self.assertEquals(move_done.state, 'done')
+ self.assertEqual(move_done.product_uom_qty, 4)
+ self.assertEqual(move_done.state, 'done')
# Checking that the new move created was canceled
- self.assertEquals(move_canceled.product_uom_qty, 6)
- self.assertEquals(move_canceled.state, 'cancel')
+ self.assertEqual(move_canceled.product_uom_qty, 6)
+ self.assertEqual(move_canceled.state, 'cancel')
# Checking that the canceled move is in the original picking
self.assertIn(move_canceled.id, picking.move_lines.mapped('id'))
@@ -1968,11 +1968,11 @@ class TestStockFlow(TestStockCommon):
f.scheduled_date = fields.Datetime.now()
picking = f.save()
- self.assertEquals(f.state, 'draft')
+ self.assertEqual(f.state, 'draft')
picking.action_confirm()
f = Form(picking, view='stock.view_picking_form')
f.scheduled_date = fields.Datetime.now()
picking = f.save()
- self.assertEquals(f.state, 'confirmed')
+ self.assertEqual(f.state, 'confirmed')
diff --git a/addons/stock/tests/test_stock_location_search.py b/addons/stock/tests/test_stock_location_search.py
index ac83eebdfdc..a7e27f54f60 100644
--- a/addons/stock/tests/test_stock_location_search.py
+++ b/addons/stock/tests/test_stock_location_search.py
@@ -20,9 +20,9 @@ class TestStockLocationSearch(common.TransactionCase):
def test_10_location_search_by_barcode(self):
"""Search stock location by barcode"""
location_names = self.location.name_search(name=self.barcode)
- self.assertEquals(len(location_names), 1)
+ self.assertEqual(len(location_names), 1)
location_id_found = location_names[0][0]
- self.assertEquals(self.location_barcode_id, location_id_found)
+ self.assertEqual(self.location_barcode_id, location_id_found)
def test_20_location_search_by_name(self):
"""Search stock location by name"""
diff --git a/addons/stock_dropshipping/tests/test_dropship.py b/addons/stock_dropshipping/tests/test_dropship.py
index 1c24dbea88d..93c56163af2 100644
--- a/addons/stock_dropshipping/tests/test_dropship.py
+++ b/addons/stock_dropshipping/tests/test_dropship.py
@@ -109,8 +109,8 @@ class TestDropship(common.TransactionCase):
purchase = self.env['purchase.order'].search([('partner_id', '=', supplier_dropship.id)])
self.assertTrue(purchase, "an RFQ should have been created by the scheduler")
purchase.button_confirm()
- self.assertEquals(purchase.state, 'purchase', 'Purchase order should be in the approved state')
- self.assertEquals(len(purchase.ids), 1, 'There should be one picking')
+ self.assertEqual(purchase.state, 'purchase', 'Purchase order should be in the approved state')
+ self.assertEqual(len(purchase.ids), 1, 'There should be one picking')
# Send the 200 pieces
purchase.picking_ids.move_lines.quantity_done = purchase.picking_ids.move_lines.product_qty
@@ -120,4 +120,4 @@ class TestDropship(common.TransactionCase):
move_line = self.env['stock.move.line'].search([
('location_dest_id', '=', self.env.ref('stock.stock_location_customers').id),
('product_id', '=', drop_shop_product.id)])
- self.assertEquals(len(move_line.ids), 1, 'There should be exactly one move line')
+ self.assertEqual(len(move_line.ids), 1, 'There should be exactly one move line')
diff --git a/addons/survey/tests/test_certification_badge.py b/addons/survey/tests/test_certification_badge.py
index 60ca29d62e6..6cb3bbbafc8 100644
--- a/addons/survey/tests/test_certification_badge.py
+++ b/addons/survey/tests/test_certification_badge.py
@@ -101,7 +101,7 @@ class TestCertificationBadge(common.SurveyCase, HttpCase):
def test_badge_configuration(self):
# add a certification badge on a new survey
challenge = self.env['gamification.challenge'].search([('reward_id', '=', self.certification_badge.id)])
- self.assertEquals(len(challenge), 0, """A challenge should not exist or be linked to the certification badge
+ self.assertEqual(len(challenge), 0, """A challenge should not exist or be linked to the certification badge
if the certification badge have not been activated on a certification survey""")
self.certification_survey.write({
@@ -110,13 +110,13 @@ class TestCertificationBadge(common.SurveyCase, HttpCase):
})
challenge = self.env['gamification.challenge'].search([('reward_id', '=', self.certification_badge.id)])
- self.assertEquals(len(challenge), 1,
+ self.assertEqual(len(challenge), 1,
"A challenge should be created if the certification badge is activated on a certification survey")
challenge_line = self.env['gamification.challenge.line'].search([('challenge_id', '=', challenge.id)])
- self.assertEquals(len(challenge_line), 1,
+ self.assertEqual(len(challenge_line), 1,
"A challenge_line should be created if the certification badge is activated on a certification survey")
goal = challenge_line.definition_id
- self.assertEquals(len(goal), 1,
+ self.assertEqual(len(goal), 1,
"A goal should be created if the certification badge is activated on a certification survey")
# don't give badge anymore
@@ -127,13 +127,13 @@ class TestCertificationBadge(common.SurveyCase, HttpCase):
'The certification badge should be inactive if give_badge is false.')
challenge = self.env['gamification.challenge'].search([('id', '=', challenge.id)])
- self.assertEquals(len(challenge), 0,
+ self.assertEqual(len(challenge), 0,
"The challenge should be deleted if the certification badge is unset from the certification survey")
challenge_line = self.env['gamification.challenge.line'].search([('id', '=', challenge_line.id)])
- self.assertEquals(len(challenge_line), 0,
+ self.assertEqual(len(challenge_line), 0,
"The challenge_line should be deleted if the certification badge is unset from the certification survey")
goal = self.env['gamification.goal'].search([('id', '=', goal.id)])
- self.assertEquals(len(goal), 0,
+ self.assertEqual(len(goal), 0,
"The goal should be deleted if the certification badge is unset from the certification survey")
# re active the badge in the survey
@@ -142,13 +142,13 @@ class TestCertificationBadge(common.SurveyCase, HttpCase):
'The certification badge should be active if give_badge is true.')
challenge = self.env['gamification.challenge'].search([('reward_id', '=', self.certification_badge.id)])
- self.assertEquals(len(challenge), 1,
+ self.assertEqual(len(challenge), 1,
"A challenge should be created if the certification badge is activated on a certification survey")
challenge_line = self.env['gamification.challenge.line'].search([('challenge_id', '=', challenge.id)])
- self.assertEquals(len(challenge_line), 1,
+ self.assertEqual(len(challenge_line), 1,
"A challenge_line should be created if the certification badge is activated on a certification survey")
goal = challenge_line.definition_id
- self.assertEquals(len(goal), 1,
+ self.assertEqual(len(goal), 1,
"A goal should be created if the certification badge is activated on a certification survey")
def test_certification_badge_access(self):
@@ -183,11 +183,11 @@ class TestCertificationBadge(common.SurveyCase, HttpCase):
self.assertEqual(len(certification_surveys), 3, 'There should be 3 certification survey created')
challenges = self.env['gamification.challenge'].search([('reward_id', 'in', certification_surveys.mapped('certification_badge_id').ids)])
- self.assertEquals(len(challenges), 3, "3 challenges should be created")
+ self.assertEqual(len(challenges), 3, "3 challenges should be created")
challenge_lines = self.env['gamification.challenge.line'].search([('challenge_id', 'in', challenges.ids)])
- self.assertEquals(len(challenge_lines), 3, "3 challenge_lines should be created")
+ self.assertEqual(len(challenge_lines), 3, "3 challenge_lines should be created")
goals = challenge_lines.mapped('definition_id')
- self.assertEquals(len(goals), 3, "3 goals should be created")
+ self.assertEqual(len(goals), 3, "3 goals should be created")
# Test write multi
certification_surveys.write({'certification_give_badge': False})
@@ -196,11 +196,11 @@ class TestCertificationBadge(common.SurveyCase, HttpCase):
'Every badge should be inactive if the 3 survey does not give badge anymore')
challenges = self.env['gamification.challenge'].search([('id', 'in', challenges.ids)])
- self.assertEquals(len(challenges), 0, "The 3 challenges should be deleted")
+ self.assertEqual(len(challenges), 0, "The 3 challenges should be deleted")
challenge_lines = self.env['gamification.challenge.line'].search([('id', 'in', challenge_lines.ids)])
- self.assertEquals(len(challenge_lines), 0, "The 3 challenge_lines should be deleted")
+ self.assertEqual(len(challenge_lines), 0, "The 3 challenge_lines should be deleted")
goals = self.env['gamification.goal'].search([('id', 'in', goals.ids)])
- self.assertEquals(len(goals), 0, "The 3 goals should be deleted")
+ self.assertEqual(len(goals), 0, "The 3 goals should be deleted")
certification_surveys.write({'certification_give_badge': True})
for survey in certification_surveys:
@@ -208,8 +208,8 @@ class TestCertificationBadge(common.SurveyCase, HttpCase):
'Every badge should be reactivated if the 3 survey give badges again')
challenges = self.env['gamification.challenge'].search([('reward_id', 'in', certification_surveys.mapped('certification_badge_id').ids)])
- self.assertEquals(len(challenges), 3, "3 challenges should be created")
+ self.assertEqual(len(challenges), 3, "3 challenges should be created")
challenge_lines = self.env['gamification.challenge.line'].search([('challenge_id', 'in', challenges.ids)])
- self.assertEquals(len(challenge_lines), 3, "3 challenge_lines should be created")
+ self.assertEqual(len(challenge_lines), 3, "3 challenge_lines should be created")
goals = challenge_lines.mapped('definition_id')
- self.assertEquals(len(goals), 3, "3 goals should be created")
+ self.assertEqual(len(goals), 3, "3 goals should be created")
diff --git a/addons/test_mail/tests/test_message_management.py b/addons/test_mail/tests/test_message_management.py
index bfdf1ccf5b0..2a45477b9bf 100644
--- a/addons/test_mail/tests/test_message_management.py
+++ b/addons/test_mail/tests/test_message_management.py
@@ -55,12 +55,12 @@ class TestMailResend(common.BaseFunctionalTest, common.MockEmails):
('res_partner_id', '=', partner.id),
('mail_message_id', '=', message.id)]
)
- self.assertEquals(notif.notification_status, state)
+ self.assertEqual(notif.notification_status, state)
return notif
def assertBusMessage(self, partners):
partner_ids = [elem[0][2] for elem in self.bus_update_failure]
- self.assertEquals(partner_ids, [partner.id for partner in partners])
+ self.assertEqual(partner_ids, [partner.id for partner in partners])
self.bus_update_failure.clear()
@classmethod
diff --git a/addons/test_mail_full/tests/test_sms_composer.py b/addons/test_mail_full/tests/test_sms_composer.py
index 04ff799408f..060863e4f02 100644
--- a/addons/test_mail_full/tests/test_sms_composer.py
+++ b/addons/test_mail_full/tests/test_sms_composer.py
@@ -463,8 +463,8 @@ class TestSMSComposerMass(test_mail_full_common.BaseFunctionalTest, sms_common.M
})
# Call manually the onchange
composer._onchange_template_id()
- self.assertEquals(composer.composition_mode, "comment")
- self.assertEquals(composer.body, "Hello %s ceci est en français." % test_record_2.display_name)
+ self.assertEqual(composer.composition_mode, "comment")
+ self.assertEqual(composer.body, "Hello %s ceci est en français." % test_record_2.display_name)
with self.mockSMSGateway():
messages = composer._action_send_sms()
@@ -487,9 +487,9 @@ class TestSMSComposerMass(test_mail_full_common.BaseFunctionalTest, sms_common.M
})
# Call manually the onchange
composer._onchange_template_id()
- self.assertEquals(composer.composition_mode, "mass")
+ self.assertEqual(composer.composition_mode, "mass")
# In english because by default but when sinding depending of record
- self.assertEquals(composer.body, "Dear ${object.display_name} this is an SMS.")
+ self.assertEqual(composer.body, "Dear ${object.display_name} this is an SMS.")
with self.mockSMSGateway():
composer.action_send_sms()
diff --git a/addons/test_website/tests/test_controller_args.py b/addons/test_website/tests/test_controller_args.py
index 4204cb1e5b4..fc21c22a2d6 100644
--- a/addons/test_website/tests/test_controller_args.py
+++ b/addons/test_website/tests/test_controller_args.py
@@ -7,25 +7,25 @@ class TestWebsiteControllerArgs(odoo.tests.HttpCase):
def test_crawl_args(self):
req = self.url_open('/ignore_args/converter/valueA/?b=valueB&c=valueC')
- self.assertEquals(req.status_code, 200)
- self.assertEquals(req.json(), {'a': 'valueA', 'b': 'valueB', 'kw': {'c': 'valueC'}})
+ self.assertEqual(req.status_code, 200)
+ self.assertEqual(req.json(), {'a': 'valueA', 'b': 'valueB', 'kw': {'c': 'valueC'}})
req = self.url_open('/ignore_args/converter/valueA/nokw?b=valueB&c=valueC')
- self.assertEquals(req.status_code, 200)
- self.assertEquals(req.json(), {'a': 'valueA', 'b': 'valueB'})
+ self.assertEqual(req.status_code, 200)
+ self.assertEqual(req.json(), {'a': 'valueA', 'b': 'valueB'})
req = self.url_open('/ignore_args/converteronly/valueA/?b=valueB&c=valueC')
- self.assertEquals(req.status_code, 200)
- self.assertEquals(req.json(), {'a': 'valueA', 'kw': None})
+ self.assertEqual(req.status_code, 200)
+ self.assertEqual(req.json(), {'a': 'valueA', 'kw': None})
req = self.url_open('/ignore_args/none?a=valueA&b=valueB')
- self.assertEquals(req.status_code, 200)
- self.assertEquals(req.json(), {'a': None, 'kw': None})
+ self.assertEqual(req.status_code, 200)
+ self.assertEqual(req.json(), {'a': None, 'kw': None})
req = self.url_open('/ignore_args/a?a=valueA&b=valueB')
- self.assertEquals(req.status_code, 200)
- self.assertEquals(req.json(), {'a': 'valueA', 'kw': None})
+ self.assertEqual(req.status_code, 200)
+ self.assertEqual(req.json(), {'a': 'valueA', 'kw': None})
req = self.url_open('/ignore_args/kw?a=valueA&b=valueB')
- self.assertEquals(req.status_code, 200)
- self.assertEquals(req.json(), {'a': 'valueA', 'kw': {'b': 'valueB'}})
+ self.assertEqual(req.status_code, 200)
+ self.assertEqual(req.json(), {'a': 'valueA', 'kw': {'b': 'valueB'}})
diff --git a/addons/test_website/tests/test_views_during_module_operation.py b/addons/test_website/tests/test_views_during_module_operation.py
index 58cf943daf4..530284e2645 100644
--- a/addons/test_website/tests/test_views_during_module_operation.py
+++ b/addons/test_website/tests/test_views_during_module_operation.py
@@ -58,7 +58,7 @@ class TestViewsDuringModuleOperation(TransactionCase):
update_module_child_view.with_context(website_id=1).write({'name': 'Child View (W1)'})
# Ensure views are correctly setup
- self.assertEquals(View.search_count([('type', '=', 'qweb'), ('key', '=', update_module_child_view.key)]), 2)
+ self.assertEqual(View.search_count([('type', '=', 'qweb'), ('key', '=', update_module_child_view.key)]), 2)
self.assertTrue(self.env.ref(update_module_view_to_be_t_called.key))
self.assertTrue(self.env.ref(update_module_base_view.key))
@@ -69,4 +69,4 @@ class TestViewsDuringModuleOperation(TransactionCase):
# Ensure generic views got removed
self.assertFalse(self.env.ref('test_website.update_module_view_to_be_t_called', raise_if_not_found=False))
# Ensure specific COW views got removed
- self.assertEquals(View.search_count([('type', '=', 'qweb'), ('key', '=', 'test_website.update_module_child_view')]), 0)
+ self.assertEqual(View.search_count([('type', '=', 'qweb'), ('key', '=', 'test_website.update_module_child_view')]), 0)
diff --git a/addons/uom/tests/test_uom.py b/addons/uom/tests/test_uom.py
index 26cbb5ef66a..1b7dd2b1e1a 100644
--- a/addons/uom/tests/test_uom.py
+++ b/addons/uom/tests/test_uom.py
@@ -18,10 +18,10 @@ class TestUom(TransactionCase):
def test_10_conversion(self):
qty = self.uom_gram._compute_quantity(1020000, self.uom_ton)
- self.assertEquals(qty, 1.02, "Converted quantity does not correspond.")
+ self.assertEqual(qty, 1.02, "Converted quantity does not correspond.")
price = self.uom_gram._compute_price(2, self.uom_ton)
- self.assertEquals(price, 2000000.0, "Converted price does not correspond.")
+ self.assertEqual(price, 2000000.0, "Converted price does not correspond.")
# If the conversion factor for Dozens (1/12) is not stored with sufficient precision,
# the conversion of 1 Dozen into Units will give e.g. 12.00000000000047 Units
@@ -29,13 +29,13 @@ class TestUom(TransactionCase):
# This is a partial regression test for rev. 311c77bb, which is further improved
# by rev. fa2f7b86.
qty = self.uom_dozen._compute_quantity(1, self.uom_unit)
- self.assertEquals(qty, 12.0, "Converted quantity does not correspond.")
+ self.assertEqual(qty, 12.0, "Converted quantity does not correspond.")
# Regression test for side-effect of commit 311c77bb - converting 1234 Grams
# into Kilograms should work even if grams are rounded to 1.
self.uom_gram.write({'rounding': 1})
qty = self.uom_gram._compute_quantity(1234, self.uom_kgm)
- self.assertEquals(qty, 1.234, "Converted quantity does not correspond.")
+ self.assertEqual(qty, 1.234, "Converted quantity does not correspond.")
def test_20_rounding(self):
product_uom = self.env['uom.uom'].create({
@@ -47,7 +47,7 @@ class TestUom(TransactionCase):
})
qty = self.uom_unit._compute_quantity(2, product_uom)
- self.assertEquals(qty, 1, "Converted quantity should be rounded up.")
+ self.assertEqual(qty, 1, "Converted quantity should be rounded up.")
def test_30_reference_uniqueness(self):
""" Check the uniqueness of the reference UoM in a category """
diff --git a/addons/web/controllers/main.py b/addons/web/controllers/main.py
index 3aa2c0e64d9..d893271ac6c 100644
--- a/addons/web/controllers/main.py
+++ b/addons/web/controllers/main.py
@@ -1292,7 +1292,7 @@ class Binary(http.Controller):
try:
attachment = Model.create({
'name': filename,
- 'datas': base64.encodestring(ufile.read()),
+ 'datas': base64.encodebytes(ufile.read()),
'res_model': model,
'res_id': int(id)
})
diff --git a/addons/web_editor/models/ir_qweb.py b/addons/web_editor/models/ir_qweb.py
index 9077fab0389..50e3a1a43e7 100644
--- a/addons/web_editor/models/ir_qweb.py
+++ b/addons/web_editor/models/ir_qweb.py
@@ -250,7 +250,7 @@ class DateTime(models.AbstractModel):
dt = user_tz.localize(dt).astimezone(utc)
except Exception:
- logger.warn(
+ logger.warning(
"Failed to convert the value for a field of the model"
" %s back from the user's timezone (%s) to UTC",
model, tz_name,
diff --git a/addons/website/models/ir_http.py b/addons/website/models/ir_http.py
index ecacdc62bac..53f64fafda4 100644
--- a/addons/website/models/ir_http.py
+++ b/addons/website/models/ir_http.py
@@ -285,9 +285,9 @@ class Http(models.AbstractModel):
# Needed to show reset template on translated pages (`_prepare_qcontext` will set it for main lang)
values['editable'] = request.uid and request.website.is_publisher()
elif code == 403:
- logger.warn("403 Forbidden:\n\n%s", values['traceback'])
+ logger.warning("403 Forbidden:\n\n%s", values['traceback'])
elif code == 400:
- logger.warn("400 Bad Request:\n\n%s", values['traceback'])
+ logger.warning("400 Bad Request:\n\n%s", values['traceback'])
try:
html = env['ir.ui.view'].render_template('website.%s' % view_id, values)
except Exception:
diff --git a/addons/website/models/website.py b/addons/website/models/website.py
index 0ddca6810e2..3902f5dae8a 100644
--- a/addons/website/models/website.py
+++ b/addons/website/models/website.py
@@ -667,14 +667,15 @@ class Website(models.Model):
return False
# dont't list routes without argument having no default value or converter
- spec = inspect.getargspec(endpoint.method.original_func)
-
- # remove self and arguments having a default value
- defaults_count = len(spec.defaults or [])
- args = spec.args[1:(-defaults_count or None)]
+ sign = inspect.signature(endpoint.method.original_func)
+ params = list(sign.parameters.values())[1:] # skip self
+ supported_kinds = (inspect.Parameter.POSITIONAL_ONLY,
+ inspect.Parameter.POSITIONAL_OR_KEYWORD)
+ has_no_default = lambda p: p.default is inspect.Parameter.empty
# check that all args have a converter
- return all((arg in rule._converters) for arg in args)
+ return all(p.name in rule._converters for p in params
+ if p.kind in supported_kinds and has_no_default(p))
def enumerate_pages(self, query_string=None, force=False):
""" Available pages in the website/CMS. This is mostly used for links
diff --git a/addons/website_form/controllers/main.py b/addons/website_form/controllers/main.py
index 81d7cf363fa..b2688c76c7e 100644
--- a/addons/website_form/controllers/main.py
+++ b/addons/website_form/controllers/main.py
@@ -214,7 +214,7 @@ class WebsiteForm(http.Controller):
custom_field = file.field_name not in authorized_fields
attachment_value = {
'name': file.filename,
- 'datas': base64.encodestring(file.read()),
+ 'datas': base64.encodebytes(file.read()),
'res_model': model_name,
'res_id': record.id,
}
diff --git a/addons/website_mail_channel/tests/test_unsubscribe.py b/addons/website_mail_channel/tests/test_unsubscribe.py
index ec1a915f232..28934d5f49d 100644
--- a/addons/website_mail_channel/tests/test_unsubscribe.py
+++ b/addons/website_mail_channel/tests/test_unsubscribe.py
@@ -25,7 +25,7 @@ class TestConfirmUnsubscribe(common.HttpCase):
def test_not_subscribed_no_template(self):
""" Test warning works on db without template (code update w/o module update) """
self.env.ref('website_mail_channel.not_subscribed').unlink()
- self.assertEquals(
+ self.assertEqual(
self.env['ir.model.data'].search_count([
('module', '=', 'website_mail_channel'),
('name', '=', 'not_subscribed'),
diff --git a/addons/website_sale/tests/test_website_sale_pricelist.py b/addons/website_sale/tests/test_website_sale_pricelist.py
index 59af832fc74..d6a372aae5c 100644
--- a/addons/website_sale/tests/test_website_sale_pricelist.py
+++ b/addons/website_sale/tests/test_website_sale_pricelist.py
@@ -91,7 +91,7 @@ class TestWebsitePriceList(TransactionCase):
}
for country, result in country_list.items():
pls = self.get_pl(show, current_pl, country)
- self.assertEquals(len(set(pls.mapped('name')) & set(result)), len(pls), 'Test failed for %s (%s %s vs %s %s)'
+ self.assertEqual(len(set(pls.mapped('name')) & set(result)), len(pls), 'Test failed for %s (%s %s vs %s %s)'
% (country, len(pls), pls.mapped('name'), len(result), result))
def test_get_pricelist_available_not_show(self):
@@ -108,7 +108,7 @@ class TestWebsitePriceList(TransactionCase):
for country, result in country_list.items():
pls = self.get_pl(show, current_pl, country)
- self.assertEquals(len(set(pls.mapped('name')) & set(result)), len(pls), 'Test failed for %s (%s %s vs %s %s)'
+ self.assertEqual(len(set(pls.mapped('name')) & set(result)), len(pls), 'Test failed for %s (%s %s vs %s %s)'
% (country, len(pls), pls.mapped('name'), len(result), result))
def test_get_pricelist_available_promocode(self):
@@ -145,7 +145,7 @@ class TestWebsitePriceList(TransactionCase):
}
for country, result in country_list.items():
pls = self.get_pl(show, current_pl, country)
- self.assertEquals(len(set(pls.mapped('name')) & set(result)), len(pls), 'Test failed for %s (%s %s vs %s %s)'
+ self.assertEqual(len(set(pls.mapped('name')) & set(result)), len(pls), 'Test failed for %s (%s %s vs %s %s)'
% (country, len(pls), pls.mapped('name'), len(result), result))
diff --git a/addons/website_sale_comparison/tests/test_website_sale_comparison.py b/addons/website_sale_comparison/tests/test_website_sale_comparison.py
index 21e1db939d7..9f68b49c6bc 100644
--- a/addons/website_sale_comparison/tests/test_website_sale_comparison.py
+++ b/addons/website_sale_comparison/tests/test_website_sale_comparison.py
@@ -39,9 +39,9 @@ class TestWebsiteSaleComparison(odoo.tests.TransactionCase):
product.with_context(website_id=1).write({'name': 'Trigger COW'})
# Verify initial state: the specific views exist
- self.assertEquals(Website1.viewref('website_sale.product').website_id.id, 1)
- self.assertEquals(Website1.viewref('website_sale_comparison.product_add_to_compare').website_id.id, 1)
- self.assertEquals(Website1.viewref(test_view_key).website_id.id, 1)
+ self.assertEqual(Website1.viewref('website_sale.product').website_id.id, 1)
+ self.assertEqual(Website1.viewref('website_sale_comparison.product_add_to_compare').website_id.id, 1)
+ self.assertEqual(Website1.viewref(test_view_key).website_id.id, 1)
# Remove the module (use `module_uninstall` because it is enough to test
# what we want here, no need/can't use `button_immediate_uninstall`
diff --git a/addons/website_theme_install/tests/test_views.py b/addons/website_theme_install/tests/test_views.py
index 42be90dfbd5..a81fd1da4e8 100644
--- a/addons/website_theme_install/tests/test_views.py
+++ b/addons/website_theme_install/tests/test_views.py
@@ -70,13 +70,13 @@ class Crawler(HttpCase):
# It should crash as it should not find a view on website 1 for '_theme_kea_sale.products', !!and certainly not a theme.ir.ui.view!!.
view = View.with_context(website_id=website_1.id)._view_obj('_theme_kea_sale.products')
view = View.with_context(website_id=website_2.id)._view_obj('_theme_kea_sale.products')
- self.assertEquals(len(view), 1, "It should find the ir.ui.view with key '_theme_kea_sale.products' on website 2..")
- self.assertEquals(view._name, 'ir.ui.view', "..and not a theme.ir.ui.view")
+ self.assertEqual(len(view), 1, "It should find the ir.ui.view with key '_theme_kea_sale.products' on website 2..")
+ self.assertEqual(view._name, 'ir.ui.view', "..and not a theme.ir.ui.view")
views = View.with_context(website_id=website_1.id).get_related_views('_website_sale.products')
- self.assertEquals(len(views), 2, "It should not mix apples and oranges, only ir.ui.view ['_website_sale.products', '_website_sale.child_view_w1'] should be returned")
+ self.assertEqual(len(views), 2, "It should not mix apples and oranges, only ir.ui.view ['_website_sale.products', '_website_sale.child_view_w1'] should be returned")
views = View.with_context(website_id=website_2.id).get_related_views('_website_sale.products')
- self.assertEquals(len(views), 2, "It should not mix apples and oranges, only ir.ui.view ['_website_sale.products', '_theme_kea_sale.products'] should be returned")
+ self.assertEqual(len(views), 2, "It should not mix apples and oranges, only ir.ui.view ['_website_sale.products', '_theme_kea_sale.products'] should be returned")
# Part 2 of the test, it test the same stuff but from a higher level (get_related_views ends up calling _view_obj)
called_theme_view = self.env['theme.ir.ui.view'].with_context(install_filename='/testviews').create({
@@ -115,9 +115,9 @@ class Crawler(HttpCase):
# Next line should not crash (was mixing apples and oranges - ir.ui.view and theme.ir.ui.view)
views = View.with_context(website_id=website_1.id).get_related_views('_website_sale.products')
- self.assertEquals(len(views), 2, "It should not mix apples and oranges, only ir.ui.view ['_website_sale.products', '_website_sale.child_view_w1'] should be returned (2)")
+ self.assertEqual(len(views), 2, "It should not mix apples and oranges, only ir.ui.view ['_website_sale.products', '_website_sale.child_view_w1'] should be returned (2)")
views = View.with_context(website_id=website_2.id).get_related_views('_website_sale.products')
- self.assertEquals(len(views), 3, "It should not mix apples and oranges, only ir.ui.view ['_website_sale.products', '_theme_kea_sale.products', '_theme_kea_sale.t_called_view'] should be returned")
+ self.assertEqual(len(views), 3, "It should not mix apples and oranges, only ir.ui.view ['_website_sale.products', '_theme_kea_sale.products', '_theme_kea_sale.t_called_view'] should be returned")
# ########################################################
# Test the controller (which is calling get_related_views)
diff --git a/odoo/addons/base/models/ir_actions_report.py b/odoo/addons/base/models/ir_actions_report.py
index a3d354cfabc..b27c801ac04 100644
--- a/odoo/addons/base/models/ir_actions_report.py
+++ b/odoo/addons/base/models/ir_actions_report.py
@@ -179,7 +179,7 @@ class IrActionsReport(models.Model):
img = Image.open(stream)
img.convert("RGB").save(stream, format="pdf")
return stream
- return io.BytesIO(base64.decodestring(attachment.datas))
+ return io.BytesIO(base64.decodebytes(attachment.datas))
def retrieve_attachment(self, record):
'''Retrieve an attachment for a specific record.
@@ -211,7 +211,7 @@ class IrActionsReport(models.Model):
return None
attachment_vals = {
'name': attachment_name,
- 'datas': base64.encodestring(buffer.getvalue()),
+ 'datas': base64.encodebytes(buffer.getvalue()),
'res_model': self.model,
'res_id': record.id,
'type': 'binary',
diff --git a/odoo/addons/base/models/ir_model.py b/odoo/addons/base/models/ir_model.py
index 1ec2cd6de2a..a330a7de5a7 100644
--- a/odoo/addons/base/models/ir_model.py
+++ b/odoo/addons/base/models/ir_model.py
@@ -647,7 +647,7 @@ class IrModelFields(models.Model):
]))
else:
# uninstall mode
- _logger.warn("The following fields were force-deleted to prevent a registry crash "
+ _logger.warning("The following fields were force-deleted to prevent a registry crash "
+ ", ".join(str(f) for f in fields)
+ " the following view might be broken %s" % view.name)
finally:
diff --git a/odoo/addons/base/models/ir_ui_menu.py b/odoo/addons/base/models/ir_ui_menu.py
index 9cde7d2fb81..b63d201ecf3 100644
--- a/odoo/addons/base/models/ir_ui_menu.py
+++ b/odoo/addons/base/models/ir_ui_menu.py
@@ -67,7 +67,7 @@ class IrUiMenu(models.Model):
icon_image = False
if icon_path:
with tools.file_open(icon_path, 'rb') as icon_file:
- icon_image = base64.encodestring(icon_file.read())
+ icon_image = base64.encodebytes(icon_file.read())
return icon_image
@api.constrains('parent_id')
diff --git a/odoo/addons/base/models/ir_ui_view.py b/odoo/addons/base/models/ir_ui_view.py
index 27dca34fffa..a89391d6d7c 100644
--- a/odoo/addons/base/models/ir_ui_view.py
+++ b/odoo/addons/base/models/ir_ui_view.py
@@ -351,7 +351,7 @@ actual arch.
message = "View inheritance may not use attribute %r as a selector." % match.group(1)
self.raise_view_error(message, self.id)
if WRONGCLASS.search(node.get('expr', '')):
- _logger.warn(
+ _logger.warning(
"Error-prone use of @class in view %s (%s): use the "
"hasclass(*classes) function to filter elements by "
"their classes", self.name, self.xml_id
diff --git a/odoo/addons/base/models/res_users.py b/odoo/addons/base/models/res_users.py
index 373b3c3bbdc..f3bdb3094e3 100644
--- a/odoo/addons/base/models/res_users.py
+++ b/odoo/addons/base/models/res_users.py
@@ -823,7 +823,7 @@ class Users(models.Model):
source = request.httprequest.remote_addr
(failures, previous) = failures_map[source]
if self._on_login_cooldown(failures, previous):
- _logger.warn(
+ _logger.warning(
"Login attempt ignored for %s on %s: "
"%d failures since last success, last failure at %s. "
"You can configure the number of login failures before a "
@@ -832,7 +832,7 @@ class Users(models.Model):
"\"base.login_cooldown_after\" to 0.",
source, self.env.cr.dbname, failures, previous)
if ipaddress.ip_address(source).is_private:
- _logger.warn(
+ _logger.warning(
"The rate-limited IP address %s is classified as private "
"and *might* be a proxy. If your Odoo is behind a proxy, "
"it may be mis-configured. Check that you are running "
@@ -879,7 +879,7 @@ class Users(models.Model):
def _register_hook(self):
if hasattr(self, 'check_credentials'):
- _logger.warn("The check_credentials method of res.users has been renamed _check_credentials. One of your installed modules defines one, but it will not be called anymore.")
+ _logger.warning("The check_credentials method of res.users has been renamed _check_credentials. One of your installed modules defines one, but it will not be called anymore.")
#
# Implied groups
#
diff --git a/odoo/addons/base/tests/test_acl.py b/odoo/addons/base/tests/test_acl.py
index 4c8954d7f62..efecd0c201f 100644
--- a/odoo/addons/base/tests/test_acl.py
+++ b/odoo/addons/base/tests/test_acl.py
@@ -35,7 +35,7 @@ class TestACL(TransactionCase):
has_group_system = self.demo_user.has_group(GROUP_SYSTEM)
self.assertFalse(has_group_system, "`demo` user should not belong to the restricted group before the test")
self.assertIn('decimal_places', original_fields, "'decimal_places' field must be properly visible before the test")
- self.assertNotEquals(view_arch.xpath("//field[@name='decimal_places']"), [],
+ self.assertNotEqual(view_arch.xpath("//field[@name='decimal_places']"), [],
"Field 'decimal_places' must be found in view definition before the test")
# restrict access to the field and check it's gone
@@ -45,7 +45,7 @@ class TestACL(TransactionCase):
form_view = currency.fields_view_get(False, 'form')
view_arch = etree.fromstring(form_view.get('arch'))
self.assertNotIn('decimal_places', fields, "'decimal_places' field should be gone")
- self.assertEquals(view_arch.xpath("//field[@name='decimal_places']"), [],
+ self.assertEqual(view_arch.xpath("//field[@name='decimal_places']"), [],
"Field 'decimal_places' must not be found in view definition")
# Make demo user a member of the restricted group and check that the field is back
@@ -56,7 +56,7 @@ class TestACL(TransactionCase):
view_arch = etree.fromstring(form_view.get('arch'))
self.assertTrue(has_group_system, "`demo` user should now belong to the restricted group")
self.assertIn('decimal_places', fields, "'decimal_places' field must be properly visible again")
- self.assertNotEquals(view_arch.xpath("//field[@name='decimal_places']"), [],
+ self.assertNotEqual(view_arch.xpath("//field[@name='decimal_places']"), [],
"Field 'decimal_places' must be found in view definition again")
@mute_logger('odoo.models')
@@ -67,8 +67,8 @@ class TestACL(TransactionCase):
# Verify the test environment first
has_group_system = self.demo_user.has_group(GROUP_SYSTEM)
self.assertFalse(has_group_system, "`demo` user should not belong to the restricted group")
- self.assert_(partner.read(['bank_ids']))
- self.assert_(partner.write({'bank_ids': []}))
+ self.assertTrue(partner.read(['bank_ids']))
+ self.assertTrue(partner.write({'bank_ids': []}))
# Now restrict access to the field and check it's forbidden
self._set_field_groups(partner, 'bank_ids', GROUP_SYSTEM)
@@ -82,8 +82,8 @@ class TestACL(TransactionCase):
self.erp_system_group.users += self.demo_user
has_group_system = self.demo_user.has_group(GROUP_SYSTEM)
self.assertTrue(has_group_system, "`demo` user should now belong to the restricted group")
- self.assert_(partner.read(['bank_ids']))
- self.assert_(partner.write({'bank_ids': []}))
+ self.assertTrue(partner.read(['bank_ids']))
+ self.assertTrue(partner.write({'bank_ids': []}))
@mute_logger('odoo.models')
def test_fields_browse_restriction(self):
diff --git a/odoo/addons/base/tests/test_base.py b/odoo/addons/base/tests/test_base.py
index 5051fec4dad..28fd7813722 100644
--- a/odoo/addons/base/tests/test_base.py
+++ b/odoo/addons/base/tests/test_base.py
@@ -165,7 +165,7 @@ class TestBase(TransactionCase):
'street': 'Strongarm Avenue, 12',
'parent_id': ironshield.id,
})
- self.assertEquals(p1.type, 'contact', 'Default type must be "contact", not the copied parent type')
+ self.assertEqual(p1.type, 'contact', 'Default type must be "contact", not the copied parent type')
self.assertEqual(ironshield.street, p1.street, 'Address fields should be copied to company')
def test_40_res_partner_address_get(self):
@@ -318,30 +318,30 @@ class TestBase(TransactionCase):
p3 = res_partner.search([('email', '=', 'ugr@sunhelm.com')], limit=1)
for p in (p0, p1, p11, p2, p3):
- self.assertEquals(p.commercial_partner_id, sunhelm, 'Incorrect commercial entity resolution')
- self.assertEquals(p.vat, sunhelm.vat, 'Commercial fields must be automatically synced')
+ self.assertEqual(p.commercial_partner_id, sunhelm, 'Incorrect commercial entity resolution')
+ self.assertEqual(p.vat, sunhelm.vat, 'Commercial fields must be automatically synced')
sunhelmvat = 'BE0123456789'
sunhelm.write({'vat': sunhelmvat})
for p in (p0, p1, p11, p2, p3):
- self.assertEquals(p.vat, sunhelmvat, 'Commercial fields must be automatically and recursively synced')
+ self.assertEqual(p.vat, sunhelmvat, 'Commercial fields must be automatically and recursively synced')
p1vat = 'BE0987654321'
p1.write({'vat': p1vat})
for p in (sunhelm, p0, p11, p2, p3):
- self.assertEquals(p.vat, sunhelmvat, 'Sync to children should only work downstream and on commercial entities')
+ self.assertEqual(p.vat, sunhelmvat, 'Sync to children should only work downstream and on commercial entities')
# promote p1 to commercial entity
p1.write({'parent_id': sunhelm.id,
'is_company': True,
'name': 'Sunhelm Subsidiary'})
- self.assertEquals(p1.vat, p1vat, 'Setting is_company should stop auto-sync of commercial fields')
- self.assertEquals(p1.commercial_partner_id, p1, 'Incorrect commercial entity resolution after setting is_company')
+ self.assertEqual(p1.vat, p1vat, 'Setting is_company should stop auto-sync of commercial fields')
+ self.assertEqual(p1.commercial_partner_id, p1, 'Incorrect commercial entity resolution after setting is_company')
# writing on parent should not touch child commercial entities
sunhelmvat2 = 'BE0112233445'
sunhelm.write({'vat': sunhelmvat2})
- self.assertEquals(p1.vat, p1vat, 'Setting is_company should stop auto-sync of commercial fields')
- self.assertEquals(p0.vat, sunhelmvat2, 'Commercial fields must be automatically synced')
+ self.assertEqual(p1.vat, p1vat, 'Setting is_company should stop auto-sync of commercial fields')
+ self.assertEqual(p0.vat, sunhelmvat2, 'Commercial fields must be automatically synced')
def test_60_read_group(self):
title_sir = self.env['res.partner.title'].create({'name': 'Sir...'})
diff --git a/odoo/addons/base/tests/test_basecase.py b/odoo/addons/base/tests/test_basecase.py
index 8bd78f860fa..a4aa02559b8 100644
--- a/odoo/addons/base/tests/test_basecase.py
+++ b/odoo/addons/base/tests/test_basecase.py
@@ -67,6 +67,6 @@ class TestTransactionCase(common.TransactionCase):
xid = 'base.test_partner_yellow'
partner = self.env.ref(xid)
pid = self.ref(xid)
- self.assertEquals(pid, partner.id, "ref() should resolve xid to database ID")
+ self.assertEqual(pid, partner.id, "ref() should resolve xid to database ID")
partner2 = self.browse_ref(xid)
self.assertEqual(partner, partner2, "browse_ref() should resolve xid to browse records")
diff --git a/odoo/addons/base/tests/test_mail.py b/odoo/addons/base/tests/test_mail.py
index 11fac3a885d..1f67c2365f9 100644
--- a/odoo/addons/base/tests/test_mail.py
+++ b/odoo/addons/base/tests/test_mail.py
@@ -81,7 +81,7 @@ class TestSanitizer(BaseCase):
self.assertTrue('ha.ckers.org' not in html or 'http://ha.ckers.org/xss.css' in html, 'html_sanitize did not remove a malicious code in %s (%s)' % (content, html))
content = "<!--[if gte IE 4]><SCRIPT>alert('XSS');</SCRIPT><![endif]-->" # down-level hidden block
- self.assertEquals(html_sanitize(content, silent=False), '')
+ self.assertEqual(html_sanitize(content, silent=False), '')
def test_html(self):
sanitized_html = html_sanitize(test_mail_examples.MISC_HTML_SOURCE)
diff --git a/odoo/addons/base/tests/test_mimetypes.py b/odoo/addons/base/tests/test_mimetypes.py
index b5fa3e1ebf8..1cca62c917b 100644
--- a/odoo/addons/base/tests/test_mimetypes.py
+++ b/odoo/addons/base/tests/test_mimetypes.py
@@ -45,7 +45,7 @@ class test_guess_mimetype(BaseCase):
content = base64.b64decode(BMP)
mimetype = guess_mimetype(content, default='test')
# mimetype should match image/bmp, image/x-ms-bmp, ...
- self.assertRegexpMatches(mimetype, r'image/.*\bbmp')
+ self.assertRegex(mimetype, r'image/.*\bbmp')
def test_mimetype_jpg(self):
content = base64.b64decode(JPG)
diff --git a/odoo/addons/base/tests/test_osv.py b/odoo/addons/base/tests/test_osv.py
index f79dde6751a..9b97cfdb0e4 100644
--- a/odoo/addons/base/tests/test_osv.py
+++ b/odoo/addons/base/tests/test_osv.py
@@ -13,9 +13,9 @@ class QueryTestCase(BaseCase):
query.where_clause.append("product_product.template_id = product_template.id")
query.add_join(("product_template", "product_category", "categ_id", "id", "categ_id"), implicit=False, outer=False) # add normal join
query.add_join(("product_product", "res_user", "user_id", "id", "user_id"), implicit=False, outer=True) # outer join
- self.assertEquals(query.get_sql()[0].strip(),
+ self.assertEqual(query.get_sql()[0].strip(),
""""product_product" LEFT JOIN "res_user" as "product_product__user_id" ON ("product_product"."user_id" = "product_product__user_id"."id"),"product_template" JOIN "product_category" as "product_template__categ_id" ON ("product_template"."categ_id" = "product_template__categ_id"."id") """.strip())
- self.assertEquals(query.get_sql()[1].strip(), """product_product.template_id = product_template.id""".strip())
+ self.assertEqual(query.get_sql()[1].strip(), """product_product.template_id = product_template.id""".strip())
def test_query_chained_explicit_joins(self):
query = Query()
@@ -23,9 +23,9 @@ class QueryTestCase(BaseCase):
query.where_clause.append("product_product.template_id = product_template.id")
query.add_join(("product_template", "product_category", "categ_id", "id", "categ_id"), implicit=False, outer=False) # add normal join
query.add_join(("product_template__categ_id", "res_user", "user_id", "id", "user_id"), implicit=False, outer=True) # CHAINED outer join
- self.assertEquals(query.get_sql()[0].strip(),
+ self.assertEqual(query.get_sql()[0].strip(),
""""product_product","product_template" JOIN "product_category" as "product_template__categ_id" ON ("product_template"."categ_id" = "product_template__categ_id"."id") LEFT JOIN "res_user" as "product_template__categ_id__user_id" ON ("product_template__categ_id"."user_id" = "product_template__categ_id__user_id"."id")""".strip())
- self.assertEquals(query.get_sql()[1].strip(), """product_product.template_id = product_template.id""".strip())
+ self.assertEqual(query.get_sql()[1].strip(), """product_product.template_id = product_template.id""".strip())
def test_mixed_query_chained_explicit_implicit_joins(self):
query = Query()
@@ -35,9 +35,9 @@ class QueryTestCase(BaseCase):
query.add_join(("product_template__categ_id", "res_user", "user_id", "id", "user_id"), implicit=False, outer=True) # CHAINED outer join
query.tables.append('"account.account"')
query.where_clause.append("product_category.expense_account_id = account_account.id") # additional implicit join
- self.assertEquals(query.get_sql()[0].strip(),
+ self.assertEqual(query.get_sql()[0].strip(),
""""product_product","product_template" JOIN "product_category" as "product_template__categ_id" ON ("product_template"."categ_id" = "product_template__categ_id"."id") LEFT JOIN "res_user" as "product_template__categ_id__user_id" ON ("product_template__categ_id"."user_id" = "product_template__categ_id__user_id"."id"),"account.account" """.strip())
- self.assertEquals(query.get_sql()[1].strip(), """product_product.template_id = product_template.id AND product_category.expense_account_id = account_account.id""".strip())
+ self.assertEqual(query.get_sql()[1].strip(), """product_product.template_id = product_template.id AND product_category.expense_account_id = account_account.id""".strip())
def test_raise_missing_lhs(self):
query = Query()
diff --git a/odoo/addons/base/tests/test_qweb.py b/odoo/addons/base/tests/test_qweb.py
index 444c2960fe0..9fa00468f06 100644
--- a/odoo/addons/base/tests/test_qweb.py
+++ b/odoo/addons/base/tests/test_qweb.py
@@ -55,13 +55,13 @@ class TestQWebTField(TransactionCase):
def test_reject_crummy_tags(self):
field = etree.Element('td', {'t-field': u'company.name'})
- with self.assertRaisesRegexp(QWebException, r'^RTE widgets do not work correctly'):
+ with self.assertRaisesRegex(QWebException, r'^RTE widgets do not work correctly'):
self.engine.render(field, {'company': None})
def test_reject_t_tag(self):
field = etree.Element('t', {'t-field': u'company.name'})
- with self.assertRaisesRegexp(QWebException, r'^t-field can not be used on a t element'):
+ with self.assertRaisesRegex(QWebException, r'^t-field can not be used on a t element'):
self.engine.render(field, {'company': None})
def test_render_t_options(self):
diff --git a/odoo/addons/base/tests/test_res_partner_bank.py b/odoo/addons/base/tests/test_res_partner_bank.py
index cbf533802a1..9d19b4ef395 100644
--- a/odoo/addons/base/tests/test_res_partner_bank.py
+++ b/odoo/addons/base/tests/test_res_partner_bank.py
@@ -14,18 +14,18 @@ class TestResPartnerBank(TransactionCase):
partner_bank_model = self.env['res.partner.bank']
acc_number = " BE-001 2518823 03 "
vals = partner_bank_model.search([('acc_number', '=', acc_number)])
- self.assertEquals(0, len(vals))
+ self.assertEqual(0, len(vals))
partner_bank = partner_bank_model.create({
'acc_number': acc_number,
'partner_id': self.ref('base.res_partner_2'),
'acc_type': 'bank',
})
vals = partner_bank_model.search([('acc_number', '=', acc_number)])
- self.assertEquals(1, len(vals))
- self.assertEquals(partner_bank, vals[0])
+ self.assertEqual(1, len(vals))
+ self.assertEqual(partner_bank, vals[0])
vals = partner_bank_model.search([('acc_number', 'in', [acc_number])])
- self.assertEquals(1, len(vals))
- self.assertEquals(partner_bank, vals[0])
+ self.assertEqual(1, len(vals))
+ self.assertEqual(partner_bank, vals[0])
self.assertEqual(partner_bank.acc_number, acc_number)
@@ -33,19 +33,19 @@ class TestResPartnerBank(TransactionCase):
sanitized_acc_number = 'BE001251882303'
vals = partner_bank_model.search(
[('acc_number', '=', sanitized_acc_number)])
- self.assertEquals(1, len(vals))
- self.assertEquals(partner_bank, vals[0])
+ self.assertEqual(1, len(vals))
+ self.assertEqual(partner_bank, vals[0])
vals = partner_bank_model.search(
[('acc_number', 'in', [sanitized_acc_number])])
- self.assertEquals(1, len(vals))
- self.assertEquals(partner_bank, vals[0])
+ self.assertEqual(1, len(vals))
+ self.assertEqual(partner_bank, vals[0])
self.assertEqual(partner_bank.sanitized_acc_number,
sanitized_acc_number)
# search is case insensitive
vals = partner_bank_model.search(
[('acc_number', '=', sanitized_acc_number.lower())])
- self.assertEquals(1, len(vals))
+ self.assertEqual(1, len(vals))
vals = partner_bank_model.search(
[('acc_number', '=', acc_number.lower())])
- self.assertEquals(1, len(vals))
+ self.assertEqual(1, len(vals))
diff --git a/odoo/addons/base/tests/test_translate.py b/odoo/addons/base/tests/test_translate.py
index ab0a852910a..1b3ad5ed8dc 100644
--- a/odoo/addons/base/tests/test_translate.py
+++ b/odoo/addons/base/tests/test_translate.py
@@ -18,7 +18,7 @@ class TranslationToolsTestCase(BaseCase):
#print "2:", repr(quoted)
unquoted = unquote("".join(quoted.split('"\n"')))
#print "3:", repr(unquoted)
- self.assertEquals(str, unquoted)
+ self.assertEqual(str, unquoted)
test_string("""test \nall kinds\n \n o\r
\\\\ nope\n\n"
@@ -41,7 +41,7 @@ class TranslationToolsTestCase(BaseCase):
<field name="foo"/>
</form>"""
result = xml_translate(terms.append, source)
- self.assertEquals(result, source)
+ self.assertEqual(result, source)
self.assertItemsEqual(terms,
['Form stuff', 'Blah blah blah', 'Put some more text here'])
@@ -50,7 +50,7 @@ class TranslationToolsTestCase(BaseCase):
terms = []
source = "Blah blah blah"
result = xml_translate(terms.append, source)
- self.assertEquals(result, source)
+ self.assertEqual(result, source)
self.assertItemsEqual(terms, [source])
def test_translate_xml_unicode(self):
@@ -58,7 +58,7 @@ class TranslationToolsTestCase(BaseCase):
terms = []
source = u"Un heureux évènement"
result = xml_translate(terms.append, source)
- self.assertEquals(result, source)
+ self.assertEqual(result, source)
self.assertItemsEqual(terms, [source])
def test_translate_xml_text_entity(self):
@@ -66,7 +66,7 @@ class TranslationToolsTestCase(BaseCase):
terms = []
source = "Blah&amp;nbsp;blah&amp;nbsp;blah"
result = xml_translate(terms.append, source)
- self.assertEquals(result, source)
+ self.assertEqual(result, source)
self.assertItemsEqual(terms, [source])
def test_translate_xml_inline1(self):
@@ -78,7 +78,7 @@ class TranslationToolsTestCase(BaseCase):
<field name="foo"/>
</form>"""
result = xml_translate(terms.append, source)
- self.assertEquals(result, source)
+ self.assertEqual(result, source)
self.assertItemsEqual(terms,
['Form stuff', 'Blah <i>blah</i> blah', 'Put some <b>more text</b> here'])
@@ -91,7 +91,7 @@ class TranslationToolsTestCase(BaseCase):
<field name="foo"/>
</form>"""
result = xml_translate(terms.append, source)
- self.assertEquals(result, source)
+ self.assertEqual(result, source)
self.assertItemsEqual(terms,
['Form stuff', 'Blah <i>blah</i> blah', 'Put <em>some <b>more text</b></em> here'])
@@ -108,7 +108,7 @@ class TranslationToolsTestCase(BaseCase):
</div>
</form>"""
result = xml_translate(terms.append, source)
- self.assertEquals(result, source)
+ self.assertEqual(result, source)
self.assertItemsEqual(terms,
['Form stuff', 'Blah blah blah'])
@@ -122,7 +122,7 @@ class TranslationToolsTestCase(BaseCase):
</div>
</form>"""
result = xml_translate(terms.append, source)
- self.assertEquals(result, source)
+ self.assertEqual(result, source)
self.assertItemsEqual(terms,
['Form stuff', '<span class="fa fa-globe" title="Title stuff"/>'])
@@ -136,7 +136,7 @@ class TranslationToolsTestCase(BaseCase):
</div>
</form>"""
result = xml_translate(terms.append, source)
- self.assertEquals(result, source)
+ self.assertEqual(result, source)
self.assertItemsEqual(terms, ['Form stuff'])
def test_translate_xml_t(self):
@@ -148,7 +148,7 @@ class TranslationToolsTestCase(BaseCase):
stuff after
</t>"""
result = xml_translate(terms.append, source)
- self.assertEquals(result, source)
+ self.assertEqual(result, source)
self.assertItemsEqual(terms,
['stuff before', 'stuff after'])
@@ -161,7 +161,7 @@ class TranslationToolsTestCase(BaseCase):
stuff after
</div>"""
result = xml_translate(terms.append, source)
- self.assertEquals(result, source)
+ self.assertEqual(result, source)
self.assertItemsEqual(terms,
['stuff before', 'stuff after'])
@@ -173,7 +173,7 @@ class TranslationToolsTestCase(BaseCase):
<attribute name="option">Do not translate this</attribute>
</field>"""
result = xml_translate(terms.append, source)
- self.assertEquals(result, source)
+ self.assertEqual(result, source)
self.assertItemsEqual(terms,
['Translate this'])
@@ -190,7 +190,7 @@ class TranslationToolsTestCase(BaseCase):
</ul>
</t>"""
result = xml_translate(terms.append, source)
- self.assertEquals(result, source)
+ self.assertEqual(result, source)
self.assertItemsEqual(terms,
['<span class="oe_menu_text">Blah</span>'])
@@ -205,10 +205,10 @@ class TranslationToolsTestCase(BaseCase):
</t>
</Invoice>"""
result = xml_translate(terms.append, source)
- self.assertEquals(result, source)
+ self.assertEqual(result, source)
self.assertItemsEqual(terms, ['Oasis'])
result = xml_translate(lambda term: term, source)
- self.assertEquals(result, source)
+ self.assertEqual(result, source)
def test_translate_xml_invalid_translations(self):
""" Test xml_translate() with invalid translations. """
@@ -226,21 +226,21 @@ class TranslationToolsTestCase(BaseCase):
<field name="foo"/>
</form>"""
result = xml_translate(translations.get, source)
- self.assertEquals(result, expect)
+ self.assertEqual(result, expect)
def test_translate_html(self):
""" Test html_translate(). """
source = """<blockquote>A <h2>B</h2> C</blockquote>"""
result = html_translate(lambda term: term, source)
- self.assertEquals(result, source)
+ self.assertEqual(result, source)
def test_translate_html_i(self):
""" Test xml_translate() and html_translate() with <i> elements. """
source = """<p>A <i class="fa-check"></i> B</p>"""
result = xml_translate(lambda term: term, source)
- self.assertEquals(result, """<p>A <i class="fa-check"/> B</p>""")
+ self.assertEqual(result, """<p>A <i class="fa-check"/> B</p>""")
result = html_translate(lambda term: term, source)
- self.assertEquals(result, source)
+ self.assertEqual(result, source)
class TestTranslation(TransactionCase):
diff --git a/odoo/addons/base/wizard/base_export_language.py b/odoo/addons/base/wizard/base_export_language.py
index 93284f54e8c..b0d09608df6 100644
--- a/odoo/addons/base/wizard/base_export_language.py
+++ b/odoo/addons/base/wizard/base_export_language.py
@@ -36,7 +36,7 @@ class BaseLanguageExport(models.TransientModel):
with contextlib.closing(io.BytesIO()) as buf:
tools.trans_export(lang, mods, buf, this.format, self._cr)
- out = base64.encodestring(buf.getvalue())
+ out = base64.encodebytes(buf.getvalue())
filename = 'new'
if lang:
diff --git a/odoo/addons/base/wizard/base_import_language.py b/odoo/addons/base/wizard/base_import_language.py
index c0d78c46299..461c95958c3 100644
--- a/odoo/addons/base/wizard/base_import_language.py
+++ b/odoo/addons/base/wizard/base_import_language.py
@@ -31,7 +31,7 @@ class BaseLanguageImport(models.TransientModel):
this = this.with_context(overwrite=this.overwrite)
with TemporaryFile('wb+') as buf:
try:
- buf.write(base64.decodestring(this.data))
+ buf.write(base64.decodebytes(this.data))
# now we determine the file format
buf.seek(0)
diff --git a/odoo/addons/test_assetsbundle/tests/test_assetsbundle.py b/odoo/addons/test_assetsbundle/tests/test_assetsbundle.py
index 6e74fb0fc99..557b1396a04 100644
--- a/odoo/addons/test_assetsbundle/tests/test_assetsbundle.py
+++ b/odoo/addons/test_assetsbundle/tests/test_assetsbundle.py
@@ -64,15 +64,15 @@ class TestJavascriptAssetsBundle(FileTouchable):
self.bundle = self._get_asset(self.jsbundle_xmlid, env=self.env)
# there shouldn't be any attachment associated to this bundle
- self.assertEquals(len(self._any_ira_for_bundle('js')), 0)
- self.assertEquals(len(self.bundle.get_attachments('js')), 0)
+ self.assertEqual(len(self._any_ira_for_bundle('js')), 0)
+ self.assertEqual(len(self.bundle.get_attachments('js')), 0)
# trigger the first generation and, thus, the first save in database
self.bundle.js()
# there should be one attachment associated to this bundle
- self.assertEquals(len(self._any_ira_for_bundle('js')), 1)
- self.assertEquals(len(self.bundle.get_attachments('js')), 1)
+ self.assertEqual(len(self._any_ira_for_bundle('js')), 1)
+ self.assertEqual(len(self.bundle.get_attachments('js')), 1)
def test_02_access(self):
""" Checks that the bundle's cache is working, i.e. that the bundle creates only one
@@ -81,7 +81,7 @@ class TestJavascriptAssetsBundle(FileTouchable):
bundle0 = self._get_asset(self.jsbundle_xmlid)
bundle0.js()
- self.assertEquals(len(self._any_ira_for_bundle('js')), 1)
+ self.assertEqual(len(self._any_ira_for_bundle('js')), 1)
version0 = bundle0.version
ira0 = self._any_ira_for_bundle('js')
@@ -90,14 +90,14 @@ class TestJavascriptAssetsBundle(FileTouchable):
bundle1 = self._get_asset(self.jsbundle_xmlid)
bundle1.js()
- self.assertEquals(len(self._any_ira_for_bundle('js')), 1)
+ self.assertEqual(len(self._any_ira_for_bundle('js')), 1)
version1 = bundle1.version
ira1 = self._any_ira_for_bundle('js')
date1 = ira1.create_date
- self.assertEquals(version0, version1)
- self.assertEquals(date0, date1)
+ self.assertEqual(version0, version1)
+ self.assertEqual(date0, date1)
def test_03_date_invalidation(self):
""" Checks that a bundle is invalidated when one of its assets' modification date is changed.
@@ -114,11 +114,11 @@ class TestJavascriptAssetsBundle(FileTouchable):
bundle1.js()
last_modified1 = bundle1.last_modified
version1 = bundle1.version
- self.assertNotEquals(last_modified0, last_modified1)
- self.assertNotEquals(version0, version1)
+ self.assertNotEqual(last_modified0, last_modified1)
+ self.assertNotEqual(version0, version1)
# check if the previous attachment is correctly cleaned
- self.assertEquals(len(self._any_ira_for_bundle('js')), 1)
+ self.assertEqual(len(self._any_ira_for_bundle('js')), 1)
def test_04_content_invalidation(self):
""" Checks that a bundle is invalidated when its content is modified by adding a file to
@@ -129,7 +129,7 @@ class TestJavascriptAssetsBundle(FileTouchable):
files0 = bundle0.files
version0 = bundle0.version
- self.assertEquals(len(self._any_ira_for_bundle('js')), 1)
+ self.assertEqual(len(self._any_ira_for_bundle('js')), 1)
view_arch = """
<data>
@@ -151,11 +151,11 @@ class TestJavascriptAssetsBundle(FileTouchable):
files1 = bundle1.files
version1 = bundle1.version
- self.assertNotEquals(files0, files1)
- self.assertNotEquals(version0, version1)
+ self.assertNotEqual(files0, files1)
+ self.assertNotEqual(version0, version1)
# check if the previous attachment are correctly cleaned
- self.assertEquals(len(self._any_ira_for_bundle('js')), 1)
+ self.assertEqual(len(self._any_ira_for_bundle('js')), 1)
def test_05_debug(self):
""" Checks that a bundle rendered in debug mode outputs non-minified assets.
@@ -167,14 +167,14 @@ class TestJavascriptAssetsBundle(FileTouchable):
self.assertIn('/test_assetsbundle/static/src/js/test_jsfile1.js', content)
# there shouldn't be any assets created in debug mode
- self.assertEquals(len(self._any_ira_for_bundle('js')), 0)
+ self.assertEqual(len(self._any_ira_for_bundle('js')), 0)
def test_08_css_generation3(self):
# self.cssbundle_xlmid contains 3 rules
self.bundle = self._get_asset(self.cssbundle_xmlid)
self.bundle.css()
- self.assertEquals(len(self._any_ira_for_bundle('css')), 1)
- self.assertEquals(len(self.bundle.get_attachments('css')), 1)
+ self.assertEqual(len(self._any_ira_for_bundle('css')), 1)
+ self.assertEqual(len(self.bundle.get_attachments('css')), 1)
def test_09_css_access(self):
""" Checks that the bundle's cache is working, i.e. that a bundle creates only enough
@@ -183,7 +183,7 @@ class TestJavascriptAssetsBundle(FileTouchable):
bundle0 = self._get_asset(self.cssbundle_xmlid)
bundle0.css()
- self.assertEquals(len(self._any_ira_for_bundle('css')), 1)
+ self.assertEqual(len(self._any_ira_for_bundle('css')), 1)
version0 = bundle0.version
ira0 = self._any_ira_for_bundle('css')
@@ -192,14 +192,14 @@ class TestJavascriptAssetsBundle(FileTouchable):
bundle1 = self._get_asset(self.cssbundle_xmlid)
bundle1.css()
- self.assertEquals(len(self._any_ira_for_bundle('css')), 1)
+ self.assertEqual(len(self._any_ira_for_bundle('css')), 1)
version1 = bundle1.version
ira1 = self._any_ira_for_bundle('css')
date1 = ira1.create_date
- self.assertEquals(version0, version1)
- self.assertEquals(date0, date1)
+ self.assertEqual(version0, version1)
+ self.assertEqual(date0, date1)
def test_11_css_content_invalidation(self):
""" Checks that a bundle is invalidated when its content is modified by adding a file to
@@ -210,7 +210,7 @@ class TestJavascriptAssetsBundle(FileTouchable):
files0 = bundle0.files
version0 = bundle0.version
- self.assertEquals(len(self._any_ira_for_bundle('css')), 1)
+ self.assertEqual(len(self._any_ira_for_bundle('css')), 1)
view_arch = """
<data>
@@ -232,11 +232,11 @@ class TestJavascriptAssetsBundle(FileTouchable):
files1 = bundle1.files
version1 = bundle1.version
- self.assertNotEquals(files0, files1)
- self.assertNotEquals(version0, version1)
+ self.assertNotEqual(files0, files1)
+ self.assertNotEqual(version0, version1)
# check if the previous attachment are correctly cleaned
- self.assertEquals(len(self._any_ira_for_bundle('css')), 1)
+ self.assertEqual(len(self._any_ira_for_bundle('css')), 1)
def test_12_css_debug(self):
""" Check that a bundle in debug mode outputs non-minified assets.
@@ -248,7 +248,7 @@ class TestJavascriptAssetsBundle(FileTouchable):
self.assertIn('/test_assetsbundle/static/src/css/test_cssfile1.css', content)
# there shouldn't be any assets created in debug mode
- self.assertEquals(len(self._any_ira_for_bundle('css')), 0)
+ self.assertEqual(len(self._any_ira_for_bundle('css')), 0)
def test_14_duplicated_css_assets(self):
""" Checks that if the bundle's ir.attachment record is duplicated, the bundle is only sourced once. This could
@@ -256,13 +256,13 @@ class TestJavascriptAssetsBundle(FileTouchable):
"""
bundle0 = self._get_asset(self.cssbundle_xmlid)
bundle0.css()
- self.assertEquals(len(self._any_ira_for_bundle('css')), 1)
+ self.assertEqual(len(self._any_ira_for_bundle('css')), 1)
# duplicate the asset bundle
ira0 = self._any_ira_for_bundle('css')
ira1 = ira0.copy()
- self.assertEquals(len(self._any_ira_for_bundle('css')), 2)
- self.assertEquals(ira0.store_fname, ira1.store_fname)
+ self.assertEqual(len(self._any_ira_for_bundle('css')), 2)
+ self.assertEqual(ira0.store_fname, ira1.store_fname)
# the ir.attachment records should be deduplicated in the bundle's content
nodes = bundle0.to_node()
@@ -278,15 +278,15 @@ class TestJavascriptAssetsBundle(FileTouchable):
self.bundle = self._get_asset(self.cssbundle_xmlid, env=self.env(context={'lang': 'ar_SY'}))
# there shouldn't be any attachment associated to this bundle
- self.assertEquals(len(self._any_ira_for_bundle('css', lang='ar_SY')), 0)
- self.assertEquals(len(self.bundle.get_attachments('css')), 0)
+ self.assertEqual(len(self._any_ira_for_bundle('css', lang='ar_SY')), 0)
+ self.assertEqual(len(self.bundle.get_attachments('css')), 0)
# trigger the first generation and, thus, the first save in database
self.bundle.css()
# there should be one attachment associated to this bundle
- self.assertEquals(len(self._any_ira_for_bundle('css', lang='ar_SY')), 1)
- self.assertEquals(len(self.bundle.get_attachments('css')), 1)
+ self.assertEqual(len(self._any_ira_for_bundle('css', lang='ar_SY')), 1)
+ self.assertEqual(len(self.bundle.get_attachments('css')), 1)
def test_16_ltr_and_rtl_css_access(self):
""" Checks that the bundle's cache is working, i.e. that the bundle creates only one
@@ -297,7 +297,7 @@ class TestJavascriptAssetsBundle(FileTouchable):
ltr_bundle0 = self._get_asset(self.cssbundle_xmlid)
ltr_bundle0.css()
- self.assertEquals(len(self._any_ira_for_bundle('css')), 1)
+ self.assertEqual(len(self._any_ira_for_bundle('css')), 1)
ltr_version0 = ltr_bundle0.version
ltr_ira0 = self._any_ira_for_bundle('css')
@@ -306,20 +306,20 @@ class TestJavascriptAssetsBundle(FileTouchable):
ltr_bundle1 = self._get_asset(self.cssbundle_xmlid)
ltr_bundle1.css()
- self.assertEquals(len(self._any_ira_for_bundle('css')), 1)
+ self.assertEqual(len(self._any_ira_for_bundle('css')), 1)
ltr_version1 = ltr_bundle1.version
ltr_ira1 = self._any_ira_for_bundle('css')
ltr_date1 = ltr_ira1.create_date
- self.assertEquals(ltr_version0, ltr_version1)
- self.assertEquals(ltr_date0, ltr_date1)
+ self.assertEqual(ltr_version0, ltr_version1)
+ self.assertEqual(ltr_date0, ltr_date1)
# Assets access for ar_SY language
rtl_bundle0 = self._get_asset(self.cssbundle_xmlid, env=self.env(context={'lang': 'ar_SY'}))
rtl_bundle0.css()
- self.assertEquals(len(self._any_ira_for_bundle('css', lang='ar_SY')), 1)
+ self.assertEqual(len(self._any_ira_for_bundle('css', lang='ar_SY')), 1)
rtl_version0 = rtl_bundle0.version
rtl_ira0 = self._any_ira_for_bundle('css', lang='ar_SY')
@@ -328,23 +328,23 @@ class TestJavascriptAssetsBundle(FileTouchable):
rtl_bundle1 = self._get_asset(self.cssbundle_xmlid, env=self.env(context={'lang': 'ar_SY'}))
rtl_bundle1.css()
- self.assertEquals(len(self._any_ira_for_bundle('css', lang='ar_SY')), 1)
+ self.assertEqual(len(self._any_ira_for_bundle('css', lang='ar_SY')), 1)
rtl_version1 = rtl_bundle1.version
rtl_ira1 = self._any_ira_for_bundle('css', lang='ar_SY')
rtl_date1 = rtl_ira1.create_date
- self.assertEquals(rtl_version0, rtl_version1)
- self.assertEquals(rtl_date0, rtl_date1)
+ self.assertEqual(rtl_version0, rtl_version1)
+ self.assertEqual(rtl_date0, rtl_date1)
# Checks rtl and ltr bundles are different
- self.assertNotEquals(ltr_ira1.id, rtl_ira1.id)
+ self.assertNotEqual(ltr_ira1.id, rtl_ira1.id)
# Check two bundles are available, one for ltr and one for rtl
css_bundles = self.env['ir.attachment'].search([
('url', '=like', '/web/content/%-%/{0}%.{1}'.format(self.cssbundle_xmlid, 'css'))
])
- self.assertEquals(len(css_bundles), 2)
+ self.assertEqual(len(css_bundles), 2)
def test_17_css_bundle_date_invalidation(self):
""" Checks that both css bundles are invalidated when one of its assets' modification date is changed
@@ -371,8 +371,8 @@ class TestJavascriptAssetsBundle(FileTouchable):
ltr_last_modified1 = ltr_bundle1.last_modified
ltr_version1 = ltr_bundle1.version
ltr_ira1 = self._any_ira_for_bundle('css')
- self.assertNotEquals(ltr_last_modified0, ltr_last_modified1)
- self.assertNotEquals(ltr_version0, ltr_version1)
+ self.assertNotEqual(ltr_last_modified0, ltr_last_modified1)
+ self.assertNotEqual(ltr_version0, ltr_version1)
rtl_bundle1 = self._get_asset(self.cssbundle_xmlid, env=self.env(context={'lang': 'ar_SY'}))
@@ -380,17 +380,17 @@ class TestJavascriptAssetsBundle(FileTouchable):
rtl_last_modified1 = rtl_bundle1.last_modified
rtl_version1 = rtl_bundle1.version
rtl_ira1 = self._any_ira_for_bundle('css', lang='ar_SY')
- self.assertNotEquals(rtl_last_modified0, rtl_last_modified1)
- self.assertNotEquals(rtl_version0, rtl_version1)
+ self.assertNotEqual(rtl_last_modified0, rtl_last_modified1)
+ self.assertNotEqual(rtl_version0, rtl_version1)
# Checks rtl and ltr bundles are different
- self.assertNotEquals(ltr_ira1.id, rtl_ira1.id)
+ self.assertNotEqual(ltr_ira1.id, rtl_ira1.id)
# check if the previous attachment is correctly cleaned
css_bundles = self.env['ir.attachment'].search([
('url', '=like', '/web/content/%-%/{0}%.{1}'.format(self.cssbundle_xmlid, 'css'))
])
- self.assertEquals(len(css_bundles), 2)
+ self.assertEqual(len(css_bundles), 2)
def test_18_css_bundle_content_invalidation(self):
""" Checks that a bundle is invalidated when its content is modified by adding a file to
@@ -410,7 +410,7 @@ class TestJavascriptAssetsBundle(FileTouchable):
css_bundles = self.env['ir.attachment'].search([
('url', '=like', '/web/content/%-%/{0}%.{1}'.format(self.cssbundle_xmlid, 'css'))
])
- self.assertEquals(len(css_bundles), 2)
+ self.assertEqual(len(css_bundles), 2)
view_arch = """
<data>
@@ -433,8 +433,8 @@ class TestJavascriptAssetsBundle(FileTouchable):
ltr_version1 = ltr_bundle1.version
ltr_ira1 = self._any_ira_for_bundle('css')
- self.assertNotEquals(ltr_files0, ltr_files1)
- self.assertNotEquals(ltr_version0, ltr_version1)
+ self.assertNotEqual(ltr_files0, ltr_files1)
+ self.assertNotEqual(ltr_version0, ltr_version1)
rtl_bundle1 = self._get_asset(self.cssbundle_xmlid, env=self.env(context={'check_view_ids': view.ids, 'lang': 'ar_SY'}))
rtl_bundle1.css()
@@ -442,17 +442,17 @@ class TestJavascriptAssetsBundle(FileTouchable):
rtl_version1 = rtl_bundle1.version
rtl_ira1 = self._any_ira_for_bundle('css', lang='ar_SY')
- self.assertNotEquals(rtl_files0, rtl_files1)
- self.assertNotEquals(rtl_version0, rtl_version1)
+ self.assertNotEqual(rtl_files0, rtl_files1)
+ self.assertNotEqual(rtl_version0, rtl_version1)
# Checks rtl and ltr bundles are different
- self.assertNotEquals(ltr_ira1.id, rtl_ira1.id)
+ self.assertNotEqual(ltr_ira1.id, rtl_ira1.id)
# check if the previous attachment are correctly cleaned
css_bundles = self.env['ir.attachment'].search([
('url', '=like', '/web/content/%-%/{0}%.{1}'.format(self.cssbundle_xmlid, 'css'))
])
- self.assertEquals(len(css_bundles), 2)
+ self.assertEqual(len(css_bundles), 2)
def test_19_css_in_debug_assets(self):
""" Checks that a bundle rendered in debug mode(assets) with right to left language direction stores css files in assets bundle.
@@ -468,12 +468,12 @@ class TestJavascriptAssetsBundle(FileTouchable):
css_bundle = self.env['ir.attachment'].search([
('url', '=', '/test_assetsbundle/static/src/css/test_cssfile1/rtl/{0}.css'.format(self.cssbundle_xmlid))
])
- self.assertEquals(len(css_bundle), 1)
+ self.assertEqual(len(css_bundle), 1)
def test_20_exteral_lib_assets(self):
html = self.env['ir.ui.view'].render_template('test_assetsbundle.template2')
attachments = self.env['ir.attachment'].search([('url', '=like', '/web/content/%-%/test_assetsbundle.bundle4.%')])
- self.assertEquals(len(attachments), 2)
+ self.assertEqual(len(attachments), 2)
self.assertEqual(html.strip(), ("""<!DOCTYPE html>
<html>
<head>
@@ -492,7 +492,7 @@ class TestJavascriptAssetsBundle(FileTouchable):
def test_21_exteral_lib_assets_debug_mode(self):
html = self.env['ir.ui.view'].render_template('test_assetsbundle.template2', {"debug": "assets"})
attachments = self.env['ir.attachment'].search([('url', '=like', '/web/content/%-%/test_assetsbundle.bundle4.%')])
- self.assertEquals(len(attachments), 0)
+ self.assertEqual(len(attachments), 0)
self.assertEqual(html.strip(), ("""<!DOCTYPE html>
<html>
<head>
@@ -578,8 +578,8 @@ class TestAssetsBundleWithIRAMock(FileTouchable):
def _bundle(self, asset, should_create, should_unlink):
self.counter.clear()
asset.to_node(debug='assets')
- self.assertEquals(self.counter['create'], int(should_create))
- self.assertEquals(self.counter['unlink'], int(should_unlink))
+ self.assertEqual(self.counter['create'], int(should_create))
+ self.assertEqual(self.counter['unlink'], int(should_unlink))
def test_01_debug_mode_assets(self):
""" Checks that the ir.attachments records created for compiled assets in debug mode
diff --git a/odoo/addons/test_lint/tests/test_pylint.py b/odoo/addons/test_lint/tests/test_pylint.py
index 8e5e69fa351..9e7b3ab0397 100644
--- a/odoo/addons/test_lint/tests/test_pylint.py
+++ b/odoo/addons/test_lint/tests/test_pylint.py
@@ -30,6 +30,7 @@ class TestPyLint(TransactionCase):
'unreachable',
'mixed-indentation',
+ 'deprecated-method',
]
BAD_FUNCTIONS = [
@@ -43,7 +44,7 @@ class TestPyLint(TransactionCase):
] + list(tools.SUPPORTED_DEBUGGER)
def _skip_test(self, reason):
- _logger.warn(reason)
+ _logger.warning(reason)
self.skipTest(reason)
def test_pylint(self):
diff --git a/odoo/addons/test_performance/tests/test_performance.py b/odoo/addons/test_performance/tests/test_performance.py
index bfd2cdcee37..1db2e33f6d2 100644
--- a/odoo/addons/test_performance/tests/test_performance.py
+++ b/odoo/addons/test_performance/tests/test_performance.py
@@ -176,7 +176,7 @@ class TestPerformance(TransactionCase):
# This write() will raise because of the unique index if the unlink() is
# not performed before the create()
rec.write({'line_ids': [(5,)] + [(0, 0, {'value': val}) for val in range(6)]})
- self.assertEquals(len(rec.line_ids), 6)
+ self.assertEqual(len(rec.line_ids), 6)
@mute_logger('odoo.models.unlink')
@users('__system__', 'demo')
diff --git a/odoo/addons/test_testing_utilities/tests/test_form_impl.py b/odoo/addons/test_testing_utilities/tests/test_form_impl.py
index c0e5093fd3b..838103157b6 100644
--- a/odoo/addons/test_testing_utilities/tests/test_form_impl.py
+++ b/odoo/addons/test_testing_utilities/tests/test_form_impl.py
@@ -42,7 +42,7 @@ class TestBasic(TransactionCase):
def test_required(self):
f = Form(self.env['test_testing_utilities.a'])
# f1 no default & no value => should fail
- with self.assertRaisesRegexp(AssertionError, 'f1 is a required field'):
+ with self.assertRaisesRegex(AssertionError, 'f1 is a required field'):
f.save()
# set f1 and unset f2 => should work
f.f1 = '1'
diff --git a/odoo/addons/test_translation_import/tests/test_term_count.py b/odoo/addons/test_translation_import/tests/test_term_count.py
index 7526049f4e8..fb98e78661f 100644
--- a/odoo/addons/test_translation_import/tests/test_term_count.py
+++ b/odoo/addons/test_translation_import/tests/test_term_count.py
@@ -151,7 +151,7 @@ class TestTermCount(common.TransactionCase):
def test_import_from_po_file(self):
"""Test the import from a single po file works"""
with file_open('test_translation_import/i18n/tlh.po', 'rb') as f:
- po_file = base64.encodestring(f.read())
+ po_file = base64.encodebytes(f.read())
import_tlh = self.env["base.language.import"].create({
'name': 'Klingon',
@@ -174,7 +174,7 @@ class TestTermCount(common.TransactionCase):
def test_lazy_translation(self):
"""Test the import from a single po file works"""
with file_open('test_translation_import/i18n/tlh.po', 'rb') as f:
- po_file = base64.encodestring(f.read())
+ po_file = base64.encodebytes(f.read())
import_tlh = self.env["base.language.import"].create({
'name': 'Klingon',
@@ -200,7 +200,7 @@ class TestTermCount(common.TransactionCase):
def test_import_from_csv_file(self):
"""Test the import from a single CSV file works"""
with file_open('test_translation_import/i18n/dot.csv', 'rb') as f:
- po_file = base64.encodestring(f.read())
+ po_file = base64.encodebytes(f.read())
import_tlh = self.env["base.language.import"].create({
'name': 'Dothraki',
diff --git a/odoo/api.py b/odoo/api.py
index 4015156f1a3..dd0010db9f5 100644
--- a/odoo/api.py
+++ b/odoo/api.py
@@ -43,7 +43,7 @@ import logging
from collections import defaultdict, Mapping
from contextlib import contextmanager
from copy import deepcopy
-from inspect import getargspec
+from inspect import signature
from pprint import pformat
from weakref import WeakSet
@@ -280,7 +280,7 @@ def downgrade(method, value, self, args, kwargs):
if not spec:
return value
_, convert, _ = spec
- if convert and len(getargspec(convert).args) > 1:
+ if convert and len(signature(convert).parameters) > 1:
return convert(self, value, *args, **kwargs)
elif convert:
return convert(value)
diff --git a/odoo/exceptions.py b/odoo/exceptions.py
index 37fde75a845..75e8749b028 100644
--- a/odoo/exceptions.py
+++ b/odoo/exceptions.py
@@ -22,7 +22,7 @@ class except_orm(Exception):
def __init__(self, name, value=None):
if type(self) == except_orm:
caller = frame_codeinfo(currentframe(), 1)
- _logger.warn('except_orm is deprecated. Please use specific exceptions like UserError or AccessError. Caller: %s:%s', *caller)
+ _logger.warning('except_orm is deprecated. Please use specific exceptions like UserError or AccessError. Caller: %s:%s', *caller)
self.name = name
self.value = value
self.args = (name, value)
diff --git a/odoo/http.py b/odoo/http.py
index 90acbbe7cf7..a4c48f67795 100644
--- a/odoo/http.py
+++ b/odoo/http.py
@@ -505,9 +505,14 @@ def route(route=None, **kw):
@functools.wraps(f)
def response_wrap(*args, **kw):
# if controller cannot be called with extra args (utm, debug, ...), call endpoint ignoring them
- spec = inspect.getargspec(f)
- if not spec.keywords:
- ignored = ['<%s=%s>' % (k, kw.pop(k)) for k in list(kw) if k not in spec.args]
+ params = inspect.signature(f).parameters.values()
+ is_kwargs = lambda p: p.kind == inspect.Parameter.VAR_KEYWORD
+ if not any(is_kwargs(p) for p in params): # missing **kw
+ is_keyword_compatible = lambda p: p.kind in (
+ inspect.Parameter.POSITIONAL_OR_KEYWORD,
+ inspect.Parameter.KEYWORD_ONLY)
+ fargs = {p.name for p in params if is_keyword_compatible(p)}
+ ignored = ['<%s=%s>' % (k, kw.pop(k)) for k in list(kw) if k not in fargs]
if ignored:
_logger.info("<function %s.%s> called ignoring args %s" % (f.__module__, f.__name__, ', '.join(ignored)))
@@ -525,7 +530,7 @@ def route(route=None, **kw):
response.set_default()
return response
- _logger.warn("<function %s.%s> returns an invalid response type for an http request" % (f.__module__, f.__name__))
+ _logger.warning("<function %s.%s> returns an invalid response type for an http request" % (f.__module__, f.__name__))
return response
response_wrap.routing = routing
response_wrap.original_func = f
@@ -775,10 +780,10 @@ class HttpRequest(WebRequest):
token = self.params.pop('csrf_token', None)
if not self.validate_csrf(token):
if token is not None:
- _logger.warn("CSRF validation failed on path '%s'",
+ _logger.warning("CSRF validation failed on path '%s'",
request.httprequest.path)
else:
- _logger.warn("""No CSRF validation token provided for path '%s'
+ _logger.warning("""No CSRF validation token provided for path '%s'
Odoo URLs are CSRF-protected by default (when accessed with unsafe
HTTP methods). See
@@ -873,12 +878,12 @@ class ControllerType(type):
parent_routing_type = getattr(parent[0], k).original_func.routing_type if parent else routing_type or 'http'
if routing_type is not None and routing_type is not parent_routing_type:
routing_type = parent_routing_type
- _logger.warn("Subclass re-defines <function %s.%s.%s> with different type than original."
+ _logger.warning("Subclass re-defines <function %s.%s.%s> with different type than original."
" Will use original type: %r" % (cls.__module__, cls.__name__, k, parent_routing_type))
v.original_func.routing_type = routing_type or parent_routing_type
- spec = inspect.getargspec(v.original_func)
- first_arg = spec.args[1] if len(spec.args) >= 2 else None
+ sign = inspect.signature(v.original_func)
+ first_arg = list(sign.parameters)[1] if len(sign.parameters) >= 2 else None
if first_arg in ["req", "request"]:
v._first_arg_is_req = True
@@ -1338,7 +1343,7 @@ class Root(object):
# Check if session.db is legit
if db:
if db not in db_filter([db], httprequest=httprequest):
- _logger.warn("Logged into database '%s', but dbfilter "
+ _logger.warning("Logged into database '%s', but dbfilter "
"rejects it; logging session out.", db)
httprequest.session.logout()
db = None
diff --git a/odoo/models.py b/odoo/models.py
index 439041dd03e..5291726f367 100644
--- a/odoo/models.py
+++ b/odoo/models.py
@@ -1891,7 +1891,7 @@ class BaseModel(MetaModel('DummyModel', (object,), {'_register': False})):
orderby_terms.append(' '.join(order_split))
else:
# Cannot order by a field that will not appear in the results (needs to be grouped or aggregated)
- _logger.warn('%s: read_group order by `%s` ignored, cannot sort on empty columns (not grouped/aggregated)',
+ _logger.warning('%s: read_group order by `%s` ignored, cannot sort on empty columns (not grouped/aggregated)',
self._name, order_part)
return groupby_terms, orderby_terms
diff --git a/odoo/modules/module.py b/odoo/modules/module.py
index 2c06bca742b..aef985230c8 100644
--- a/odoo/modules/module.py
+++ b/odoo/modules/module.py
@@ -456,7 +456,7 @@ def get_test_modules(module):
_logger.exception('Can not `import %s`.', module)
return []
if hasattr(mod, 'fast_suite') or hasattr(mod, 'checks'):
- _logger.warn(
+ _logger.warning(
"Found deprecated fast_suite or checks attribute in test module "
"%s. These have no effect in or after version 8.0.",
mod.__name__)
diff --git a/odoo/service/server.py b/odoo/service/server.py
index 490d204d166..574d569fbca 100644
--- a/odoo/service/server.py
+++ b/odoo/service/server.py
@@ -657,7 +657,7 @@ class PreforkServer(CommonServer):
self.queue.append(sig)
self.pipe_ping(self.pipe)
else:
- _logger.warn("Dropping signal: %s", sig)
+ _logger.warning("Dropping signal: %s", sig)
def worker_spawn(self, klass, workers_registry):
self.generation += 1
diff --git a/odoo/tools/cache.py b/odoo/tools/cache.py
index e23f7ea1124..2d50b51aa94 100644
--- a/odoo/tools/cache.py
+++ b/odoo/tools/cache.py
@@ -4,7 +4,7 @@
# decorator makes wrappers that have the same API as their wrapped function
from collections import defaultdict
from decorator import decorator
-from inspect import formatargspec, getargspec
+from inspect import signature
import logging
unsafe_eval = eval
@@ -64,7 +64,7 @@ class ormcache(object):
""" Determine the function that computes a cache key from arguments. """
if self.skiparg is None:
# build a string that represents function code and evaluate it
- args = formatargspec(*getargspec(self.method))[1:-1]
+ args = str(signature(self.method))[1:-1]
if self.args:
code = "lambda %s: (%s,)" % (args, ", ".join(self.args))
else:
@@ -90,7 +90,7 @@ class ormcache(object):
value = d[key] = self.method(*args, **kwargs)
return value
except TypeError:
- _logger.warn("cache lookup error on %r", key, exc_info=True)
+ _logger.warning("cache lookup error on %r", key, exc_info=True)
counter.err += 1
return self.method(*args, **kwargs)
@@ -113,9 +113,9 @@ class ormcache_context(ormcache):
""" Determine the function that computes a cache key from arguments. """
assert self.skiparg is None, "ormcache_context() no longer supports skiparg"
# build a string that represents function code and evaluate it
- spec = getargspec(self.method)
- args = formatargspec(*spec)[1:-1]
- cont_expr = "(context or {})" if 'context' in spec.args else "self._context"
+ sign = signature(self.method)
+ args = str(sign)[1:-1]
+ cont_expr = "(context or {})" if 'context' in sign.parameters else "self._context"
keys_expr = "tuple(%s.get(k) for k in %r)" % (cont_expr, self.keys)
if self.args:
code = "lambda %s: (%s, %s)" % (args, ", ".join(self.args), keys_expr)
@@ -142,13 +142,13 @@ class ormcache_multi(ormcache):
super(ormcache_multi, self).determine_key()
# key_multi computes the extra element added to the key
- spec = getargspec(self.method)
- args = formatargspec(*spec)[1:-1]
+ sign = signature(self.method)
+ args = str(sign)[1:-1]
code_multi = "lambda %s: %s" % (args, self.multi)
self.key_multi = unsafe_eval(code_multi)
# self.multi_pos is the position of self.multi in args
- self.multi_pos = spec.args.index(self.multi)
+ self.multi_pos = list(sign.parameters).index(self.multi)
def lookup(self, method, *args, **kwargs):
d, key0, counter = self.lru(args[0])
diff --git a/odoo/tools/convert.py b/odoo/tools/convert.py
index 5ace904749b..f876ecb4cae 100644
--- a/odoo/tools/convert.py
+++ b/odoo/tools/convert.py
@@ -787,10 +787,10 @@ def convert_xml_import(cr, module, xmlfile, idref=None, mode='init', noupdate=Fa
_logger.exception("The XML file '%s' does not fit the required schema !", xmlfile.name)
if jingtrang:
p = subprocess.run(['pyjing', schema, xmlfile.name], stdout=subprocess.PIPE)
- _logger.warn(p.stdout.decode())
+ _logger.warning(p.stdout.decode())
else:
for e in relaxng.error_log:
- _logger.warn(e)
+ _logger.warning(e)
_logger.info("Install 'jingtrang' for more precise and useful validation messages.")
raise