Compare commits

...

15 Commits

Author SHA1 Message Date
chenye
5008210176 合并 develop 分支到 feature/7249 2025-07-14 14:21:44 +08:00
chenye
f487ab4cce 提交7268,7271等bug修改 2025-07-14 14:15:28 +08:00
李晓斌
3527105e83 Accept Merge Request #2282: (feature/7253 -> develop)
Merge Request: Debug-7269_lxb_commit

Created By: @李晓斌
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @李晓斌
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2282?initial=true
2025-07-14 11:41:47 +08:00
lixiaobin@jikimo.com
88e4cfb541 Debug-7269_lxb_commit 2025-07-14 11:32:29 +08:00
管欢
5a175c078f Accept Merge Request #2281: (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/2281
2025-07-14 10:55:52 +08:00
guanhuan
20980bed9d 修复客供料产品下达计划,第二个计划下达报错 2025-07-14 10:54:17 +08:00
陈烨
9b94357439 Accept Merge Request #2280: (feature/7249 -> develop)
Merge Request: Merge branch 'develop' into feature/7249

Created By: @陈烨
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @陈烨
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2280
2025-07-14 08:50:26 +08:00
chenye
5ae3c5dd47 Merge branch 'develop' into feature/7249 2025-07-11 17:57:31 +08:00
chenye
60be14dda2 修改bug7264和7265 2025-07-11 17:49:05 +08:00
陈烨
f0ff7c4a74 Accept Merge Request #2279: (feature/7249 -> develop)
Merge Request: Merge branch 'develop' into feature/7249

Created By: @陈烨
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @陈烨
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2279
2025-07-11 17:01:05 +08:00
chenye
2b6e2fe31b Merge branch 'develop' into feature/7249 2025-07-11 16:48:24 +08:00
chenye
f1390e47c9 提交7252bug修改内容 2025-07-11 16:36:18 +08:00
李晓斌
c7cd0a6a69 Accept Merge Request #2278: (feature/7253 -> develop)
Merge Request: 7253_BUG修复

Created By: @李晓斌
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @李晓斌
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2278
2025-07-11 11:40:18 +08:00
lixiaobin@jikimo.com
fa5307a2ea 7253_BUG修复 2025-07-11 11:13:08 +08:00
guanhuan
4706bfe85e 计划量字段被修改成了别的字段名 2025-07-10 17:36:37 +08:00
8 changed files with 53 additions and 22 deletions

View File

@@ -42,7 +42,9 @@ class StockPicking(models.Model):
purchase_request_lines = self.move_ids.move_orig_ids.purchase_line_id.purchase_request_lines
if purchase_request_lines:
purchase_request_lines.move_dest_ids = [
(4, x.id) for x in backorder_ids.move_ids if x.product_id.id in purchase_request_lines.mapped('product_id.id')
(4, x.id) for x in backorder_ids.move_ids if
x.product_id.id in purchase_request_lines.mapped('product_id.id') and \
not x.created_purchase_request_line_id
]
return res

View File

@@ -18,3 +18,12 @@ class MrpBom(models.Model):
subcontract = self.get_supplier(product.materials_type_id)
bom_id.subcontractor_id = subcontract.partner_id.id
return bom_id
def name_get(self):
"""重写name_get方法只显示BOM编码"""
result = []
for record in self:
# 只显示BOM编码如果编码为空则显示产品名称
display_name = record.code or record.product_tmpl_id.name or f'BOM-{record.id}'
result.append((record.id, display_name))
return result

View File

