#9 feat(Product): add external_id field.
This commit is contained in:
		| @@ -0,0 +1,18 @@ | ||||
| # Generated by Django 5.0.6 on 2025-07-19 22:32 | ||||
|  | ||||
| from django.db import migrations, models | ||||
|  | ||||
|  | ||||
| class Migration(migrations.Migration): | ||||
|  | ||||
|     dependencies = [ | ||||
|         ('don_confiao', '0040_customer_external_id'), | ||||
|     ] | ||||
|  | ||||
|     operations = [ | ||||
|         migrations.AddField( | ||||
|             model_name='product', | ||||
|             name='external_id', | ||||
|             field=models.CharField(blank=True, max_length=100, null=True), | ||||
|         ), | ||||
|     ] | ||||
| @@ -43,6 +43,7 @@ class Product(models.Model): | ||||
|         default=MeasuringUnits.UNIT | ||||
|     ) | ||||
|     categories = models.ManyToManyField(ProductCategory) | ||||
|     external_id = models.CharField(max_length=100, null=True, blank=True) | ||||
|  | ||||
|     def __str__(self): | ||||
|         return self.name | ||||
|   | ||||
| @@ -10,6 +10,15 @@ class TestProducts(TestCase): | ||||
|     def setUp(self): | ||||
|         self.client = Client() | ||||
|  | ||||
|     def test_create_product(self): | ||||
|         product = Product() | ||||
|         product.name = "Un producto" | ||||
|         product.price = 1000 | ||||
|         product.save() | ||||
|  | ||||
|         self.assertIsInstance(product, Product) | ||||
|         self.assertIsNone(product.external_id) | ||||
|  | ||||
|     def test_import_products(self): | ||||
|         self._import_csv() | ||||
|         all_products = self._get_products() | ||||
|   | ||||
		Reference in New Issue
	
	Block a user