Compare commits

...

22 Commits

Author SHA1 Message Date
guanhuan
fe8df494f9 需求计划列表字段位置变动 2025-06-30 17:13:46 +08:00
guanhuan
32cd68e15f 调拨动作中屏蔽验证 2025-06-30 13:36:04 +08:00
guanhuan
f0e47371ed 新增坯料类型 2025-06-27 15:29:02 +08:00
yuxianghui
6dde814acc 产品-form页面加工参数 添加坯料类型字段 2025-06-27 15:17:15 +08:00
yuxianghui
71ab241e94 产品添加坯料类型字段,值来着bfm下单 2025-06-27 15:10:15 +08:00
yuxianghui
0a13acbb68 修改 销售订单确认时,生成产品BOM时校验单位用量值的提示信息 2025-06-26 17:04:50 +08:00
hyyy
4b026535f8 修改固定列tree的传参方式 2025-06-25 14:01:34 +08:00
hyyy
99ac89f995 需求-字段命名调整 2025-06-25 09:54:37 +08:00
yuxianghui
35b1d648c3 产品新增单件用量 unit_number 字段,值由bfm下单同步获得;产品生成的BOM中组件数量的值由unit_number 字段提供。 2025-06-24 15:36:23 +08:00
guanhuan
fe3492ceb5 坯料尺寸显示修改 2025-06-24 11:32:41 +08:00
yuxianghui
4274b9fe99 出厂检验报告-页脚修改回退 2025-06-20 17:53:04 +08:00
禹翔辉
4ddabdefa1 Accept Merge Request #2227: (feature/出厂检验报告模版 -> develop)
Merge Request: 优化出厂检验报告模版

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2227
2025-06-20 13:39:42 +08:00
yuxianghui
364127beb3 1 2025-06-20 13:37:42 +08:00
yuxianghui
109ea8729d 优化出厂检验报告模版 2025-06-20 12:03:17 +08:00
禹翔辉
32de726164 Accept Merge Request #2226: (feature/平台下单接口优化 -> develop)
Merge Request: 修改出厂检验报告模版

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2226
2025-06-20 11:49:32 +08:00
yuxianghui
79f89f068b 修改出厂检验报告模版 2025-06-20 11:47:59 +08:00
禹翔辉
52189cff72 Accept Merge Request #2225: (feature/平台下单接口优化 -> develop)
Merge Request: 修改出厂检验报告生成模版

Created By: @禹翔辉
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @禹翔辉
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2225
2025-06-20 11:37:18 +08:00
yuxianghui
aadccce47e 修改出厂检验报告生成模版 2025-06-20 11:35:23 +08:00
胡尧
abd88fd721 Accept Merge Request #2224: (feature/6711 -> develop)
Merge Request: 修改产量接口bug

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2224?initial=true
2025-06-20 11:27:06 +08:00
胡尧
2c2fa87719 修改产量接口bug 2025-06-20 11:26:48 +08:00
胡尧
7d8b7048a8 Accept Merge Request #2223: (feature/6711 -> develop)
Merge Request: 去掉多余代码

Created By: @胡尧
Accepted By: @胡尧
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2223?initial=true
2025-06-20 11:15:58 +08:00
胡尧
e7b312fb22 去掉多余代码 2025-06-20 10:53:31 +08:00
8 changed files with 69 additions and 40 deletions

View File