@@ -36,6 +36,9 @@ class SfDemandPlan(models.Model):
blank_type = fields.Selection([('圆料', '圆料'), ('方料', '方料')], string='坯料分类',
related='product_id.blank_type')
blank_precision = fields.Selection([('精坯', '精坯'), ('粗坯', '粗坯')], string='坯料类型',
related='product_id.blank_precision')
manual_quotation = fields.Boolean('人工编程',related='product_id.manual_quotation', default=False)
embryo_long = fields.Char('坯料尺寸(mm)', compute='_compute_embryo_long', store=True)
is_incoming_material = fields.Boolean('客供料', related='sale_order_line_id.is_incoming_material', store=True)
pending_qty = fields.Float(
@@ -112,6 +115,9 @@ class SfDemandPlan(models.Model):
def _compute_embryo_long(self):
for line in self:
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)}"
else:
line.embryo_long = None
@@ -209,13 +215,16 @@ class SfDemandPlan(models.Model):
def name_get(self):
result = []
for plan in self:
result.append((plan.id, plan.product_id.name))
result.append((plan.id, plan.demand_plan_number))
return result
def button_production_release_plan(self):
line_ids = self.line_ids.filtered(lambda p: p.status == '30')
sum_product_uom_qty = sum(line_ids.mapped('plan_uom_qty'))
customer_location_id = self.env['ir.model.data']._xmlid_to_res_id('stock.stock_location_customers')
for line in self.line_ids:
if line.manual_quotation and line.custom_made_type == 'automation':
raise ValidationError(f"产品{line.product_id.name}为人工编程,不能选择自动化产线加工")
if not self.overdelivery_allowed and line_ids.filtered(lambda p: p.location_id.id == customer_location_id):
if float_compare(sum_product_uom_qty, self.product_uom_qty,
precision_rounding=self.product_id.uom_id.rounding) == 1:

View File

@@ -21,7 +21,7 @@ class SfProductionDemandPlan(models.Model):
status = fields.Selection([
('10', '草稿'),
('20', '待确认'),
('30', '需求确认'),
('30', '待工艺设计'),
('50', '待下达生产'),
('60', '已下达'),
('100', '取消'),
@@ -169,7 +169,7 @@ class SfProductionDemandPlan(models.Model):
finished_product_arrival_date = fields.Date('采购计划到货(成品)')
bom_id = fields.Many2one('mrp.bom', string="BOM", readonly=True)
location_id = fields.Many2one('stock.location', string='需求位置', default=get_location_id, readonly=True)
manual_quotation = fields.Boolean('人工编程',related='product_id.manual_quotation',default=False)
@api.constrains('plan_uom_qty')
def _check_plan_uom_qty(self):
line_ids = self.filtered(lambda p: p.plan_uom_qty == 0 or p.plan_uom_qty < 0)
@@ -344,9 +344,11 @@ class SfProductionDemandPlan(models.Model):
pro_plan.do_production_schedule()
def update_sale_order_state(self):
demand_plan = self.env['sf.demand.plan'].sudo().search([('sale_order_id', '=', self.sale_order_id.id)])
demand_plan_state = demand_plan.filtered(lambda line: line.state != '40')
if not demand_plan_state:
# demand_plan = self.env['sf.demand.plan'].sudo().search([('sale_order_id', '=', self.sale_order_id.id)])
# demand_plan_state = demand_plan.filtered(lambda line: line.state != '40')
production_demand_plan = self.env['sf.production.demand.plan'].sudo().search([('sale_order_id', '=', self.sale_order_id.id)])
production_demand_plan_state = production_demand_plan.filtered(lambda line: line.status in ('10', '20', '30'))
if not production_demand_plan_state:
# 修改销售订单为加工中
self.sale_order_id.state = 'processing'
@@ -587,7 +589,7 @@ class SfProductionDemandPlan(models.Model):
def unlink(self):
for item in self:
if item.status not in ('10', '20', '30'):
raise ValidationError(u'只能删除状态为【草稿,待确认,需求确认】的需求计划。')
raise ValidationError(u'只能删除状态为【草稿,待确认,待工艺设计】的需求计划。')
else:
super(SfProductionDemandPlan, item).unlink()
@@ -642,6 +644,8 @@ class SfProductionDemandPlan(models.Model):
self.ensure_one()
if not self.new_supply_method:
raise ValidationError(f"供货方式不能为空!")
if self.product_id.manual_quotation and self.custom_made_type == 'automation':
raise ValidationError(f"产品{self.product_id.name}为人工编程,不能选择自动化产线加工")
check_overdelivery_allowed = False
if not self.demand_plan_id.overdelivery_allowed:
customer_location_id = self.env['ir.model.data']._xmlid_to_res_id('stock.stock_location_customers')
@@ -673,6 +677,7 @@ class SfProductionDemandPlan(models.Model):
self._action_launch_stock_rule()
if self.supply_method in ('automation', 'manual'):
self.write({'status': '50'})
self.update_sale_order_state()
else:
self.write({'status': '60'})
self.update_sale_order_state()

View File

@@ -83,7 +83,7 @@
}
}
th[data-name=processing_time] + th::before{
content: '待执行单据';
line-height: 38px;
}
/*.demand_plan_tree th[data-name=planned_start_date] + th::before{*/
/* content: '待执行单据';*/
/* line-height: 38px;*/
/*}*/

