Save warehouse in product
This commit is contained in:
parent
30a4a276dd
commit
a95a6842f9
|
@ -5280,6 +5280,7 @@ class Facturas(BaseModel):
|
|||
receptor['NumRegIdTrib'] = invoice.cliente.id_fiscal
|
||||
|
||||
conceptos = []
|
||||
|
||||
rows = FacturasDetalle.select().where(FacturasDetalle.factura==invoice)
|
||||
for row in rows:
|
||||
if is_global:
|
||||
|
@ -5581,12 +5582,6 @@ class Facturas(BaseModel):
|
|||
)
|
||||
q.execute()
|
||||
|
||||
# ~ obj.xml = result['xml']
|
||||
# ~ obj.uuid = result['uuid']
|
||||
# ~ obj.fecha_timbrado = result['date']
|
||||
# ~ obj.estatus = 'Timbrada'
|
||||
# ~ obj.error = ''
|
||||
# ~ obj.save()
|
||||
row = {'uuid': cfdi_uuid, 'estatus': 'Timbrada'}
|
||||
if enviar_correo:
|
||||
cls._send(cls, id, rfc)
|
||||
|
@ -5892,6 +5887,9 @@ class Facturas(BaseModel):
|
|||
if warehouse is None:
|
||||
continue
|
||||
|
||||
p.warehouse = warehouse
|
||||
p.save()
|
||||
|
||||
fields = (
|
||||
WareHouseProduct.warehouse==warehouse,
|
||||
WareHouseProduct.product==p.producto,
|
||||
|
@ -6463,6 +6461,7 @@ class FacturasDetalle(BaseModel):
|
|||
cuenta_predial = TextField(default='')
|
||||
empaques = DecimalField(default=0.0, max_digits=14, decimal_places=4,
|
||||
auto_round=True)
|
||||
warehouse = ForeignKeyField(Almacenes, null=True)
|
||||
|
||||
class Meta:
|
||||
order_by = ('factura',)
|
||||
|
@ -10296,6 +10295,12 @@ def _migrate_tables(rfc=''):
|
|||
warehouse = ForeignKeyField(Almacenes, null=True, to_field=Almacenes.id)
|
||||
migrations.append(migrator.add_column(table, 'warehouse', warehouse))
|
||||
|
||||
table = 'facturasdetalle'
|
||||
columns = [c.name for c in database_proxy.get_columns(table)]
|
||||
if not 'warehouse_id' in columns:
|
||||
warehouse = ForeignKeyField(Almacenes, null=True, to_field=Almacenes.id)
|
||||
migrations.append(migrator.add_column(table, 'warehouse_id', warehouse))
|
||||
|
||||
if migrations:
|
||||
with database_proxy.atomic() as txn:
|
||||
migrate(*migrations)
|
||||
|
|
Loading…
Reference in New Issue