forked from elmau/empresa-libre
Mejora #278
This commit is contained in:
parent
278bd06b72
commit
73fa31abc8
|
@ -3303,10 +3303,18 @@ class Facturas(BaseModel):
|
||||||
@classmethod
|
@classmethod
|
||||||
def validate_count_partners(cls, ids):
|
def validate_count_partners(cls, ids):
|
||||||
filters = (Facturas.id.in_(tuple(ids.keys())))
|
filters = (Facturas.id.in_(tuple(ids.keys())))
|
||||||
partners = (Facturas.select(fn.COUNT(Facturas.cliente))
|
# ~ partners = (Facturas.select(fn.COUNT(Facturas.cliente))
|
||||||
|
# ~ .where(filters)
|
||||||
|
# ~ .group_by(Facturas.cliente)
|
||||||
|
# ~ .order_by(Facturas.cliente).tuples())
|
||||||
|
# ~ if len(partners) > 1:
|
||||||
|
# ~ return False
|
||||||
|
# ~ return True
|
||||||
|
partners = (Facturas.select(fn.COUNT(Socios.rfc))
|
||||||
.where(filters)
|
.where(filters)
|
||||||
.group_by(Facturas.cliente)
|
.join(Socios).switch(Facturas)
|
||||||
.order_by(Facturas.cliente).tuples())
|
.group_by(Socios.rfc)
|
||||||
|
.order_by(Socios.rfc).tuples())
|
||||||
if len(partners) > 1:
|
if len(partners) > 1:
|
||||||
return False
|
return False
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in New Issue