Merge branch develop into feature/增加一键合并下发功能,修正合并下发逻辑

This commit is contained in:
马广威
2023-04-24 14:33:44 +08:00
1075 changed files with 245703 additions and 5606 deletions

View File

@@ -13,13 +13,14 @@
'depends': ['sf_base', 'sf_sale', 'sf_dlm'],
'data': [
'views/res_partner_view.xml',
'views/view.xml',
# 'views/view.xml',
'report/bill_report.xml',
],
'demo': [
],
'qweb': [
],
'license': 'LGPL-3',
'installable': True,
'application': False,
'auto_install': False,

View File

@@ -11,7 +11,7 @@ class Sf_Bf_Connect(http.Controller):
cors="*")
def get_bfm_process_order_list(self, **kw):
"""
接收业务平台加工订单分配工厂时传送来的订单数据并生成销售订单和产品及
接收业务平台加工订单分配工厂时传送来的订单数据并生成销售订单和产品及
:param kw:
:return:
"""
@@ -52,16 +52,16 @@ class Sf_Bf_Connect(http.Controller):
bom.with_user(request.env.ref("base.user_admin")).bom_create_line_has(bom_data)
else:
if product.materials_type_id.gain_way == '自加工':
# 创建
# 创建
self_machining_embryo = request.env['product.template'].sudo().no_bom_product_create(
self_machining_id,
item,
order_id, 'self_machining', i)
# 创建料的bom
# 创建料的bom
self_machining_bom = request.env['mrp.bom'].with_user(
request.env.ref("base.user_admin")).bom_create(
self_machining_embryo, 'normal', False)
# 创建料里bom的组件
# 创建料里bom的组件
self_machining_bom_line = self_machining_bom.with_user(
request.env.ref("base.user_admin")).bom_create_line(
self_machining_embryo)
@@ -77,17 +77,17 @@ class Sf_Bf_Connect(http.Controller):
product_bom_self_machining.with_user(request.env.ref("base.user_admin")).bom_create_line_has(
self_machining_embryo)
elif product.materials_type_id.gain_way == '外协':
# 创建
# 创建
outsource_embryo = request.env['product.template'].sudo().no_bom_product_create(outsource_id,
item,
order_id,
'subcontract',
i)
# 创建料的bom
# 创建料的bom
outsource_bom = request.env['mrp.bom'].with_user(request.env.ref("base.user_admin")).bom_create(
outsource_embryo,
'subcontract', True)
# 创建料的bom的组件
# 创建料的bom的组件
outsource_bom_line = outsource_bom.with_user(
request.env.ref("base.user_admin")).bom_create_line(outsource_embryo)
if outsource_bom_line == False:
@@ -111,7 +111,6 @@ class Sf_Bf_Connect(http.Controller):
product_bom_purchase.with_user(request.env.ref("base.user_admin")).bom_create_line_has(
purchase_embryo)
order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item)
order_id.step_file = product.model_file
i += 1
res['factory_order_no'] = order_id.name
return json.JSONEncoder().encode(res)

View File

@@ -1,4 +1,4 @@
import cpca
#import cpca
import logging
import base64
import requests
@@ -37,7 +37,7 @@ class JdEclp(models.Model):
deliveryType = fields.Selection([('6', '特快零担'), ('25', '特快重货')], string='运输类型', default='25')
# bill = fields.Char(string='物流面单')
bill = fields.Many2one('ir.attachment', string='物流面单', compute='query_bill_pdf')
# bill = fields.Many2one('ir.attachment', string='物流面单', compute='query_bill_pdf')
# bill_show = fields.Binary(string='物流面单展示', readonly=True, related='self.bill.datas')
bill_show = fields.Binary(string='物流面单展示', readonly=True)

View File

@@ -1,5 +1,6 @@
from odoo import api, fields, models, SUPERUSER_ID, _
from odoo.exceptions import ValidationError
from collections import defaultdict, namedtuple
from datetime import datetime
import logging
from odoo.exceptions import UserError
@@ -34,7 +35,6 @@ class StatusChange(models.Model):
context = self._context.copy()
context.pop('default_name', None)
logging.info('函数已经执行=============4')
self.with_context(context)._action_confirm()
if self.env.user.has_group('sale.group_auto_done_setting'):
logging.info('函数已经执行=============5')
@@ -148,17 +148,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)
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)
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')])
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