Initial commit

This commit is contained in:
gsinghpal
2026-02-22 01:22:18 -05:00
commit 5200d5baf0
2394 changed files with 386834 additions and 0 deletions

View File

@@ -0,0 +1 @@
from . import test_access_rights

View File

@@ -0,0 +1,45 @@
# Copyright © 2023 Garazd Creation (https://garazd.biz)
# @author: Yurii Razumovskyi (support@garazd.biz)
# @author: Iryna Razumovska (support@garazd.biz)
# License OPL-1 (https://www.odoo.com/documentation/16.0/legal/licenses.html).
from odoo.tests.common import TransactionCase
from odoo.tests import tagged
@tagged('post_install', '-at_install')
class TestProductLabel(TransactionCase):
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.label_template_50x25 = cls.env['print.product.label.template'].create({
'name': 'Test Label',
'paperformat_id': cls.env.ref('garazd_product_label_pro.paperformat_label_custom_50x25').id,
'orientation': 'Portrait',
'cols': 1,
'rows': 1,
'width': 50,
'height': 25,
})
cls.product_a = cls.env['product.product'].create({
'name': 'Test Product A',
'type': 'consu',
'list_price': 20.0,
'barcode': '1234567890',
})
cls.product_b = cls.env['product.product'].create({
'name': 'Test Product B',
'type': 'consu',
'list_price': 199.99,
'barcode': '9999999999999',
})
def setUp(self):
super(TestProductLabel, self).setUp()
self.print_wizard = self.env['print.product.label'].with_context(**{
'active_model': 'product.product',
'default_product_product_ids': [self.product_a.id, self.product_b.id],
}).create({})

View File

@@ -0,0 +1,27 @@
# Copyright © 2023 Garazd Creation (https://garazd.biz)
# @author: Yurii Razumovskyi (support@garazd.biz)
# @author: Iryna Razumovska (support@garazd.biz)
# License OPL-1 (https://www.odoo.com/documentation/16.0/legal/licenses.html).
from odoo.tests import tagged
from odoo.addons.base.tests.common import BaseUsersCommon
from .common import TestProductLabel
@tagged('post_install', '-at_install')
class TestAccessRights(BaseUsersCommon, TestProductLabel):
def test_access_internal_user(self):
""" Test internal user's access rights """
PrintWizard = self.env['print.product.label'].with_user(self.user_internal)
wizard_as_internal_user = PrintWizard.browse(self.print_wizard.id)
# Internal user can use label templates
wizard_as_internal_user.read()
# Internal user can change label templates
wizard_as_internal_user.write({'template_id': self.label_template_50x25.id})
# Internal user can preview label templates
wizard_as_internal_user.action_print()