View File

@@ -22,6 +22,7 @@
<field name="model_id" optional="hide"/>
<field name="part_name"/>
<field name="part_number"/>
<field name="manual_quotation" optional="hide"/>
<field name="is_incoming_material"/>
<field name="new_supply_method" attrs="{'readonly': [('status', '!=', '30')]}"/>
<field name="readonly_custom_made_type" invisible="1"/>
@@ -31,9 +32,9 @@
<field name="product_uom_qty"/>
<field name="plan_uom_qty" attrs="{'readonly': [('status', '!=', '30')]}"/>
<field name="deadline_of_delivery"/>
<field name="inventory_quantity_auto_apply"/>
<field name="qty_delivered"/>
<field name="qty_to_deliver"/>
<field name="inventory_quantity_auto_apply" optional="hide"/>
<field name="qty_delivered" optional="hide"/>
<field name="qty_to_deliver" optional="hide"/>
<field name="model_long"/>
<field name="blank_type" optional="hide"/>
<field name="blank_precision"/>

View File

@@ -20,7 +20,9 @@
<field name="part_number"/>
<field name="materials_id"/>
<field name="blank_type"/>
<field name="blank_precision"/>
<field name="embryo_long"/>
<field name="manual_quotation"/>
<field name="is_incoming_material"/>
<field name="pending_qty"/>
<field name="planned_qty"/>
@@ -86,7 +88,7 @@
'required': [('new_supply_method', '=', 'custom_made')]}"/>
<field name="route_ids" widget="many2many_tags" optional="hide"/>
<field name="location_id" optional="hide"/>
<field name="bom_id" optional="hide"/>
<field name="bom_id" optional="hide" readonly="1" options="{'no_create': True}"/>
<field name="processing_time" optional="hide"/>
<field name="plan_uom_qty" attrs="{'readonly': [('status', '!=', '30')]}"/>
<field name="blank_arrival_date"/>

View File

@@ -217,6 +217,7 @@ class StockRule(models.Model):
'''
创建制造订单时生成序列号
'''
if production.product_id.tracking != "none":
production.action_generate_serial()
origin_production = production.move_dest_ids and production.move_dest_ids[
0].raw_material_production_id or False
@@ -442,7 +443,7 @@ class ProductionLot(models.Model):
@api.model
def _get_next_serial(self, company, product):
"""Return the next serial number to be attributed to the product."""
if product.tracking == "serial":
if product.tracking != "none":
last_serial = self.env['stock.lot'].search(
[('company_id', '=', company.id), ('product_id', '=', product.id), ('name', 'ilike', product.name)],
limit=1, order='name desc')
@@ -453,7 +454,9 @@ class ProductionLot(models.Model):
return self.env['stock.lot'].generate_lot_names1(product.name, last_serial.name if (
not move_line_id or
(last_serial and last_serial.name > move_line_id.lot_name)) else move_line_id.lot_name, 2)[1]
else:
return "%s-%03d" % (product.name, 1)
return False
qr_code_image = fields.Binary(string='二维码', compute='_generate_qr_code')