# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

### Added

### Changed

### Deprecated

### Removed

### Fixed

### Security

## [3.21] - 2026-04-14

### Added
- Continuous mode: vehicle and driver fields are now visible (optional) in the Expeditions form. If selected, they apply to the first delivery only.
- New `distance_rounding_precision` config setting for controlling decimal places on distance in km (default 0).
- Option to display dosed material weights in tonnes instead of kilograms in consumption, stock, and production printouts and exports (checkbox in the report form).

### Changed
- Changed default rounding precision for tonnes to 2.
- Move value/currency formatting from frontend to backend.
- Only allow .ord files to create/update order and recipe in standby mode.

### Fixed
- Fix distance override showing 0 and not accepting zero value.

## [3.20] - 2026-04-10

### Changed
- Tabular printout: don't title-ize translated headers.
- Decimal comma handling for Metrostav exports (work in progress).

### Fixed
- Display names instead of IDs in production printout filter headers.

## [3.19] - 2026-04-08

### Fixed
- Fixed UNIQUE constraint error on construction site name when processing .ord files with the same site name but different site numbers (e.g. "Olomouc" used for multiple ConstructionSiteNumber values). Duplicate names are now disambiguated with the site number suffix.

## [3.18] - 2026-04-07

### Added
- Changelog is now included in the atxpkg package.

## [3.17] - 2026-04-05

### Added
- New `tonnes_rounding_precision` config setting for controlling decimal places on delivery sheet total tonnes (default 3).
- New `volume_rounding_precision` config setting for controlling decimal places on volume in m³ (default 2).
- Show last paired driver in vehicle listing and last paired vehicle in driver listing (mj195).
- Decimal comma toggle for CSV/TSV export.

### Changed
- Renamed `rounding_precision` config setting to `currency_rounding_precision` for clarity. Old name is still supported for backward compatibility.

### Fixed
- Fix vehicle-driver pairings not being saved for new pairs (broken since 3.15), causing driver/pump auto-fill to not work for first-time pairings.
- Fix 0 tonnes on delivery sheets caused by print event firing before DB transaction commits.
- Hide continuous mode auto-print setting on batch plants.

## [3.16] - 2026-04-01

### Fixed
 - Added missing migration

## [3.15] - 2026-04-01

### Added
- Add configurable invoice template.
- Add form to modify car-driver cache.
- Show vehicle volume in select box.
- Add sub-headers to setup form.

### Changed
- Reorder vehicle form fields to be consistent with column order in listing.

### Fixed
- Add missing LockedTable caption translation.

### Security

## [3.14] - 2026-03-30

### Added
- Add recipe pricelists with price matrix UI, replacing single per-recipe price.
- Add per-user can_produce permission.

### Changed
- Show x2/x3/x4 repeated print buttons only on delivery sheets and invoices.
- Filter pump order selectbox to active orders from last 30 days.
- Internally rename CompanySurcharge to Surcharge.
- Internally rename Price to SpecialPrice.

### Fixed
- Persist without_water setting across program restarts.

## [3.13] - 2026-03-22

### Added
- Show tonnes in production printout and export.
- "Group by delivery" option for production printout and export.

### Fixed
- Bind test server to localhost.

## [3.12] - 2026-03-19

### Added
- Email fields for Setup (company and facility/provozovna) and ConstructionSite models.

### Changed
- Upgrade peewee to 4.0.2 and peewee-migrate to 1.15.0.

### Fixed
- Only set k_value/k_ratio on Addition-type OrderMaterials.

## [3.11] - 2026-03-13

### Fixed
- Fix database migrations not found when running PyInstaller-packaged binary.
- Fix populate_db using old 'customer' kwarg instead of renamed 'customer_name'.

## [3.10] - 2026-03-12 [YANKED]

### Added
- Add suppress_print flag to Recipe model.
- Add production enable feature with challenge-based manual override.

### Changed
- Use AtxWSGIServer/AtxWSGIRequestHandler from atxpylib.web and update atxpylib.

### Fixed
- Fix SmartSelectBox losing selection on redraw.
- Fix SmartSelectBox double-click bug when focus changes.
- Fix frontend tests failing when run from non-Prague timezone.

## [3.9] - 2026-03-05 [YANKED]

### Fixed
- Fix compilation.

## [3.8] - 2026-03-04 [YANKED]

### Added
- Add support for weather display.
- Add ConstructionSiteNumber field (for KDX).
- Add facility code to order communication file.
- Add vehicle registration (SPZ) filter to production printout.
- Add operator to zapa delivery sheet.
- Write operator to order file.
- Add bes and miroads logos.
- Parse DistanceJobSite from KDX .ord files and save to ConstructionSite.distance.

### Changed
- Modernize compilation.
- Update zapa delivery sheet templates.
- Update dependencies and atxpylib.
- Make INI file tests case-sensitive.

