diff --git a/sf_plan/__manifest__.py b/sf_plan/__manifest__.py index 54f3b064..430084ef 100644 --- a/sf_plan/__manifest__.py +++ b/sf_plan/__manifest__.py @@ -16,7 +16,8 @@ 'depends': ['sf_manufacturing'], 'data': [ 'security/ir.model.access.csv', - 'views/view.xml' + 'views/view.xml', + 'views/duration_view.xml' ], 'assets': { diff --git a/sf_plan/models/__init__.py b/sf_plan/models/__init__.py index c47d4ff3..bc694edf 100644 --- a/sf_plan/models/__init__.py +++ b/sf_plan/models/__init__.py @@ -2,3 +2,4 @@ # Part of Odoo. See LICENSE file for full copyright and licensing details. from . import custom_plan +from . import duration diff --git a/sf_plan/models/duration.py b/sf_plan/models/duration.py new file mode 100644 index 00000000..6fbe34e2 --- /dev/null +++ b/sf_plan/models/duration.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +import base64 +import json, requests +from odoo import models, fields, api, _ +from datetime import datetime, timedelta +from odoo.exceptions import UserError, ValidationError + + +class HoleDuration(models.Model): + _name = 'hole.duration' + _description = 'Hole Duration' + + hole_diameter = fields.Selection([('3', '≤¢3'), ('6', '≤¢6'), ('10', '≤¢10'), ('12', '≤¢12'), ('16', '≤¢16'), ('25', '≤¢25')], string='孔径', required=True) + name = fields.Char(string='名称', required=True, default='钻孔') + hole_depth = fields.Selection([ + ('10', '≤10'), + ('30', '≤30'), + ('50', '≤50'), + ('70', '≤70'), + ('90', '≤90'), + ('100', '≤100'), + ('120', '≤120'), + ('150', '≤150')], string='深度', required=True) + working_hours = fields.Float(string='工时', required=True) + hole_expansion = fields.Float(string='扩孔', required=True, default=0.6) diff --git a/sf_plan/security/ir.model.access.csv b/sf_plan/security/ir.model.access.csv index 3a1a20c9..9fe7bb5c 100644 --- a/sf_plan/security/ir.model.access.csv +++ b/sf_plan/security/ir.model.access.csv @@ -1,6 +1,7 @@ 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_hole_duration,hole.duration,model_hole_duration,base.group_user,1,1,1,1 diff --git a/sf_plan/views/duration_view.xml b/sf_plan/views/duration_view.xml new file mode 100644 index 00000000..c592fae3 --- /dev/null +++ b/sf_plan/views/duration_view.xml @@ -0,0 +1,52 @@ + + + + + hole.duration.tree + hole.duration + + + + + + + + + + + + + hole.duration.form + hole.duration + +
+ + + + + + + + + +
+
+
+ + + 孔加工 + ir.actions.act_window + hole.duration + tree,form + + + + +
+
diff --git a/sf_plan/views/view.xml b/sf_plan/views/view.xml index 49a42c5f..5df9e8db 100644 --- a/sf_plan/views/view.xml +++ b/sf_plan/views/view.xml @@ -128,7 +128,7 @@ decoration-success="state == 'done'" progress_bar="name" form_view_id="sf_production_plan_form" - default_scale="week" + default_scale="day" scales="day,week,month,year" precision="{'day': 'hour:quarter', 'week': 'day:half', 'month': 'day', 'year': 'month:quarter'}"> diff --git a/web_gantt/static/src/js/gantt_row.js b/web_gantt/static/src/js/gantt_row.js index 729ddbd8..efff4af2 100644 --- a/web_gantt/static/src/js/gantt_row.js +++ b/web_gantt/static/src/js/gantt_row.js @@ -261,12 +261,18 @@ var GanttRow = Widget.extend({ _adaptPills: function () { var self = this; var dateStartField = this.state.dateStartField; + console.log("dateStartField",dateStartField) var dateStopField = this.state.dateStopField; + console.log("dateStopField",dateStopField) var ganttStartDate = this.state.startDate; + console.log("ganttStartDate",ganttStartDate) var ganttStopDate = this.state.stopDate; + console.log("ganttStopDate",ganttStopDate) this.pills.forEach(function (pill) { var pillStartDate = self._convertToUserTime(pill[dateStartField]); + console.log("pillStartDate",pillStartDate) var pillStopDate = self._convertToUserTime(pill[dateStopField]); + console.log("pillStopDate",pillStopDate) if (pillStartDate < ganttStartDate) { pill.startDate = ganttStartDate; pill.disableStartResize = true;