Mejora #278
This commit is contained in:
parent
278bd06b72
commit
73fa31abc8
|
@ -3303,10 +3303,18 @@ class Facturas(BaseModel):
|
|||
@classmethod
|
||||
def validate_count_partners(cls, ids):
|
||||
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)
|
||||
.group_by(Facturas.cliente)
|
||||
.order_by(Facturas.cliente).tuples())
|
||||
.join(Socios).switch(Facturas)
|
||||
.group_by(Socios.rfc)
|
||||
.order_by(Socios.rfc).tuples())
|
||||
if len(partners) > 1:
|
||||
return False
|
||||
return True
|
||||
|
|
Loading…
Reference in New Issue