@@ -72,6 +72,7 @@ class SfProductionDemandPlan(models.Model):
model_long = fields.Char('尺寸(mm)', compute='_compute_model_long')
blank_type = fields.Selection([('圆料', '圆料'), ('方料', '方料')], string='坯料分类',
related='product_id.blank_type')
blank_precision = fields.Selection([('精坯', '精坯'), ('粗坯', '粗坯')], string='坯料类型', related='product_id.blank_precision')
embryo_long = fields.Char('坯料尺寸(mm)', compute='_compute_embryo_long')
materials_id = fields.Char('材料', compute='_compute_materials_id', store=True)
model_machining_precision = fields.Selection(selection=_get_machining_precision, string='精度',
@@ -196,11 +197,14 @@ class SfProductionDemandPlan(models.Model):
else:
line.model_long = None
@api.depends('product_id.model_long', 'product_id.model_width', 'product_id.model_height')
@api.depends('product_id.model_long', 'product_id.model_width', 'product_id.model_height', 'product_id.blank_type')
def _compute_embryo_long(self):
for line in self:
if line.product_id:
line.embryo_long = f"{round(line.product_id.model_long, 3)}*{round(line.product_id.model_width, 3)}*{round(line.product_id.model_height, 3)}"
if line.product_id.blank_type == '圆料':
line.embryo_long = f"Ø{round(line.product_id.model_width, 3)}*{round(line.product_id.model_long, 3)}"
else:
line.embryo_long = f"{round(line.product_id.model_long, 3)}*{round(line.product_id.model_width, 3)}*{round(line.product_id.model_height, 3)}"
else:
line.embryo_long = None
@@ -399,29 +403,30 @@ class SfProductionDemandPlan(models.Model):
outsourcing_purchase_request.extend(pr_ids.ids)
if record.supply_method == 'outsourcing' and not record.sale_order_line_id.is_incoming_material:
bom_line_ids = record.product_id.bom_ids.bom_line_ids
# BOM_数量
total_product_qty = sum(line.product_qty for line in bom_line_ids)
bom_product_ids = bom_line_ids.mapped('product_id')
product_purchase_orders = self.env['purchase.order'].sudo().search([
('state', 'in', ('purchase', 'done')),
('order_line.product_id', 'in', bom_product_ids.ids)
])
# 购订单_数量
total_outsourcing_purchase_quantity = sum(
sum(
order.order_line.filtered(
lambda line: line.product_id in bom_product_ids
).mapped('product_qty')
if bom_line_ids:
# BOM_数量
total_product_qty = sum(line.product_qty for line in bom_line_ids)
bom_product_ids = bom_line_ids.mapped('product_id')
product_purchase_orders = self.env['purchase.order'].sudo().search([
('state', 'in', ('purchase', 'done')),
('order_line.product_id', 'in', bom_product_ids.ids)
])
# 购订单_数量
total_outsourcing_purchase_quantity = sum(
sum(
order.order_line.filtered(
lambda line: line.product_id in bom_product_ids
).mapped('product_qty')
)
for order in product_purchase_orders
)
for order in product_purchase_orders
)
quantity = total_outsourcing_purchase_quantity / total_product_qty
if float_compare(quantity, record.product_uom_qty,
precision_rounding=record.product_id.uom_id.rounding) == -1:
purchase_request = self.env['purchase.request'].sudo().search(
[('line_ids.product_id', 'in', bom_product_ids.ids),
('line_ids.purchase_state', 'not in', ('purchase', 'done')), ('state', '!=', 'done')])
outsourcing_purchase_request.extend(purchase_request.ids)
quantity = total_outsourcing_purchase_quantity / total_product_qty
if float_compare(quantity, record.product_uom_qty,
precision_rounding=record.product_id.uom_id.rounding) == -1:
purchase_request = self.env['purchase.request'].sudo().search(
[('line_ids.product_id', 'in', bom_product_ids.ids),
('line_ids.purchase_state', 'not in', ('purchase', 'done')), ('state', '!=', 'done')])
outsourcing_purchase_request.extend(purchase_request.ids)
record.outsourcing_purchase_request = json.dumps(outsourcing_purchase_request)
if outsourcing_purchase_request:
record.hide_action_purchase_orders = True

View File

@@ -81,4 +81,9 @@
input,label {
cursor: pointer;
}
}
}
th[data-name=processing_time] + th::before{
content: '待执行单据';
line-height: 38px;
}

View File

