Compare commits
No commits in common. "95fab71898336156ede9561b9a15c709dbe1944c" and "8a2a5687394da1cc4eaf7818d1f7866421a1eac9" have entirely different histories.
95fab71898
...
8a2a568739
@ -1,4 +0,0 @@
|
||||
nombre,correo,telefono
|
||||
Alejandro Ayala,mono@disroot.org,3232321
|
||||
Mono Francisco,pablo@onecluster.org,321312312
|
||||
Pablo Bolivar,alejo@onecluster.org,3243242
|
|
@ -12,10 +12,6 @@ class ImportProductsForm(forms.Form):
|
||||
csv_file = forms.FileField()
|
||||
|
||||
|
||||
class ImportCustomersForm(forms.Form):
|
||||
csv_file = forms.FileField()
|
||||
|
||||
|
||||
class PurchaseForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = Sale
|
||||
|
@ -1,23 +0,0 @@
|
||||
# Generated by Django 5.0.6 on 2024-10-26 22:01
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('don_confiao', '0030_paymentsale'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name='customer',
|
||||
old_name='address',
|
||||
new_name='email',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='customer',
|
||||
name='phone',
|
||||
field=models.CharField(blank=True, max_length=100, null=True),
|
||||
),
|
||||
]
|
@ -1,18 +0,0 @@
|
||||
# Generated by Django 5.0.6 on 2024-10-26 22:21
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('don_confiao', '0031_rename_address_customer_email_customer_phone'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='customer',
|
||||
name='address',
|
||||
field=models.CharField(blank=True, max_length=100, null=True),
|
||||
),
|
||||
]
|
@ -9,8 +9,6 @@ from datetime import datetime
|
||||
class Customer(models.Model):
|
||||
name = models.CharField(max_length=100, default=None, null=False, blank=False)
|
||||
address = models.CharField(max_length=100, null=True, blank=True)
|
||||
email = models.CharField(max_length=100, null=True, blank=True)
|
||||
phone = models.CharField(max_length=100, null=True, blank=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.name
|
||||
|
@ -1,13 +0,0 @@
|
||||
{% extends 'don_confiao/base.html' %}
|
||||
{% block content %}
|
||||
{% if form.is_multipart %}
|
||||
<form enctype="multipart/form-data" method="post">
|
||||
{% else %}
|
||||
<form method="post">
|
||||
{% endif %}
|
||||
|
||||
{% csrf_token %}
|
||||
{{ form }}
|
||||
<input type="submit" value="Importar">
|
||||
</form>
|
||||
{% endblock %}
|
@ -4,5 +4,4 @@
|
||||
<li><a href='./comprar'>Comprar</a></li>
|
||||
<li><a href='./productos'>Productos</a></li>
|
||||
<li><a href='./importar_productos'>Importar Productos</a></li>
|
||||
<li><a href='./importar_terceros'>Importar Terceros</a></li>
|
||||
</ul>
|
||||
|
@ -9,7 +9,6 @@
|
||||
<li><a href='/don_confiao/compras'>Compras</a></li>
|
||||
<li><a href='/don_confiao/lista_productos'>Productos</a></li>
|
||||
<li><a href='/don_confiao/importar_productos'>Importar Productos</a></li>
|
||||
<li><a href='/don_confiao/importar_terceros'>Importar Terceros</a></li>
|
||||
<li><a href='/don_confiao/cuadrar_tarro'>Cuadrar tarro</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
@ -19,7 +19,6 @@ urlpatterns = [
|
||||
path("productos", views.products, name="products"),
|
||||
path("lista_productos", views.ProductListView.as_view(), name='product_list'),
|
||||
path("importar_productos", views.import_products, name="import_products"),
|
||||
path("importar_terceros", views.import_customers, name="import_customers"),
|
||||
path("exportar_ventas_para_tryton",
|
||||
views.exportar_ventas_para_tryton,
|
||||
name="exportar_ventas_para_tryton"),
|
||||
|
@ -4,10 +4,9 @@ from django.views.generic import ListView
|
||||
from django.db import transaction
|
||||
|
||||
from .models import (
|
||||
Sale, SaleLine, Product, Customer, ProductCategory, Payment, PaymentMethods)
|
||||
Sale, SaleLine, Product, ProductCategory, Payment, PaymentMethods)
|
||||
from .forms import (
|
||||
ImportProductsForm,
|
||||
ImportCustomersForm,
|
||||
PurchaseForm,
|
||||
SaleLineFormSet,
|
||||
ReconciliationJarForm,
|
||||
@ -95,19 +94,6 @@ def import_products(request):
|
||||
{'form': form}
|
||||
)
|
||||
|
||||
def import_customers(request):
|
||||
if request.method == "POST":
|
||||
form = ImportCustomersForm(request.POST, request.FILES)
|
||||
if form.is_valid():
|
||||
handle_import_customers_file(request.FILES["csv_file"])
|
||||
return HttpResponseRedirect("productos")
|
||||
else:
|
||||
form = ImportCustomersForm()
|
||||
return render(
|
||||
request,
|
||||
"don_confiao/import_customers.html",
|
||||
{'form': form}
|
||||
)
|
||||
|
||||
def reconciliate_jar(request):
|
||||
summary = Payment.get_reconciliation_jar_summary()
|
||||
@ -168,18 +154,6 @@ def handle_import_products_file(csv_file):
|
||||
for category in categories:
|
||||
product.categories.add(category)
|
||||
|
||||
def handle_import_customers_file(csv_file):
|
||||
data = io.StringIO(csv_file.read().decode('utf-8'))
|
||||
reader = csv.DictReader(data, quotechar='"')
|
||||
for row in reader:
|
||||
customer, created = Customer.objects.update_or_create(
|
||||
name=row['nombre'],
|
||||
defaults={
|
||||
'email': row['correo'],
|
||||
'phone': row['telefono']
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
def exportar_ventas_para_tryton(request):
|
||||
tryton_sales_header = [
|
||||
|
Loading…
Reference in New Issue
Block a user