### Fixed
- Prevent InputField from losing user input on external redraw.
- Fix setMithrilQueryString losing params due to stale route.
- Fix frontend tests failing when system timezone differs from app timezone.
- Fix socket leak in test server port discovery.
- Fix obsolete atxd300 import parameter in manual.

## [3.7] - 2026-01-14

### Added
- Add DriverName and ContractID to Order communication file section.

### Changed
- Update dependencies.
- Move audit from Makefile to Justfile.

## [3.6] - 2025-11-25

### Added
- Optionally show produced volume for contract in expedition form.

### Fixed
- Fix production in non-standby mode.

## [3.5] - 2025-11-17

### Added
- Add initial code to enable production in standby mode.

### Changed
- Add mypy to Justfile.

## [3.4] - 2025-10-27

### Fixed
- Fix crash on continuous delivery handling when deleting order before production.

## [3.3] - 2025-10-23

### Added
- Add separate print event setting for continuous mode.

### Changed
- Unify/simplify production overview selection form.
- Auto-print code cleanups.
- Update dependencies.

## [3.2] - 2025-10-20

### Changed
- Standby mode: ignore temporary files.
- Minor auto-print sequence optimization.

## [3.1] - 2025-10-16

### Fixed
- Fixes after merging bridges refactoring.

### Removed
- Remove orphaned bridges.py file after refactoring to package structure.

## [3.0] - 2025-10-16

### Added
- Add Baris bridge integration with exponential backoff.
- Add standby (listen) mode replacing most of KDX bridge logic.
- Add density field to Material and OrderMaterial.
- Add delivery sheet templates: bezedos, staving, more eurovia variants.
- Add pre-computed date/time human-readable fields to delivery sheets.
- Add preferred table ordering.
- Add better error messages to templates.

### Changed
- Rename material amount to weight, remove unit field.
- Rename listen mode to standby mode.
- Refactor bridges.py into a package.
- Migrate from quitfile to filesig.
- Move .coveragerc into pyproject.toml.
- Change density unit to kg/l.
- Disallow returned_volume for continuous orders.
- Round volume of continuous orders when duplicating.
- Better listing of materials with rounding in batch listing.
- Update dependencies.

### Fixed
- Fix keystroke loss in filter input when typing fast.
- Fix automatic printing error when in continuous mode.
- Fix order._distance_driven_extra and KVD distance_driven in printout.
- Fix grand_total in batch protocol.

### Removed
- Remove RegistrationNumberField.
- Remove reload_config.

## [2.7] - 2025-08-23

### Added
- Add BATCH_COMPLETED printer event, allow selecting for continuous_mode.

### Changed
- Refactor order status change code and input file processing.
- Always have a delivery prepared, not just for batch production.
- Use calc_water_cement_contact_t for all delivery sheets.
- Update dependencies.

### Fixed
- Fix payment type cash displaying as not_set.
- Fix delivery creation in minidisp import.

## [2.6] - 2025-08-18

### Added
- Add grand total to batch protocol.
- Split importer.py into modules, finish import from atxd300.

### Changed
- More logging when importing customers from atxd300.
- Raise if not all DBF fields were used.

### Fixed
- Fix batch_protocol.html layout.

## [2.5] - 2025-08-15

### Changed
- Use calc_water_cement_contact_t for KVD delivery sheets.

## [2.4] - 2025-08-13

### Fixed
- Fix automatic print of single-batch orders.
- Do not send useless requests to atxdispatchprint.

## [2.3] - 2025-08-11

### Added
- Add concrete price percentage multiplier surcharge.
- Translate tabular export headers.

### Changed
- Duplicate driver on order duplication.
- Add actual workability time to eurovia delivery sheets.
- Reorder fields in production overview form.
- Don't show total batch count when continuous_mode.
- Eurovia delivery sheet updates.
- Update dependencies and atxpylib.

### Fixed
- Fix misleading title in Recipe.copy.

## [2.2] - 2025-07-30

### Changed
- Add stamp to eurovia delivery sheet templates.

## [2.1] - 2025-07-30

### Added
- Add prefetch mechanism.
- Add volume to deliveries listing.
- Show continuous_mode in listing if enabled.

### Changed
- Refactor PaymentType and OrderStatus enums.
- Generalize car_driver/pump_driver handling.
- Allow to "forget" car_driver and pump_driver association by selecting "none" driver.
- Order material groups in material selectbox.
- Let user partially control delivery sheet printing for continuous mode.
- Split eurovia delivery sheet templates to half-a4 and landscape-a4 versions.
- Properly format delivery volume column.
- Do not create .ord files for fully recycled orders.

### Fixed
- Fix Delivery.Driver history fields not saving new data.
- Fix wrong names and types for car_driver/pump_driver tables.
- Fix order_delivery form header, show auto_number explicitly.

## [2.0] - 2025-07-25

### Added
- Add remote printing functionality with event stream for print queue.
- Add optional local print mode.
- Add remote printing to pump order.
- Read Production_Start section from .std file to determine actual continuous mode.

