fix(contract-template): fix a bug where contract template where not using the productor max cheque quantity
All checks were successful
Deploy Amap / deploy (push) Successful in 1m42s
All checks were successful
Deploy Amap / deploy (push) Successful in 1m42s
This commit is contained in:
173
README.md
173
README.md
@@ -1,29 +1,160 @@
|
|||||||
# TODO
|
# Todo list
|
||||||
|
## Contracts
|
||||||
|
- [x] Recap.
|
||||||
|
- [x] Download one contract.
|
||||||
|
- [x] Download all contract.
|
||||||
|
- [ ] Update contract after first generation (for unregistered users).
|
||||||
|
- [ ] View and edit contract application (dashboard/contracts/id/edit/)
|
||||||
|
|
||||||
## backend\src\contracts\contracts.py
|
## Forms
|
||||||
|
- [ ] Link products to a form.
|
||||||
- Extract recap
|
- [ ] Preview form
|
||||||
|
|
||||||
## Link products to a form
|
|
||||||
|
|
||||||
## Wording
|
## Wording
|
||||||
|
|
||||||
- all translations
|
- [ ] All translations.
|
||||||
|
- [ ] All French descriptions.
|
||||||
|
- [ ] Reorganize keys in JSON objects.
|
||||||
|
|
||||||
## Footer
|
## Footer
|
||||||
|
- [ ] Legal.
|
||||||
|
- [ ] About.
|
||||||
|
- [ ] Contact.
|
||||||
|
|
||||||
### Legal
|
## Dashboard
|
||||||
|
- [ ] Pagination.
|
||||||
|
- [ ] Soft Deletion
|
||||||
|
|
||||||
### About
|
## Tests
|
||||||
|
### Contracts
|
||||||
### Contact
|
##### Create
|
||||||
|
- [ ] 200 Working case
|
||||||
## Pagination
|
- [ ] 401 Unauthorized
|
||||||
|
- [ ] 403 Forbidden
|
||||||
## Confirmation modal on suppression
|
- [ ] 422 Unprocessable Entity
|
||||||
### Show on cascade deletion
|
##### Update
|
||||||
|
- [ ] 200 Working case
|
||||||
## Update contract after (without registration)
|
- [ ] 404 Not found
|
||||||
|
- [ ] 401 Unauthorized
|
||||||
## Preview form (if not visible can be accessed by referer nothing is stored)
|
- [ ] 403 Forbidden
|
||||||
## View and edit contract application (dashboard/contracts/id/edit/)
|
- [ ] 422 Unprocessable Entity
|
||||||
|
##### Read
|
||||||
|
###### Get one
|
||||||
|
- [ ] 200 Working case
|
||||||
|
- [ ] 404 Not found
|
||||||
|
- [ ] 401 Unauthorized
|
||||||
|
- [ ] 403 Forbidden
|
||||||
|
###### Get all
|
||||||
|
##### Delete
|
||||||
|
- [ ] 200 Working case
|
||||||
|
- [ ] 404 Not found
|
||||||
|
- [ ] 401 Unauthorized
|
||||||
|
- [ ] 403 Forbidden
|
||||||
|
- [ ] 422 Unprocessable Entity
|
||||||
|
### Forms
|
||||||
|
##### Create
|
||||||
|
- [x] 200 Working case
|
||||||
|
- [x] 401 Unauthorized
|
||||||
|
- [x] 403 Forbidden
|
||||||
|
- [x] 422 Unprocessable Entity
|
||||||
|
##### Update
|
||||||
|
- [x] 200 Working case
|
||||||
|
- [x] 404 Not found
|
||||||
|
- [x] 401 Unauthorized
|
||||||
|
- [x] 403 Forbidden
|
||||||
|
- [x] 422 Unprocessable Entity
|
||||||
|
##### Read
|
||||||
|
###### Get one
|
||||||
|
###### Get all
|
||||||
|
##### Delete
|
||||||
|
- [x] 200 Working case
|
||||||
|
- [x] 404 Not found
|
||||||
|
- [x] 401 Unauthorized
|
||||||
|
- [x] 403 Forbidden
|
||||||
|
- [x] 422 Unprocessable Entity
|
||||||
|
### Shipments
|
||||||
|
##### Create
|
||||||
|
- [x] 200 Working case
|
||||||
|
- [x] 401 Unauthorized
|
||||||
|
- [x] 403 Forbidden
|
||||||
|
- [x] 422 Unprocessable Entity
|
||||||
|
##### Update
|
||||||
|
- [x] 200 Working case
|
||||||
|
- [x] 404 Not found
|
||||||
|
- [x] 401 Unauthorized
|
||||||
|
- [x] 403 Forbidden
|
||||||
|
- [x] 422 Unprocessable Entity
|
||||||
|
##### Read
|
||||||
|
###### Get one
|
||||||
|
###### Get all
|
||||||
|
##### Delete
|
||||||
|
- [x] 200 Working case
|
||||||
|
- [x] 404 Not found
|
||||||
|
- [x] 401 Unauthorized
|
||||||
|
- [x] 403 Forbidden
|
||||||
|
- [x] 422 Unprocessable Entity
|
||||||
|
### Productors
|
||||||
|
##### Create
|
||||||
|
- [x] 200 Working case
|
||||||
|
- [x] 401 Unauthorized
|
||||||
|
- [x] 403 Forbidden
|
||||||
|
- [x] 422 Unprocessable Entity
|
||||||
|
##### Update
|
||||||
|
- [x] 200 Working case
|
||||||
|
- [x] 404 Not found
|
||||||
|
- [x] 401 Unauthorized
|
||||||
|
- [x] 403 Forbidden
|
||||||
|
- [x] 422 Unprocessable Entity
|
||||||
|
##### Read
|
||||||
|
###### Get one
|
||||||
|
###### Get all
|
||||||
|
##### Delete
|
||||||
|
- [x] 200 Working case
|
||||||
|
- [x] 404 Not found
|
||||||
|
- [x] 401 Unauthorized
|
||||||
|
- [x] 403 Forbidden
|
||||||
|
- [x] 422 Unprocessable Entity
|
||||||
|
### Products
|
||||||
|
##### Create
|
||||||
|
- [x] 200 Working case
|
||||||
|
- [x] 401 Unauthorized
|
||||||
|
- [x] 403 Forbidden
|
||||||
|
- [x] 422 Unprocessable Entity
|
||||||
|
##### Update
|
||||||
|
- [x] 200 Working case
|
||||||
|
- [x] 404 Not found
|
||||||
|
- [x] 401 Unauthorized
|
||||||
|
- [x] 403 Forbidden
|
||||||
|
- [x] 422 Unprocessable Entity
|
||||||
|
##### Read
|
||||||
|
###### Get one
|
||||||
|
###### Get all
|
||||||
|
##### Delete
|
||||||
|
- [x] 200 Working case
|
||||||
|
- [x] 404 Not found
|
||||||
|
- [x] 401 Unauthorized
|
||||||
|
- [x] 403 Forbidden
|
||||||
|
- [x] 422 Unprocessable Entity
|
||||||
|
### Users
|
||||||
|
##### Create
|
||||||
|
- [x] 200 Working case
|
||||||
|
- [x] 401 Unauthorized
|
||||||
|
- [x] 403 Forbidden
|
||||||
|
- [x] 422 Unprocessable Entity
|
||||||
|
##### Update
|
||||||
|
- [x] 200 Working case
|
||||||
|
- [x] 404 Not found
|
||||||
|
- [x] 401 Unauthorized
|
||||||
|
- [x] 403 Forbidden
|
||||||
|
- [x] 422 Unprocessable Entity
|
||||||
|
##### Read
|
||||||
|
###### Get one
|
||||||
|
###### Get all
|
||||||
|
##### Delete
|
||||||
|
- [x] 200 Working case
|
||||||
|
- [x] 404 Not found
|
||||||
|
- [x] 401 Unauthorized
|
||||||
|
- [x] 403 Forbidden
|
||||||
|
- [x] 422 Unprocessable Entity
|
||||||
|
### Auth
|
||||||
|
### Generate contracts / recap
|
||||||
@@ -108,6 +108,11 @@ async def get_base_contract_template(
|
|||||||
'price': None,
|
'price': None,
|
||||||
'products': [{'product': pr, 'quantity': None} for pr in sh.products]
|
'products': [{'product': pr, 'quantity': None} for pr in sh.products]
|
||||||
} for sh in form.shipments]
|
} for sh in form.shipments]
|
||||||
|
cheque_payment_method = list(filter(
|
||||||
|
lambda x: x.name == "cheque", form.productor.payment_methods))
|
||||||
|
cheque_number = cheque_payment_method[0].max if len(
|
||||||
|
cheque_payment_method) > 0 else 3
|
||||||
|
print(cheque_number, cheque_payment_method)
|
||||||
empty_contract = models.ContractPublic(
|
empty_contract = models.ContractPublic(
|
||||||
firstname='',
|
firstname='',
|
||||||
form=form,
|
form=form,
|
||||||
@@ -116,15 +121,13 @@ async def get_base_contract_template(
|
|||||||
phone='',
|
phone='',
|
||||||
products=[],
|
products=[],
|
||||||
payment_method='cheque',
|
payment_method='cheque',
|
||||||
cheque_quantity=3,
|
cheque_quantity=cheque_number,
|
||||||
total_price=0,
|
total_price=0,
|
||||||
id=1
|
id=1
|
||||||
)
|
)
|
||||||
cheques = [
|
cheques = [
|
||||||
{'name': None, 'value': None},
|
{'name': None, 'value': None},
|
||||||
{'name': None, 'value': None},
|
] * cheque_number
|
||||||
{'name': None, 'value': None}
|
|
||||||
]
|
|
||||||
try:
|
try:
|
||||||
pdf_bytes = generate_html_contract(
|
pdf_bytes = generate_html_contract(
|
||||||
empty_contract,
|
empty_contract,
|
||||||
|
|||||||
@@ -413,7 +413,6 @@ def generate_recap(
|
|||||||
'3': 'Piece'
|
'3': 'Piece'
|
||||||
}
|
}
|
||||||
if len(contracts) <= 0:
|
if len(contracts) <= 0:
|
||||||
# TODO: raise correct exception
|
|
||||||
return None
|
return None
|
||||||
first_contract = contracts[0]
|
first_contract = contracts[0]
|
||||||
reccurents_sorted = sorted(
|
reccurents_sorted = sorted(
|
||||||
|
|||||||
10
backend/tests/services/test_contracts_service.py
Normal file
10
backend/tests/services/test_contracts_service.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
class TestContractsService:
|
||||||
|
def test_get_all_contracts(
|
||||||
|
self,
|
||||||
|
):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def test_get_all_filtered_contracts(
|
||||||
|
self,
|
||||||
|
):
|
||||||
|
pass
|
||||||
Reference in New Issue
Block a user