Kgshop commited on
Commit
b47f22d
·
verified ·
1 Parent(s): 5f05d15

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -3
app.py CHANGED
@@ -3415,14 +3415,16 @@ ADMIN_TEMPLATE = '''
3415
  <label><input type="checkbox" name="cf_zip" {% if settings.customer_fields.zip %}checked{% endif %}> Индекс</label>
3416
  </div>
3417
 
3418
- {% if sys_mode not in ['external', 'light_external'] %}
3419
  <div style="font-weight: 600; margin-bottom: 5px; border-top: 1px solid var(--border); padding-top: 15px;">Учет товара:</div>
3420
 
3421
  <label style="display:flex; align-items:center; gap:10px;">
3422
  <input type="checkbox" name="use_master_boxes" style="width:auto;" {% if settings.use_master_boxes %}checked{% endif %}>
3423
  {{ t('Включить учет больших коробок') }}
3424
  </label>
 
3425
 
 
3426
  <label><input type="checkbox" name="track_inventory" {% if settings.track_inventory %}checked{% endif %}> Включить остатки на складе</label>
3427
  <label><input type="checkbox" name="use_barcodes" {% if settings.use_barcodes %}checked{% endif %}> Использовать штрих-коды</label>
3428
  {% if sys_mode == 'both' %}
@@ -4020,7 +4022,7 @@ ADMIN_TEMPLATE = '''
4020
  <script>
4021
  const trackInventory = {{ 'true' if settings.track_inventory and sys_mode not in ['external', 'light_external'] else 'false' }};
4022
  const useBarcodes = {{ 'true' if settings.use_barcodes and sys_mode not in ['external', 'light_external'] else 'false' }};
4023
- const useMasterBoxes = {{ 'true' if settings.use_master_boxes and sys_mode not in ['external', 'light_external'] else 'false' }};
4024
  const marginTracking = {{ 'true' if settings.margin_tracking and sys_mode == 'both' else 'false' }};
4025
  const businessType = '{{ settings.business_type }}';
4026
 
@@ -5968,13 +5970,21 @@ def admin(env_id):
5968
  settings['invoice_contacts'] = request.form.get('invoice_contacts', '').strip()
5969
  settings['currency'] = request.form.get('currency', '₸')
5970
 
5971
- if settings.get('system_mode', 'both') in ['external', 'light_external']:
 
5972
  settings['track_inventory'] = False
5973
  settings['use_barcodes'] = False
5974
  settings['use_master_boxes'] = False
5975
  settings['margin_tracking'] = False
5976
  settings['hide_stock_online'] = False
5977
  settings['closed_catalog_enabled'] = 'closed_catalog_enabled' in request.form
 
 
 
 
 
 
 
5978
  else:
5979
  settings['track_inventory'] = 'track_inventory' in request.form
5980
  settings['use_barcodes'] = 'use_barcodes' in request.form
@@ -6489,3 +6499,4 @@ if __name__ == '__main__':
6489
 
6490
  port = int(os.environ.get('PORT', 7860))
6491
  app.run(host='0.0.0.0', port=port)
 
 
3415
  <label><input type="checkbox" name="cf_zip" {% if settings.customer_fields.zip %}checked{% endif %}> Индекс</label>
3416
  </div>
3417
 
3418
+ {% if sys_mode != 'external' %}
3419
  <div style="font-weight: 600; margin-bottom: 5px; border-top: 1px solid var(--border); padding-top: 15px;">Учет товара:</div>
3420
 
3421
  <label style="display:flex; align-items:center; gap:10px;">
3422
  <input type="checkbox" name="use_master_boxes" style="width:auto;" {% if settings.use_master_boxes %}checked{% endif %}>
3423
  {{ t('Включить учет больших коробок') }}
3424
  </label>
3425
+ {% endif %}
3426
 
3427
+ {% if sys_mode not in ['external', 'light_external'] %}
3428
  <label><input type="checkbox" name="track_inventory" {% if settings.track_inventory %}checked{% endif %}> Включить остатки на складе</label>
3429
  <label><input type="checkbox" name="use_barcodes" {% if settings.use_barcodes %}checked{% endif %}> Использовать штрих-коды</label>
3430
  {% if sys_mode == 'both' %}
 
4022
  <script>
4023
  const trackInventory = {{ 'true' if settings.track_inventory and sys_mode not in ['external', 'light_external'] else 'false' }};
4024
  const useBarcodes = {{ 'true' if settings.use_barcodes and sys_mode not in ['external', 'light_external'] else 'false' }};
4025
+ const useMasterBoxes = {{ 'true' if settings.use_master_boxes and sys_mode != 'external' else 'false' }};
4026
  const marginTracking = {{ 'true' if settings.margin_tracking and sys_mode == 'both' else 'false' }};
4027
  const businessType = '{{ settings.business_type }}';
4028
 
 
5970
  settings['invoice_contacts'] = request.form.get('invoice_contacts', '').strip()
5971
  settings['currency'] = request.form.get('currency', '₸')
5972
 
5973
+ sys_m = settings.get('system_mode', 'both')
5974
+ if sys_m == 'external':
5975
  settings['track_inventory'] = False
5976
  settings['use_barcodes'] = False
5977
  settings['use_master_boxes'] = False
5978
  settings['margin_tracking'] = False
5979
  settings['hide_stock_online'] = False
5980
  settings['closed_catalog_enabled'] = 'closed_catalog_enabled' in request.form
5981
+ elif sys_m == 'light_external':
5982
+ settings['track_inventory'] = False
5983
+ settings['use_barcodes'] = False
5984
+ settings['use_master_boxes'] = 'use_master_boxes' in request.form
5985
+ settings['margin_tracking'] = False
5986
+ settings['hide_stock_online'] = False
5987
+ settings['closed_catalog_enabled'] = 'closed_catalog_enabled' in request.form
5988
  else:
5989
  settings['track_inventory'] = 'track_inventory' in request.form
5990
  settings['use_barcodes'] = 'use_barcodes' in request.form
 
6499
 
6500
  port = int(os.environ.get('PORT', 7860))
6501
  app.run(host='0.0.0.0', port=port)
6502
+