1.新增销售和计划权限组2.优化代码格式
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user