#9 feat(Sale): add external_id field.
This commit is contained in:
parent
f8ff6b7905
commit
62d39c97c0
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 5.0.6 on 2025-07-19 15:56
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('don_confiao', '0038_alter_saleline_quantity'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='sale',
|
||||||
|
name='external_id',
|
||||||
|
field=models.CharField(blank=True, max_length=100, null=True),
|
||||||
|
),
|
||||||
|
]
|
@ -105,6 +105,7 @@ class Sale(models.Model):
|
|||||||
related_name='Sales',
|
related_name='Sales',
|
||||||
null=True
|
null=True
|
||||||
)
|
)
|
||||||
|
external_id = models.CharField(max_length=100, null=True, blank=True)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.date} {self.customer}"
|
return f"{self.date} {self.customer}"
|
||||||
|
@ -27,12 +27,13 @@ class TestAPI(APITestCase):
|
|||||||
sale = Sale.objects.all()[0]
|
sale = Sale.objects.all()[0]
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
sale.customer.name,
|
sale.customer.name,
|
||||||
self.customer.name
|
self.customer.name,
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
sale.id,
|
sale.id,
|
||||||
content['id']
|
content['id']
|
||||||
)
|
)
|
||||||
|
self.assertIsNone(sale.external_id)
|
||||||
|
|
||||||
def test_create_sale_with_decimal(self):
|
def test_create_sale_with_decimal(self):
|
||||||
response = self._create_sale_with_decimal()
|
response = self._create_sale_with_decimal()
|
||||||
|
Loading…
Reference in New Issue
Block a user