currency per column in table definition

This commit is contained in:
Priec
2026-08-03 15:48:21 +02:00
parent 023f8c9dcb
commit 050f93e1fd
16 changed files with 87 additions and 105 deletions

View File

@@ -28,8 +28,6 @@ pub(crate) struct BuilderForm {
pub accounting_currency: String,
#[serde(default)]
pub table_name: String,
#[serde(default)]
pub base_currency: String,
// The pending column being described in the input panel.
#[serde(default)]
@@ -46,6 +44,8 @@ pub(crate) struct BuilderForm {
pub column_quantity_ledger_input: String,
#[serde(default)]
pub column_rounding_input: String,
#[serde(default)]
pub column_currency_input: String,
// One entry per already-added column, in order.
#[serde(default)]
@@ -58,6 +58,8 @@ pub(crate) struct BuilderForm {
pub column_quantity_ledger: Vec<String>,
#[serde(default)]
pub column_rounding: Vec<String>,
#[serde(default)]
pub column_currencies: Vec<String>,
// One entry per link target offered by the profile, in order.
#[serde(default)]
@@ -92,6 +94,7 @@ impl BuilderForm {
self.column_indexed.len(),
self.column_quantity_ledger.len(),
self.column_rounding.len(),
self.column_currencies.len(),
]
.into_iter()
.min()
@@ -108,6 +111,7 @@ impl BuilderForm {
} else {
MoneyMode::Exact
},
currency: self.column_currencies[index].clone(),
})
.collect::<Vec<_>>();
@@ -138,7 +142,6 @@ impl BuilderForm {
creating_new_profile,
accounting_currency: self.accounting_currency.clone(),
table_name: self.table_name.clone(),
base_currency: self.base_currency.clone(),
column_name_input: self.column_name_input.clone(),
column_type_input: self.column_type_input.clone(),
temporal_type_input: self.temporal_type_input.clone(),
@@ -146,6 +149,7 @@ impl BuilderForm {
column_indexing_input: self.column_indexing_input.clone(),
column_quantity_ledger_input: self.column_quantity_ledger_input.clone(),
column_rounding_input: self.column_rounding_input.clone(),
column_currency_input: self.column_currency_input.clone(),
columns,
links,
row_display_columns,
@@ -231,6 +235,7 @@ mod tests {
column_indexed: vec!["yes".into(), "no".into()],
column_quantity_ledger: vec!["no".into(), "no".into()],
column_rounding: vec!["exact".into(), "half-up".into()],
column_currencies: vec![String::new(), "EUR".into()],
link_tables: vec!["customer".into(), "project".into()],
link_modes: vec!["required".into(), "none".into()],
row_display_columns: vec!["number".into()],