[ADD] product_main_seller: Restore OCA addon from original version
- Restored product_main_seller addon to fix dependency chain - Addon required by product_origin_char and website_sale_aplicoop [IMP] website_sale_aplicoop: Add demo data configuration to manifest - Updated __manifest__.py to include demo data files - Demo data includes partners, suppliers, products, group orders, and sale orders - Demo data successfully loads during module installation
This commit is contained in:
parent
a483925005
commit
6f593c6240
22 changed files with 997 additions and 1 deletions
1
product_main_seller/tests/__init__.py
Normal file
1
product_main_seller/tests/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
|||
from . import test_seller
|
||||
72
product_main_seller/tests/test_seller.py
Normal file
72
product_main_seller/tests/test_seller.py
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
# Copyright (C) 2022 - Today: GRAP (http://www.grap.coop)
|
||||
# @author: Quentin DUPONT (quentin.dupont@grap.coop)
|
||||
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
|
||||
|
||||
from odoo import Command
|
||||
from odoo.tests.common import TransactionCase
|
||||
|
||||
|
||||
class TestSeller(TransactionCase):
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
super().setUpClass()
|
||||
cls.product_workplace = cls.env.ref("product.product_product_24")
|
||||
cls.product_acoustic = cls.env.ref("product.product_product_25")
|
||||
cls.product_with_var_chair = cls.env.ref("product.product_product_11")
|
||||
cls.product_without_seller_desk = cls.env.ref("product.product_product_3")
|
||||
|
||||
cls.partner_woodcorner = cls.env.ref("base.res_partner_1")
|
||||
cls.partner_azure = cls.env.ref("base.res_partner_12")
|
||||
|
||||
def test_01_computed_main_vendor(self):
|
||||
self.assertEqual(
|
||||
self.product_acoustic.main_seller_id,
|
||||
self.product_acoustic.seller_ids[0].partner_id,
|
||||
)
|
||||
self.assertEqual(
|
||||
self.product_with_var_chair.main_seller_id,
|
||||
self.product_acoustic.product_variant_ids[0]
|
||||
.variant_seller_ids[0]
|
||||
.partner_id,
|
||||
)
|
||||
|
||||
def test_02_replace_supplierinfo(self):
|
||||
self.product_acoustic.seller_ids = [
|
||||
Command.clear(),
|
||||
Command.create({"partner_id": self.partner_azure.id}),
|
||||
]
|
||||
self.assertEqual(self.product_acoustic.main_seller_id.id, self.partner_azure.id)
|
||||
|
||||
def test_03_add_supplierinfo_no_existing_supplierinfo(self):
|
||||
self.product_without_seller_desk.seller_ids = [
|
||||
Command.create({"partner_id": self.partner_azure.id}),
|
||||
]
|
||||
self.assertEqual(
|
||||
self.product_without_seller_desk.main_seller_id.id, self.partner_azure.id
|
||||
)
|
||||
|
||||
def test_03_add_supplierinfo_low_sequence(self):
|
||||
self.product_workplace.seller_ids.write({"sequence": 1})
|
||||
self.product_workplace.seller_ids = [
|
||||
Command.create({"sequence": 100, "partner_id": self.partner_azure.id}),
|
||||
]
|
||||
self.assertNotEqual(
|
||||
self.product_workplace.main_seller_id.id, self.partner_azure.id
|
||||
)
|
||||
|
||||
def test_03_add_supplierinfo_high_sequence(self):
|
||||
self.product_workplace.seller_ids.write({"sequence": 1000})
|
||||
self.product_workplace.seller_ids = [
|
||||
Command.create({"sequence": 100, "partner_id": self.partner_azure.id}),
|
||||
]
|
||||
self.assertEqual(
|
||||
self.product_workplace.main_seller_id.id, self.partner_azure.id
|
||||
)
|
||||
|
||||
def test_04_update_supplierinfo(self):
|
||||
self.product_acoustic.seller_ids.write({"partner_id": self.partner_azure.id})
|
||||
self.assertEqual(self.product_acoustic.main_seller_id.id, self.partner_azure.id)
|
||||
|
||||
def test_05_unlink_supplierinfo(self):
|
||||
self.product_acoustic.seller_ids.unlink()
|
||||
self.assertEqual(self.product_acoustic.main_seller_id.id, False)
|
||||
Loading…
Add table
Add a link
Reference in a new issue