Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions addons/account/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,11 @@ def _create_product(cls, **create_values):
@classmethod
def get_default_groups(cls):
groups = super().get_default_groups()

if cls.env['ir.module.module'].search([('name', '=', 'product_cost_security')]).state == 'installed':
# OO-1216 Restore permissions reduced by product_cost_security for testing
groups |= cls.env.ref('product_cost_security.group_product_edit_cost')

return groups | cls.env.ref('account.group_account_manager') | cls.env.ref('account.group_account_user') \
| cls.env.ref('account.group_validate_bank_account')

Expand Down
7 changes: 7 additions & 0 deletions addons/sale/tests/test_sale_prices.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,13 @@ def test_multi_currency_discount(self):
'name': 'E.T',
'login': 'hohoho',
})

if self.env['ir.module.module'].search([('name', '=', 'product_cost_security')]).state == 'installed':
# OO-1216 Restore permissions reduced by product_cost_security for testing
user_in_other_company.write({
'groups_id': [Command.link(self.env.ref('product_cost_security.group_product_edit_cost').id)],
})

with mute_logger('odoo.models.unlink'):
self.env['res.currency.rate'].search([]).unlink()
self.env['res.currency.rate'].create({
Expand Down
6 changes: 6 additions & 0 deletions addons/sale_stock/tests/test_anglo_saxon_valuation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1629,6 +1629,12 @@ def test_fifo_reverse_and_create_new_invoice(self):
'groups_id': [(6, 0, self.env.ref('account.group_account_invoice').ids)],
})

if self.env['ir.module.module'].search([('name', '=', 'product_cost_security')]).state == 'installed':
# OO-1216 Restore permissions reduced by product_cost_security for testing
accountman.write({
'groups_id': [Command.link(self.env.ref('product_cost_security.group_product_edit_cost').id)],
})

in_moves = self.env['stock.move'].create([{
'name': 'IN move @%s' % p,
'product_id': self.product.id,
Expand Down
7 changes: 7 additions & 0 deletions addons/sale_stock/tests/test_sale_stock.py
Original file line number Diff line number Diff line change
Expand Up @@ -1724,6 +1724,13 @@ def test_inventory_admin_no_backorder_not_own_sale_order(self):
self.ref('stock.group_stock_manager'),
self.ref('sales_team.group_sale_salesman')])]
})

if self.env['ir.module.module'].search([('name', '=', 'product_cost_security')]).state == 'installed':
# OO-1216 Restore permissions reduced by product_cost_security for testing
inventory_admin_user.write({
'groups_id': [Command.link(self.env.ref('product_cost_security.group_product_edit_cost').id)],
})

pick.with_user(inventory_admin_user).move_ids.write(
{'quantity': 1, 'picked': True})
Form.from_action(self.env(user=inventory_admin_user), pick.button_validate())\
Expand Down
8 changes: 8 additions & 0 deletions addons/sales_team/tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

from odoo.addons.base.tests.common import BaseCommon
from odoo.addons.mail.tests.common import mail_new_test_user
from odoo import Command


class SalesTeamCommon(BaseCommon):
Expand Down Expand Up @@ -34,6 +35,13 @@ def setUpClass(cls):
'notification_type': 'email',
'groups_id': [(6, 0, cls.group_sale_manager.ids)],
})

if cls.env['ir.module.module'].search([('name', '=', 'product_cost_security')]).state == 'installed':
# OO-1216 Restore permissions reduced by product_cost_security for testing
cls.sale_manager.write({
'groups_id': [Command.link(cls.env.ref('product_cost_security.group_product_edit_cost').id)],
})

cls.sale_team = cls.env['crm.team'].create({
'name': 'Test Sales Team',
})
Expand Down
7 changes: 7 additions & 0 deletions addons/stock_account/tests/test_lot_valuation.py
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,13 @@ def test_deliveries_with_minimal_access_rights(self):
'email': 'inventory_user@gmail.com',
'groups_id': [Command.set(self.env.ref('stock.group_stock_user').ids)],
})

if self.env['ir.module.module'].search([('name', '=', 'product_cost_security')]).state == 'installed':
# OO-1216 Restore permissions reduced by product_cost_security for testing
inventory_user.write({
'groups_id': [Command.link(self.env.ref('product_cost_security.group_product_edit_cost').id)],
})

customer = self.env['res.partner'].create({
'name': 'Lovely customer'
})
Expand Down
6 changes: 6 additions & 0 deletions addons/stock_account/tests/test_stockvaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ def setUpClass(cls):
'groups_id': [(6, 0, [cls.env.ref('stock.group_stock_user').id])]
})

if cls.env['ir.module.module'].search([('name', '=', 'product_cost_security')]).state == 'installed':
# OO-1216 Restore permissions reduced by product_cost_security for testing
cls.inventory_user.write({
'groups_id': [Command.link(cls.env.ref('product_cost_security.group_product_edit_cost').id)],
})

cls.stock_input_account, cls.stock_output_account, cls.stock_valuation_account, cls.expense_account, cls.stock_journal = _create_accounting_data(cls.env)
cls.product1.categ_id.write({
'property_stock_account_input_categ_id': cls.stock_input_account.id,
Expand Down