diff --git a/jikimo_frontend/__manifest__.py b/jikimo_frontend/__manifest__.py
index ea28cb5f..a90a374e 100644
--- a/jikimo_frontend/__manifest__.py
+++ b/jikimo_frontend/__manifest__.py
@@ -10,7 +10,7 @@
""",
'category': 'sf',
'website': 'https://www.sf.jikimo.com',
- 'depends': ['web'],
+ 'depends': ['web', 'purchase'],
'data': [
],
@@ -24,12 +24,16 @@
'jikimo_frontend/static/src/fields/custom_many2many_checkboxes/*',
'jikimo_frontend/static/src/scss/custom_style.scss',
# 'jikimo_frontend/static/src/views/list_nums/list_nbCols.js',
- # 'jikimo_frontend/static/src/views/list_nums/list_nums.xml',
- # 'jikimo_frontend/static/src/views/list_nums/list_nums2.xml',
- # 'jikimo_frontend/static/src/views/list_nums/list_nums3.xml',
+ 'jikimo_frontend/static/src/views/list_nums/list_nums.xml',
+ 'jikimo_frontend/static/src/views/list_nums/list_nums2.xml',
+ 'jikimo_frontend/static/src/views/list_nums/list_nums3.xml',
'jikimo_frontend/static/src/js/custom_form_status_indicator.js',
'jikimo_frontend/static/src/scss/rowno_in_tree.scss',
- 'jikimo_frontend/static/src/views/list_nums/list_render.xml',
+ # 'jikimo_frontend/static/src/views/list_nums/list_render.xml',
+ 'jikimo_frontend/static/src/list/list_up_down_button.xml',
+ 'jikimo_frontend/static/src/list/custom_import.js',
+ 'jikimo_frontend/static/src/list/custom_width.js',
+ 'jikimo_frontend/static/src/views/list_nums/extent_purchase.xml',
],
diff --git a/jikimo_frontend/static/src/list/custom_width.js b/jikimo_frontend/static/src/list/custom_width.js
new file mode 100644
index 00000000..512abc44
--- /dev/null
+++ b/jikimo_frontend/static/src/list/custom_width.js
@@ -0,0 +1,84 @@
+/** @odoo-module */
+
+import {patch} from '@web/core/utils/patch';
+import {ListRenderer} from "@web/views/list/list_renderer"
+
+// var {patch} = require("web.utils") 这句话也行
+
+patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
+ // 你可以重写或者添加一些方法和属性
+ // The following code manipulates the DOM directly to avoid having to wait for a
+ // render + patch which would occur on the next frame and cause flickering.
+ freezeColumnWidths() {
+ console.log('ccccccccccccccccccccccccccc')
+ if (!this.keepColumnWidths) {
+ this.columnWidths = null;
+ }
+
+ const table = this.tableRef.el;
+ const headers = [...table.querySelectorAll("thead th:not(.o_list_actions_header)")];
+ const column_num = headers.length
+
+ if (!this.columnWidths || !this.columnWidths.length) {
+ // no column widths to restore
+ // Set table layout auto and remove inline style to make sure that css
+ // rules apply (e.g. fixed width of record selector)
+ table.style.tableLayout = "auto";
+ headers.forEach((th) => {
+ th.style.width = null;
+ th.style.maxWidth = null;
+ });
+
+ this.setDefaultColumnWidths(column_num);
+
+ // Squeeze the table by applying a max-width on largest columns to
+ // ensure that it doesn't overflow
+ this.columnWidths = this.computeColumnWidthsFromContent();
+ table.style.tableLayout = "fixed";
+ }
+ headers.forEach((th, index) => {
+ if (!th.style.width) {
+ th.style.width = `${Math.floor(this.columnWidths[index])}px`;
+ }
+ });
+ },
+
+ setDefaultColumnWidths(column_num) {
+ const bbb = this.state.columns[0].name
+ const widths = this.state.columns.map((col) => this.calculateColumnWidth(col));
+ const sumOfRelativeWidths = (widths
+ .filter(({ type }) => type === "relative")
+ .reduce((sum, { value }) => sum + value, 0));
+
+ // 获取数组的最后一项
+ const lastItem = widths[widths.length - 1];
+
+ // 复制最后一项
+ const newItem = { ...lastItem };
+
+ // 将新的对象添加到数组的末尾
+ widths.push(newItem);
+
+ // 判断销售的sequence
+ if (this.state.columns[0].name === "sequence") {
+ widths[1] = { type: "relative", value: 0.1 };
+ }
+
+ // 1 because nth-child selectors are 1-indexed, 2 when the first column contains
+ // the checkboxes to select records.
+ const columnOffset = this.hasSelectors ? 2 : 1;
+ widths.forEach(({ type, value }, i) => {
+ const headerEl = this.tableRef.el.querySelector(`th:nth-child(${i + columnOffset})`);
+ if (type === "absolute") {
+ if (this.isEmpty) {
+ headerEl.style.width = value;
+ } else {
+ headerEl.style.minWidth = value;
+ }
+ } else if (type === "relative" && this.isEmpty) {
+ headerEl.style.width = `${((value / column_num) * 100).toFixed(2)}%`;
+ }
+ });
+ },
+}
+);
diff --git a/jikimo_frontend/static/src/list/list_up_down_button.xml b/jikimo_frontend/static/src/list/list_up_down_button.xml
new file mode 100644
index 00000000..8bd28f5e
--- /dev/null
+++ b/jikimo_frontend/static/src/list/list_up_down_button.xml
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jikimo_frontend/static/src/scss/rowno_in_tree.scss b/jikimo_frontend/static/src/scss/rowno_in_tree.scss
index f5aa2914..c244ad7d 100644
--- a/jikimo_frontend/static/src/scss/rowno_in_tree.scss
+++ b/jikimo_frontend/static/src/scss/rowno_in_tree.scss
@@ -1,3 +1,4 @@
.row_no {
- width:4% !important;
+ width: 3.2% !important;
+ vertical-align: middle;
}
diff --git a/jikimo_frontend/static/src/views/list_nums/extent_purchase.xml b/jikimo_frontend/static/src/views/list_nums/extent_purchase.xml
new file mode 100644
index 00000000..f9c25a3d
--- /dev/null
+++ b/jikimo_frontend/static/src/views/list_nums/extent_purchase.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/jikimo_frontend/static/src/views/list_nums/list_nums.xml b/jikimo_frontend/static/src/views/list_nums/list_nums.xml
index 6424887a..d2ad6824 100644
--- a/jikimo_frontend/static/src/views/list_nums/list_nums.xml
+++ b/jikimo_frontend/static/src/views/list_nums/list_nums.xml
@@ -5,7 +5,7 @@
- |
+ |
diff --git a/sf_plan/models/custom_plan.py b/sf_plan/models/custom_plan.py
index 064a1e20..e80a7783 100644
--- a/sf_plan/models/custom_plan.py
+++ b/sf_plan/models/custom_plan.py
@@ -63,6 +63,14 @@ class sf_production_plan(models.Model):
# picking_type_id = fields.Many2one('stock.picking.type', 'Operation Type', compute='_compute_orderpoint_id')
# move_dest_ids = fields.One2many('stock.move', 'created_production_id', compute='_compute_orderpoint_id')
+ @api.model
+ def get_import_templates(self):
+ """returns the xlsx import template file"""
+ return [{
+ 'label': _('导入计划数据'),
+ 'template': '/sf_plan/static/src/xlsx/sf_production_plan.xlsx'
+ }]
+
@api.model
def _compute_orderpoint_id(self):
pass
diff --git a/sf_plan/static/src/xlsx/sf_production_plan.xlsx b/sf_plan/static/src/xlsx/sf_production_plan.xlsx
new file mode 100644
index 00000000..a82cab58
Binary files /dev/null and b/sf_plan/static/src/xlsx/sf_production_plan.xlsx differ