@@ -4,14 +4,13 @@
<field name="model">sf.production.demand.plan</field>
<field name="arch" type="xml">
<tree string="需求计划" default_order="sequence desc,id desc" editable="bottom"
class="demand_plan_tree">
class="demand_plan_tree freeze-columns-before-part_number">
<header>
<button string="打印" name="button_action_print" type="object"
class="btn-primary"/>
</header>
<field name="sequence" widget="handle"/>
<field name="id" optional="hide"/>
<field name="priority"/>
<field name="status"/>
<field name="customer_name"/>
<field name="order_remark"/>
@@ -28,7 +27,8 @@
<field name="qty_delivered"/>
<field name="qty_to_deliver"/>
<field name="model_long"/>
<field name="blank_type"/>
<field name="blank_type" optional="hide"/>
<field name="blank_precision"/>
<field name="embryo_long"/>
<field name="materials_id"/>
<field name="model_machining_precision"/>
@@ -43,7 +43,10 @@
<field name="date_order"/>
<field name="contract_code"/>
<field name="plan_remark"/>
<field name="processing_time"/>
<field name="priority" decoration-danger="priority == '1'"
decoration-warning="priority == '2'"
decoration-info="priority == '3'"
decoration-success="priority == '4'"/>
<field name="material_check" optional="hide"/>
<field name="hide_action_open_mrp_production" invisible="1"/>
<field name="hide_action_purchase_orders" invisible="1"/>
@@ -62,6 +65,7 @@
<field name="planned_start_date"/>
<field name="actual_start_date"/>
<field name="actual_end_date"/>
<field name="processing_time"/>
<field name="create_date" optional="hide" string="创建时间"/>
<field name="create_uid" optional="hide" string="创建人"/>
<field name="write_date" string="更新时间"/>
@@ -91,7 +95,8 @@
<group expand="0" string="Group By">
<filter name="group_by_priority" string="优先级" domain="[]" context="{'group_by': 'priority'}"/>
<filter name="group_by_status" string="状态" domain="[]" context="{'group_by': 'status'}"/>
<filter name="group_by_customer_name" string="客户" domain="[]" context="{'group_by': 'customer_name'}"/>
<filter name="group_by_customer_name" string="客户" domain="[]"
context="{'group_by': 'customer_name'}"/>
<filter name="group_by_is_incoming_material" string="客供料" domain="[]"
context="{'group_by': 'is_incoming_material'}"/>
<filter name="group_by_supply_method" string="供货方式" domain="[]"
@@ -122,4 +127,9 @@
action="sf_production_demand_plan_action"
parent="sf_plan.sf_production_plan_menu"
/>
<!-- 调拨动作中屏蔽验证-->
<record id="stock.action_validate_picking" model="ir.actions.server">
<field name="binding_model_id" eval="False"/>
</record>
</odoo>

View File

@@ -3,6 +3,7 @@ import logging
import re
from odoo import models, fields, api
from odoo.exceptions import ValidationError
class ResProductCategory(models.Model):
@@ -47,11 +48,14 @@ class ResMrpBomMo(models.Model):
item.subcontractor_name = ''
def bom_create_line_has(self, embryo):
product = self.product_tmpl_id
if product.unit_number in (0, None, False):
raise ValidationError(f'产品{product.name}单件用量的值不能为{product.unit_number}')
vals = {
'bom_id': self.id,
'product_id': embryo.id,
'product_tmpl_id': embryo.product_tmpl_id.id,
'product_qty': 1,
'product_qty': product.unit_number,
'product_uom_id': 1
}
return self.env['mrp.bom.line'].sudo().create(vals)
@@ -122,7 +126,7 @@ class ResMrpBomMo(models.Model):
# 查bom的原材料
def get_raw_bom(self, product):
raw_bom = self.env['product.product'].search(
[('categ_id.type', '=', '原材料'), ('materials_type_id', '=', product.materials_type_id.id)],limit=1)
[('categ_id.type', '=', '原材料'), ('materials_type_id', '=', product.materials_type_id.id)], limit=1)
return raw_bom

View File

@@ -95,6 +95,8 @@
<page string="加工参数">
<group>
<group string="模型">
<field name="blank_type" readonly="1"/>
<field name="blank_precision" readonly="1"/>
<label for="model_long" string="坯料尺寸[mm]"/>
<div class="o_address_format">
<label for="model_long" string="长"/>
@@ -104,7 +106,7 @@
<label for="model_height" string="高"/>
<field name="model_height" class="o_address_zip"/>
</div>
<field name="blank_type" readonly="1"/>
<field name="unit_number" readonly="1"/>
<field name="model_volume" string="体积[mm³]"/>
<field name="product_model_type_id" string="模型类型"/>
<field name="model_processing_panel" placeholder="例如R,U" string="加工面板"

