Compare commits
22 Commits
feature/71
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe8df494f9 | ||
|
|
32cd68e15f | ||
|
|
f0e47371ed | ||
|
|
6dde814acc | ||
|
|
71ab241e94 | ||
|
|
0a13acbb68 | ||
|
|
4b026535f8 | ||
|
|
99ac89f995 | ||
|
|
35b1d648c3 | ||
|
|
fe3492ceb5 | ||
|
|
4274b9fe99 | ||
|
|
4ddabdefa1 | ||
|
|
364127beb3 | ||
|
|
109ea8729d | ||
|
|
32de726164 | ||
|
|
79f89f068b | ||
|
|
52189cff72 | ||
|
|
aadccce47e | ||
|
|
abd88fd721 | ||
|
|
2c2fa87719 | ||
|
|
7d8b7048a8 | ||
|
|
e7b312fb22 |
@@ -72,6 +72,7 @@ class SfProductionDemandPlan(models.Model):
|
|||||||
model_long = fields.Char('尺寸(mm)', compute='_compute_model_long')
|
model_long = fields.Char('尺寸(mm)', compute='_compute_model_long')
|
||||||
blank_type = fields.Selection([('圆料', '圆料'), ('方料', '方料')], string='坯料分类',
|
blank_type = fields.Selection([('圆料', '圆料'), ('方料', '方料')], string='坯料分类',
|
||||||
related='product_id.blank_type')
|
related='product_id.blank_type')
|
||||||
|
blank_precision = fields.Selection([('精坯', '精坯'), ('粗坯', '粗坯')], string='坯料类型', related='product_id.blank_precision')
|
||||||
embryo_long = fields.Char('坯料尺寸(mm)', compute='_compute_embryo_long')
|
embryo_long = fields.Char('坯料尺寸(mm)', compute='_compute_embryo_long')
|
||||||
materials_id = fields.Char('材料', compute='_compute_materials_id', store=True)
|
materials_id = fields.Char('材料', compute='_compute_materials_id', store=True)
|
||||||
model_machining_precision = fields.Selection(selection=_get_machining_precision, string='精度',
|
model_machining_precision = fields.Selection(selection=_get_machining_precision, string='精度',
|
||||||
@@ -196,10 +197,13 @@ class SfProductionDemandPlan(models.Model):
|
|||||||
else:
|
else:
|
||||||
line.model_long = None
|
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):
|
def _compute_embryo_long(self):
|
||||||
for line in self:
|
for line in self:
|
||||||
if line.product_id:
|
if line.product_id:
|
||||||
|
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)}"
|
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:
|
else:
|
||||||
line.embryo_long = None
|
line.embryo_long = None
|
||||||
@@ -399,6 +403,7 @@ class SfProductionDemandPlan(models.Model):
|
|||||||
outsourcing_purchase_request.extend(pr_ids.ids)
|
outsourcing_purchase_request.extend(pr_ids.ids)
|
||||||
if record.supply_method == 'outsourcing' and not record.sale_order_line_id.is_incoming_material:
|
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_line_ids = record.product_id.bom_ids.bom_line_ids
|
||||||
|
if bom_line_ids:
|
||||||
# BOM_数量
|
# BOM_数量
|
||||||
total_product_qty = sum(line.product_qty for line in bom_line_ids)
|
total_product_qty = sum(line.product_qty for line in bom_line_ids)
|
||||||
bom_product_ids = bom_line_ids.mapped('product_id')
|
bom_product_ids = bom_line_ids.mapped('product_id')
|
||||||
|
|||||||
@@ -82,3 +82,8 @@
|
|||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
th[data-name=processing_time] + th::before{
|
||||||
|
content: '待执行单据';
|
||||||
|
line-height: 38px;
|
||||||
|
}
|
||||||
|
|||||||
@@ -4,14 +4,13 @@
|
|||||||
<field name="model">sf.production.demand.plan</field>
|
<field name="model">sf.production.demand.plan</field>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
<tree string="需求计划" default_order="sequence desc,id desc" editable="bottom"
|
<tree string="需求计划" default_order="sequence desc,id desc" editable="bottom"
|
||||||
class="demand_plan_tree">
|
class="demand_plan_tree freeze-columns-before-part_number">
|
||||||
<header>
|
<header>
|
||||||
<button string="打印" name="button_action_print" type="object"
|
<button string="打印" name="button_action_print" type="object"
|
||||||
class="btn-primary"/>
|
class="btn-primary"/>
|
||||||
</header>
|
</header>
|
||||||
<field name="sequence" widget="handle"/>
|
<field name="sequence" widget="handle"/>
|
||||||
<field name="id" optional="hide"/>
|
<field name="id" optional="hide"/>
|
||||||
<field name="priority"/>
|
|
||||||
<field name="status"/>
|
<field name="status"/>
|
||||||
<field name="customer_name"/>
|
<field name="customer_name"/>
|
||||||
<field name="order_remark"/>
|
<field name="order_remark"/>
|
||||||
@@ -28,7 +27,8 @@
|
|||||||
<field name="qty_delivered"/>
|
<field name="qty_delivered"/>
|
||||||
<field name="qty_to_deliver"/>
|
<field name="qty_to_deliver"/>
|
||||||
<field name="model_long"/>
|
<field name="model_long"/>
|
||||||
<field name="blank_type"/>
|
<field name="blank_type" optional="hide"/>
|
||||||
|
<field name="blank_precision"/>
|
||||||
<field name="embryo_long"/>
|
<field name="embryo_long"/>
|
||||||
<field name="materials_id"/>
|
<field name="materials_id"/>
|
||||||
<field name="model_machining_precision"/>
|
<field name="model_machining_precision"/>
|
||||||
@@ -43,7 +43,10 @@
|
|||||||
<field name="date_order"/>
|
<field name="date_order"/>
|
||||||
<field name="contract_code"/>
|
<field name="contract_code"/>
|
||||||
<field name="plan_remark"/>
|
<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="material_check" optional="hide"/>
|
||||||
<field name="hide_action_open_mrp_production" invisible="1"/>
|
<field name="hide_action_open_mrp_production" invisible="1"/>
|
||||||
<field name="hide_action_purchase_orders" invisible="1"/>
|
<field name="hide_action_purchase_orders" invisible="1"/>
|
||||||
@@ -62,6 +65,7 @@
|
|||||||
<field name="planned_start_date"/>
|
<field name="planned_start_date"/>
|
||||||
<field name="actual_start_date"/>
|
<field name="actual_start_date"/>
|
||||||
<field name="actual_end_date"/>
|
<field name="actual_end_date"/>
|
||||||
|
<field name="processing_time"/>
|
||||||
<field name="create_date" optional="hide" string="创建时间"/>
|
<field name="create_date" optional="hide" string="创建时间"/>
|
||||||
<field name="create_uid" optional="hide" string="创建人"/>
|
<field name="create_uid" optional="hide" string="创建人"/>
|
||||||
<field name="write_date" string="更新时间"/>
|
<field name="write_date" string="更新时间"/>
|
||||||
@@ -91,7 +95,8 @@
|
|||||||
<group expand="0" string="Group By">
|
<group expand="0" string="Group By">
|
||||||
<filter name="group_by_priority" string="优先级" domain="[]" context="{'group_by': 'priority'}"/>
|
<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_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="[]"
|
<filter name="group_by_is_incoming_material" string="客供料" domain="[]"
|
||||||
context="{'group_by': 'is_incoming_material'}"/>
|
context="{'group_by': 'is_incoming_material'}"/>
|
||||||
<filter name="group_by_supply_method" string="供货方式" domain="[]"
|
<filter name="group_by_supply_method" string="供货方式" domain="[]"
|
||||||
@@ -122,4 +127,9 @@
|
|||||||
action="sf_production_demand_plan_action"
|
action="sf_production_demand_plan_action"
|
||||||
parent="sf_plan.sf_production_plan_menu"
|
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>
|
</odoo>
|
||||||
@@ -3,6 +3,7 @@ import logging
|
|||||||
|
|
||||||
import re
|
import re
|
||||||
from odoo import models, fields, api
|
from odoo import models, fields, api
|
||||||
|
from odoo.exceptions import ValidationError
|
||||||
|
|
||||||
|
|
||||||
class ResProductCategory(models.Model):
|
class ResProductCategory(models.Model):
|
||||||
@@ -47,11 +48,14 @@ class ResMrpBomMo(models.Model):
|
|||||||
item.subcontractor_name = ''
|
item.subcontractor_name = ''
|
||||||
|
|
||||||
def bom_create_line_has(self, embryo):
|
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 = {
|
vals = {
|
||||||
'bom_id': self.id,
|
'bom_id': self.id,
|
||||||
'product_id': embryo.id,
|
'product_id': embryo.id,
|
||||||
'product_tmpl_id': embryo.product_tmpl_id.id,
|
'product_tmpl_id': embryo.product_tmpl_id.id,
|
||||||
'product_qty': 1,
|
'product_qty': product.unit_number,
|
||||||
'product_uom_id': 1
|
'product_uom_id': 1
|
||||||
}
|
}
|
||||||
return self.env['mrp.bom.line'].sudo().create(vals)
|
return self.env['mrp.bom.line'].sudo().create(vals)
|
||||||
@@ -122,7 +126,7 @@ class ResMrpBomMo(models.Model):
|
|||||||
# 查bom的原材料
|
# 查bom的原材料
|
||||||
def get_raw_bom(self, product):
|
def get_raw_bom(self, product):
|
||||||
raw_bom = self.env['product.product'].search(
|
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
|
return raw_bom
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,8 @@
|
|||||||
<page string="加工参数">
|
<page string="加工参数">
|
||||||
<group>
|
<group>
|
||||||
<group string="模型">
|
<group string="模型">
|
||||||
|
<field name="blank_type" readonly="1"/>
|
||||||
|
<field name="blank_precision" readonly="1"/>
|
||||||
<label for="model_long" string="坯料尺寸[mm]"/>
|
<label for="model_long" string="坯料尺寸[mm]"/>
|
||||||
<div class="o_address_format">
|
<div class="o_address_format">
|
||||||
<label for="model_long" string="长"/>
|
<label for="model_long" string="长"/>
|
||||||
@@ -104,7 +106,7 @@
|
|||||||
<label for="model_height" string="高"/>
|
<label for="model_height" string="高"/>
|
||||||
<field name="model_height" class="o_address_zip"/>
|
<field name="model_height" class="o_address_zip"/>
|
||||||
</div>
|
</div>
|
||||||
<field name="blank_type" readonly="1"/>
|
<field name="unit_number" readonly="1"/>
|
||||||
<field name="model_volume" string="体积[mm³]"/>
|
<field name="model_volume" string="体积[mm³]"/>
|
||||||
<field name="product_model_type_id" string="模型类型"/>
|
<field name="product_model_type_id" string="模型类型"/>
|
||||||
<field name="model_processing_panel" placeholder="例如R,U" string="加工面板"
|
<field name="model_processing_panel" placeholder="例如R,U" string="加工面板"
|
||||||
|
|||||||
@@ -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'])
|
('state', 'in', ['rework'])
|
||||||
])
|
])
|
||||||
|
|
||||||
@@ -857,7 +857,6 @@ class Sf_Dashboard_Connect(http.Controller):
|
|||||||
:param kw:
|
:param kw:
|
||||||
:return:
|
: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': '成功', 'not_done_data': [], 'done_data': []}
|
||||||
res = {'status': 1, 'message': '成功', 'data': {}}
|
res = {'status': 1, 'message': '成功', 'data': {}}
|
||||||
plan_obj = request.env['sf.production.plan'].sudo()
|
plan_obj = request.env['sf.production.plan'].sudo()
|
||||||
|
|||||||
@@ -27,9 +27,11 @@ class ResProductMo(models.Model):
|
|||||||
categ_type = fields.Selection(string='产品的类别', related='categ_id.type', store=True)
|
categ_type = fields.Selection(string='产品的类别', related='categ_id.type', store=True)
|
||||||
model_name = fields.Char('模型名称')
|
model_name = fields.Char('模型名称')
|
||||||
blank_type = fields.Selection([('圆料', '圆料'), ('方料', '方料')], string='坯料分类')
|
blank_type = fields.Selection([('圆料', '圆料'), ('方料', '方料')], string='坯料分类')
|
||||||
|
blank_precision = fields.Selection([('精坯', '精坯'), ('粗坯', '粗坯')], string='坯料类型')
|
||||||
model_long = fields.Float('模型长(mm)', digits=(16, 3))
|
model_long = fields.Float('模型长(mm)', digits=(16, 3))
|
||||||
model_width = fields.Float('模型宽(mm)', digits=(16, 3))
|
model_width = fields.Float('模型宽(mm)', digits=(16, 3))
|
||||||
model_height = 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_volume = fields.Float('模型体积(m³)')
|
||||||
model_area = fields.Float('模型表面积(m²)')
|
model_area = fields.Float('模型表面积(m²)')
|
||||||
model_machining_precision = fields.Selection(selection=_get_machining_precision, string='加工精度')
|
model_machining_precision = fields.Selection(selection=_get_machining_precision, string='加工精度')
|
||||||
@@ -901,9 +903,11 @@ class ResProductMo(models.Model):
|
|||||||
vals = {
|
vals = {
|
||||||
'name': product_name,
|
'name': product_name,
|
||||||
'blank_type': item.get('blank_type'),
|
'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_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_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),
|
'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) *
|
'model_volume': self.format_float(((item['model_long'] + embryo_redundancy_id.long) *
|
||||||
(item['model_width'] + embryo_redundancy_id.width) *
|
(item['model_width'] + embryo_redundancy_id.width) *
|
||||||
(item['model_height'] + embryo_redundancy_id.height))) if not blank_bool else (
|
(item['model_height'] + embryo_redundancy_id.height))) if not blank_bool else (
|
||||||
|
|||||||
Reference in New Issue
Block a user