修改计划排程代码
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import datetime
|
||||
import logging
|
||||
from datetime import timedelta, time
|
||||
from collections import defaultdict
|
||||
from odoo import fields, models, api
|
||||
@@ -6,6 +7,8 @@ from odoo.addons.resource.models.resource import Intervals
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
import math
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class ResWorkcenter(models.Model):
|
||||
_name = "mrp.workcenter"
|
||||
@@ -225,7 +228,11 @@ class ResWorkcenter(models.Model):
|
||||
if plan_ids:
|
||||
sum_qty = sum([p.product_qty for p in plan_ids])
|
||||
date_planned_working_hours = self._compute_effective_working_hours_day1(date_planned)
|
||||
if sum_qty >= date_planned_working_hours:
|
||||
default_capacity = round(
|
||||
self.production_line_hour_capacity * date_planned_working_hours, 2)
|
||||
_logger.info('排程日期:%s,计划数量:%s,日产能:%s,日工时:%s' % (
|
||||
date_planned, sum_qty, default_capacity, date_planned_working_hours))
|
||||
if sum_qty >= default_capacity:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user