1.新增销售和计划权限组2.优化代码格式

This commit is contained in:
jinling.yang
2023-11-21 16:10:05 +08:00
parent 31f07c5156
commit 6ec6094c5e
21 changed files with 85 additions and 111 deletions

View File

@@ -1,2 +1,3 @@
from .import controllers

View File

@@ -59,7 +59,7 @@ class Sf_Bf_Connect(http.Controller):
self_machining_bom_line = self_machining_bom.with_user(
request.env.ref("base.user_admin")).bom_create_line(
self_machining_embryo)
if self_machining_bom_line is False:
if not self_machining_bom_line:
res['status'] = 2
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配'
request.cr.rollback()
@@ -84,7 +84,7 @@ class Sf_Bf_Connect(http.Controller):
# 创建坯料的bom的组件
outsource_bom_line = outsource_bom.with_user(
request.env.ref("base.user_admin")).bom_create_line(outsource_embryo)
if outsource_bom_line is False:
if not outsource_bom_line:
res['status'] = 2
res['message'] = '该订单模型的材料型号在您分配的工厂里暂未有原材料,请先配置再进行分配'
request.cr.rollback()

View File

@@ -1,10 +1,7 @@
from datetime import datetime
import logging
import requests
from odoo import api, fields, models, SUPERUSER_ID, _
from odoo.exceptions import UserError
from odoo.exceptions import ValidationError
from collections import defaultdict, namedtuple
from odoo import fields, models
_logger = logging.getLogger(__name__)
@@ -197,19 +194,20 @@ class FinishStatusChange(models.Model):
if self.user_has_groups('stock.group_reception_report') \
and self.picking_type_id.auto_show_reception_report:
lines = self.move_ids.filtered(lambda
m: m.product_id.type == 'product' and m.state != 'cancel' and m.quantity_done and not m.move_dest_ids)
m: m.product_id.type == 'product' and m.state != 'cancel'
and m.quantity_done and not m.move_dest_ids)
if lines:
# don't show reception report if all already assigned/nothing to assign
wh_location_ids = self.env['stock.location']._search(
[('id', 'child_of', self.picking_type_id.warehouse_id.view_location_id.id),
('usage', '!=', 'supplier')])
if self.env['stock.move'].search([
('state', 'in', ['confirmed', 'partially_available', 'waiting', 'assigned']),
('product_qty', '>', 0),
('location_id', 'in', wh_location_ids),
('move_orig_ids', '=', False),
('picking_id', 'not in', self.ids),
('product_id', 'in', lines.product_id.ids)], limit=1):
('state', 'in', ['confirmed', 'partially_available', 'waiting', 'assigned']),
('product_qty', '>', 0),
('location_id', 'in', wh_location_ids),
('move_orig_ids', '=', False),
('picking_id', 'not in', self.ids),
('product_id', 'in', lines.product_id.ids)], limit=1):
action = self.action_view_reception_report()
action['context'] = {'default_picking_ids': self.ids}
return action