feat: products and prices from the database, edited in the Kanban's Site tab (front 8.1)
Gestão and the administrators switch each product on and off and set its price from a start date; a price that has started is history and cannot change, a scheduled one can be cancelled. The Site and the server read the current price; with no row the code's prices and TREATMENT_CENTS still apply, so nothing changes until someone sets one. A switched-off product disappears from the Site and new quotes with it are refused. Approved quotes and paid orders keep their price. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -51,7 +51,8 @@ from urllib.parse import urlencode
|
||||
|
||||
import httpx
|
||||
|
||||
from .core.pricing import treatment_cents
|
||||
from . import catalog
|
||||
from .core import db
|
||||
|
||||
API = 'https://api.tiny.com.br/public-api/v3'
|
||||
AUTH = 'https://accounts.tiny.com.br/realms/tiny/protocol/openid-connect'
|
||||
@@ -172,7 +173,9 @@ def required_settings():
|
||||
setting for mode, setting in PRODUCT_SETTINGS.items() if not (sku_prefix(mode) or step_sku(mode))]
|
||||
# A paid treatment is a line of its own: missing, every treated order would
|
||||
# fail at the Tiny, so ask for it with the rest of the settings.
|
||||
if treatment_cents() > 0:
|
||||
with db.connect() as c:
|
||||
treatment = catalog.current(c)['tratamento']
|
||||
if treatment['enabled'] and treatment['unit_cents'] > 0:
|
||||
required.append('TINY_PRODUCT_TREATMENT')
|
||||
return required
|
||||
|
||||
|
||||
Reference in New Issue
Block a user