Accept Merge Request #1983: (feature/commercially_launched -> develop)

Merge Request: Merge branch 'develop' into feature/commercially_launched

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/1983
This commit is contained in:
胡尧
2025-04-01 20:45:15 +08:00
committed by Coding
9 changed files with 59 additions and 15 deletions

View File

@@ -1,6 +1,6 @@
# Translation of Odoo Server.
# This file contains the translation of the following modules:
# * purchase_request
# * jikimo_purchase_request
#
# Translators:
# Jeffery Chen Fan <jeffery9@gmail.com>, 2016
@@ -862,7 +862,7 @@ msgstr "采购申请 %s 已完成"
#: code:addons/purchase_request/wizard/purchase_request_line_make_purchase_order.py:0
#, python-format
msgid "Purchase Request %s is not approved or in progress"
msgstr "采购申请 %s 未获批准或进行中"
msgstr "采购申请 %s 状态非已批准或进行中"
#. module: purchase_request
#: model:ir.model,name:purchase_request.model_purchase_request_allocation

View File

@@ -87,6 +87,20 @@ class PurchaseRequestLineMakePurchaseOrder(models.TransientModel):
"type": "ir.actions.act_window",
}
def _check_valid_request_line(self, request_line_ids):
for line in self.env["purchase.request.line"].browse(request_line_ids):
if line.request_id.state not in ["approved", "in_progress"]:
raise UserError(
_("采购申请 %s 未审批或未进行中")
% line.request_id.name
)
super(PurchaseRequestLineMakePurchaseOrder, self)._check_valid_request_line(request_line_ids)
@api.model
def check_group(self, request_lines):
# 去掉合并必须同一采购组的限制
pass
class PurchaseRequestLineMakePurchaseOrderItem(models.TransientModel):
_inherit = "purchase.request.line.make.purchase.order.item"

View File

@@ -32,7 +32,7 @@
<field name="is_bill" invisible="True"/>
<field name="logistics_status" invisible="True"/>
<field name="logistics_way" invisible="True"/>
<button string="物流下单" name="create_order" type="object" confirm="是否确认物流下单" class="btn-primary"
<!-- <button string="物流下单" name="create_order" type="object" confirm="是否确认物流下单" class="btn-primary" -->
attrs="{'invisible': ['|', '|', '|', ('check_out', '!=', 'OUT'), ('state', '!=', 'assigned'), ('is_bill', '=', True), ('logistics_way', '=', '自提')]}"/>
<button string="获取物流面单" name="get_bill" type="object" confirm="是否获取物流面单" class="btn-primary"
attrs="{'invisible': ['|', '|', '|', '|', ('check_out', '!=', 'OUT'), ('state', '!=', 'assigned'), ('logistics_status', '=', '2'), ('is_bill', '=', False), ('logistics_way', '=', '自提')]}"/>

View File

