Costs module

class Costs.CostsController(tab_widget, costs_ui, settings)

Bases: object

Controls the Costs tab

Parameters
  • costs_ui (Ui_costs_tab) – the UI for the costs_widget

  • settings (SettingsModel) – the user’s settings

clear_cost_fields()

Empties the costs fields

static cost_results_to_dicts(cost_results, report_type_name)
database_updated(code)

Invoked when the database is updated

Parameters

code (int) – the exit code of the update

delete_current_cost()

Deletes the selected cost data

fill_names(only_get_costs_names=False)

Fills the name field combobox

static get_costs(report_type, vendor_name=None, name=None)

Fills the costs fields with data from the database

Return type

list

static get_delete_sql_data(begin_date, end_date, report_type, name, vendor)
Return type

list

static get_insert_sql_values(begin_date, end_date, report_type, name, vendor, cost_in_original_currency, original_currency, cost_in_local_currency, cost_in_local_currency_with_tax)
Return type

list

static get_names(report_type, vendor_name=None)
insert_cost()

Inserts cost data

load_currency_list()

Updates the original currency combobox

load_vendor_list(vendors)

Updates the vendor list combobox

Parameters

vendors (Sequence[Vendor]) – the new list of vendors

on_available_cost_clicked(index)

Invoked when a cost is selected

on_cost_in_local_currency_changed()

Invoked when the cost in local currency parameter changes

on_cost_in_local_currency_with_tax_changed()

Invoked when the cost in local currency with tax parameter changes

on_cost_in_original_currency_changed()

Invoked when the cost in original currency parameter changes

on_export_clicked()

Invoked when the export button is clicked, exports cost data

on_import_clicked()

Invoked when the import button is clicked, imports cost data

on_name_parameter_changed()

Invoked when the name field parameter changes

on_original_currency_changed()

Invoked when the original currency parameter changes

on_refresh_clicked()

Invoked when the refresh button is clicked

on_report_parameter_changed()

Invoked when the report parameter changes

on_vendor_parameter_changed()

Invoked when the vendor parameter changes

populate_available_costs()

Shows available costs for the current selection

populate_cost_fields()

Populates the cost edit fields with selected cost data

update_costs()

Updates the class with latest cost data

update_settings(settings)

Invoked when the settings are saved

Parameters

settings (SettingsModel) – the new settings