Compare commits

...

12 Commits

Author SHA1 Message Date
lixiaobin@jikimo.com
94d727e8e0 Bug_7262_lxb_commit 2025-07-16 14:06:58 +08:00
lixiaobin@jikimo.com
9416d1c1a0 BUG_7276_lxb_commit 2025-07-16 11:20:26 +08:00
管欢
7dd44ca12c Accept Merge Request #2288: (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/2288
2025-07-16 09:41:06 +08:00
李晓斌
2738085a1e Accept Merge Request #2287: (feature/7253 -> develop)
Merge Request: Bug_7276_lxb_commit

Created By: @李晓斌
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @李晓斌
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2287?initial=true
2025-07-15 16:56:26 +08:00
lixiaobin@jikimo.com
61c1fdbd05 Bug_7276_lxb_commit 2025-07-15 16:53:52 +08:00
李晓斌
714c68c0c1 Accept Merge Request #2286: (feature/7253 -> develop)
Merge Request: BUG_7276_lxb_commit

Created By: @李晓斌
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @李晓斌
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2286
2025-07-15 14:35:11 +08:00
lixiaobin@jikimo.com
f3e7ba7f68 BUG_7276_lxb_commit 2025-07-15 14:17:38 +08:00
lixiaobin@jikimo.com
df589b43e7 BUG_7276_lxb_commit 2025-07-15 14:13:01 +08:00
lixiaobin@jikimo.com
8bdc65c626 BUG_7276_lxb_commit 2025-07-15 14:09:14 +08:00
李晓斌
7fca59322e Accept Merge Request #2285: (feature/7253 -> develop)
Merge Request: BUG_7276_lxb_commit

Created By: @李晓斌
Reviewed By: @胡尧
Approved By: @胡尧 
Accepted By: @李晓斌
URL: https://jikimo-hn.coding.net/p/jikimo_sfs/d/jikimo_sf/git/merge/2285
2025-07-15 09:42:48 +08:00
lixiaobin@jikimo.com
42694c1ac6 BUG_7276_lxb_commit 2025-07-15 09:39:50 +08:00
管欢
e88fc012ec Accept Merge Request #2284: (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/2284
2025-07-14 16:16:20 +08:00
3 changed files with 27 additions and 14 deletions

View File

