修改日志的使用库

This commit is contained in:
liaodanlong
2024-12-11 11:05:25 +08:00
parent d1ba2cc3d4
commit f32ca13dff

View File

@@ -9,8 +9,6 @@ import requests
from itertools import groupby
from collections import defaultdict, namedtuple
from loguru import _logger
from odoo import api, fields, models, SUPERUSER_ID, _
from odoo.exceptions import UserError, ValidationError
from odoo.addons.sf_base.commons.common import Common
@@ -56,10 +54,11 @@ class MrpProduction(models.Model):
if sale_order:
production.sale_order_id = sale_order.id
else:
_logger.warning("No sale order found for production %s with product %s (name match: %s)",
production.id, production.product_id.name, result)
logging.warning("No sale order found for production {} with product {} (name match: {})".format(
production.id, production.product_id.name, result))
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')
def _compute_deadline_of_delivery(self):
for production in self:
@@ -800,6 +799,7 @@ class MrpProduction(models.Model):
for workorders in reversed(proc_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)
# 工单排序
def _reset_work_order_sequence1(self, k):
for rec in self:
@@ -1468,6 +1468,7 @@ class MrpProduction(models.Model):
production.sale_order_count = 1
else:
production.sale_order_count = 0
def action_view_sale_orders(self):
if self.sale_order_id:
action = {
@@ -1480,7 +1481,6 @@ class MrpProduction(models.Model):
})
return action
@api.model_create_multi
def create(self, vals_list):
"""