accounts renamed to ledger_accounts from now on
This commit is contained in:
@@ -1040,7 +1040,7 @@ mod tests {
|
||||
let error = draft.validate(crate::i18n::Locale::default()).unwrap_err();
|
||||
assert!(error.contains("38 characters"), "{error}");
|
||||
|
||||
draft.table_name = "accounts".to_string();
|
||||
draft.table_name = "ledger_accounts".to_string();
|
||||
assert!(draft.validate(crate::i18n::Locale::default()).is_err());
|
||||
draft.table_name = "general_ledger".to_string();
|
||||
assert!(draft.validate(crate::i18n::Locale::default()).is_err());
|
||||
|
||||
@@ -98,7 +98,7 @@ pub(crate) async fn load_page(
|
||||
.into_iter()
|
||||
// The profile's ledger accounts are not a link target of their own: an
|
||||
// ACCOUNTING column is how a row is posted to one.
|
||||
.filter(|table| table.name != crate::schema::ACCOUNTS_TABLE)
|
||||
.filter(|table| table.name != crate::schema::LEDGER_ACCOUNTS_TABLE)
|
||||
.map(|table| RelationTableOption {
|
||||
name: table.name,
|
||||
global: table.global,
|
||||
|
||||
@@ -349,7 +349,7 @@ impl TableDefinitionPageState {
|
||||
/// A table cannot link to itself, and the chart of accounts is reached
|
||||
/// through an ACCOUNTING row rather than through a link of one's own.
|
||||
fn eligible_link_target(&self, table: &TableSummary) -> bool {
|
||||
table.name != self.selection.table && table.name != crate::schema::ACCOUNTS_TABLE
|
||||
table.name != self.selection.table && table.name != crate::schema::LEDGER_ACCOUNTS_TABLE
|
||||
}
|
||||
|
||||
pub(crate) fn global_link_target_tables(&self) -> Vec<&str> {
|
||||
|
||||
@@ -268,8 +268,8 @@ mod tests {
|
||||
profile: "billing".to_string(),
|
||||
table: "invoice".to_string(),
|
||||
},
|
||||
tables: vec![table("invoice", "dynamic"), table("accounts", "system")],
|
||||
link_targets: vec![table("invoice", "dynamic"), table("accounts", "system")],
|
||||
tables: vec![table("invoice", "dynamic"), table("ledger_accounts", "system")],
|
||||
link_targets: vec![table("invoice", "dynamic"), table("ledger_accounts", "system")],
|
||||
detail: Some(TableDetailView {
|
||||
id: 7,
|
||||
row_version: 1,
|
||||
@@ -398,7 +398,7 @@ mod tests {
|
||||
#[test]
|
||||
fn a_system_table_gets_no_write_form() {
|
||||
let mut state = page();
|
||||
state.selection.table = "accounts".to_string();
|
||||
state.selection.table = "ledger_accounts".to_string();
|
||||
|
||||
let html = render_delete_page(&state);
|
||||
assert!(!html.contains("Template error"), "{html}");
|
||||
@@ -551,7 +551,7 @@ mod tests {
|
||||
assert!(html.contains(r#"<optgroup label="System-created">"#));
|
||||
assert!(!html.contains(r#"<option value="invoice""#));
|
||||
// The chart of accounts is reached through ACCOUNTING, never linked to.
|
||||
assert!(!html.contains(r#"<option value="accounts""#));
|
||||
assert!(!html.contains(r#"<option value="ledger_accounts""#));
|
||||
}
|
||||
|
||||
/// The append screen holds a column to the same rules the builder does,
|
||||
|
||||
@@ -45,7 +45,7 @@ const PROFILE_ONLY_TYPES: [&str; 2] = [ACCOUNTING_FIELD_TYPE, ACCOUNTING_TRANSFE
|
||||
|
||||
/// The profile's chart of accounts. A row reaches it through an ACCOUNTING
|
||||
/// definition row, never through a link declared by hand.
|
||||
pub(crate) const ACCOUNTS_TABLE: &str = "accounts";
|
||||
pub(crate) const LEDGER_ACCOUNTS_TABLE: &str = "ledger_accounts";
|
||||
|
||||
const TYPE_DISPLAY_ORDER: &[&str] = &[
|
||||
"text",
|
||||
@@ -883,7 +883,7 @@ impl ColumnDraft {
|
||||
column_type: &str,
|
||||
) -> Option<String> {
|
||||
let target = link_target(column_type)?;
|
||||
if target == ACCOUNTS_TABLE {
|
||||
if target == LEDGER_ACCOUNTS_TABLE {
|
||||
return Some(crate::tr!(locale, "schema-err-account-link"));
|
||||
}
|
||||
(!self.table_name.is_empty() && target == self.table_name).then(|| {
|
||||
@@ -1232,7 +1232,7 @@ pub(crate) const RESERVED_TABLE_NAMES: [&str; 5] = [
|
||||
"general_ledger",
|
||||
"journal_lines",
|
||||
"quantity_ledger",
|
||||
ACCOUNTS_TABLE,
|
||||
LEDGER_ACCOUNTS_TABLE,
|
||||
"custom_exchange_rates",
|
||||
];
|
||||
|
||||
@@ -1626,7 +1626,7 @@ pub(crate) mod tests {
|
||||
generated_column("credit", "money", true),
|
||||
// The foreign key to the profile's accounts, which the
|
||||
// backend reports with the rest of them.
|
||||
generated_column("account", "link(accounts)", false),
|
||||
generated_column("account", "link(ledger_accounts)", false),
|
||||
],
|
||||
..compound("accounting")
|
||||
},
|
||||
@@ -2344,7 +2344,7 @@ pub(crate) mod tests {
|
||||
let mut draft = draft();
|
||||
draft.name_input = "posted_to".to_string();
|
||||
draft.type_input = "link".to_string();
|
||||
draft.link_table_input = ACCOUNTS_TABLE.to_string();
|
||||
draft.link_table_input = LEDGER_ACCOUNTS_TABLE.to_string();
|
||||
|
||||
let error = draft.add_from_inputs(crate::i18n::Locale::default()).unwrap_err();
|
||||
assert!(error.contains("built into ACCOUNTING"), "{error}");
|
||||
|
||||
Reference in New Issue
Block a user