Initial commit: OCA Technical packages (595 packages)

This commit is contained in:
Ernad Husremovic 2025-08-29 15:43:03 +02:00
commit 2cc02aac6e
24950 changed files with 2318079 additions and 0 deletions

View file

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

View file

@ -0,0 +1,69 @@
# © 2023 David BEAL @ Akretion
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import base64
import os
from odoo.addons.base.tests.common import BaseCommon
class TestResPartner(BaseCommon):
@classmethod
def setUpClass(self):
super().setUpClass()
self.brand = self.env["res.brand"].create(
{
"name": "Brand A",
}
)
self.partner = self.env["res.partner"].create(
{
"name": "Test Partner",
"brand_id": self.brand.id,
}
)
def test_brand_id(self):
"""Test if the brand_id is correctly assigned to the partner."""
self.assertEqual(
self.partner.brand_id,
self.brand,
"Brand ID is not assigned correctly to the partner.",
)
def test_brand_logo(self):
"""Test if the brand_logo field correctly references the brand's logo."""
# Build the relative path to the image dynamically (from the module root)
module_path = os.path.dirname(os.path.abspath(__file__))
image_path = os.path.join(
module_path, "..", "static", "description", "carrouf.png"
)
image_path = os.path.abspath(image_path)
# Load the image file from the relative path
with open(image_path, "rb") as image_file:
brand_image = base64.b64encode(image_file.read())
# Set the image on the brand
self.brand.write(
{
"image_128": brand_image,
}
)
# Check if the partner's brand_logo field is correctly updated
self.assertEqual(
self.partner.brand_logo,
brand_image,
"Brand logo is not correctly related to the partner.",
)
def test_empty_brand_logo(self):
"""Test if the partner's brand_logo is empty
when no image is set on the brand."""
# Initially, the brand does not have an image set.
self.assertFalse(
self.partner.brand_logo,
"Brand logo should be empty if the brand does not have an image.",
)