diff --git a/engine/core/migrations/0053_product_is_updatable.py b/engine/core/migrations/0053_product_is_updatable.py new file mode 100644 index 00000000..d22b59a0 --- /dev/null +++ b/engine/core/migrations/0053_product_is_updatable.py @@ -0,0 +1,21 @@ +# Generated by Django 5.2.9 on 2025-12-18 18:18 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ("core", "0052_alter_stock_system_attributes"), + ] + + operations = [ + migrations.AddField( + model_name="product", + name="is_updatable", + field=models.BooleanField( + default=True, + help_text="indicates whether this product should be updated from periodic task", + verbose_name="is product updatable", + ), + ), + ] diff --git a/engine/core/models.py b/engine/core/models.py index 7ff1797a..91d6b0cd 100644 --- a/engine/core/models.py +++ b/engine/core/models.py @@ -628,6 +628,15 @@ class Product(ExportModelOperationsMixin("product"), NiceModel): blank=False, null=False, ) + is_updatable = BooleanField( + default=True, + help_text=_( + "indicates whether this product should be updated from periodic task" + ), + verbose_name=_("is product updatable"), + blank=False, + null=False, + ) name = CharField( max_length=255, help_text=_("provide a clear identifying name for the product"), diff --git a/engine/core/vendors/__init__.py b/engine/core/vendors/__init__.py index 28145d4f..4a3d5d3f 100644 --- a/engine/core/vendors/__init__.py +++ b/engine/core/vendors/__init__.py @@ -83,6 +83,10 @@ class VendorInactiveError(VendorError): pass +class ProductUnapdatableError(VendorError): + pass + + class AbstractVendor: """ Abstract class defining vendor-related operations and handling. @@ -578,6 +582,10 @@ class AbstractVendor: return av + def check_updatable(self, product: Product): + if not product.is_updatable: + raise ProductUnapdatableError("Product %s is not updatable", product.sku) + def update_stock(self) -> None: pass