Debian Codegraph @

addons/pos_sale/static/tests/unit/data/sale_order_line.data.js

raw symbols SCIP
1 import { patch } from "@web/core/utils/patch";
2 import { hootPosModels } from "@point_of_sale/../tests/unit/data/generate_model_definitions";
3 import { models, MockServer } from "@web/../tests/web_test_helpers";
4
5 export class SaleOrderLine extends models.ServerModel {
6 _name = "sale.order.line";
7
8 _load_pos_data_fields() {
9 return [
10 "discount",
11 "display_name",
12 "price_total",
13 "price_unit",
14 "product_id",
15 "product_uom_qty",
16 "qty_delivered",
17 "qty_invoiced",
18 "qty_to_invoice",
19 "display_type",
20 "name",
21 "tax_ids",
22 "is_downpayment",
23 "extra_tax_data",
24 "write_date",
25 "is_repair_line",
26 ];
27 }
28
29 _records = [
30 {
31 id: 1,
32 display_name: "Product 1",
33 product_id: 5,
34 product_uom_qty: 5,
35 price_unit: 100,
36 price_total: 500,
37 discount: 0,
38 qty_delivered: 0,
39 qty_invoiced: 0,
40 qty_to_invoice: 5,
41 display_type: false,
42 name: "Product 1",
43 tax_ids: [],
44 is_downpayment: false,
45 extra_tax_data: {},
46 write_date: "2025-07-03 17:04:14",
47 },
48 {
49 id: 2,
50 display_name: "Product 2",
51 product_id: 6,
52 product_uom_qty: 3,
53 price_unit: 50,
54 price_total: 150,
55 discount: 0,
56 qty_delivered: 0,
57 qty_invoiced: 0,
58 qty_to_invoice: 3,
59 display_type: false,
60 name: "Product 2",
61 tax_ids: [],
62 is_downpayment: false,
63 extra_tax_data: {},
64 write_date: "2025-07-03 17:04:14",
65 },
66 ];
67
68 async read_converted(ids) {
69 const model = MockServer.env[this._name];
70 const posFields = model._load_pos_data_fields();
71 const records = model.search_read(
72 [["id", "in", ids]],
73 posFields,
74 false,
75 false,
76 false,
77 false
78 );
79 return records;
80 }
81 }
82
83 patch(hootPosModels, [...hootPosModels, SaleOrderLine]);