Correcting contract forms display
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
|
import uuid
|
||||||
from fastapi import Depends, HTTPException
|
from fastapi import Depends, HTTPException
|
||||||
|
|
||||||
from ..core.routes import get_crud_router
|
from ..core.routes import get_crud_router
|
||||||
@@ -48,7 +48,8 @@ async def create(item: ContractCreate, user=Depends(can_create_contract)) -> dic
|
|||||||
parties.append({
|
parties.append({
|
||||||
'entity': await Entity.get(p.entity_id),
|
'entity': await Entity.get(p.entity_id),
|
||||||
'part': p.part,
|
'part': p.part,
|
||||||
'representative': await Entity.get(p.representative_id) if p.representative_id else None
|
'representative': await Entity.get(p.representative_id) if p.representative_id else None,
|
||||||
|
'signature_uuid': str(uuid.uuid4())
|
||||||
})
|
})
|
||||||
|
|
||||||
contract_dict['parties'] = parties
|
contract_dict['parties'] = parties
|
||||||
@@ -70,6 +71,11 @@ async def create(item: ContractCreate, user=Depends(can_create_contract)) -> dic
|
|||||||
return {"message": "Contract Successfully created", "id": o.id}
|
return {"message": "Contract Successfully created", "id": o.id}
|
||||||
|
|
||||||
|
|
||||||
|
@contract_router.put("/{id}", response_description="")
|
||||||
|
async def update(id: str, req: ContractUpdate) -> ContractRead:
|
||||||
|
raise HTTPException(status_code=400, detail="No modification on contract")
|
||||||
|
|
||||||
|
|
||||||
def replace_variables_in_value(variables, value: str):
|
def replace_variables_in_value(variables, value: str):
|
||||||
for v in variables:
|
for v in variables:
|
||||||
value = value.replace('%{}%'.format(v.key), v.value)
|
value = value.replace('%{}%'.format(v.key), v.value)
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ class Party(BaseModel):
|
|||||||
entity: Entity
|
entity: Entity
|
||||||
part: str
|
part: str
|
||||||
representative: Entity = None
|
representative: Entity = None
|
||||||
signature_uuid: str = str(uuid.uuid4())
|
signature_uuid: str
|
||||||
signature_affixed: bool = False
|
signature_affixed: bool = False
|
||||||
|
|
||||||
|
|
||||||
@@ -81,8 +81,8 @@ class DraftProvision(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
class Provision(BaseModel):
|
class Provision(BaseModel):
|
||||||
title: str
|
title: str = RichtextSingleline()
|
||||||
body: str
|
body: str = RichtextMultiline()
|
||||||
|
|
||||||
|
|
||||||
class ContractDraft(CrudDocument):
|
class ContractDraft(CrudDocument):
|
||||||
|
|||||||
@@ -38,8 +38,19 @@ class ContractDraftUpdate(ContractDraftCreate):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class EntityRead(BaseModel):
|
||||||
|
label: str
|
||||||
|
|
||||||
|
|
||||||
|
class PartyRead(BaseModel):
|
||||||
|
signature_affixed: bool
|
||||||
|
signature_uuid: str = Field(format="signature-link")
|
||||||
|
part: str
|
||||||
|
entity: EntityRead
|
||||||
|
|
||||||
|
|
||||||
class ContractRead(Contract):
|
class ContractRead(Contract):
|
||||||
pass
|
parties: List[PartyRead]
|
||||||
|
|
||||||
|
|
||||||
class ContractCreate(Writer):
|
class ContractCreate(Writer):
|
||||||
|
|||||||
Reference in New Issue
Block a user