| 1 |
import { models } from "@web/../tests/web_test_helpers"; |
| 2 |
|
| 3 |
export class ProductTemplate extends models.ServerModel { |
| 4 |
_name = "product.template"; |
| 5 |
|
| 6 |
_load_pos_data_fields() { |
| 7 |
return [ |
| 8 |
"id", |
| 9 |
"display_name", |
| 10 |
"standard_price", |
| 11 |
"categ_id", |
| 12 |
"pos_categ_ids", |
| 13 |
"taxes_id", |
| 14 |
"barcode", |
| 15 |
"name", |
| 16 |
"list_price", |
| 17 |
"is_favorite", |
| 18 |
"default_code", |
| 19 |
"to_weight", |
| 20 |
"uom_id", |
| 21 |
"description_sale", |
| 22 |
"description", |
| 23 |
"tracking", |
| 24 |
"type", |
| 25 |
"service_tracking", |
| 26 |
"is_storable", |
| 27 |
"write_date", |
| 28 |
"color", |
| 29 |
"pos_sequence", |
| 30 |
"available_in_pos", |
| 31 |
"attribute_line_ids", |
| 32 |
"active", |
| 33 |
"image_128", |
| 34 |
"combo_ids", |
| 35 |
"product_variant_ids", |
| 36 |
"public_description", |
| 37 |
"pos_optional_product_ids", |
| 38 |
"sequence", |
| 39 |
"product_tag_ids", |
| 40 |
]; |
| 41 |
} |
| 42 |
|
| 43 |
_records = [ |
| 44 |
{ |
| 45 |
id: 1, |
| 46 |
display_name: "TIP", |
| 47 |
standard_price: 0, |
| 48 |
categ_id: false, |
| 49 |
pos_categ_ids: [], |
| 50 |
taxes_id: [], |
| 51 |
barcode: false, |
| 52 |
name: "TIP", |
| 53 |
list_price: 100, |
| 54 |
is_favorite: false, |
| 55 |
default_code: false, |
| 56 |
to_weight: false, |
| 57 |
uom_id: 1, |
| 58 |
description_sale: false, |
| 59 |
description: false, |
| 60 |
tracking: "none", |
| 61 |
type: "consu", |
| 62 |
service_tracking: "no", |
| 63 |
is_storable: false, |
| 64 |
write_date: "2025-07-03 13:04:14", |
| 65 |
color: 0, |
| 66 |
pos_sequence: 5, |
| 67 |
available_in_pos: true, |
| 68 |
attribute_line_ids: [], |
| 69 |
active: true, |
| 70 |
image_128: false, |
| 71 |
combo_ids: [], |
| 72 |
product_variant_ids: [1], |
| 73 |
public_description: false, |
| 74 |
pos_optional_product_ids: [], |
| 75 |
sequence: 1, |
| 76 |
product_tag_ids: [], |
| 77 |
}, |
| 78 |
{ |
| 79 |
id: 5, |
| 80 |
display_name: "TEST", |
| 81 |
standard_price: 0, |
| 82 |
categ_id: false, |
| 83 |
pos_categ_ids: [1], |
| 84 |
taxes_id: [1], |
| 85 |
barcode: false, |
| 86 |
name: "TEST", |
| 87 |
list_price: 100, |
| 88 |
is_favorite: false, |
| 89 |
default_code: false, |
| 90 |
to_weight: false, |
| 91 |
uom_id: 1, |
| 92 |
description_sale: false, |
| 93 |
description: false, |
| 94 |
tracking: "none", |
| 95 |
type: "consu", |
| 96 |
service_tracking: "no", |
| 97 |
is_storable: false, |
| 98 |
write_date: "2025-07-03 13:04:14", |
| 99 |
color: 0, |
| 100 |
pos_sequence: 5, |
| 101 |
available_in_pos: true, |
| 102 |
attribute_line_ids: [], |
| 103 |
active: true, |
| 104 |
image_128: false, |
| 105 |
combo_ids: [], |
| 106 |
product_variant_ids: [5], |
| 107 |
public_description: false, |
| 108 |
pos_optional_product_ids: [], |
| 109 |
sequence: 1, |
| 110 |
product_tag_ids: [], |
| 111 |
}, |
| 112 |
{ |
| 113 |
id: 6, |
| 114 |
display_name: "TEST 2", |
| 115 |
standard_price: 0, |
| 116 |
categ_id: false, |
| 117 |
pos_categ_ids: [2], |
| 118 |
taxes_id: [2], |
| 119 |
barcode: false, |
| 120 |
name: "TEST 2", |
| 121 |
list_price: 100, |
| 122 |
is_favorite: false, |
| 123 |
default_code: false, |
| 124 |
to_weight: false, |
| 125 |
uom_id: 1, |
| 126 |
description_sale: false, |
| 127 |
description: false, |
| 128 |
tracking: "none", |
| 129 |
type: "consu", |
| 130 |
service_tracking: "no", |
| 131 |
is_storable: false, |
| 132 |
write_date: "2025-07-03 13:04:14", |
| 133 |
color: 0, |
| 134 |
pos_sequence: 5, |
| 135 |
available_in_pos: true, |
| 136 |
attribute_line_ids: [], |
| 137 |
active: true, |
| 138 |
image_128: false, |
| 139 |
combo_ids: [], |
| 140 |
product_variant_ids: [6], |
| 141 |
public_description: false, |
| 142 |
pos_optional_product_ids: [], |
| 143 |
sequence: 1, |
| 144 |
product_tag_ids: [], |
| 145 |
}, |
| 146 |
{ |
| 147 |
id: 7, |
| 148 |
display_name: "Product combo", |
| 149 |
standard_price: 0, |
| 150 |
categ_id: false, |
| 151 |
pos_categ_ids: [2], |
| 152 |
taxes_id: [2], |
| 153 |
barcode: false, |
| 154 |
name: "Product combo", |
| 155 |
list_price: 100, |
| 156 |
is_favorite: false, |
| 157 |
default_code: false, |
| 158 |
to_weight: false, |
| 159 |
uom_id: 1, |
| 160 |
description_sale: false, |
| 161 |
description: false, |
| 162 |
tracking: "none", |
| 163 |
type: "combo", |
| 164 |
service_tracking: "no", |
| 165 |
is_storable: false, |
| 166 |
write_date: "2025-07-03 13:04:14", |
| 167 |
color: 0, |
| 168 |
pos_sequence: 5, |
| 169 |
available_in_pos: true, |
| 170 |
attribute_line_ids: [], |
| 171 |
active: true, |
| 172 |
image_128: false, |
| 173 |
combo_ids: [1, 2], |
| 174 |
product_variant_ids: [7], |
| 175 |
public_description: false, |
| 176 |
pos_optional_product_ids: [], |
| 177 |
sequence: 1, |
| 178 |
product_tag_ids: [], |
| 179 |
}, |
| 180 |
{ |
| 181 |
id: 8, |
| 182 |
display_name: "Wood chair", |
| 183 |
standard_price: 0, |
| 184 |
categ_id: false, |
| 185 |
pos_categ_ids: [2], |
| 186 |
taxes_id: [2], |
| 187 |
barcode: false, |
| 188 |
name: "Wood chair", |
| 189 |
list_price: 300, |
| 190 |
is_favorite: false, |
| 191 |
default_code: false, |
| 192 |
to_weight: false, |
| 193 |
uom_id: 1, |
| 194 |
description_sale: false, |
| 195 |
description: false, |
| 196 |
tracking: "none", |
| 197 |
type: "consu", |
| 198 |
service_tracking: "no", |
| 199 |
is_storable: false, |
| 200 |
write_date: "2025-07-03 13:04:14", |
| 201 |
color: 0, |
| 202 |
pos_sequence: 5, |
| 203 |
available_in_pos: true, |
| 204 |
attribute_line_ids: [], |
| 205 |
active: true, |
| 206 |
image_128: false, |
| 207 |
product_variant_ids: [8], |
| 208 |
public_description: false, |
| 209 |
pos_optional_product_ids: [], |
| 210 |
sequence: 1, |
| 211 |
product_tag_ids: [], |
| 212 |
}, |
| 213 |
{ |
| 214 |
id: 9, |
| 215 |
display_name: "Steel chair", |
| 216 |
standard_price: 0, |
| 217 |
categ_id: false, |
| 218 |
pos_categ_ids: [2], |
| 219 |
taxes_id: [2], |
| 220 |
barcode: false, |
| 221 |
name: "Steel chair", |
| 222 |
list_price: 450, |
| 223 |
is_favorite: false, |
| 224 |
default_code: false, |
| 225 |
to_weight: false, |
| 226 |
uom_id: 1, |
| 227 |
description_sale: false, |
| 228 |
description: false, |
| 229 |
tracking: "none", |
| 230 |
type: "consu", |
| 231 |
service_tracking: "no", |
| 232 |
is_storable: false, |
| 233 |
write_date: "2025-07-03 13:04:14", |
| 234 |
color: 0, |
| 235 |
pos_sequence: 5, |
| 236 |
available_in_pos: true, |
| 237 |
attribute_line_ids: [], |
| 238 |
active: true, |
| 239 |
image_128: false, |
| 240 |
product_variant_ids: [9], |
| 241 |
public_description: false, |
| 242 |
pos_optional_product_ids: [], |
| 243 |
sequence: 1, |
| 244 |
product_tag_ids: [], |
| 245 |
}, |
| 246 |
{ |
| 247 |
id: 10, |
| 248 |
display_name: "Wood desk", |
| 249 |
standard_price: 0, |
| 250 |
categ_id: false, |
| 251 |
pos_categ_ids: [2], |
| 252 |
taxes_id: [2], |
| 253 |
barcode: false, |
| 254 |
name: "Wood desk", |
| 255 |
list_price: 600, |
| 256 |
is_favorite: false, |
| 257 |
default_code: false, |
| 258 |
to_weight: false, |
| 259 |
uom_id: 1, |
| 260 |
description_sale: false, |
| 261 |
description: false, |
| 262 |
tracking: "none", |
| 263 |
type: "consu", |
| 264 |
service_tracking: "no", |
| 265 |
is_storable: false, |
| 266 |
write_date: "2025-07-03 13:04:14", |
| 267 |
color: 0, |
| 268 |
pos_sequence: 5, |
| 269 |
available_in_pos: true, |
| 270 |
attribute_line_ids: [], |
| 271 |
active: true, |
| 272 |
image_128: false, |
| 273 |
product_variant_ids: [10], |
| 274 |
public_description: false, |
| 275 |
pos_optional_product_ids: [], |
| 276 |
sequence: 1, |
| 277 |
product_tag_ids: [], |
| 278 |
}, |
| 279 |
{ |
| 280 |
id: 11, |
| 281 |
display_name: "Steel desk", |
| 282 |
standard_price: 0, |
| 283 |
categ_id: false, |
| 284 |
pos_categ_ids: [2], |
| 285 |
taxes_id: [2], |
| 286 |
barcode: false, |
| 287 |
name: "Steel desk", |
| 288 |
list_price: 700, |
| 289 |
is_favorite: false, |
| 290 |
default_code: false, |
| 291 |
to_weight: false, |
| 292 |
uom_id: 1, |
| 293 |
description_sale: false, |
| 294 |
description: false, |
| 295 |
tracking: "none", |
| 296 |
type: "consu", |
| 297 |
service_tracking: "no", |
| 298 |
is_storable: false, |
| 299 |
write_date: "2025-07-03 13:04:14", |
| 300 |
color: 0, |
| 301 |
pos_sequence: 5, |
| 302 |
available_in_pos: true, |
| 303 |
attribute_line_ids: [], |
| 304 |
active: true, |
| 305 |
image_128: false, |
| 306 |
product_variant_ids: [11], |
| 307 |
public_description: false, |
| 308 |
pos_optional_product_ids: [], |
| 309 |
sequence: 1, |
| 310 |
product_tag_ids: [], |
| 311 |
}, |
| 312 |
{ |
| 313 |
id: 12, |
| 314 |
display_name: "Bacon burger", |
| 315 |
standard_price: 0, |
| 316 |
categ_id: false, |
| 317 |
pos_categ_ids: [4], |
| 318 |
taxes_id: [2], |
| 319 |
barcode: false, |
| 320 |
name: "Bacon burger", |
| 321 |
list_price: 14, |
| 322 |
is_favorite: false, |
| 323 |
default_code: false, |
| 324 |
to_weight: false, |
| 325 |
uom_id: 1, |
| 326 |
description_sale: false, |
| 327 |
description: false, |
| 328 |
tracking: "none", |
| 329 |
type: "consu", |
| 330 |
service_tracking: "no", |
| 331 |
is_storable: false, |
| 332 |
write_date: "2025-07-03 13:04:14", |
| 333 |
color: 0, |
| 334 |
pos_sequence: 5, |
| 335 |
available_in_pos: true, |
| 336 |
attribute_line_ids: [], |
| 337 |
active: true, |
| 338 |
image_128: false, |
| 339 |
product_variant_ids: [12], |
| 340 |
public_description: false, |
| 341 |
pos_optional_product_ids: [], |
| 342 |
sequence: 1, |
| 343 |
product_tag_ids: [], |
| 344 |
}, |
| 345 |
{ |
| 346 |
id: 13, |
| 347 |
display_name: "Pizza margarita", |
| 348 |
standard_price: 0, |
| 349 |
categ_id: false, |
| 350 |
pos_categ_ids: [5], |
| 351 |
taxes_id: [2], |
| 352 |
barcode: false, |
| 353 |
name: "Pizza margarita", |
| 354 |
list_price: 12, |
| 355 |
is_favorite: false, |
| 356 |
default_code: false, |
| 357 |
to_weight: false, |
| 358 |
uom_id: 1, |
| 359 |
description_sale: false, |
| 360 |
description: false, |
| 361 |
tracking: "none", |
| 362 |
type: "consu", |
| 363 |
service_tracking: "no", |
| 364 |
is_storable: false, |
| 365 |
write_date: "2025-07-03 13:04:14", |
| 366 |
color: 0, |
| 367 |
pos_sequence: 5, |
| 368 |
available_in_pos: true, |
| 369 |
attribute_line_ids: [], |
| 370 |
active: true, |
| 371 |
image_128: false, |
| 372 |
product_variant_ids: [13], |
| 373 |
public_description: false, |
| 374 |
pos_optional_product_ids: [], |
| 375 |
sequence: 1, |
| 376 |
product_tag_ids: [], |
| 377 |
}, |
| 378 |
{ |
| 379 |
id: 14, |
| 380 |
display_name: "Club sandwich", |
| 381 |
standard_price: 0, |
| 382 |
categ_id: false, |
| 383 |
pos_categ_ids: [3], |
| 384 |
taxes_id: [2], |
| 385 |
barcode: false, |
| 386 |
name: "Club sandwich", |
| 387 |
list_price: 3.4, |
| 388 |
is_favorite: false, |
| 389 |
default_code: false, |
| 390 |
to_weight: false, |
| 391 |
uom_id: 1, |
| 392 |
description_sale: false, |
| 393 |
description: false, |
| 394 |
tracking: "none", |
| 395 |
type: "consu", |
| 396 |
service_tracking: "no", |
| 397 |
is_storable: false, |
| 398 |
write_date: "2025-07-03 13:04:14", |
| 399 |
color: 0, |
| 400 |
pos_sequence: 5, |
| 401 |
available_in_pos: true, |
| 402 |
attribute_line_ids: [], |
| 403 |
active: true, |
| 404 |
image_128: false, |
| 405 |
product_variant_ids: [14], |
| 406 |
public_description: false, |
| 407 |
pos_optional_product_ids: [], |
| 408 |
sequence: 1, |
| 409 |
product_tag_ids: [], |
| 410 |
}, |
| 411 |
{ |
| 412 |
id: 15, |
| 413 |
display_name: "Accounting Test Product 1", |
| 414 |
standard_price: 0, |
| 415 |
categ_id: false, |
| 416 |
pos_categ_ids: [], |
| 417 |
taxes_id: [2], |
| 418 |
barcode: false, |
| 419 |
name: "Accounting Test Product 1", |
| 420 |
list_price: 1000, |
| 421 |
is_favorite: false, |
| 422 |
default_code: false, |
| 423 |
to_weight: false, |
| 424 |
uom_id: 1, |
| 425 |
description_sale: false, |
| 426 |
description: false, |
| 427 |
tracking: "none", |
| 428 |
type: "consu", |
| 429 |
service_tracking: "no", |
| 430 |
is_storable: false, |
| 431 |
write_date: "2025-07-03 13:04:14", |
| 432 |
color: 0, |
| 433 |
pos_sequence: 5, |
| 434 |
available_in_pos: true, |
| 435 |
attribute_line_ids: [], |
| 436 |
active: true, |
| 437 |
image_128: false, |
| 438 |
product_variant_ids: [15], |
| 439 |
public_description: false, |
| 440 |
pos_optional_product_ids: [], |
| 441 |
sequence: 1, |
| 442 |
product_tag_ids: [], |
| 443 |
}, |
| 444 |
{ |
| 445 |
id: 16, |
| 446 |
display_name: "Accounting Test Product 2", |
| 447 |
standard_price: 0, |
| 448 |
categ_id: false, |
| 449 |
pos_categ_ids: [], |
| 450 |
taxes_id: [1, 2], |
| 451 |
barcode: false, |
| 452 |
name: "Accounting Test Product 2", |
| 453 |
list_price: 100, |
| 454 |
is_favorite: false, |
| 455 |
default_code: false, |
| 456 |
to_weight: false, |
| 457 |
uom_id: 1, |
| 458 |
description_sale: false, |
| 459 |
description: false, |
| 460 |
tracking: "none", |
| 461 |
type: "consu", |
| 462 |
service_tracking: "no", |
| 463 |
is_storable: false, |
| 464 |
write_date: "2025-07-03 13:04:14", |
| 465 |
color: 0, |
| 466 |
pos_sequence: 5, |
| 467 |
available_in_pos: true, |
| 468 |
attribute_line_ids: [], |
| 469 |
active: true, |
| 470 |
image_128: false, |
| 471 |
product_variant_ids: [16], |
| 472 |
public_description: false, |
| 473 |
pos_optional_product_ids: [], |
| 474 |
sequence: 1, |
| 475 |
product_tag_ids: [], |
| 476 |
}, |
| 477 |
{ |
| 478 |
id: 17, |
| 479 |
display_name: "Multi Category Product", |
| 480 |
standard_price: 0, |
| 481 |
categ_id: false, |
| 482 |
pos_categ_ids: [1, 2], |
| 483 |
taxes_id: [2], |
| 484 |
barcode: false, |
| 485 |
name: "Multi Category Product", |
| 486 |
list_price: 100, |
| 487 |
is_favorite: false, |
| 488 |
default_code: false, |
| 489 |
to_weight: false, |
| 490 |
uom_id: 1, |
| 491 |
description_sale: false, |
| 492 |
description: false, |
| 493 |
tracking: "none", |
| 494 |
type: "consu", |
| 495 |
service_tracking: "no", |
| 496 |
is_storable: false, |
| 497 |
write_date: "2025-07-03 13:04:14", |
| 498 |
color: 0, |
| 499 |
pos_sequence: 5, |
| 500 |
available_in_pos: true, |
| 501 |
attribute_line_ids: [], |
| 502 |
active: true, |
| 503 |
image_128: false, |
| 504 |
combo_ids: [], |
| 505 |
product_variant_ids: [17], |
| 506 |
public_description: false, |
| 507 |
pos_optional_product_ids: [], |
| 508 |
sequence: 1, |
| 509 |
product_tag_ids: [], |
| 510 |
}, |
| 511 |
{ |
| 512 |
id: 18, |
| 513 |
display_name: "Free Product - Wood chair", |
| 514 |
standard_price: 0, |
| 515 |
categ_id: false, |
| 516 |
pos_categ_ids: [2], |
| 517 |
taxes_id: [2], |
| 518 |
barcode: false, |
| 519 |
name: "Free Product - Wood chair", |
| 520 |
list_price: 0, |
| 521 |
is_favorite: false, |
| 522 |
default_code: false, |
| 523 |
to_weight: false, |
| 524 |
uom_id: 1, |
| 525 |
description_sale: false, |
| 526 |
description: false, |
| 527 |
tracking: "none", |
| 528 |
type: "consu", |
| 529 |
service_tracking: "no", |
| 530 |
is_storable: false, |
| 531 |
write_date: "2025-07-03 13:04:14", |
| 532 |
color: 0, |
| 533 |
pos_sequence: 5, |
| 534 |
available_in_pos: true, |
| 535 |
attribute_line_ids: [], |
| 536 |
active: true, |
| 537 |
image_128: false, |
| 538 |
product_variant_ids: [18], |
| 539 |
public_description: false, |
| 540 |
pos_optional_product_ids: [], |
| 541 |
sequence: 1, |
| 542 |
product_tag_ids: [], |
| 543 |
}, |
| 544 |
]; |
| 545 |
get_product_info_pos() { |
| 546 |
return { |
| 547 |
all_prices: { tax_details: [] }, |
| 548 |
pricelists: [], |
| 549 |
warehouses: [], |
| 550 |
suppliers: [], |
| 551 |
variants: [], |
| 552 |
optional_products: [], |
| 553 |
}; |
| 554 |
} |
| 555 |
} |