mirror of
https://github.com/bringout/oca-ocb-sale.git
synced 2026-04-26 14:31:58 +02:00
19.0 vanilla
This commit is contained in:
parent
79f83631d5
commit
73afc09215
6267 changed files with 1534193 additions and 1130106 deletions
|
|
@ -1,28 +1,31 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Part of Odoo. See LICENSE file for full copyright and licensing details.
|
||||
|
||||
from odoo import Command
|
||||
from odoo.exceptions import AccessError, UserError
|
||||
from odoo.tests import tagged
|
||||
from odoo.tools import mute_logger
|
||||
|
||||
from odoo.addons.base.tests.common import BaseUsersCommon
|
||||
from odoo.addons.mail.tests.common import MailCommon
|
||||
from odoo.addons.sale.tests.common import SaleCommon
|
||||
|
||||
|
||||
@tagged('post_install', '-at_install')
|
||||
class TestAccessRights(BaseUsersCommon, SaleCommon):
|
||||
class TestAccessRights(SaleCommon, MailCommon):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
|
||||
cls.user_portal = cls._create_new_portal_user()
|
||||
cls.user_internal = cls._create_new_internal_user()
|
||||
|
||||
cls.sale_user2 = cls.env['res.users'].create({
|
||||
'name': 'salesman_2',
|
||||
'login': 'salesman_2',
|
||||
'email': 'default_user_salesman_2@example.com',
|
||||
'signature': '--\nMark',
|
||||
'notification_type': 'email',
|
||||
'groups_id': [(6, 0, cls.group_sale_salesman.ids)],
|
||||
'group_ids': [(6, 0, cls.group_sale_salesman.ids)],
|
||||
})
|
||||
|
||||
# Create the SO with a specific salesperson
|
||||
|
|
@ -91,6 +94,22 @@ class TestAccessRights(BaseUsersCommon, SaleCommon):
|
|||
# Salesperson can confirm the SO
|
||||
so_as_salesperson.action_confirm()
|
||||
|
||||
# Salesperson can't confirm the related move
|
||||
move_as_salesperson = so_as_salesperson._create_invoices().with_user(self.sale_user2)
|
||||
with self.assertRaises(AccessError):
|
||||
move_as_salesperson.action_post()
|
||||
|
||||
move_as_salesperson.sudo().action_post()
|
||||
|
||||
composer = self.env['account.move.send.wizard']\
|
||||
.with_user(self.sale_user2)\
|
||||
.with_context(active_model='account.move', active_ids=move_as_salesperson.ids)\
|
||||
.create({})
|
||||
|
||||
# Salesperson can send & print
|
||||
with self.mock_mail_gateway(mail_unlink_sent=False):
|
||||
composer.action_send_and_print()
|
||||
|
||||
@mute_logger('odoo.addons.base.models.ir_model', 'odoo.addons.base.models.ir_rule')
|
||||
def test_access_portal_user(self):
|
||||
""" Test portal user's access rights """
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue