Accept Merge Request #1613: (feature/delivery_status -> 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/1613
This commit is contained in:
廖丹龙
2024-12-11 11:23:34 +08:00
committed by Coding

View File

@@ -9,8 +9,6 @@ import requests
from itertools import groupby from itertools import groupby
from collections import defaultdict, namedtuple from collections import defaultdict, namedtuple
from loguru import _logger
from odoo import api, fields, models, SUPERUSER_ID, _ from odoo import api, fields, models, SUPERUSER_ID, _
from odoo.exceptions import UserError, ValidationError from odoo.exceptions import UserError, ValidationError
from odoo.addons.sf_base.commons.common import Common from odoo.addons.sf_base.commons.common import Common
@@ -56,10 +54,11 @@ class MrpProduction(models.Model):
if sale_order: if sale_order:
production.sale_order_id = sale_order.id production.sale_order_id = sale_order.id
else: else:
_logger.warning("No sale order found for production %s with product %s (name match: %s)", logging.warning("No sale order found for production {} with product {} (name match: {})".format(
production.id, production.product_id.name, result) production.id, production.product_id.name, result))
except Exception as e: except Exception as e:
_logger.error("Error while fetching sale order for production %s: %s", production.id, str(e)) logging.error("Error while fetching sale order for production {}: {}".format(production.id, str(e)))
@api.depends('procurement_group_id.mrp_production_ids.move_dest_ids.group_id.sale_id') @api.depends('procurement_group_id.mrp_production_ids.move_dest_ids.group_id.sale_id')
def _compute_deadline_of_delivery(self): def _compute_deadline_of_delivery(self):
for production in self: for production in self:
@@ -800,6 +799,7 @@ class MrpProduction(models.Model):
for workorders in reversed(proc_workorders): for workorders in reversed(proc_workorders):
self.env['stock.picking'].create_outcontract_picking(workorders, production, sorted_workorders) self.env['stock.picking'].create_outcontract_picking(workorders, production, sorted_workorders)
self.env['purchase.order'].get_purchase_order(workorders, production, product_id_to_production_names) self.env['purchase.order'].get_purchase_order(workorders, production, product_id_to_production_names)
# 工单排序 # 工单排序
def _reset_work_order_sequence1(self, k): def _reset_work_order_sequence1(self, k):
for rec in self: for rec in self:
@@ -1468,6 +1468,7 @@ class MrpProduction(models.Model):
production.sale_order_count = 1 production.sale_order_count = 1
else: else:
production.sale_order_count = 0 production.sale_order_count = 0
def action_view_sale_orders(self): def action_view_sale_orders(self):
if self.sale_order_id: if self.sale_order_id:
action = { action = {
@@ -1480,7 +1481,6 @@ class MrpProduction(models.Model):
}) })
return action return action
@api.model_create_multi @api.model_create_multi
def create(self, vals_list): def create(self, vals_list):
""" """