-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IMP] pms: add add exp date to jwt data
- Loading branch information
1 parent
1043c1c
commit 60568bd
Showing
14 changed files
with
106 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,3 @@ | |
from . import datamodels | ||
from . import models | ||
from . import services | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
from . import res_users | ||
from . import jwt_access_token | ||
from . import pms_reservation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import json | ||
|
||
from odoo import fields, models | ||
|
||
|
||
class PmsReservation(models.Model): | ||
_inherit = "pms.reservation" | ||
|
||
pwa_action_buttons = fields.Char(compute="_compute_pwa_action_buttons") | ||
|
||
def _compute_pwa_action_buttons(self): | ||
"""Return ordered button list, where the first button is | ||
the preditive action, the next are active actions: | ||
- "Assign": Predictive: Reservation by assign | ||
Active- Idem | ||
- "checkin": Predictive- state 'confirm' and checkin day | ||
Active- Idem and assign | ||
- "checkout": Predictive- Pay, onboard and checkout day | ||
Active- Onboard and checkout day | ||
- "Paymen": Predictive- Onboard and pending amount > 0 | ||
Active- pending amount > 0 | ||
- "Invoice": Predictive- qty invoice > 0, onboard, pending amount = 0 | ||
Active- qty invoice > 0 | ||
- "Cancel": Predictive- Never | ||
Active- state in draft, confirm, onboard, full onboard | ||
""" | ||
for reservation in self: | ||
active_buttons = {} | ||
for k in ["Assign", "Checkin", "Checkout", "Payment", "Invoice", "Cancel"]: | ||
if k == "Assign": | ||
if reservation.to_assign: | ||
active_buttons[k] = True | ||
else: | ||
active_buttons[k] = False | ||
elif k == "Checkin": | ||
if reservation.allowed_checkin: | ||
active_buttons[k] = True | ||
else: | ||
active_buttons[k] = False | ||
elif k == "Checkout": | ||
if reservation.allowed_checkout: | ||
active_buttons[k] = True | ||
else: | ||
active_buttons[k] = False | ||
elif k == "Payment": | ||
if reservation.folio_pending_amount > 0: | ||
active_buttons[k] = True | ||
else: | ||
active_buttons[k] = False | ||
elif k == "Invoice": | ||
if reservation.invoice_status == "to invoice": | ||
active_buttons[k] = True | ||
else: | ||
active_buttons[k] = False | ||
elif k == "Cancel": | ||
if reservation.allowed_cancel: | ||
active_buttons[k] = True | ||
else: | ||
active_buttons[k] = False | ||
|
||
reservation.pwa_action_buttons = json.dumps(active_buttons) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink | ||
access_jwt_access_token,Read jwt access token,model_jwt_provider_access_token,,1,0,0,0 | ||
access_jwt_access_token,Read jwt access token,model_jwt_provider_access_token,,1,0,0,0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
# generated from manifests external_dependencies | ||
bs4 | ||
jwt | ||
marshmallow | ||
pycountry | ||
simplejson | ||
xlrd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../../../pms_api_rest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import setuptools | ||
|
||
setuptools.setup( | ||
setup_requires=['setuptools-odoo'], | ||
odoo_addon=True, | ||
) |