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 a5ca68f1..33405fc3 100644 --- a/jikimo_frontend/static/src/js/custom_form_status_indicator.js +++ b/jikimo_frontend/static/src/js/custom_form_status_indicator.js @@ -9,54 +9,144 @@ var Dialog = require('web.Dialog'); // var {patch} = require("web.utils") 这句话也行 patch(FormStatusIndicator.prototype, 'jikimo_frontend.FormStatusIndicator', { - // 你可以重写或者添加一些方法和属性 - async _onDiscardChanges() { - // var self = this; - Dialog.confirm(this, _t("Are you sure you want to discard changes?"), { - title: _t("Discard Changes"), + // 你可以重写或者添加一些方法和属性 + async _onDiscardChanges() { + // var self = this; + Dialog.confirm(this, _t("Are you sure you want to discard changes?"), { + title: _t("Discard Changes"), - // confirm_callback: function () { - // self.model.discardChanges(self.handle); - // }, - }); - }, + // confirm_callback: function () { + // self.model.discardChanges(self.handle); + // }, + }); + }, - async discard() { - // if (window.confirm("Are you sure you want to discard changes?")) { - // await this.props.discard(); - // } - // const result = await this._confirmDiscardChange(); - await this._confirmDiscardChange(); - await this.props.discard(); - }, + async discard() { + // if (window.confirm("Are you sure you want to discard changes?")) { + // await this.props.discard(); + // } + // const result = await this._confirmDiscardChange(); + await this._confirmDiscardChange(); + await this.props.discard(); + }, - _confirmDiscardChange(){ - var self = this; - var def = new Promise(function (resolve, reject) { - var message = _t("请确认是否要舍弃之前的更改?"); - var dialog = Dialog.confirm(self, message, { - title: _t("Warning"), - confirm_callback: resolve.bind(self, true), - cancel_callback: reject, - }); - dialog.on('closed', self, reject); - }); - return def; - }, + _confirmDiscardChange() { + var self = this; + var def = new Promise(function (resolve, reject) { + var message = _t("请确认是否要舍弃之前的更改?"); + var dialog = Dialog.confirm(self, message, { + title: _t("Warning"), + confirm_callback: resolve.bind(self, true), + cancel_callback: reject, + }); + dialog.on('closed', self, reject); + }); + return def; + }, -} + } ); -$(function (){ +$(function () { document.addEventListener('click', function () { const dom = $('.o_form_status_indicator_buttons ') - if(dom) { + if (dom) { const dom1 = dom.children().eq(0) const dom2 = dom.children().eq(1) - if(!dom1.text()) { + if (!dom1.text()) { dom1.append('保存') dom2.append('取消') } } }) + + function customRequired() { + let timer = null + let timer_count = 0 + clearInterval(timer) + timer = setInterval(() => { + timer_count++ + const dom = $('.custom_required') + let tableDom = $('.table_custom_required') + if (tableDom.length) { + tableDom = tableDom.eq(0).parents('tr').children('.table_custom_required') + tableDom.each(function () { + const i = $(this).index() + const requiredDom = $(this).parents('table').find('thead').find('th').eq(i).find('span').eq(0) + const t = requiredDom.text().replace('*', '') + requiredDom.html('*' + t) + }) + clearInterval(timer) + } + if (dom.length) { + dom.each(function () { + const requiredDom = $(this).parent().prev().find('label') + let t = requiredDom.html() + if (t.indexOf('c*') < 0) { + t = '*' + t + } + requiredDom.html(t) + }) + clearInterval(timer) + } + if (timer_count == 20) { + clearInterval(timer) + } + }, 500) + } + + function setRequired(dom = {label: [], table: []}) { + let domTimer = null + let timer_count = 0 + clearInterval(domTimer) + domTimer = setInterval(() => { + timer_count++ + const lint = $('.o_form_view_container') + if (lint.length) { + clearInterval(domTimer) + const {label, table} = dom + if (label.length) { + $(dom.label.join(',')).each(function () { + let t = $(this).html() + if (t.indexOf('c*') < 0) { + t = '*' + t + } + $(this).html(t) + }) + } + + if (table.length) { + table.forEach(_ => { + const th = $(`th[data-name=${_}]`) + const t = th.find('span').eq(0).text().replace('*','') + th.find('span').eq(0).html('*' + t) + + }) + + } + } + if (timer_count == 20) { + clearInterval(domTimer) + } + }, 500) + } + + var currentUrl = location.href + const customRequiredDom = { + label: ['label[for=production_line_id]','label[for=date_approve]','label[for=partner_id]', 'label[for=validity_date]', '.o_horizontal[role=radiogroup]', 'label[for=vat]', 'label[for=phone]', 'label[for=mobile]', 'label[for=email]', 'label[for=category_id]','label[for=date_order]','label[for=picking_type_id]'], + table: ['product_template_id', 'product_uom_qty', 'price_unit','product_id','product_qty'] + } + const listenerUrl = setInterval(() => { + const isChange = currentUrl != location.href + if (isChange) { + currentUrl = location.href + customRequired() + setRequired(customRequiredDom) + } + if($('label[for=production_line_id]')) { + setRequired({table: [], label: ['label[for=production_line_id]']}) + } + }, 500) + customRequired() + setRequired(customRequiredDom) }) diff --git a/quality/models/quality.py b/quality/models/quality.py index f8867327..7edff2c7 100644 --- a/quality/models/quality.py +++ b/quality/models/quality.py @@ -263,6 +263,8 @@ class QualityCheck(models.Model): picture = fields.Binary('Picture', attachment=True) additional_note = fields.Text( 'Additional Note', help="Additional remarks concerning this check.") + report_result = fields.Char('检测结果', readonly=True) + report_pdf = fields.Binary('检测报告', readonly=True) def _compute_alert_count(self): alert_data = self.env['quality.alert'].read_group([('check_id', 'in', self.ids)], ['check_id'], ['check_id']) @@ -408,3 +410,5 @@ class QualityAlert(models.Model): domain = [('team_ids', '=', False)] stage_ids = stages._search(domain, order=order, access_rights_uid=SUPERUSER_ID) return stages.browse(stage_ids) + + diff --git a/quality/security/ir.model.access.csv b/quality/security/ir.model.access.csv index ee2c26a9..a44cc95b 100644 --- a/quality/security/ir.model.access.csv +++ b/quality/security/ir.model.access.csv @@ -9,11 +9,9 @@ access_quality_point_user,quality.point,quality.model_quality_point,quality.grou access_quality_point_test_type_user,quality.point.test_type,quality.model_quality_point_test_type,quality.group_quality_user,1,0,0,0 access_quality_check_stock_user,quality.check,quality.model_quality_check,stock.group_stock_user,1,1,1,0 access_stock_lot_user,stock.lot,stock.model_stock_lot,quality.group_quality_user,1,0,0,0 -access_stock_lot_group_quality_manager,stock_lot_group_quality_manager,stock.model_stock_lot,quality.group_quality_manager,1,0,0,0 access_stock_pack_user,stock.move.line,stock.model_stock_move_line,quality.group_quality_user,1,0,0,0 access_stock_picking_group_quality_user,stock_picking_group_quality_user,stock.model_stock_picking,quality.group_quality_user,1,0,0,0 -access_stock_picking_group_quality_manager,stock_picking_group_quality_manager,stock.model_stock_picking,quality.group_quality_manager,1,0,0,0 access_quality_alert_team_manager,quality.alert.team,quality.model_quality_alert_team,quality.group_quality_manager,1,1,1,1 access_quality_check_manager,quality.check,quality.model_quality_check,quality.group_quality_manager,1,1,1,1 diff --git a/quality_control/views/quality_views.xml b/quality_control/views/quality_views.xml index 4aa2c1b5..acb0fb71 100644 --- a/quality_control/views/quality_views.xml +++ b/quality_control/views/quality_views.xml @@ -32,7 +32,9 @@
- + + +
@@ -65,20 +67,28 @@
-
-

+
+

+ +

+
- + @@ -144,25 +154,25 @@ - quality.alert.view.pivot - quality.alert - - - - - - + quality.alert.view.pivot + quality.alert + + + + + + - quality.alert.view.graph - quality.alert - - - - - - + quality.alert.view.graph + quality.alert + + + + + + @@ -186,7 +196,8 @@ kanban,tree,form,pivot,graph,calendar [('team_id', '=', active_id)] {'default_team_id': active_id, - 'search_default_team_id': [active_id]} + 'search_default_team_id': [active_id]} +
@@ -195,7 +206,7 @@ kanban,tree,form,pivot,graph,calendar

- Create a new quality alert + Create a new quality alert

@@ -212,24 +223,35 @@ - + quality.check.view.form quality.check
-
-
@@ -242,21 +264,27 @@ - - + +