@@ -736,7 +736,8 @@ class ResMrpWorkOrder(models.Model):
local_filename = self.save_name + '.xls'
local_file_path = os.path.join(local_dir_path, local_filename)
logging.info('local_file_path:%s' % local_file_path)
remote_path = '/home/ftp/ftp_root/ThreeTest/XT/Before/' + local_filename
# remote_path = '/home/ftp/ftp_root/ThreeTest/XT/Before/' + local_filename
remote_path = '/ThreeTest/XT/Before/' + local_filename
logging.info('remote_path:%s' % remote_path)
is_get_detection_file = self.env['ir.config_parameter'].sudo().get_param('is_get_detection_file')
if not is_get_detection_file:
@@ -1533,7 +1534,7 @@ class ResMrpWorkOrder(models.Model):
# workorder.rfid_code_old = rfid_code
# workorder.rfid_code = False
logging.info('workorder.rfid_code:%s' % workorder.rfid_code)
# if is_production_id is True and record.routing_type in ['解除装夹', '表面工艺', '切割']:
if is_production_id is True:
logging.info('product_qty:%s' % record.production_id.product_qty)
for move_raw_id in record.production_id.move_raw_ids:
@@ -1548,6 +1549,17 @@ class ResMrpWorkOrder(models.Model):
# if raw_move:
# raw_move.write({'state': 'done'})
if record.production_id.state != 'rework':
# 如果工单包含了外协工序,需要预留数量
if self.move_raw_ids.move_orig_ids.subcontract_workorder_id:
location_id = self.move_raw_ids.location_id
quant = self.move_raw_ids.lot_ids.quant_ids.filtered(lambda q: q.location_id.id == location_id.id)
if quant.reserved_quantity == 0:
self.env['stock.quant']._update_reserved_quantity(
self.move_raw_ids.product_id,
location_id,
quant.quantity,
lot_id=quant.lot_id,
)
record.production_id.button_mark_done1()
# record.production_id.state = 'done'
@@ -1851,7 +1863,7 @@ class CNCprocessing(models.Model):
# 将FTP的多面的程序单文件下载到临时目录
def download_file_tmp(self, production_no, processing_panel):
remotepath = os.path.join('/home/ftp/ftp_root/NC', production_no, 'return', processing_panel)
remotepath = os.path.join('/', production_no, 'return', processing_panel)
serverdir = os.path.join('/tmp', production_no, 'return', processing_panel)
ftp_resconfig = self.env['res.config.settings'].get_values()
ftp = FtpController(str(ftp_resconfig['ftp_host']), int(ftp_resconfig['ftp_port']), ftp_resconfig['ftp_user'],

View File

@@ -355,9 +355,9 @@ class StockRule(models.Model):
)
for p in production_process:
logging.info('production_process:%s' % p.name)
process_parameter = production_item.product_id.model_process_parameters_ids.filtered(
process_parameters = production_item.product_id.model_process_parameters_ids.filtered(
lambda pm: pm.process_id.id == p.id)
if process_parameter:
for process_parameter in process_parameters:
i += 1
route_production_process = self.env[
'mrp.routing.workcenter'].search(
@@ -688,6 +688,7 @@ class StockPicking(models.Model):
# 如果当前工单是是制造订单的最后一个工艺外协工单
if workorder == next((workorder for workorder in reversed(sorted_workorders) if workorder.is_subcontract),
None):
if item.move_raw_ids:
move_dest_id = item.move_raw_ids[0].id
else:
# 从sorted_workorders中找到上一工单的move
@@ -724,6 +725,7 @@ class StockPicking(models.Model):
moves_out._action_confirm()
moves_out._assign_picking_post_process(new=new_picking)
@api.depends('move_type', 'immediate_transfer', 'move_ids.state', 'move_ids.picking_id')
def _compute_state(self):
super(StockPicking, self)._compute_state()
@@ -847,6 +849,7 @@ class ReStockMove(models.Model):
# 'route_ids': False if not route else [(4, route.id)],
'date_deadline': datetime.now(),
'picking_type_id': picking_type_id,
# 'is_subcontract': True,
}
return move_values
@@ -1117,6 +1120,13 @@ class ReStockMove(models.Model):
self.state = 'assigned'
return self.action_show_details()
def _prepare_move_line_vals(self, quantity=None, reserved_quant=None):
res = super(ReStockMove, self)._prepare_move_line_vals(quantity, reserved_quant)
if self.subcontract_workorder_id:
if self.subcontract_workorder_id.production_id.move_raw_ids.move_line_ids:
res['lot_id'] = self.subcontract_workorder_id.production_id.move_raw_ids.move_line_ids[0].lot_id.id
return res
class ReStockQuant(models.Model):
_inherit = 'stock.quant'

View File

@@ -18,7 +18,7 @@
<xpath expr="//page/field[@name='order_line']/tree/field[@name='remark']" position="before">
<field name="supply_method" attrs="{'invisible': [('state', '=', 'draft')], 'required': [('state', '=', 'supply method')]}" />
</xpath>
<xpath expr="//field[@name='order_line']/tree/field[@name='glb_url']" position="before">
<xpath expr="//field[@name='order_line']/tree/field[@name='product_template_id']" position="after">
<field name="part_number" optional="show" class="section_and_note_text"/>
</xpath>
<!-- <xpath expr="//field[@name='order_line']/tree/field[@name='remark']" position="before"> -->
@@ -71,7 +71,7 @@
<record id="sale.action_quotations_with_onboarding" model="ir.actions.act_window">
<field name="search_view_id" ref="jikimo_sale_order_view_search_inherit_quotation_supply_method"/>
<field name="context">{'search_default_draft': 1}</field>
<field name="context">{'search_default_supply_method': 1}</field>
</record>
<record id="action_quotations_supply_method" model="ir.actions.act_window">

View File

@@ -191,7 +191,8 @@ class SFMessageWork(models.Model):
def write(self, vals):
res = super(SFMessageWork, self).write(vals)
for record in self:
if ('leave_id' in vals and vals['leave_id'] is False or 'date_planned_start' in vals and vals['date_planned_start'] is False) \
and self.schedule_state != '未排':
self.add_queue('计划数据异常跟踪')
and record.schedule_state != '未排':
record.add_queue('计划数据异常跟踪')
return res

View File

@@ -150,6 +150,7 @@ class ReSaleOrder(models.Model):
'is_incoming_material': True if item.get('embryo_redundancy_id') else False,
'manual_quotation': item.get('manual_quotation'),
'model_id': item['model_id'],
'delivery_end_date': item['delivery_end_date'],
}
return self.env['sale.order.line'].with_context(skip_procurement=True).create(vals)
@@ -272,6 +273,8 @@ class ResaleOrderLine(models.Model):
model_url = fields.Char('模型文件地址')
model_id = fields.Char('模型id')
delivery_end_date = fields.Date('交货截止日期')
@api.depends('embryo_redundancy_id')
def _compute_is_incoming_material(self):
for line in self:

View File

@@ -136,6 +136,10 @@
<xpath expr="//field[@name='order_line']/tree/field[@name='product_uom']" position="attributes">
<attribute name="optional">hide</attribute>
</xpath>
<xpath expr="//field[@name='order_line']/tree/field[@name='remark']" position="before">
<field name="delivery_end_date" optional="hide"/>
</xpath>
<field name="user_id" position="attributes">
<attribute name="attrs">{'readonly': [('state', 'in', ['cancel','sale'])]}</attribute>
</field>