Validate exists partner in edit
This commit is contained in:
parent
2c684ae6bd
commit
8e7aa23d1b
|
@ -2966,6 +2966,16 @@ class Socios(BaseModel):
|
|||
fields.pop('accounts', '')
|
||||
regimenes = fields.pop('regimenes', ())
|
||||
|
||||
w = (
|
||||
(Socios.rfc==fields['rfc']) &
|
||||
(Socios.slug==fields['slug']) &
|
||||
(Socios.id!=id)
|
||||
)
|
||||
if Socios.select().where(w).exists():
|
||||
msg = 'Ya existe otro emisor con este RFC y Razón Social'
|
||||
data = {'ok': False, 'row': {}, 'new': True, 'msg': msg}
|
||||
return data
|
||||
|
||||
try:
|
||||
q = Socios.update(**fields).where(Socios.id==id)
|
||||
q.execute()
|
||||
|
|
Loading…
Reference in New Issue