@@ -222,10 +222,15 @@ class SfDemandPlan(models.Model):
line_ids = self.line_ids.filtered(lambda p: p.status == '30') line_ids = self.line_ids.filtered(lambda p: p.status == '30')
sum_product_uom_qty = sum(line_ids.mapped('plan_uom_qty')) 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') customer_location_id = self.env['ir.model.data']._xmlid_to_res_id('stock.stock_location_customers')
if not self.overdelivery_allowed and line_ids.filtered(lambda p: p.location_id.id == customer_location_id): check_overdelivery_allowed = False
if float_compare(sum_product_uom_qty, self.product_uom_qty, for line in line_ids:
precision_rounding=self.product_id.uom_id.rounding) == 1: if line.location_id.id == customer_location_id:
raise ValidationError(f"已禁止向合作伙伴/客户超量发货,请更换“补货原因”或将“可超量发货”设置为“是”。") if not self.overdelivery_allowed:
if float_compare(sum_product_uom_qty, self.product_uom_qty,
precision_rounding=line.product_id.uom_id.rounding) == 1:
check_overdelivery_allowed = True
if check_overdelivery_allowed:
raise ValidationError(f"已禁止向合作伙伴/客户超量发货,请更换“补货原因”或将“可超量发货”设置为“是”。")
elif float_compare(sum_product_uom_qty, self.product_uom_qty, elif float_compare(sum_product_uom_qty, self.product_uom_qty,
precision_rounding=self.product_id.uom_id.rounding) == 1: precision_rounding=self.product_id.uom_id.rounding) == 1:
return { return {

View File

@@ -613,14 +613,14 @@ class SfProductionDemandPlan(models.Model):
filtered_plan = self.filtered(lambda mo: mo.status == '30') filtered_plan = self.filtered(lambda mo: mo.status == '30')
if not filtered_plan: if not filtered_plan:
raise UserError(_("没有需要下达的计划!")) raise UserError(_("没有需要下达的计划!"))
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')
if self.location_id.id == customer_location_id:
check_overdelivery_allowed = True
# 按产品分组并计算总数 # 按产品分组并计算总数
product_data = {} product_data = {}
for plan in filtered_plan: for plan in filtered_plan:
check_overdelivery_allowed = False
if not plan.demand_plan_id.overdelivery_allowed:
customer_location_id = self.env['ir.model.data']._xmlid_to_res_id('stock.stock_location_customers')
if plan.location_id.id == customer_location_id:
check_overdelivery_allowed = True
if plan.product_id not in product_data: if plan.product_id not in product_data:
# 初始化产品数据,从产品上获取需求量 # 初始化产品数据,从产品上获取需求量
product_data[plan.product_id] = { product_data[plan.product_id] = {
@@ -630,17 +630,22 @@ class SfProductionDemandPlan(models.Model):
# 累加计划数量 # 累加计划数量
product_data[plan.product_id]['plan_uom_qty'] += plan.plan_uom_qty product_data[plan.product_id]['plan_uom_qty'] += plan.plan_uom_qty
product_data[plan.product_id]['overdelivery_allowed'] = check_overdelivery_allowed
# 检查需求超过计划数量的产品 # 检查需求超过计划数量的产品
warning_messages = [] warning_messages = []
error_messages = []
for product, data in product_data.items(): for product, data in product_data.items():
if float_compare(data['plan_uom_qty'], data['product_uom_qty'], if data['overdelivery_allowed'] and float_compare(data['plan_uom_qty'], data['product_uom_qty'],precision_rounding=product.uom_id.rounding) == 1:
error_messages.append(f"您正在下达的产品 {product.display_name},已禁止向合作伙伴/客户超量发货,请更换“补货原因”或将“可超量发货”设置为“是”。")
elif float_compare(data['plan_uom_qty'], data['product_uom_qty'],
precision_rounding=product.uom_id.rounding) == 1: precision_rounding=product.uom_id.rounding) == 1:
warning_messages.append( warning_messages.append(
_("您正在下达的产品 %s,计划量%s,需求数量为%s,已超过需求数量") % _("您正在下达的产品 %s,计划量%s,需求数量为%s,已超过需求数量") %
(product.display_name, data['plan_uom_qty'], data['product_uom_qty']) (product.display_name, data['plan_uom_qty'], data['product_uom_qty'])
) )
if warning_messages and check_overdelivery_allowed: if error_messages:
raise ValidationError(f"已禁止向合作伙伴/客户超量发货,请更换“补货原因”或将“可超量发货”设置为“是”。") error_message = "\n".join(error_messages)
raise ValidationError(error_message)
elif warning_messages: elif warning_messages:
warning_message = "\n".join(warning_messages) warning_message = "\n".join(warning_messages)
return { return {
@@ -655,6 +660,9 @@ class SfProductionDemandPlan(models.Model):
'default_demand_plan_line_id': self.ids, 'default_demand_plan_line_id': self.ids,
'default_release_message': warning_message, 'default_release_message': warning_message,
}} }}
else:
for demand_plan_line_id in filtered_plan:
demand_plan_line_id.action_confirm()
def button_release_plan(self): def button_release_plan(self):
self.ensure_one() self.ensure_one()

View File

@@ -155,7 +155,7 @@ class ReSaleOrder(models.Model):
'glb_url': item['glb_url'], 'glb_url': item['glb_url'],
'remark': item.get('remark'), 'remark': item.get('remark'),
'embryo_redundancy_id': item.get('embryo_redundancy_id'), 'embryo_redundancy_id': item.get('embryo_redundancy_id'),
'is_incoming_material': True if item.get('embryo_redundancy_id') else False, 'is_incoming_material': True if item.get('incoming_size') else False,
'manual_quotation': item.get('manual_quotation'), 'manual_quotation': item.get('manual_quotation'),
'model_id': item['model_id'], 'model_id': item['model_id'],
'delivery_end_date': item['delivery_end_date'] 'delivery_end_date': item['delivery_end_date']
@@ -287,7 +287,7 @@ class ResaleOrderLine(models.Model):
check_status = fields.Selection(related='order_id.check_status') check_status = fields.Selection(related='order_id.check_status')
remark = fields.Char('备注') remark = fields.Char('备注')
is_incoming_material = fields.Boolean('客供料', compute='_compute_is_incoming_material', store=True) is_incoming_material = fields.Boolean('客供料', store=True)
embryo_redundancy_id = fields.Many2one('sf.embryo.redundancy', '坯料冗余') embryo_redundancy_id = fields.Many2one('sf.embryo.redundancy', '坯料冗余')
manual_quotation = fields.Boolean('人工编程', default=False) manual_quotation = fields.Boolean('人工编程', default=False)
model_url = fields.Char('模型文件地址') model_url = fields.Char('模型文件地址')