Compare commits
5 Commits
feature/消息
...
feature/sa
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
281f3c67c3 | ||
|
|
64eb66c334 | ||
|
|
9e5dbc0104 | ||
|
|
c57918736d | ||
|
|
1816f1a497 |
@@ -177,9 +177,10 @@ patch(ListRenderer.prototype, 'jikimo_frontend.ListRenderer', {
|
||||
const thead_th_num = thead_tr.children().length
|
||||
const tbody_tr_num = tbody_tr.children().length
|
||||
const num = thead_th_num - tbody_tr_num
|
||||
console.log('num', num);
|
||||
if(num == -1) {
|
||||
thead_tr.prepend('<td>序号</td>')
|
||||
tbody.children('tr').each(function () {
|
||||
$(this).children('td').eq(0).remove()
|
||||
})
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
|
||||
@@ -72,30 +72,8 @@ class jikimo_purchase_tier_validation(models.Model):
|
||||
message_type='notification',
|
||||
subtype_xmlid='mail.mt_note'
|
||||
)
|
||||
res = super(jikimo_purchase_tier_validation, self).request_validation()
|
||||
self.state = 'to approve'
|
||||
return res
|
||||
|
||||
def restart_validation(self):
|
||||
res = super(jikimo_purchase_tier_validation, self).restart_validation()
|
||||
self.state = 'draft'
|
||||
return res
|
||||
|
||||
def _validate_tier(self, tiers=False):
|
||||
res = super(jikimo_purchase_tier_validation, self)._validate_tier(tiers)
|
||||
self.state = 'approved'
|
||||
return res
|
||||
|
||||
def _rejected_tier(self, tiers=False):
|
||||
res = super(jikimo_purchase_tier_validation, self)._rejected_tier(tiers)
|
||||
self.state = 'draft'
|
||||
return res
|
||||
|
||||
@api.model
|
||||
def _get_under_validation_exceptions(self):
|
||||
res = super(jikimo_purchase_tier_validation, self)._get_under_validation_exceptions()
|
||||
res.append("state")
|
||||
return res
|
||||
return super(jikimo_purchase_tier_validation, self).request_validation()
|
||||
|
||||
# 上传合同文件
|
||||
def upload_contract_file(self):
|
||||
|
||||
@@ -519,7 +519,6 @@
|
||||
<field name="name">Quality Checks</field>
|
||||
<field name="res_model">quality.check</field>
|
||||
<field name="view_mode">tree,kanban,form,pivot,graph</field>
|
||||
<field name="context">{'is_web_request': True}</field>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
No quality check found
|
||||
|
||||
@@ -783,7 +783,7 @@ class MrpProduction(models.Model):
|
||||
workorder.duration_expected = workorder._get_duration_expected()
|
||||
|
||||
# 外协出入库单处理
|
||||
def get_subcontract_pick_purchase(self):
|
||||
def get_subcontract_pick_purchase(self, special_design_workorder):
|
||||
production_all = self.sorted(lambda x: x.id)
|
||||
product_id_to_production_names = {}
|
||||
grouped_product_ids = {k: list(g) for k, g in
|
||||
@@ -792,18 +792,19 @@ class MrpProduction(models.Model):
|
||||
product_id_to_production_names[product_id] = [p.name for p in pd]
|
||||
sorted_workorders = None
|
||||
for production in production_all:
|
||||
proc_workorders = []
|
||||
process_parameter_workorder = self.env['mrp.workorder'].search(
|
||||
[('surface_technics_parameters_id', '!=', False), ('production_id', '=', production.id),
|
||||
('is_subcontract', '=', True), ('state', '!=', 'cancel')], order='sequence asc')
|
||||
if process_parameter_workorder:
|
||||
# 将这些特殊表面工艺工单的采购单与调拨单置为失效
|
||||
for workorder in process_parameter_workorder:
|
||||
workorder._get_surface_technics_purchase_ids().write({'state': 'cancel'})
|
||||
workorder.move_subcontract_workorder_ids.write({'state': 'cancel'})
|
||||
workorder.move_subcontract_workorder_ids.picking_id.write({'state': 'cancel'})
|
||||
# proc_workorders = []
|
||||
# process_parameter_workorder = self.env['mrp.workorder'].search(
|
||||
# [('surface_technics_parameters_id', '!=', False), ('production_id', '=', production.id),
|
||||
# ('is_subcontract', '=', True), ('state', '!=', 'cancel')], order='sequence asc')
|
||||
# need_delete_workorder = process_parameter_workorder - special_design_workorder
|
||||
# for workorder in need_delete_workorder:
|
||||
# workorder._get_surface_technics_purchase_ids().write({'active': False})
|
||||
# workorder.move_subcontract_workorder_ids.write({'state': 'cancel'})
|
||||
# workorder.move_subcontract_workorder_ids.picking_id.write({'active': False})
|
||||
|
||||
if special_design_workorder:
|
||||
consecutive_workorders = []
|
||||
sorted_workorders = sorted(process_parameter_workorder, key=lambda w: w.sequence)
|
||||
sorted_workorders = sorted(special_design_workorder, key=lambda w: w.sequence)
|
||||
# for i, workorder in enumerate(sorted_workorders):
|
||||
# # 检查当前工作订单和下一个工作订单是否连续,并且供应商相同
|
||||
# if i == 0:
|
||||
|
||||
@@ -605,10 +605,10 @@ class StockPicking(models.Model):
|
||||
sale_info = self.env['sale.order'].sudo().search(
|
||||
[('name', '=', sale_name)])
|
||||
else:
|
||||
sale_order_line = self.env['sale.order.line'].sudo().search(
|
||||
production_list = self.env['mrp.production'].sudo().search(
|
||||
[('product_id', '=', product_id.id)])
|
||||
if sale_order_line:
|
||||
sale_info = sale_order_line[0].order_id
|
||||
if production_list:
|
||||
sale_info = production_list[0].sale_order_id
|
||||
if sale_info:
|
||||
item.sale_order_id = sale_info.id
|
||||
item.retrospect_ref = sale_info.order_code
|
||||
@@ -654,10 +654,7 @@ class StockPicking(models.Model):
|
||||
if self.location_id.name == '成品存货区' and self.location_dest_id.name == '客户':
|
||||
sale_id = self.env['sale.order'].sudo().search(
|
||||
[('name', '=', self.origin)])
|
||||
stock_picking_list = self.env['stock.picking'].sudo().search(
|
||||
[('id', 'in', sale_id.picking_ids.ids)])
|
||||
stock_picking = stock_picking_list.filtered(lambda p: p.state not in ("done", "cancel"))
|
||||
if sale_id and not stock_picking:
|
||||
if sale_id and res:
|
||||
sale_id.write({'state': 'delivered'})
|
||||
return res
|
||||
|
||||
@@ -681,7 +678,7 @@ class StockPicking(models.Model):
|
||||
# 从sorted_workorders中找到上一工单的move
|
||||
if len(sorted_workorders) > 1:
|
||||
move_dest_id = \
|
||||
sorted_workorders[sorted_workorders.index(workorder) + 1].move_subcontract_workorder_ids[1].id
|
||||
sorted_workorders[sorted_workorders.index(workorder) + 1].move_subcontract_workorder_ids[1].id
|
||||
new_picking = True
|
||||
outcontract_picking_type_in = self.env.ref(
|
||||
'sf_manufacturing.outcontract_picking_in').id,
|
||||
|
||||
@@ -57,6 +57,7 @@ class ProductionTechnologyWizard(models.TransientModel):
|
||||
# td_upd = self.env['sf.technology.design'].sudo().search(domain)
|
||||
# if td_upd:
|
||||
# ro.write({'sequence': td_upd.sequence, 'active': td_upd.active})
|
||||
# 特殊表面工艺
|
||||
special_design = self.env['sf.technology.design'].sudo().search(
|
||||
[('routing_tag', '=', 'special'), ('production_id', '=', production.id),
|
||||
('is_auto', '=', False), ('active', 'in', [True, False])])
|
||||
@@ -112,7 +113,9 @@ class ProductionTechnologyWizard(models.TransientModel):
|
||||
workorder.blocked_by_workorder_ids = blocked_by_workorder_ids[0]
|
||||
productions._create_workorder(False)
|
||||
if self.production_id.product_id.categ_id.type == '成品':
|
||||
productions.get_subcontract_pick_purchase()
|
||||
special_design_workorder = self.env['mrp.workorder'].search(
|
||||
[('technology_design_id', 'in', special_design.ids), ('production_id', '=', special.production_id.id), ('state', '!=', 'cancel')])
|
||||
productions.get_subcontract_pick_purchase(special_design_workorder)
|
||||
productions.is_adjust = False
|
||||
for item in productions:
|
||||
workorder = item.workorder_ids.filtered(lambda wo: wo.state not in ('cancel')).sorted(
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
'category': 'sf',
|
||||
'website': 'https://www.sf.jikimo.com',
|
||||
'depends': ['sale', 'purchase', 'sf_plan', 'jikimo_message_notify', 'stock', 'sf_quality', 'mrp',
|
||||
'sf_manufacturing', 'product', 'quality'],
|
||||
'sf_manufacturing','product'],
|
||||
'data': [
|
||||
'data/bussiness_node.xml',
|
||||
'data/cron_data.xml',
|
||||
@@ -20,7 +20,6 @@
|
||||
'security/ir.model.access.csv',
|
||||
'views/mrp_workorder_views.xml',
|
||||
'views/purchase_order_view.xml',
|
||||
'views/stock_picking_view.xml',
|
||||
],
|
||||
'test': [
|
||||
],
|
||||
|
||||
@@ -150,10 +150,5 @@
|
||||
<field name="name">采购单已逾期提醒</field>
|
||||
<field name="model">purchase.order</field>
|
||||
</record>
|
||||
|
||||
<record id="bussiness_quality_check" model="jikimo.message.bussiness.node">
|
||||
<field name="name">待质检提醒</field>
|
||||
<field name="model">product.product</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -389,17 +389,5 @@
|
||||
事项:[共有{{num}}个采购订单已逾期]({{url}})
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="template_quality_check" model="jikimo.message.template">
|
||||
<field name="name">待质检提醒</field>
|
||||
<field name="model_id" ref="product.model_product_product"/>
|
||||
<field name="model">product.product</field>
|
||||
<field name="bussiness_node_id" ref="bussiness_quality_check"/>
|
||||
<field name="msgtype">markdown</field>
|
||||
<field name="urgency">normal</field>
|
||||
<field name="content">### 待质检提醒:
|
||||
单号:产品[{{name}}]({{url}})
|
||||
事项:有{{num}}个质检单需要处理。</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -13,4 +13,3 @@ from . import sf_message_maintenance_logs
|
||||
from . import sf_message_mrp_production_wizard
|
||||
from . import sf_message_mrp_production_adjust_wizard
|
||||
from . import sf_message_product
|
||||
from . import sf_message_quality_check
|
||||
|
||||
@@ -63,9 +63,8 @@ class SFMessageMrpProduction(models.Model):
|
||||
[('origin', 'in', mrp_production_names), ('state', '=', 'assigned')])
|
||||
if stock_picking_num >= 1:
|
||||
url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
||||
action_id = self.env.ref('sf_message.action_picking_outsourced_tree_ready').id
|
||||
menu_id = self.env.ref('stock.menu_stock_root').id
|
||||
url_with_id = f"{url}/web#view_type=list&action={action_id}&menu_id={menu_id}"
|
||||
action_id = self.env.ref('stock.action_picking_tree_ready').id
|
||||
url_with_id = f"{url}/web#view_type=list&action={action_id}"
|
||||
content = content.replace('{{name}}', mrp_production.product_id.name).replace('{{url}}',
|
||||
url_with_id).replace(
|
||||
'{{num}}', str(stock_picking_num))
|
||||
|
||||
@@ -3,7 +3,7 @@ from odoo import models, fields, api, _
|
||||
from urllib.parse import urlencode
|
||||
|
||||
|
||||
class SFMessageProduct(models.Model):
|
||||
class SFMessagePlan(models.Model):
|
||||
_name = 'product.product'
|
||||
_inherit = ['product.product', 'jikimo.message.dispatch']
|
||||
|
||||
@@ -28,18 +28,6 @@ class SFMessageProduct(models.Model):
|
||||
'{{number}}', str(production_num)).replace(
|
||||
'{{request_url}}', url)
|
||||
contents.append(content)
|
||||
if message_queue_id.message_template_id.name == '待质检提醒':
|
||||
content = message_queue_id.message_template_id.content
|
||||
product_product = self.env['product.product'].sudo().search([('id', '=', int(message_queue_id.res_id))])
|
||||
quality_check_num = self.env['quality.check'].sudo().search_count(
|
||||
[('product_id', '=', product_product.id), ('quality_state', '=', 'none')])
|
||||
if quality_check_num >= 1:
|
||||
url = self.env['ir.config_parameter'].sudo().get_param('web.base.url')
|
||||
action_id = self.env.ref('quality_control.quality_check_action_report').id
|
||||
url_with_id = f"{url}/web#view_type=list&action={action_id}"
|
||||
content = content.replace('{{name}}', product_product.name).replace('{{url}}', url_with_id).replace(
|
||||
'{{num}}', str(quality_check_num))
|
||||
contents.append(content)
|
||||
return contents, message_queue_ids
|
||||
|
||||
def get_request_url(self):
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import logging
|
||||
from odoo import models, fields, api, _
|
||||
|
||||
|
||||
class SFMessageQualityCheck(models.Model):
|
||||
_name = 'quality.check'
|
||||
_inherit = ['quality.check', 'jikimo.message.dispatch']
|
||||
|
||||
@api.model_create_multi
|
||||
def create(self, vals_list):
|
||||
result = super().create(vals_list)
|
||||
try:
|
||||
# 判断是否为web页面创建请求
|
||||
is_web_request = self.env.context.get('is_web_request', False)
|
||||
if not is_web_request:
|
||||
for obj in result:
|
||||
jikimo_message_queue = self.get_message_queue(obj.product_id.id)
|
||||
if not jikimo_message_queue:
|
||||
obj.product_id.add_queue('待质检提醒')
|
||||
except Exception as e:
|
||||
logging.info('add_queue待质检提醒 error:%s' % e)
|
||||
return result
|
||||
|
||||
def get_message_queue(self, res_id):
|
||||
business_node_id = self.env.ref('sf_message.bussiness_quality_check').id
|
||||
message_template = self.env["jikimo.message.template"].sudo().search([
|
||||
("name", "=", '待质检提醒'),
|
||||
("bussiness_node_id", "=", business_node_id)
|
||||
], limit=1)
|
||||
jikimo_message_queue = self.env['jikimo.message.queue'].sudo().search(
|
||||
[('res_id', '=', res_id), ("message_status", "in", ("pending", "sent")),
|
||||
('message_template_id', '=', message_template.id)])
|
||||
return jikimo_message_queue
|
||||
@@ -32,7 +32,7 @@ class SFMessageSale(models.Model):
|
||||
for purchase_order_id in purchase_order_ids:
|
||||
if purchase_order_id.purchase_type == 'outsourcing':
|
||||
purchase_order_id.add_queue('委外加工采购单提醒')
|
||||
if purchase_order_id.purchase_type == 'outside':
|
||||
if purchase_order_id.purchase_type == 'standard':
|
||||
purchase_order_id.add_queue('外购订单采购单提醒')
|
||||
except Exception as e:
|
||||
logging.info('add_queue error:%s' % e)
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
|
||||
<record id="view_picking_internal_search_sf" model="ir.ui.view">
|
||||
<field name="name">stock.picking.search</field>
|
||||
<field name="model">stock.picking</field>
|
||||
<field name="inherit_id" ref="stock.view_picking_internal_search"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//filter[@name='activities_exception']" position="before">
|
||||
<filter name="outsourced" string="外协出库" domain="[('picking_type_id.name', '=', '外协出库')]"
|
||||
invisible="1"/>
|
||||
<separator/>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
<record id="action_picking_outsourced_tree_ready" model="ir.actions.act_window">
|
||||
<field name="name">待办</field>
|
||||
<field name="res_model">stock.picking</field>
|
||||
<field name="type">ir.actions.act_window</field>
|
||||
<field name="view_mode">tree,kanban,form,calendar</field>
|
||||
<field name="domain"></field>
|
||||
<field name="context">{'search_default_outsourced': 1,'contact_display': 'partner_address',
|
||||
'search_default_available': 1}
|
||||
</field>
|
||||
<field name="search_view_id" ref="stock.view_picking_internal_search"/>
|
||||
<field name="help" type="html">
|
||||
<p class="o_view_nocontent_smiling_face">
|
||||
没有仓库调拨。 让我们创建一个!
|
||||
</p>
|
||||
<p>
|
||||
移动允许您将产品从一个位置移动到另外一个位置。
|
||||
</p>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -363,7 +363,6 @@ class RePurchaseOrder(models.Model):
|
||||
server_product_process = []
|
||||
purchase_order = pp._get_surface_technics_purchase_ids()
|
||||
if purchase_order:
|
||||
purchase_order.write({'state': 'draft'})
|
||||
pp.purchase_id = [(6, 0, [purchase_order.id])]
|
||||
else:
|
||||
server_template = self.env['product.template'].search(
|
||||
@@ -374,12 +373,16 @@ class RePurchaseOrder(models.Model):
|
||||
'product_qty': 1,
|
||||
'product_uom': server_template.uom_id.id
|
||||
}))
|
||||
# 获取服务商品最后一个供应商的采购员
|
||||
purchase_user_id = server_template.seller_ids[-1].partner_id.purchase_user_id
|
||||
purchase_order = self.env['purchase.order'].sudo().create({
|
||||
'partner_id': server_template.seller_ids[0].partner_id.id,
|
||||
'origin': production.name,
|
||||
'state': 'draft',
|
||||
'purchase_type': 'consignment',
|
||||
'order_line': server_product_process})
|
||||
'order_line': server_product_process,
|
||||
'user_id': purchase_user_id.id
|
||||
})
|
||||
pp.purchase_id = [(6, 0, [purchase_order.id])]
|
||||
# self.env.cr.commit()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user