解决冲突
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
'website': 'https://www.sf.jikimo.com',
|
||||
'depends': ['sf_base', 'sf_maintenance', 'web_widget_model_viewer', 'sf_warehouse','jikimo_attachment_viewer', 'jikimo_sale_multiple_supply_methods'],
|
||||
'data': [
|
||||
'data/cron_data.xml',
|
||||
'data/stock_data.xml',
|
||||
'data/empty_racks_data.xml',
|
||||
'data/panel_data.xml',
|
||||
|
||||
29
sf_manufacturing/data/cron_data.xml
Normal file
29
sf_manufacturing/data/cron_data.xml
Normal file
@@ -0,0 +1,29 @@
|
||||
<odoo>
|
||||
<data noupdate="1">
|
||||
<record model="ir.cron" id="ir_cron_update_construction_period_status">
|
||||
<field name="name">工期状态变更</field>
|
||||
<field name="model_id" ref="model_mrp_workorder"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">model._corn_update_construction_period_status()</field>
|
||||
<field name="interval_number">12</field>
|
||||
<field name="interval_type">hours</field>
|
||||
<field name="numbercall">-1</field>
|
||||
<field name="doall" eval="False"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="active" eval="True"/>
|
||||
</record>
|
||||
|
||||
<record model="ir.cron" id="ir_cron_update_delivery_status">
|
||||
<field name="name">交期状态变更</field>
|
||||
<field name="model_id" ref="model_mrp_production"/>
|
||||
<field name="state">code</field>
|
||||
<field name="code">model._corn_update_delivery_status()</field>
|
||||
<field name="interval_number">12</field>
|
||||
<field name="interval_type">hours</field>
|
||||
<field name="numbercall">-1</field>
|
||||
<field name="doall" eval="False"/>
|
||||
<field name="user_id" ref="base.user_root"/>
|
||||
<field name="active" eval="True"/>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -35,23 +35,18 @@ class MrpProduction(models.Model):
|
||||
tool_state_remark2 = fields.Text(string='功能刀具状态备注(无效刀)', readonly=True)
|
||||
|
||||
def _compute_default_delivery_status(self):
|
||||
need_list = [
|
||||
'pending_cam',
|
||||
'progress',
|
||||
'rework',
|
||||
'scrap',
|
||||
'to_close',
|
||||
]
|
||||
try:
|
||||
if self.state not in need_list:
|
||||
if self.state == 'cancel':
|
||||
return False
|
||||
if not self.deadline_of_delivery:
|
||||
return '已逾期'
|
||||
return False
|
||||
hours = self.get_hours_diff()
|
||||
if hours >= 48:
|
||||
return '正常'
|
||||
elif hours > 0 and hours < 48:
|
||||
elif hours > 0 and hours < 48 and self.state != 'done':
|
||||
return '预警'
|
||||
elif hours > 0 and hours < 48 and self.state == 'done':
|
||||
return '正常'
|
||||
else:
|
||||
return '已逾期'
|
||||
except Exception as e:
|
||||
@@ -60,20 +55,55 @@ class MrpProduction(models.Model):
|
||||
|
||||
@api.depends('state', 'deadline_of_delivery')
|
||||
def _compute_delivery_status(self):
|
||||
for production in self:
|
||||
delivery_status = production._compute_default_delivery_status()
|
||||
if delivery_status and production.delivery_status != delivery_status:
|
||||
production.delivery_status = delivery_status
|
||||
|
||||
delivery_status = fields.Selection([('正常', '正常'), ('预警', '预警'), ('已逾期', '已逾期')], string='交期状态',
|
||||
store=True,
|
||||
compute='_compute_delivery_status',
|
||||
default=lambda self: self._compute_default_delivery_status())
|
||||
|
||||
def get_page_all_records(self, model_name, func, domain, page_size=100):
|
||||
# 获取模型对象
|
||||
model = self.env[model_name].sudo()
|
||||
|
||||
# 初始化分页参数
|
||||
page_number = 1
|
||||
while True:
|
||||
# 计算偏移量
|
||||
offset = (page_number - 1) * page_size
|
||||
|
||||
# 获取当前页的数据
|
||||
records = model.search(domain, limit=page_size, offset=offset)
|
||||
|
||||
# 如果没有更多记录,退出循环
|
||||
if not records:
|
||||
break
|
||||
|
||||
# 将当前页的数据添加到结果列表
|
||||
func(records)
|
||||
# 增加页码
|
||||
page_number += 1
|
||||
|
||||
def run_compute_delivery_status(self, records):
|
||||
records._compute_delivery_status()
|
||||
|
||||
def _corn_update_delivery_status(self):
|
||||
need_list = [
|
||||
'draft',
|
||||
'technology_to_confirmed',
|
||||
'confirmed',
|
||||
'pending_cam',
|
||||
'progress',
|
||||
'rework',
|
||||
'scrap',
|
||||
'to_close',
|
||||
]
|
||||
for production in self:
|
||||
production.delivery_status = production._compute_default_delivery_status()
|
||||
|
||||
delivery_status = fields.Selection([('正常', '正常'), ('预警', '预警'), ('已逾期', '已逾期')], string='交期状态',
|
||||
store=True,
|
||||
compute='_compute_delivery_status',
|
||||
default=lambda self: self._compute_default_delivery_status())
|
||||
# previous_workorder = self.env['mrp.production'].search([('state', 'in', need_list)])
|
||||
self.get_page_all_records('mrp.production', self.run_compute_delivery_status,
|
||||
[('state', 'in', need_list)], 100)
|
||||
|
||||
def get_hours_diff(self):
|
||||
# 获取当前日期和时间
|
||||
@@ -779,6 +809,7 @@ class MrpProduction(models.Model):
|
||||
if td_ids:
|
||||
work.sequence = td_ids[0].sequence
|
||||
|
||||
|
||||
def _reset_work_order_sequence_1(self):
|
||||
"""
|
||||
工单工序排序方法(旧)
|
||||
|
||||
@@ -148,19 +148,19 @@ class ResMrpWorkOrder(models.Model):
|
||||
tag_type = fields.Selection([("重新加工", "重新加工")], string="标签", tracking=True)
|
||||
|
||||
def _compute_default_construction_period_status(self):
|
||||
need_list = [
|
||||
'progress',
|
||||
'to be detected']
|
||||
need_list=['pending', 'waiting', 'ready', 'progress', 'to be detected','done']
|
||||
try:
|
||||
if self.state not in need_list:
|
||||
return False
|
||||
if not self.date_planned_finished:
|
||||
return '已逾期'
|
||||
return False
|
||||
hours = self.get_hours_diff()
|
||||
if hours >= 12:
|
||||
return '正常'
|
||||
elif hours > 0 and hours < 12:
|
||||
elif hours > 0 and hours < 12 and self.state!='done':
|
||||
return '预警'
|
||||
elif hours > 0 and hours < 12 and self.state=='done':
|
||||
return '正常'
|
||||
else:
|
||||
return '已逾期'
|
||||
except Exception as e:
|
||||
@@ -170,12 +170,46 @@ class ResMrpWorkOrder(models.Model):
|
||||
@api.depends('state', 'date_planned_finished')
|
||||
def _compute_construction_period_status(self):
|
||||
for worker in self:
|
||||
worker.construction_period_status = worker._compute_default_construction_period_status()
|
||||
construction_period_status = worker._compute_default_construction_period_status()
|
||||
if construction_period_status and worker.construction_period_status!=construction_period_status:
|
||||
worker.construction_period_status = construction_period_status
|
||||
|
||||
construction_period_status = fields.Selection([('正常', '正常'), ('预警', '预警'), ('已逾期', '已逾期')], string='工期状态',
|
||||
store=True,
|
||||
compute='_compute_construction_period_status',
|
||||
default=lambda self: self._compute_default_construction_period_status())
|
||||
construction_period_status = fields.Selection([('正常', '正常'), ('预警', '预警'), ('已逾期', '已逾期')],
|
||||
string='工期状态',
|
||||
store=True,
|
||||
compute='_compute_construction_period_status',
|
||||
default=lambda
|
||||
self: self._compute_default_construction_period_status())
|
||||
|
||||
def get_page_all_records(self, model_name, func, domain, page_size=100):
|
||||
# 获取模型对象
|
||||
model = self.env[model_name].sudo()
|
||||
|
||||
# 初始化分页参数
|
||||
page_number = 1
|
||||
while True:
|
||||
# 计算偏移量
|
||||
offset = (page_number - 1) * page_size
|
||||
|
||||
# 获取当前页的数据
|
||||
records = model.search(domain, limit=page_size, offset=offset)
|
||||
|
||||
# 如果没有更多记录,退出循环
|
||||
if not records:
|
||||
break
|
||||
|
||||
# 将当前页的数据添加到结果列表
|
||||
func(records)
|
||||
# 增加页码
|
||||
page_number += 1
|
||||
def run_compute_construction_period_status(self,records):
|
||||
records._compute_construction_period_status()
|
||||
def _corn_update_construction_period_status(self):
|
||||
need_list=['pending', 'waiting', 'ready', 'progress', 'to be detected']
|
||||
# need_list = [
|
||||
# 'progress',
|
||||
# 'to be detected']
|
||||
self.get_page_all_records('mrp.workorder',self.run_compute_construction_period_status,[('state', 'in', need_list)],100)
|
||||
|
||||
def get_hours_diff(self):
|
||||
# 获取当前日期和时间
|
||||
|
||||
@@ -505,6 +505,12 @@ class ProductionLot(models.Model):
|
||||
if product.categ_id.name == '刀具':
|
||||
return self.env['stock.lot'].get_tool_generate_lot_names1(company, product)
|
||||
else:
|
||||
# 对last_serial的name进行检测,如果不是以产品名称+数字的形式的就重新搜索
|
||||
if product.name.split('[')[0] not in last_serial.name:
|
||||
last_serial = self.env['stock.lot'].search(
|
||||
[('company_id', '=', company.id), ('product_id', '=', product.id),
|
||||
('name', 'ilike', product.name.split('[')[0])],
|
||||
limit=1, order='name desc')
|
||||
return self.env['stock.lot'].generate_lot_names1(product.name, last_serial.name, 2)[1]
|
||||
now = datetime.now().strftime("%Y%m%d")
|
||||
if product.cutting_tool_model_id:
|
||||
@@ -831,10 +837,11 @@ class ReStockMove(models.Model):
|
||||
self.next_serial = self._get_tool_next_serial(self.company_id, self.product_id, self.origin)
|
||||
else:
|
||||
self.next_serial = self.env['stock.lot']._get_next_serial(self.company_id, self.product_id)
|
||||
if self.picking_type_id.sequence_code == 'DL' and not self.move_line_nosuggest_ids:
|
||||
self.action_assign_serial_show_details()
|
||||
elif self.product_id.tracking == "lot":
|
||||
self._put_tool_lot(self.company_id, self.product_id, self.origin)
|
||||
if not self.move_line_nosuggest_ids:
|
||||
self._generate_serial_numbers()
|
||||
|
||||
|
||||
return {
|
||||
'name': _('Detailed Operations'),
|
||||
|
||||
@@ -557,7 +557,7 @@
|
||||
<separator/>
|
||||
</xpath>
|
||||
<xpath expr="//search" position="inside">
|
||||
<searchpanel class="account_root">
|
||||
<searchpanel>
|
||||
<field name="state" icon="fa-filter" enable_counters="1"/>
|
||||
<field name="delivery_status" icon="fa-filter" enable_counters="1"/>
|
||||
</searchpanel>
|
||||
|
||||
@@ -265,7 +265,7 @@
|
||||
|
||||
<!-- 这个也是制造订单生产计划,只是把tree视图放在了默认位置 -->
|
||||
<record id="sf_production_plan_action1" model="ir.actions.act_window">
|
||||
<field name="name">制造订单生产计划</field>
|
||||
<field name="name">CNC产线计划排程</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="res_model">sf.production.plan</field>
|
||||
<field name="view_mode">tree,gantt,form</field>
|
||||
|
||||
@@ -16130,6 +16130,11 @@ msgstr "在手库存"
|
||||
msgid "Inventory Overview"
|
||||
msgstr "库存概览"
|
||||
|
||||
#. module: stock
|
||||
#: model:ir.actions.act_window,name:stock.stock_picking_type_action
|
||||
msgid "Internal Transfers"
|
||||
msgstr "厂内出入库"
|
||||
|
||||
#. module: stock
|
||||
#: model:ir.model.fields,field_description:stock.field_stock_quant__inventory_quantity_set
|
||||
msgid "Inventory Quantity Set"
|
||||
|
||||
@@ -23,8 +23,8 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="quality_control.quality_alert_action_check" model="ir.actions.act_window">
|
||||
<field name="name">质量缺陷单</field>
|
||||
<record id="quality_alert_action_check" model="ir.actions.act_window">
|
||||
<field name="name">质量缺陷</field>
|
||||
<field name="res_model">quality.alert</field>
|
||||
<field name="view_mode">tree,kanban,form,pivot,graph,calendar</field>
|
||||
<field name="help" type="html">
|
||||
@@ -34,6 +34,13 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<menuitem
|
||||
id="quality_control.menu_quality_alert"
|
||||
name="质量缺陷"
|
||||
action="quality_alert_action_check"
|
||||
parent="quality_control.menu_quality_control"
|
||||
sequence="20"/>
|
||||
|
||||
<record model="ir.ui.view" id="quality_point_view_form_inherit_sf">
|
||||
<field name="name">quality.point.form.inherit.sf</field>
|
||||
<field name="model">quality.point</field>
|
||||
|
||||
@@ -1106,6 +1106,9 @@ class SfProcurementGroup(models.Model):
|
||||
class SfPickingType(models.Model):
|
||||
_inherit = 'stock.picking.type'
|
||||
|
||||
code = fields.Selection([('incoming', 'Receipt'), ('outgoing', 'Delivery'), ('internal', '厂内出入库')],
|
||||
'Type of Operation', required=True)
|
||||
|
||||
def _default_show_operations(self):
|
||||
return self.user_has_groups(
|
||||
'stock.group_production_lot,'
|
||||
|
||||
Reference in New Issue
Block a user