Merge branch 'develop' of https://e.coding.net/jikimo-hn/jikimo_sfs/jikimo_sf into feature/修改机床参数bug

# Conflicts:
#	sf_warehouse/views/view.xml
This commit is contained in:
qihao.gong@jikimo.com
2024-01-22 14:37:25 +08:00
21 changed files with 287 additions and 83 deletions

View File

@@ -8,8 +8,6 @@ from odoo.exceptions import UserError
from odoo.addons.sf_base.commons.common import Common
from odoo.tools import float_compare, float_round, float_is_zero, format_datetime
from odoo.tools import float_compare, float_is_zero
class MrpProduction(models.Model):
_inherit = 'mrp.production'
@@ -162,7 +160,6 @@ class MrpProduction(models.Model):
logging.info('fetchCNC error:%s' % e)
raise UserError("cnc程序获取编程单失败,请联系管理员")
# 维修模块按钮
def button_maintenance_req(self):
self.ensure_one()
@@ -489,7 +486,7 @@ class MrpProduction(models.Model):
self._reset_work_order_sequence()
return True
#修改标记已完成方法
# 修改标记已完成方法
def button_mark_done1(self):
self._button_mark_done_sanity_checks()
@@ -506,7 +503,6 @@ class MrpProduction(models.Model):
productions_not_to_backorder = self
productions_to_backorder = self.env['mrp.production']
backorders = productions_to_backorder and productions_to_backorder._split_productions()
backorders = backorders - productions_to_backorder
@@ -514,13 +510,16 @@ class MrpProduction(models.Model):
productions_to_backorder._post_inventory(cancel_backorder=True)
# if completed products make other confirmed/partially_available moves available, assign them
done_move_finished_ids = (productions_to_backorder.move_finished_ids | productions_not_to_backorder.move_finished_ids).filtered(lambda m: m.state == 'done')
done_move_finished_ids = (
productions_to_backorder.move_finished_ids | productions_not_to_backorder.move_finished_ids).filtered(
lambda m: m.state == 'done')
done_move_finished_ids._trigger_assign()
# Moves without quantity done are not posted => set them as done instead of canceling. In
# case the user edits the MO later on and sets some consumed quantity on those, we do not
# want the move lines to be canceled.
(productions_not_to_backorder.move_raw_ids | productions_not_to_backorder.move_finished_ids).filtered(lambda x: x.state not in ('done', 'cancel')).write({
(productions_not_to_backorder.move_raw_ids | productions_not_to_backorder.move_finished_ids).filtered(
lambda x: x.state not in ('done', 'cancel')).write({
'state': 'done',
'product_uom_qty': 0.0,
})
@@ -546,8 +545,10 @@ class MrpProduction(models.Model):
'res_id': self.id,
'target': 'main',
}
if self.user_has_groups('mrp.group_mrp_reception_report') and self.picking_type_id.auto_show_reception_report:
lines = self.move_finished_ids.filtered(lambda m: m.product_id.type == 'product' and m.state != 'cancel' and m.quantity_done and not m.move_dest_ids)
if self.user_has_groups(
'mrp.group_mrp_reception_report') and self.picking_type_id.auto_show_reception_report:
lines = self.move_finished_ids.filtered(lambda
m: m.product_id.type == 'product' and m.state != 'cancel' and m.quantity_done and not m.move_dest_ids)
if lines:
if any(mo.show_allocation for mo in self):
action = self.action_view_reception_report()
@@ -574,4 +575,4 @@ class MrpProduction(models.Model):
'domain': [('id', 'in', backorders.ids)],
'view_mode': 'tree,form',
})
return action
return action

View File

@@ -1,5 +1,6 @@
import logging
from odoo import fields, models
from odoo import fields, models, api
from odoo.exceptions import UserError
class ResMrpRoutingWorkcenter(models.Model):
@@ -21,13 +22,17 @@ class ResMrpRoutingWorkcenter(models.Model):
bom_id = fields.Many2one('mrp.bom', required=False)
surface_technics_id = fields.Many2one('sf.production.process', string="表面工艺")
def generate_code(self):
return self.env['ir.sequence'].next_by_code('mrp.routing.workcenter')
code = fields.Char('编码', default=generate_code)
# 获得当前登陆者公司
def get_company_id(self):
self.company_id = self.env.user.company_id.id
company_id = fields.Many2one('res.company', compute="get_company_id", related=False)
# 排产的时候, 根据坯料的长宽高比对一下机床的最大加工尺寸.不符合就不要分配给这个加工中心(机床).
# 工单对应的工作中心,根据工序中的工作中心去匹配,
# 如果只配置了一个工作中心,则默认采用该工作中心;

View File

@@ -232,7 +232,7 @@ class ResMrpWorkOrder(models.Model):
'processing_panel': k,
'quality_point_ids': route.route_workcenter_id.quality_point_ids,
'routing_type': route.routing_type,
'work_state': '' if not route.routing_type == '获取CNC加工程序' else '待发起',
'work_state': '待发起',
'workcenter_id': self.env['mrp.routing.workcenter'].get_workcenter(route.workcenter_ids.ids,
route.routing_type,
production.product_id),