Merge branch 'develop' into release/release_2.4

This commit is contained in:
胡尧
2024-09-29 16:51:41 +08:00
6 changed files with 16 additions and 11 deletions

View File

@@ -1,4 +1,5 @@
import datetime import datetime
import logging
from datetime import timedelta, time from datetime import timedelta, time
from collections import defaultdict from collections import defaultdict
from odoo import fields, models, api from odoo import fields, models, api
@@ -6,6 +7,8 @@ from odoo.addons.resource.models.resource import Intervals
from odoo.exceptions import UserError, ValidationError from odoo.exceptions import UserError, ValidationError
import math import math
_logger = logging.getLogger(__name__)
class ResWorkcenter(models.Model): class ResWorkcenter(models.Model):
_name = "mrp.workcenter" _name = "mrp.workcenter"
@@ -225,7 +228,11 @@ class ResWorkcenter(models.Model):
if plan_ids: if plan_ids:
sum_qty = sum([p.product_qty for p in plan_ids]) sum_qty = sum([p.product_qty for p in plan_ids])
date_planned_working_hours = self._compute_effective_working_hours_day1(date_planned) date_planned_working_hours = self._compute_effective_working_hours_day1(date_planned)
if sum_qty >= date_planned_working_hours: default_capacity = round(
self.production_line_hour_capacity * date_planned_working_hours, 2)
_logger.info('排程日期:%s,计划数量:%s,日产能:%s,日工时:%s' % (
date_planned, sum_qty, default_capacity, date_planned_working_hours))
if sum_qty >= default_capacity:
return False return False
return True return True

View File

@@ -19,9 +19,8 @@ class SFMessagePurchase(models.Model):
return contents return contents
def request_url(self, id): def request_url(self, id):
we_config_info = self.env['we.config'].sudo().search([], limit=1) url = self.env['ir.config_parameter'].get_param('web.base.url')
redirect_domain = self.env['we.app'].sudo().search([('id', '=', we_config_info.odoo_app_id.id)]).redirect_domain full_url = 'https://%s/' % url
full_url = 'https://%s/' % redirect_domain
action_id = self.env.ref('purchase.purchase_form_action').id action_id = self.env.ref('purchase.purchase_form_action').id
menu_id = self.env['ir.model.data'].search([('name', '=', 'module_website_payment')]).id menu_id = self.env['ir.model.data'].search([('name', '=', 'module_website_payment')]).id
# 查询参数 # 查询参数

View File

@@ -47,7 +47,7 @@ class SFMessageSale(models.Model):
if item.message_template_id.bussiness_node_id.name == '待接单': if item.message_template_id.bussiness_node_id.name == '待接单':
content = super(SFMessageSale, self)._get_message(item) content = super(SFMessageSale, self)._get_message(item)
action_id = self.env.ref('sale.action_quotations_with_onboarding').id action_id = self.env.ref('sale.action_quotations_with_onboarding').id
url = f"{url}/web#id={item.res_id}view_type=form&action={action_id}" url = f"{url}/web#id={item.res_id}&view_type=form&action={action_id}"
content = content[0].replace('{{url}}', url) content = content[0].replace('{{url}}', url)
contents.append(content) contents.append(content)
# 确认接单的处理 # 确认接单的处理

View File

@@ -52,9 +52,8 @@ class SFMessageStockPicking(models.Model):
return res return res
def request_url(self): def request_url(self):
we_config_info = self.env['we.config'].sudo().search([], limit=1) url = self.env['ir.config_parameter'].get_param('web.base.url')
redirect_domain = self.env['we.app'].sudo().search([('id', '=', we_config_info.odoo_app_id.id)]).redirect_domain full_url = 'https://%s/' % url
full_url = 'https://%s/' % redirect_domain
action_id = self.env.ref('stock.stock_picking_type_action').id action_id = self.env.ref('stock.stock_picking_type_action').id
menu_id = self.env['ir.model.data'].search([('name', '=', 'module_theme_treehouse')]).id menu_id = self.env['ir.model.data'].search([('name', '=', 'module_theme_treehouse')]).id
# 查询参数 # 查询参数

View File

@@ -40,9 +40,8 @@ class SFMessageWork(models.Model):
return contents return contents
def request_url(self): def request_url(self):
we_config_info = self.env['we.config'].sudo().search([], limit=1) url = self.env['ir.config_parameter'].get_param('web.base.url')
redirect_domain = self.env['we.app'].sudo().search([('id', '=', we_config_info.odoo_app_id.id)]).redirect_domain full_url = 'https://%s/' % url
full_url = 'https://%s/' % redirect_domain
action_id = self.env.ref('sf_manufacturing.mrp_workorder_action_tablet').id action_id = self.env.ref('sf_manufacturing.mrp_workorder_action_tablet').id
menu_id = self.env['ir.model.data'].search([('name', '=', 'module_stock_dropshipping')]).id menu_id = self.env['ir.model.data'].search([('name', '=', 'module_stock_dropshipping')]).id
# 查询参数 # 查询参数

View File

@@ -18,6 +18,7 @@ class OrderPrice(models.Model):
return True return True
except ValueError: except ValueError:
return False return False
@api.depends('sale_order_id.order_line.remark')
def _compute_bfm_amount_total(self): def _compute_bfm_amount_total(self):
for record in self: for record in self:
amount_total = 0 amount_total = 0