#9 feat(Product): add external_id field.

This commit is contained in:
Mono Mono 2025-07-19 17:32:35 -05:00
parent 46e7181653
commit ba9ef039f4
3 changed files with 28 additions and 0 deletions

View File

@ -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),
),
]

View File

@ -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

View File

@ -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()