diff --git a/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.js b/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.js
index 836ee6d8..8c2be97f 100644
--- a/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.js
+++ b/jikimo_frontend/static/src/fields/Many2OneRadioField/many2one_radio_field.js
@@ -11,24 +11,22 @@ export class Many2OneRadioField extends RadioField {
// 你自己的代码
}
-
onImageClick(event) {
// 放大图片逻辑
// 获取图片元素
const img = event.target;
- const close = img.nextSibling
-
+ const close = img.nextSibling;
// 实现放大图片逻辑
// 比如使用 CSS 放大
img.parentElement.classList.add('zoomed');
- close.classList.add('img_close')
+ close.classList.add('img_close');
}
onCloseClick(event) {
const close = event.target;
- const img = close.previousSibling
- img.parentElement.classList.remove('zoomed')
- close.classList.remove('img_close')
+ const img = close.previousSibling;
+ img.parentElement.classList.remove('zoomed');
+ close.classList.remove('img_close');
}
get items() {
@@ -47,10 +45,9 @@ export class Many2OneRadioField extends RadioField {
return [];
}
}
-
}
-Many2OneRadioField.template = "jikimo_frontend.Many2OneRadioField"
+Many2OneRadioField.template = "jikimo_frontend.Many2OneRadioField";
// MyCustomWidget.supportedTypes = ['many2many'];
registry.category("fields").add("many2one_radio", Many2OneRadioField);
diff --git a/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.js b/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.js
index 5845dbae..a3053b72 100644
--- a/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.js
+++ b/jikimo_frontend/static/src/fields/custom_many2many_checkboxes/custom_many2many_checkboxes.js
@@ -15,23 +15,24 @@ export class MyCustomWidget extends Many2ManyCheckboxesField {
// 放大图片逻辑
// 获取图片元素
const img = event.target;
- const close = img.nextSibling
+ const close = img.nextSibling;
// 实现放大图片逻辑
// 比如使用 CSS 放大
img.parentElement.classList.add('zoomed');
- close.classList.add('img_close')
+ close.classList.add('img_close');
}
onCloseClick(event) {
const close = event.target;
- const img = close.previousSibling
- img.parentElement.classList.remove('zoomed')
- close.classList.remove('img_close')
+ const img = close.previousSibling;
+ img.parentElement.classList.remove('zoomed');
+ close.classList.remove('img_close');
}
}
-MyCustomWidget.template = "jikimo_frontend.MyCustomWidget"
+MyCustomWidget.template = "jikimo_frontend.MyCustomWidget";
// MyCustomWidget.supportedTypes = ['many2many'];
registry.category("fields").add("custom_many2many_checkboxes", MyCustomWidget);
+
diff --git a/jikimo_frontend/static/src/js/custom_form_status_indicator.js b/jikimo_frontend/static/src/js/custom_form_status_indicator.js
index a5f68479..c1ba8248 100644
--- a/jikimo_frontend/static/src/js/custom_form_status_indicator.js
+++ b/jikimo_frontend/static/src/js/custom_form_status_indicator.js
@@ -3,7 +3,7 @@
import {patch} from '@web/core/utils/patch';
// import { Dialog } from "@web/core/dialog/dialog";
import {_t} from "@web/core/l10n/translation";
-import {FormStatusIndicator} from "@web/views/form/form_status_indicator/form_status_indicator"
+import {FormStatusIndicator} from "@web/views/form/form_status_indicator/form_status_indicator";
var Dialog = require('web.Dialog');
// var {patch} = require("web.utils") 这句话也行
diff --git a/jikimo_frontend/static/src/list/custom_width.js b/jikimo_frontend/static/src/list/custom_width.js
index 31fd23ca..f7c1c55d 100644
--- a/jikimo_frontend/static/src/list/custom_width.js
+++ b/jikimo_frontend/static/src/list/custom_width.js
@@ -1,7 +1,7 @@
/** @odoo-module */
import {patch} from '@web/core/utils/patch';
-import {ListRenderer} from "@web/views/list/list_renderer"
+import {ListRenderer} from "@web/views/list/list_renderer";
// var {patch} = require("web.utils") 这句话也行
@@ -17,7 +17,7 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
const table = this.tableRef.el;
const headers = [...table.querySelectorAll("thead th:not(.o_list_actions_header)")];
- const column_num = headers.length
+ const column_num = headers.length;
if (!this.columnWidths || !this.columnWidths.length) {
// no column widths to restore
@@ -66,8 +66,8 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
// }
// 判断 this.state.columns 是否存在且长度大于零
- if (this.state.columns && this.state.columns.length > 0 &&
- this.state.columns[0].name === "sequence") {
+ if (this.state.columns && this.state.columns.length > 0
+ && this.state.columns[0].name === "sequence") {
widths[1] = { type: "relative", value: 0.1 };
}
diff --git a/jikimo_frontend/static/src/views/list_nums/list_nbCols.js b/jikimo_frontend/static/src/views/list_nums/list_nbCols.js
index b0bacb02..1403544f 100644
--- a/jikimo_frontend/static/src/views/list_nums/list_nbCols.js
+++ b/jikimo_frontend/static/src/views/list_nums/list_nbCols.js
@@ -8,4 +8,4 @@ patch(ListRenderer.prototype, '/jikimo_frontend/static/src/views/list_nums/list_
const nbCols = this._super(...arguments);
return nbCols + 1;
}
-});
\ No newline at end of file
+});
diff --git a/sf_bf_connect/__manifest__.py b/sf_bf_connect/__manifest__.py
index 46ca09f8..ce938272 100644
--- a/sf_bf_connect/__manifest__.py
+++ b/sf_bf_connect/__manifest__.py
@@ -10,10 +10,10 @@
""",
'category': 'sf',
'website': 'https://www.sf.cs.jikimo.com',
- 'depends': ['sf_base'],
+ 'depends': ['sf_base', 'delivery'],
'data': [
'views/res_partner_view.xml',
- # 'views/view.xml',
+ 'views/view.xml',
'report/bill_report.xml',
],
'demo': [
diff --git a/sf_bf_connect/models/jd_eclp.py b/sf_bf_connect/models/jd_eclp.py
index dfcb20f8..4ccb0db6 100644
--- a/sf_bf_connect/models/jd_eclp.py
+++ b/sf_bf_connect/models/jd_eclp.py
@@ -3,9 +3,9 @@ import logging
from datetime import datetime
import requests
import cpca
-from odoo.exceptions import UserError
-from odoo.exceptions import ValidationError
-from odoo import api, fields, models, SUPERUSER_ID, _
+# from odoo.exceptions import UserError
+# from odoo.exceptions import ValidationError
+from odoo import api, fields, models
_logger = logging.getLogger(__name__)
@@ -40,9 +40,22 @@ class JdEclp(models.Model):
# bill = fields.Many2one('ir.attachment', string='物流面单', compute='query_bill_pdf')
# bill_show = fields.Binary(string='物流面单展示', readonly=True, related='self.bill.datas')
bill_show = fields.Binary(string='物流面单展示', readonly=True)
+ check_out = fields.Char(string='查询是否为出库单', compute='_check_is_out')
+
+ @api.depends('name')
+ def _check_is_out(self):
+ """
+ 判断是否为出库单
+ """
+ if self.name:
+ is_check_out = self.name.split('/')
+ self.check_out = is_check_out[1]
@api.depends('carrier_tracking_ref')
def query_bill_pdf(self):
+ """
+ 查询物流面单,并赋值给bill
+ """
self.bill = self.env['ir.attachment'].sudo().search([('name', '=', self.carrier_tracking_ref)])
@api.depends('origin')
@@ -77,12 +90,12 @@ class JdEclp(models.Model):
self.receiverTownName = self.receiverTownName
except Exception as e:
print(f"Error address is none: {e}")
- pass
def create_order(self):
# sale_order_id = self.env['sale.order'].search([('name', '=', self.origin)])
# if self.carrier_id == '京东物流':
+ config = self.env['res.config.settings'].get_values()
createTime = str(datetime.now())
json1 = {
'params': {
@@ -106,7 +119,7 @@ class JdEclp(models.Model):
},
}
_logger.info('准备调接口1')
- url1 = 'https://bfm.cs.jikimo.com/api/create/jd/order'
+ url1 = config['bfm_url'] + '/api/create/jd/order'
requests.post(url1, json=json1, data=None)
_logger.info('调用成功1')
_logger.info('准备调接口2')
@@ -115,7 +128,7 @@ class JdEclp(models.Model):
'orderNo': self.origin,
},
}
- url2 = 'https://bfm.cs.jikimo.com/api/get/jd/no'
+ url2 = config['bfm_url'] + '/api/get/jd/no'
response = requests.post(url2, json=json2, data=None)
# _logger.info('调用成功2', response.json()['result']['wbNo'])
self.carrier_tracking_ref = response.json()['result']['wbNo']
@@ -124,12 +137,16 @@ class JdEclp(models.Model):
# raise UserError("选择京东物流才能下单呦")
def get_bill(self):
+ """
+ 获取物流面单
+ """
+ config = self.env['res.config.settings'].get_values()
json1 = {
'params': {
'no': self.origin,
},
}
- url1 = 'https://bfm.cs.jikimo.com/api/create/jd/bill'
+ url1 = config['bfm_url'] + '/api/create/jd/bill'
response = requests.post(url1, json=json1, data=None)
# _logger.info('调用成功2', response.json())
@@ -152,5 +169,3 @@ class JdEclp(models.Model):
# 'model_name': 'stock.picking',
})
_logger.info(attachment)
- # _logger.info(attachment.datas)
- # _logger.info(attachment.datas_fname)
diff --git a/sf_bf_connect/models/process_status.py b/sf_bf_connect/models/process_status.py
index 3a579920..d79b3369 100644
--- a/sf_bf_connect/models/process_status.py
+++ b/sf_bf_connect/models/process_status.py
@@ -3,7 +3,6 @@ import logging
import requests
from odoo import fields, models
-
_logger = logging.getLogger(__name__)
@@ -203,17 +202,17 @@ class FinishStatusChange(models.Model):
[('id', 'child_of', self.picking_type_id.warehouse_id.view_location_id.id),
('usage', '!=', 'supplier')])
if self.env['stock.move'].search([
- ('state', 'in', ['confirmed', 'partially_available', 'waiting', 'assigned']),
- ('product_qty', '>', 0),
- ('location_id', 'in', wh_location_ids),
- ('move_orig_ids', '=', False),
- ('picking_id', 'not in', self.ids),
- ('product_id', 'in', lines.product_id.ids)], limit=1):
+ ('state', 'in', ['confirmed', 'partially_available', 'waiting', 'assigned']),
+ ('product_qty', '>', 0),
+ ('location_id', 'in', wh_location_ids),
+ ('move_orig_ids', '=', False),
+ ('picking_id', 'not in', self.ids),
+ ('product_id', 'in', lines.product_id.ids)], limit=1):
action = self.action_view_reception_report()
action['context'] = {'default_picking_ids': self.ids}
return action
- out_start_time = str(datetime.now())
+ # out_start_time = str(datetime.now())
json2 = {
'params': {
'model_name': 'jikimo.process.order',
diff --git a/sf_bf_connect/views/view.xml b/sf_bf_connect/views/view.xml
index ec6dc394..c4f0e446 100644
--- a/sf_bf_connect/views/view.xml
+++ b/sf_bf_connect/views/view.xml
@@ -1,5 +1,31 @@
+
+
+ 增加一个check_out字段
+ stock.picking
+
+
+
+
+
+
+
+
+
+ 物流
+ stock.picking
+
+
+
+
+
+
+
+
+
tracking
stock.picking
@@ -7,45 +33,33 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/sf_machine_connect/models/ftp_client.py b/sf_machine_connect/models/ftp_client.py
index 7ca0ad06..b33dbeee 100644
--- a/sf_machine_connect/models/ftp_client.py
+++ b/sf_machine_connect/models/ftp_client.py
@@ -1,20 +1,15 @@
# -*- coding: utf-8 -*-
import os
-import time
import json
import base64
-import shutil
import logging
-import hashlib
from io import BytesIO
from zipfile import ZipFile
from datetime import datetime, timedelta
import requests
from odoo.http import request
-from odoo import fields, models, api, _
+from odoo import fields, models, api
from odoo.exceptions import UserError
-from odoo.exceptions import MissingError
-from odoo.exceptions import ValidationError
from odoo.addons.sf_machine_connect.models import py2opcua, ftp_operate
_logger = logging.getLogger(__name__)
@@ -470,7 +465,7 @@ class WorkCenterBarcode(models.Model):
raise UserError('NC下发执行超时, 请检查下发状态')
def get__state(self):
- pay_time = str(datetime.now())
+ # pay_time = str(datetime.now())
json = {
'params': {
'model_name': 'jikimo.process.order',
@@ -538,7 +533,7 @@ class WorkCenterBarcode(models.Model):
action1 = json.dumps(action)
return action1
else:
- return False
+ return None
def cnc_file_download(self):
"""
diff --git a/sf_machine_connect/models/ftp_operate.py b/sf_machine_connect/models/ftp_operate.py
index 457ef6ed..29ee69a1 100644
--- a/sf_machine_connect/models/ftp_operate.py
+++ b/sf_machine_connect/models/ftp_operate.py
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
-import os
import logging
from ftplib import FTP
@@ -20,7 +19,6 @@ class FTP_P(FTP):
cmd = 'LIST'
templist = []
tempdic = {}
- func = None
if args[-1:] and type(args[-1]) != type(''):
args, func = args[:-1], args[-1]
for arg in args:
diff --git a/sf_machine_connect/models/res_config_setting.py b/sf_machine_connect/models/res_config_setting.py
index 6d9a6c84..16cc4d77 100644
--- a/sf_machine_connect/models/res_config_setting.py
+++ b/sf_machine_connect/models/res_config_setting.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
import logging
-from odoo import api, fields, models, _
+from odoo import api, fields, models
_logger = logging.getLogger(__name__)
diff --git a/sf_machine_connect/static/src/js/barcode_button.js b/sf_machine_connect/static/src/js/barcode_button.js
index e7d9f879..5fcd8caf 100644
--- a/sf_machine_connect/static/src/js/barcode_button.js
+++ b/sf_machine_connect/static/src/js/barcode_button.js
@@ -97,13 +97,12 @@ export class CodeField extends Component {
} else {
if (records[0].state === '占用') {
// console.log('此托盘已占用,请检查')
- alert('此托盘已占用,请检查')
+ alert('此托盘已占用,请检查');
} else {
// console.log('此托盘已损坏,请登记')
- alert('此托盘已损坏,请登记')
+ alert('此托盘已损坏,请登记');
}
}
-
} else {
const searchInput = this.autocompleteContainerRef.el.querySelector("input");
searchInput.value = barcode;
@@ -114,7 +113,7 @@ export class CodeField extends Component {
}
}
}
-CodeField.template = 'sf_machine_connect.CodeField'
+CodeField.template = 'sf_machine_connect.CodeField';
// Register the field in the registry
CodeField.props = standardFieldProps;
registry.category("fields").add("code", CodeField);
diff --git a/sf_machine_connect/static/src/js/barcode_form.js b/sf_machine_connect/static/src/js/barcode_form.js
index f6190918..3eefda66 100644
--- a/sf_machine_connect/static/src/js/barcode_form.js
+++ b/sf_machine_connect/static/src/js/barcode_form.js
@@ -48,4 +48,4 @@ odoo.define('my_module.barcode_handler', function (require) {
return {
BarcodeHandlerField: BarcodeHandlerField,
};
-});
\ No newline at end of file
+});
diff --git a/sf_machine_connect/static/src/js/barcode_handler_field.js b/sf_machine_connect/static/src/js/barcode_handler_field.js
index 526f28d7..133e0ffe 100644
--- a/sf_machine_connect/static/src/js/barcode_handler_field.js
+++ b/sf_machine_connect/static/src/js/barcode_handler_field.js
@@ -8,7 +8,7 @@ const { Component, xml } = owl;
export class BarcodeHandlerField extends Component {
setup() {
- this.actionService = useService("action")
+ this.actionService = useService("action");
const barcode = useService("barcode");
// this.rpc = useService("rpc");
// useBus(barcode.bus, "barcode_scanned", this.onBarcodeScanned.bind(this));
@@ -18,7 +18,7 @@ export class BarcodeHandlerField extends Component {
// const { data } = await this.env.services.rpc('/web/dataset/call_kw', params);
const response = await this.env.services.rpc('/web/dataset/call_kw', params);
// return response
- const responseObject = JSON.parse(response)
+ const responseObject = JSON.parse(response);
return responseObject;
}
@@ -58,8 +58,7 @@ export class BarcodeHandlerField extends Component {
} else {
// console.error("Barcode not found or RPC call failed.");
}
- }
-
+ };
}
BarcodeHandlerField.template = xml``;
diff --git a/sf_machine_connect/wizard/action_up.py b/sf_machine_connect/wizard/action_up.py
index ffcb88ad..e2d160cd 100644
--- a/sf_machine_connect/wizard/action_up.py
+++ b/sf_machine_connect/wizard/action_up.py
@@ -2,15 +2,11 @@
import base64
import logging
import os
-import json
-import hashlib
-import time
from datetime import datetime
-import requests
-from odoo import fields, models, api, _
-from odoo.exceptions import ValidationError
+from odoo import fields, models
+# from odoo.exceptions import ValidationError
from odoo.exceptions import UserError
-from odoo.addons.sf_machine_connect.models import py2opcua, ftp_operate
+from odoo.addons.sf_machine_connect.models import ftp_operate
_logger = logging.getLogger(__name__)
diff --git a/sf_maintenance/models/sf_equipment_maintenance_standards.py b/sf_maintenance/models/sf_equipment_maintenance_standards.py
index 2892cac4..92a94c0e 100644
--- a/sf_maintenance/models/sf_equipment_maintenance_standards.py
+++ b/sf_maintenance/models/sf_equipment_maintenance_standards.py
@@ -1,6 +1,6 @@
# -*-coding:utf-8-*-
-from odoo import api, fields, models, SUPERUSER_ID, _
-from odoo.exceptions import UserError
+from odoo import api, fields, models
+
class SfEquipmentSaintenanceStandards(models.Model):
diff --git a/sf_maintenance/models/sf_maintenance.py b/sf_maintenance/models/sf_maintenance.py
index 0bd64991..d7eb3d55 100644
--- a/sf_maintenance/models/sf_maintenance.py
+++ b/sf_maintenance/models/sf_maintenance.py
@@ -1,10 +1,10 @@
# -*- coding: utf-8 -*-
import json
import base64
-from datetime import date, datetime, timedelta
+from datetime import timedelta
import requests
from odoo.addons.sf_base.commons.common import Common
-from odoo import api, fields, models, SUPERUSER_ID, _
+from odoo import api, fields, models, _
from odoo.exceptions import UserError
diff --git a/sf_maintenance/models/sf_maintenance_requests.py b/sf_maintenance/models/sf_maintenance_requests.py
index 4c9e8fde..8686926b 100644
--- a/sf_maintenance/models/sf_maintenance_requests.py
+++ b/sf_maintenance/models/sf_maintenance_requests.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
import base64
-from odoo import api, fields, models, SUPERUSER_ID, _
+from odoo import api, fields, models, _
from odoo.exceptions import UserError
diff --git a/sf_manufacturing/__manifest__.py b/sf_manufacturing/__manifest__.py
index 69004216..d963ab3e 100644
--- a/sf_manufacturing/__manifest__.py
+++ b/sf_manufacturing/__manifest__.py
@@ -41,14 +41,6 @@
],
'qweb': [
],
- 'assets': {
- 'web.assets_backend': [
- 'sf_manufacturing/static/src/js/kanban_change.js',
- 'sf_manufacturing/static/src/scss/kanban_change.scss',
- 'sf_manufacturing/static/src/xml/kanban_change.xml',
- ],
-
- },
'license': 'LGPL-3',
'installable': True,
'application': False,
diff --git a/sf_manufacturing/models/model_type.py b/sf_manufacturing/models/model_type.py
index 48707939..29357d02 100644
--- a/sf_manufacturing/models/model_type.py
+++ b/sf_manufacturing/models/model_type.py
@@ -1,4 +1,4 @@
-from odoo import fields, models, api
+from odoo import fields, models
class ModelType(models.Model):
diff --git a/sf_manufacturing/models/mrp_workorder.py b/sf_manufacturing/models/mrp_workorder.py
index 133c1ec0..8d3bf6c2 100644
--- a/sf_manufacturing/models/mrp_workorder.py
+++ b/sf_manufacturing/models/mrp_workorder.py
@@ -616,7 +616,7 @@ class CNCprocessing(models.Model):
logging.info('folder_name:%s' % folder_name)
serverdir = os.path.join('/tmp', folder_name, 'return', processing_panel)
logging.info('serverdir:%s' % serverdir)
- for root, dirs, files in os.walk(serverdir):
+ for root, files in os.walk(serverdir):
for f in files:
logging.info('f:%s' % f)
if os.path.splitext(f)[1] == ".pdf":
diff --git a/sf_manufacturing/models/stock.py b/sf_manufacturing/models/stock.py
index 4cb0aa44..473a9b43 100644
--- a/sf_manufacturing/models/stock.py
+++ b/sf_manufacturing/models/stock.py
@@ -5,7 +5,7 @@ import logging
import json
from re import split as regex_split
from re import findall as regex_findall
-from datetime import datetime, timedelta
+from datetime import datetime
import requests
from odoo import SUPERUSER_ID, _, api, fields, models
from odoo.tools import float_compare
@@ -149,8 +149,8 @@ class StockRule(models.Model):
raise ProcurementException(errors)
for company_id, productions_values in productions_values_by_company.items():
- # create the MO as SUPERUSER because the current user may not have the rights to do it (mto product
- # launched by a sale for example)
+ # create the MO as SUPERUSER because the current user may not have the rights to do it
+ # (mto product launched by a sale for example)
'''创建制造订单'''
productions = self.env['mrp.production'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create(
productions_values)
@@ -201,18 +201,17 @@ class StockRule(models.Model):
sale_order = self.env['sale.order'].sudo().search([('name', '=', production.origin)])
if sale_order:
- bb = sale_order.deadline_of_delivery
- productions = self.env['sf.production.plan'].with_user(SUPERUSER_ID).sudo().with_company(company_id). \
- create({
- 'name': production.name,
- 'order_deadline': sale_order.deadline_of_delivery,
- 'production_id': production.id,
- 'date_planned_start': production.date_planned_start,
- 'origin': production.origin,
- 'product_qty': production.product_qty,
- 'product_id': production.product_id.id,
- 'state': 'draft',
- })
+ self.env['sf.production.plan'].sudo().with_company(company_id). \
+ create({
+ 'name': production.name,
+ 'order_deadline': sale_order.deadline_of_delivery,
+ 'production_id': production.id,
+ 'date_planned_start': production.date_planned_start,
+ 'origin': production.origin,
+ 'product_qty': production.product_qty,
+ 'product_id': production.product_id.id,
+ 'state': 'draft',
+ })
return True
diff --git a/sf_manufacturing/static/src/js/kanban_change.js b/sf_manufacturing/static/src/js/kanban_change.js
index 72e7abbe..edef0285 100644
--- a/sf_manufacturing/static/src/js/kanban_change.js
+++ b/sf_manufacturing/static/src/js/kanban_change.js
@@ -17,16 +17,10 @@ class CustomKanbanController extends KanbanController {
this.workOrders = await this.getAllWorkOrders();
// this.workOrdersNew = this.workOrders;
// console.log('lines222222222', this.workOrders);
- //
// console.log(typeof this.workOrders);
// console.log(Array.isArray(this.workOrders));
- //
// console.log(this.workOrders.every(order =>
// typeof order === 'object' && order.id !== undefined));
-
-
-
-
// var aDiv = document.getElementsByClassName('o_kanban_record')
// for (var i = 0; i < aDiv.length; i++) {
// console.log(aDiv[i])
@@ -37,8 +31,7 @@ class CustomKanbanController extends KanbanController {
buttonClick(ev) {
const button = ev.currentTarget;
const id = button.getAttribute('data-id');
-
- console.log('true_id', id);
+ // console.log('true_id', id);
// const context = {production_line_show: 'shengchanxian1'}
this.env.services.rpc('/web/dataset/call_kw', {
model: 'mrp.workcenter',
@@ -58,8 +51,8 @@ class CustomKanbanController extends KanbanController {
// console.log('response', response);
location.reload();
window.onload = function () {
- button.classList.add('choose')
- }
+ button.classList.add('choose');
+ };
});
});
}
@@ -82,8 +75,6 @@ class CustomKanbanController extends KanbanController {
// 你可以在这里处理响应,例如将其存储在控制器的状态中
return response;
}
-
-
}
CustomKanbanController.template = "sf_manufacturing.CustomKanbanView1";
@@ -94,4 +85,4 @@ export const customKanbanView = {
};
// Register it to the views registry
-registry.category("views").add("custom_kanban1", customKanbanView);
\ No newline at end of file
+registry.category("views").add("custom_kanban1", customKanbanView);
diff --git a/sf_plan/__manifest__.py b/sf_plan/__manifest__.py
index 40b36882..d0cd7bcb 100644
--- a/sf_plan/__manifest__.py
+++ b/sf_plan/__manifest__.py
@@ -16,6 +16,7 @@
'depends': ['sf_manufacturing'],
'data': [
'security/ir.model.access.csv',
+ # 'security/rules.xml',
'views/view.xml',
],
diff --git a/sf_plan/models/custom_plan.py b/sf_plan/models/custom_plan.py
index 5fba575f..075c7e21 100644
--- a/sf_plan/models/custom_plan.py
+++ b/sf_plan/models/custom_plan.py
@@ -11,6 +11,7 @@ from odoo.exceptions import UserError, ValidationError
class sf_production_plan(models.Model):
_name = 'sf.production.plan'
_description = 'sf_production_plan'
+ _inherit = ['mail.thread']
_order = 'create_date desc'
state = fields.Selection([
@@ -20,6 +21,7 @@ class sf_production_plan(models.Model):
('finished', '已完成')
], string='工单状态', tracking=True)
name = fields.Char(string='工单编号')
+ active = fields.Boolean(string='已归档', default=True)
# selected = fields.Boolean(default=False)
# order_number = fields.Char(string='订单号')
order_deadline = fields.Datetime(string='订单交期')
@@ -49,6 +51,26 @@ class sf_production_plan(models.Model):
sequence = fields.Integer(string='序号', copy=False, readonly=True, index=True)
current_operation_name = fields.Char(string='当前工序名称', size=64, default='生产计划')
+ # @api.model
+ # def _search(self, args, offset=0, limit=None, order=None, count=False, access_rights_uid=None):
+ # """
+ # 默认修改筛选
+ # """
+ # return super(sf_production_plan, self.with_context(active_test=False))._search(
+ # args, offset, limit, order, count, access_rights_uid)
+
+ def archive(self):
+ """
+ 归档
+ """
+ self.write({'active': False})
+
+ def unarchive(self):
+ """
+ 取消归档
+ """
+ self.write({'active': True})
+
@api.model
def get_import_templates(self):
"""returns the xlsx import template file"""
diff --git a/sf_plan/security/ir.model.access.csv b/sf_plan/security/ir.model.access.csv
index 3a1a20c9..3123afe9 100644
--- a/sf_plan/security/ir.model.access.csv
+++ b/sf_plan/security/ir.model.access.csv
@@ -1,8 +1,3 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
-access_sf_production_plan,sf.production.plan,model_sf_production_plan,base.group_user,1,1,1,1
-access_sf_machine_schedule,sf.machine.schedule,model_sf_machine_schedule,base.group_user,1,1,1,1
-
-
-
-
-
+access_sf_production_plan,sf.production.plan,model_sf_production_plan,base.group_user,1,0,0,0
+access_sf_production_plan_for_dispatch,sf.production.plan for dispatch,model_sf_production_plan,sf_base.group_plan_dispatch,1,1,1,0
diff --git a/sf_plan/security/rules.xml b/sf_plan/security/rules.xml
new file mode 100644
index 00000000..7355bc8c
--- /dev/null
+++ b/sf_plan/security/rules.xml
@@ -0,0 +1,9 @@
+
+
+ Own Orders Only
+
+
+
+ [('create_uid', '=', user.id)]
+
+
\ No newline at end of file
diff --git a/sf_plan/views/view.xml b/sf_plan/views/view.xml
index 5df9e8db..ee3d441d 100644
--- a/sf_plan/views/view.xml
+++ b/sf_plan/views/view.xml
@@ -6,9 +6,6 @@
sf.production.plan
-
-
-
@@ -18,8 +15,8 @@
-
-
+
+
@@ -31,8 +28,11 @@