1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-04-20 22:02:44 +00:00

Merge branch 'nerf_pc_kfet' into 'main'

Nerf pc kfet

See merge request bde/nk20!291
This commit is contained in:
quark 2025-03-09 17:58:25 +01:00
commit 434097aba4
4 changed files with 10 additions and 6 deletions

View File

@ -245,7 +245,7 @@ function consume (source, source_alias, dest, quantity, amount, reason, type, ca
invalidity_reason: 'Solde insuffisant', invalidity_reason: 'Solde insuffisant',
polymorphic_ctype: type, polymorphic_ctype: type,
resourcetype: 'RecurrentTransaction', resourcetype: 'RecurrentTransaction',
source: source, source: source.id,
source_alias: source_alias, source_alias: source_alias,
destination: dest, destination: dest,
template: template template: template

View File

@ -1,7 +1,7 @@
# Copyright (C) 2018-2024 by BDE ENS Paris-Saclay # Copyright (C) 2018-2024 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
from datetime import date from datetime import date, timedelta
from django.contrib.auth.backends import ModelBackend from django.contrib.auth.backends import ModelBackend
from django.contrib.auth.models import User from django.contrib.auth.models import User
@ -106,6 +106,7 @@ class PermissionBackend(ModelBackend):
Q=Q, Q=Q,
now=timezone.now(), now=timezone.now(),
today=date.today(), today=date.today(),
week=timedelta(days=7),
) )
yield permission yield permission

View File

@ -2591,7 +2591,7 @@
"note", "note",
"transaction" "transaction"
], ],
"query": "[\"OR\", {\"source__balance__gte\": 0}, [\"AND\", [\"NOT\", {\"recurrenttransaction__template__category__name\": \"Alcool\"}], {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}}], {\"valid\": false}]", "query": "[\"OR\", [\"AND\", [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}}, {\"valid\": false}], [\"NOT\", {\"recurrenttransaction__template__category__name\": \"Alcool\"}]], [\"AND\", [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 0]}}, {\"valid\": false}], {\"recurrenttransaction__template__category__name\": \"Alcool\"}]]",
"type": "add", "type": "add",
"mask": 2, "mask": 2,
"field": "", "field": "",
@ -2607,7 +2607,8 @@
"note", "note",
"transaction" "transaction"
], ],
"query": "[\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": true}]", "query": "[\"AND\", [\"OR\", [\"AND\", [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": true}], [\"NOT\", {\"recurrenttransaction__template__category__name\": \"Alcool\"}]], [\"AND\", [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 0]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": true}], {\"recurrenttransaction__template__category__name\": \"Alcool\"}]], {\"created_at__gte\": {\"F\": [\"SUB\", [\"now\"], [\"week\"]]}}]"
,
"type": "change", "type": "change",
"mask": 2, "mask": 2,
"field": "valid", "field": "valid",
@ -2623,7 +2624,8 @@
"note", "note",
"transaction" "transaction"
], ],
"query": "[\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": true}]", "query": "[\"AND\", [\"OR\", [\"AND\", [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": true}], [\"NOT\", {\"recurrenttransaction__template__category__name\": \"Alcool\"}]], [\"AND\", [\"OR\", {\"source__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 0]}, \"valid\": false}, {\"destination__balance__gte\": {\"F\": [\"SUB\", [\"MUL\", [\"F\", \"amount\"], [\"F\", \"quantity\"]], 2000]}, \"valid\": true}], {\"recurrenttransaction__template__category__name\": \"Alcool\"}]], {\"created_at__gte\": {\"F\": [\"SUB\", [\"now\"], [\"week\"]]}}]"
,
"type": "change", "type": "change",
"mask": 2, "mask": 2,
"field": "invalidity_reason", "field": "invalidity_reason",

View File

@ -1,7 +1,7 @@
# Copyright (C) 2018-2024 by BDE ENS Paris-Saclay # Copyright (C) 2018-2024 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
from datetime import date from datetime import date, timedelta
from json.decoder import JSONDecodeError from json.decoder import JSONDecodeError
from django.contrib.auth.models import User from django.contrib.auth.models import User
@ -73,6 +73,7 @@ class PermissionQueryTestCase(TestCase):
Q=Q, Q=Q,
now=timezone.now(), now=timezone.now(),
today=date.today(), today=date.today(),
week=timedelta(days=7),
) )
instanced.update_query() instanced.update_query()
query = instanced.query query = instanced.query