### Changed
- Refactor comms files processing.
- Use Manager-provided ContinuousMode.
- Use lang='cs' in printouts when no language provided.
- Improve Enums.
- Update dependencies.

## [1.73] - 2025-07-23

### Changed
- Small fixups for KVD overlay sheet.

## [1.72] - 2025-07-21

### Fixed
- Fix crash on order cancellation with non-zero returned volume.

## [1.71] - 2025-07-09

### Added
- Add Recalc form button to EditOrder form.
- Allow Order unit_price and transport editing.

### Changed
- Make uv the implicit Python and venv runner.
- Remove unused dev dependencies and endpoint.
- Update dependencies.

### Fixed
- Fix edit order tests sometimes failing.

## [1.70] - 2025-06-30

### Added
- Add Order recycled volume field.
- Add 3min +/-10s to water-cement contact time for batch-less deliveries.

### Changed
- Export CSV in cs locale.
- Updates for faked cement-water contact value for eurovia delivery sheets.
- Update dependencies.

### Fixed
- Fix no-break space issue.
- Fix CSV tests.
- Fix KeyboardInterrupt handling in main loop.

## [1.69] - 2025-06-25

### Added
- Add customer logo images.

### Changed
- Move delivery sheet and logo setting from config file to Setup.
- Change phone from company to facility for eurovia delivery sheet.
- Reorder menu.
- Update dependencies.

## [1.68] - 2025-06-09

### Added
- Add User.phone field.

### Changed
- Shrink listings.
- Improve search text normalization.
- Disable auth for /print endpoint.
- Fit eurovia a5 sheet onto one paper.
- Update dependencies.

### Fixed
- Fix material longname extra having space as prefix.
- Fix cache hit ignore.
- Fix typing errors for new mypy.

## [1.67] - 2025-06-09

### Added
- Add tabular export to production overview.
- Print grouped info on all rows in production overview.

## [1.66] - 2025-06-06

### Changed
- Update delivery sheet template for eurovia SBM4000.

## [1.65] - 2025-06-05

### Added
- Pre-fill comment when contract is selected in expedition.

## [1.64] - 2025-05-19

### Added
- Add missing tests for Delivery.driver.

### Changed
- Update dependencies.
- More KVD delivery sheet updates.
- Hide Expeditions temperature if not module delivery sheets.
- Merge KVD printout branch.

### Fixed
- Fix wrong default for Order.payment_type.

## [1.63] - 2025-05-16

### Added
- Add driver field to order+delivery edit form.
- Add VehicleDriver tests.
- Add driver pre-fill to expeditions and new pump order.

### Changed
- Update KVD delivery sheet to new layout.
- Refactor Field locators in tests.
- Update types.
- Uncouple driver from vehicle.
- Show/hide driver details in listings.

### Fixed
- Fix invalid attribute access in templates.
- Small Expeditions cache refactor.
- Optimize lookups in cache code.
- Make cache behave less surprisingly.
- Use list where appropriate.

## [1.62] - 2025-05-15

### Added
- Add a way to import Order.customer and Order.construction_site from minidisp.
- Add Justfile vendor task.

### Changed
- Update dependencies.
- Update vendored JS libraries.
- Update pre-commit hooks.
- Properly size Plus buttons.

### Fixed
- Minidisp importer: be more verbose with errors, use unix style paths, unify naming.
- Minor optimization for importer.
- Prevent input of modified keys to SlimSelect.

### Security
- Update vulnerable flask version.

## [1.61] - 2025-05-07

### Changed
- Order Materials listing by name.

## [1.60] - 2025-05-06

### Added
- Add contract to Order edit if the Order was created via contract.

### Changed
- Reorder Order listing columns.
- Properly hide payment type in Order listing if module prices is not enabled.

## [1.59] - 2025-05-06

### Changed
- Raise eurovia continuous delivery sheet print margin.
- Decouple /prices from module_contract in menu.
- Resolve payment_type todos.

## [1.58] - 2025-05-06

### Changed
- Unbold ufi code.

### Fixed
- Implement delivery_sheet_eurovia_continuous_a5.html changes requested by certification.
- Minor fixes for delivery_sheet_eurovia_continuous_a5.html.

## [1.57] - 2025-04-30

### Fixed
- Be more strict when checking for special URL.
- Fix flaky test.
- Fix Loader count falling below 0.
- Correct super call.
- Use new delivery sheet setup name.

## [1.56] - 2025-04-29

### Changed
- Do not show Prices listing if not module_prices.
- Do not show recipe.price in selectbox if not module_prices.

### Fixed
- Show error when unable to delete an instance.

## [1.55] - 2025-04-29

### Changed
- Add hover effect on tables (listings).
- Move Recipe.price to a different spot in form.
- Merge volume-weight branch.
- Merge fast-cached-spinner branch.

---

**Note:** This changelog records all notable changes made to the project. Earlier versions are not included in this initial changelog but may be added in future updates.
