| 1 |
import { models } from "@web/../tests/web_test_helpers"; |
| 2 |
|
| 3 |
export class PosConfig extends models.ServerModel { |
| 4 |
_name = "pos.config"; |
| 5 |
|
| 6 |
notify_synchronisation(session_id, device_identifier, records = {}) { |
| 7 |
return true; |
| 8 |
} |
| 9 |
|
| 10 |
_load_pos_data_fields() { |
| 11 |
return []; |
| 12 |
} |
| 13 |
|
| 14 |
register_new_device_identifier(self) { |
| 15 |
return { |
| 16 |
device_identifier: 1, |
| 17 |
}; |
| 18 |
} |
| 19 |
|
| 20 |
read_config_open_orders(configId) { |
| 21 |
// We can read everything since its only related to the current test. |
| 22 |
const orderIds = this.env["pos.order"].search_read([], ["id"]).map((order) => order.id); |
| 23 |
return { |
| 24 |
deleted_record_ids: {}, |
| 25 |
dynamic_records: { |
| 26 |
...this.env["pos.order"].read_pos_data(orderIds, [], configId), |
| 27 |
}, |
| 28 |
}; |
| 29 |
} |
| 30 |
|
| 31 |
get_next_order_refs(device_identifier = 0) { |
| 32 |
const sequence_num = ++this._orderRef; |
| 33 |
|
| 34 |
const now = new Date(); |
| 35 |
const YY = now.getFullYear().toString().slice(-2); |
| 36 |
const LL = String(device_identifier % 100); |
| 37 |
const SSS = String(this.id); |
| 38 |
const F = 0; |
| 39 |
const OOOO = String(sequence_num).padStart(6, "0"); |
| 40 |
const order_ref = `${YY}${LL}-${SSS}-${F}${OOOO}`; |
| 41 |
|
| 42 |
return [order_ref, sequence_num, String(sequence_num).padStart(3, "0")]; |
| 43 |
} |
| 44 |
|
| 45 |
_load_pos_data_read(data) { |
| 46 |
data[0]["_partner_commercial_fields"] = []; |
| 47 |
data[0]["_server_version"] = "18.3+e"; |
| 48 |
data[0]["_base_url"] = "http://localhost:4444"; |
| 49 |
data[0]["_data_server_date"] = "2025-07-03 12:40:15"; |
| 50 |
data[0]["_has_cash_move_perm"] = true; |
| 51 |
data[0]["_has_available_products"] = true; |
| 52 |
data[0]["_pos_special_products_ids"] = []; |
| 53 |
return data; |
| 54 |
} |
| 55 |
|
| 56 |
_records = [ |
| 57 |
{ |
| 58 |
id: 1, |
| 59 |
display_name: "Hoot", |
| 60 |
access_token: "test_access_token", |
| 61 |
name: "Hoot", |
| 62 |
printer_ids: [1], |
| 63 |
is_order_printer: true, |
| 64 |
is_installed_account_accountant: true, |
| 65 |
picking_type_id: 9, |
| 66 |
journal_id: 1, |
| 67 |
invoice_journal_id: 1, |
| 68 |
currency_id: 1, |
| 69 |
iface_cashdrawer: false, |
| 70 |
iface_electronic_scale: false, |
| 71 |
iface_print_via_proxy: false, |
| 72 |
iface_scan_via_proxy: false, |
| 73 |
iface_big_scrollbars: false, |
| 74 |
iface_print_auto: false, |
| 75 |
iface_print_skip_screen: true, |
| 76 |
iface_tax_included: "total", |
| 77 |
iface_available_categ_ids: [], |
| 78 |
customer_display_bg_img: false, |
| 79 |
customer_display_bg_img_name: false, |
| 80 |
restrict_price_control: false, |
| 81 |
is_margins_costs_accessible_to_every_user: false, |
| 82 |
cash_control: true, |
| 83 |
set_maximum_difference: false, |
| 84 |
receipt_header: false, |
| 85 |
receipt_footer: false, |
| 86 |
basic_receipt: false, |
| 87 |
proxy_ip: false, |
| 88 |
active: true, |
| 89 |
uuid: "6f9034bb-faf8-4875-b216-dafb78982918", |
| 90 |
session_ids: [1], |
| 91 |
current_session_id: 1, |
| 92 |
current_session_state: "opening_control", |
| 93 |
number_of_rescue_session: 0, |
| 94 |
last_session_closing_cash: 0.0, |
| 95 |
last_session_closing_date: false, |
| 96 |
pos_session_username: "Administrator", |
| 97 |
pos_session_state: "opening_control", |
| 98 |
pos_session_duration: "0", |
| 99 |
pricelist_id: false, |
| 100 |
available_pricelist_ids: [1], |
| 101 |
company_id: 250, |
| 102 |
group_pos_manager_id: false, |
| 103 |
group_pos_user_id: false, |
| 104 |
iface_tipproduct: false, |
| 105 |
tip_product_id: 1, |
| 106 |
fiscal_position_ids: [], |
| 107 |
default_fiscal_position_id: false, |
| 108 |
default_bill_ids: [], |
| 109 |
use_pricelist: true, |
| 110 |
use_presets: true, |
| 111 |
default_preset_id: 1, |
| 112 |
available_preset_ids: [1, 2], |
| 113 |
tax_regime_selection: false, |
| 114 |
limit_categories: false, |
| 115 |
module_pos_restaurant: false, |
| 116 |
module_pos_avatax: false, |
| 117 |
module_pos_discount: false, |
| 118 |
module_pos_appointment: false, |
| 119 |
is_posbox: false, |
| 120 |
is_header_or_footer: false, |
| 121 |
module_pos_hr: false, |
| 122 |
amount_authorized_diff: 0.0, |
| 123 |
payment_method_ids: [2, 1], |
| 124 |
company_has_template: true, |
| 125 |
current_user_id: 2, |
| 126 |
other_devices: false, |
| 127 |
rounding_method: false, |
| 128 |
cash_rounding: false, |
| 129 |
only_round_cash_method: false, |
| 130 |
has_active_session: true, |
| 131 |
manual_discount: true, |
| 132 |
ship_later: false, |
| 133 |
warehouse_id: false, |
| 134 |
route_id: false, |
| 135 |
picking_policy: "direct", |
| 136 |
auto_validate_terminal_payment: true, |
| 137 |
trusted_config_ids: [], |
| 138 |
show_product_images: true, |
| 139 |
show_category_images: true, |
| 140 |
note_ids: [], |
| 141 |
module_pos_sms: false, |
| 142 |
is_closing_entry_by_product: false, |
| 143 |
order_edit_tracking: false, |
| 144 |
last_data_change: "2025-07-03 14:35:55", |
| 145 |
fallback_nomenclature_id: false, |
| 146 |
create_date: "2025-07-03 12:40:00", |
| 147 |
write_date: "2025-07-03 14:35:55", |
| 148 |
epson_printer_ip: false, |
| 149 |
use_fast_payment: true, |
| 150 |
fast_payment_method_ids: [1], |
| 151 |
}, |
| 152 |
]; |
| 153 |
} |