View File

@@ -489,7 +489,7 @@ class Sf_Dashboard_Connect(http.Controller):
# 工单返工数量
plan_data_rework = work_order_obj.search(plan_domain + [
plan_data_rework = work_order_obj.search(work_order_domain + [
('state', 'in', ['rework'])
])
@@ -857,7 +857,6 @@ class Sf_Dashboard_Connect(http.Controller):
:param kw:
:return:
"""
request.env['stock.warehouse'].browse(request.env.company.id).pbm_loc_id
# res = {'status': 1, 'message': '成功', 'not_done_data': [], 'done_data': []}
res = {'status': 1, 'message': '成功', 'data': {}}
plan_obj = request.env['sf.production.plan'].sudo()

View File

@@ -27,9 +27,11 @@ class ResProductMo(models.Model):
categ_type = fields.Selection(string='产品的类别', related='categ_id.type', store=True)
model_name = fields.Char('模型名称')
blank_type = fields.Selection([('圆料', '圆料'), ('方料', '方料')], string='坯料分类')
blank_precision = fields.Selection([('精坯', '精坯'), ('粗坯', '粗坯')], string='坯料类型')
model_long = fields.Float('模型长(mm)', digits=(16, 3))
model_width = fields.Float('模型宽(mm)', digits=(16, 3))
model_height = fields.Float('模型高(mm)', digits=(16, 3))
unit_number = fields.Float('单件用量', digits=(16, 3), default=1)
model_volume = fields.Float('模型体积(m³)')
model_area = fields.Float('模型表面积(m²)')
model_machining_precision = fields.Selection(selection=_get_machining_precision, string='加工精度')
@@ -901,9 +903,11 @@ class ResProductMo(models.Model):
vals = {
'name': product_name,
'blank_type': item.get('blank_type'),
'blank_precision': item.get('blank_precision'),
'model_long': item.get('blank_length') if blank_bool else self.format_float(item['model_long'] + embryo_redundancy_id.long),
'model_width': item.get('blank_width') if blank_bool else self.format_float(item['model_width'] + embryo_redundancy_id.width),
'model_height': item.get('blank_height') if blank_bool else self.format_float(item['model_height'] + embryo_redundancy_id.height),
'unit_number': item.get('unit_number'),
'model_volume': self.format_float(((item['model_long'] + embryo_redundancy_id.long) *
(item['model_width'] + embryo_redundancy_id.width) *
(item['model_height'] + embryo_redundancy_id.height))) if not blank_bool else (
@@ -957,7 +961,7 @@ class ResProductMo(models.Model):
self.attachment_update(item['quality_standard_name'], copy_product_id.product_tmpl_id.id,
'quality_standard', item['quality_standard_mimetype'])
return copy_product_id
def format_float(self, value):
# 将浮点数转换为字符串
value_str = str(value)

View File

@@ -92,7 +92,7 @@
<div class="page" style="min-height: 800px; position: relative; padding-bottom: 250px;">
<table class="table table-sm o_main_table mt-4" style="border: 1px solid black;">
<tr>
<td style="width: 15%; border: 1px solid black;"><strong>产品名称:</strong></td>
@@ -113,7 +113,7 @@
<td style="border: 1px solid black;"><span t-field="o.check_qty"/></td>
</tr>
</table>
<h4 class="text-center mt-4">检验结果</h4>
<div class="" style="position: relative;">
<table class="table table-sm mt-2" style="border: 1px solid black;">
@@ -182,7 +182,7 @@
</span>
</div>
</div>
<div class="row mt-4">
<div class="col-6">
<p><strong>操作员: </strong> <span t-field="o.measure_operator"/></p>
@@ -200,7 +200,7 @@
<p></p>
</div>
</div> -->
<!-- 页脚固定在底部 -->
<!-- <div style="position: absolute; bottom: 0; left: 0; right: 0;"> -->
<t t-call="sf_quality.report_quality_footer"/>