diff --git a/common/proto/accounting.proto b/common/proto/accounting.proto index 55df4b19..bc476a65 100644 --- a/common/proto/accounting.proto +++ b/common/proto/accounting.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package komp_ac.accounting; -import "exchange_rates.proto"; +import "common.proto"; // Mutable informational journals. A journal may contain only debits, only // credits, or any non-zero balance. Balance is reported but never enforced. @@ -170,9 +170,9 @@ message JournalLineInput { string account = 2; string amount = 3; string description = 4; - // Empty uses the profile provider's previous publication. Set this per line when the - // accountant needs a different rule, a saved custom rate, or a one-off rate. - optional komp_ac.exchange_rates.ExchangeRateSelection exchange_rate_selection = 5; + // Omit to use the selected conversion module's posting policy. + // Explicit options are interpreted only by their named module. + optional komp_ac.common.CurrencyConversionOptions conversion_options = 5; } message CloseJournalRequest { @@ -325,6 +325,7 @@ message JournalLine { string original_amount = 16; string original_currency = 17; int64 conversion_evidence_id = 18; + int64 conversion_table_definition_id = 19; } message Journal { diff --git a/common/proto/common.proto b/common/proto/common.proto index 073e01c5..cf40321e 100644 --- a/common/proto/common.proto +++ b/common/proto/common.proto @@ -9,3 +9,9 @@ message CountResponse { message PositionRequest { int64 position = 1; } + +// Options interpreted only by the named currency-conversion module. +message CurrencyConversionOptions { + string module_id = 1; + string options_json = 2; +} diff --git a/common/proto/tables_data.proto b/common/proto/tables_data.proto index 49919fda..bd8c6613 100644 --- a/common/proto/tables_data.proto +++ b/common/proto/tables_data.proto @@ -3,7 +3,6 @@ syntax = "proto3"; package komp_ac.tables_data; import "common.proto"; -import "exchange_rates.proto"; import "google/protobuf/struct.proto"; // Read and write row data for user-defined tables inside profiles (schemas). @@ -166,7 +165,7 @@ map data = 3; message PostAccountingTableDataRequest { PostTableDataRequest row = 1; - komp_ac.exchange_rates.ExchangeRateSelection exchange_rate_selection = 2; + komp_ac.common.CurrencyConversionOptions conversion_options = 2; } // Insert response. @@ -272,7 +271,7 @@ message PutTableDataRequest { message PutAccountingTableDataRequest { PutTableDataRequest update = 1; - komp_ac.exchange_rates.ExchangeRateSelection exchange_rate_selection = 2; + komp_ac.common.CurrencyConversionOptions conversion_options = 2; bool confirmed = 3; repeated string expected_affected_profiles = 4; } diff --git a/common/src/proto/descriptor.bin b/common/src/proto/descriptor.bin index 001cb632..b4a81cb0 100644 Binary files a/common/src/proto/descriptor.bin and b/common/src/proto/descriptor.bin differ diff --git a/common/src/proto/komp_ac.accounting.rs b/common/src/proto/komp_ac.accounting.rs index ea5f7d50..4707807e 100644 --- a/common/src/proto/komp_ac.accounting.rs +++ b/common/src/proto/komp_ac.accounting.rs @@ -72,11 +72,11 @@ pub struct JournalLineInput { pub amount: ::prost::alloc::string::String, #[prost(string, tag = "4")] pub description: ::prost::alloc::string::String, - /// Empty uses the profile provider's previous publication. Set this per line when the - /// accountant needs a different rule, a saved custom rate, or a one-off rate. + /// Omit to use the selected conversion module's posting policy. + /// Explicit options are interpreted only by their named module. #[prost(message, optional, tag = "5")] - pub exchange_rate_selection: ::core::option::Option< - super::exchange_rates::ExchangeRateSelection, + pub conversion_options: ::core::option::Option< + super::common::CurrencyConversionOptions, >, } #[derive(serde::Serialize, serde::Deserialize)] @@ -314,6 +314,8 @@ pub struct JournalLine { pub original_currency: ::prost::alloc::string::String, #[prost(int64, tag = "18")] pub conversion_evidence_id: i64, + #[prost(int64, tag = "19")] + pub conversion_table_definition_id: i64, } #[derive(serde::Serialize, serde::Deserialize)] #[derive(Clone, PartialEq, ::prost::Message)] diff --git a/common/src/proto/komp_ac.common.rs b/common/src/proto/komp_ac.common.rs index 211fa638..f037304d 100644 --- a/common/src/proto/komp_ac.common.rs +++ b/common/src/proto/komp_ac.common.rs @@ -14,3 +14,12 @@ pub struct PositionRequest { #[prost(int64, tag = "1")] pub position: i64, } +/// Options interpreted only by the named currency-conversion module. +#[derive(serde::Serialize, serde::Deserialize)] +#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)] +pub struct CurrencyConversionOptions { + #[prost(string, tag = "1")] + pub module_id: ::prost::alloc::string::String, + #[prost(string, tag = "2")] + pub options_json: ::prost::alloc::string::String, +} diff --git a/common/src/proto/komp_ac.tables_data.rs b/common/src/proto/komp_ac.tables_data.rs index 4ecd6908..6a190133 100644 --- a/common/src/proto/komp_ac.tables_data.rs +++ b/common/src/proto/komp_ac.tables_data.rs @@ -54,8 +54,8 @@ pub struct PostAccountingTableDataRequest { #[prost(message, optional, tag = "1")] pub row: ::core::option::Option, #[prost(message, optional, tag = "2")] - pub exchange_rate_selection: ::core::option::Option< - super::exchange_rates::ExchangeRateSelection, + pub conversion_options: ::core::option::Option< + super::common::CurrencyConversionOptions, >, } /// Insert response. @@ -187,8 +187,8 @@ pub struct PutAccountingTableDataRequest { #[prost(message, optional, tag = "1")] pub update: ::core::option::Option, #[prost(message, optional, tag = "2")] - pub exchange_rate_selection: ::core::option::Option< - super::exchange_rates::ExchangeRateSelection, + pub conversion_options: ::core::option::Option< + super::common::CurrencyConversionOptions, >, #[prost(bool, tag = "3")] pub confirmed: bool, diff --git a/server b/server index 1da33d65..f00542d0 160000 --- a/server +++ b/server @@ -1 +1 @@ -Subproject commit 1da33d65622004d0005b672a7b67b2f69d7c9492 +Subproject commit f00542d009fdb32b1f9c1426ec0522cfe52ae28e