Compare commits
155 Commits
feature/67
...
release/re
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
20069d5336 | ||
|
|
fe8df494f9 | ||
|
|
0e7d6fac4e | ||
|
|
32cd68e15f | ||
|
|
70113cb3c5 | ||
|
|
f0e47371ed | ||
|
|
6dde814acc | ||
|
|
71ab241e94 | ||
|
|
272e424975 | ||
|
|
1fd9900e41 | ||
|
|
0a13acbb68 | ||
|
|
a68d6d4d06 | ||
|
|
c630074f4a | ||
|
|
4bea169327 | ||
|
|
e2ddac4fb0 | ||
|
|
e52ec3982f | ||
|
|
160bd117b7 | ||
|
|
a19cf5d894 | ||
|
|
885064fb12 | ||
|
|
8f7e785760 | ||
|
|
8123885c71 | ||
|
|
c2f346571d | ||
|
|
e3494ce8b7 | ||
|
|
d75cff0a5d | ||
|
|
4b026535f8 | ||
|
|
28ade4ac72 | ||
|
|
99ac89f995 | ||
|
|
372f95d812 | ||
|
|
4099756d15 | ||
|
|
91bad533c3 | ||
|
|
f5ed94866b | ||
|
|
b70f280c6e | ||
|
|
152657e41b | ||
|
|
35b1d648c3 | ||
|
|
174af13a58 | ||
|
|
832b06be1f | ||
|
|
3b60db56de | ||
|
|
579b7138e7 | ||
|
|
98f8430c45 | ||
|
|
912847ae33 | ||
|
|
d1f9f8cf8c | ||
|
|
7d1f7b11eb | ||
|
|
fe3492ceb5 | ||
|
|
72f737c370 | ||
|
|
98c5b3b013 | ||
|
|
0d76d1a7d3 | ||
|
|
b177bd95ff | ||
|
|
a5bb686708 | ||
|
|
c1bafef1aa | ||
|
|
46125dc44b | ||
|
|
d0d3215bf3 | ||
|
|
92a0c15708 | ||
|
|
0013f9f8c9 | ||
|
|
4274b9fe99 | ||
|
|
149d8e287b | ||
|
|
3f65742add | ||
|
|
b56e3545a1 | ||
|
|
fd7080a332 | ||
|
|
85fb64ed55 | ||
|
|
9ad06b4361 | ||
|
|
f9c13341e6 | ||
|
|
d2a61c79d0 | ||
|
|
5f80b377e5 | ||
|
|
ab2e685004 | ||
|
|
dcc5eef006 | ||
|
|
7e8b2adb3d | ||
|
|
9aa870065b | ||
|
|
60c39929b2 | ||
|
|
9a5b8a2627 | ||
|
|
73696eb72c | ||
|
|
55babb8a35 | ||
|
|
6682dbfb7d | ||
|
|
e0b8e5fe07 | ||
|
|
800f2eb6a7 | ||
|
|
3cc633131e | ||
|
|
e3fb266890 | ||
|
|
844f7de1ab | ||
|
|
266601cf84 | ||
|
|
2e168a4ba7 | ||
|
|
68ba47ed70 | ||
|
|
5bb6fcd4f7 | ||
|
|
9a05bbd82c | ||
|
|
b33c992b25 | ||
|
|
5947b3dfe9 | ||
|
|
95e43b0fba | ||
|
|
e7afc76753 | ||
|
|
788183e239 | ||
|
|
4ddabdefa1 | ||
|
|
364127beb3 | ||
|
|
109ea8729d | ||
|
|
32de726164 | ||
|
|
79f89f068b | ||
|
|
52189cff72 | ||
|
|
aadccce47e | ||
|
|
abd88fd721 | ||
|
|
f38f60a6a8 | ||
|
|
7d8b7048a8 | ||
|
|
bc641bde3a | ||
|
|
d73ffab9b5 | ||
|
|
4b1c0bc3b5 | ||
|
|
45730e2dd4 | ||
|
|
8903f32cf8 | ||
|
|
8bd1c8a095 | ||
|
|
abf9a0997b | ||
|
|
aec2d1c516 | ||
|
|
127efb67d7 | ||
|
|
78edf1f7eb | ||
|
|
e6e13a5970 | ||
|
|
427b548939 | ||
|
|
8c9db7e8c8 | ||
|
|
990f73ea4e | ||
|
|
b4ed65a75c | ||
|
|
53ba2ec589 | ||
|
|
566bc0e1e2 | ||
|
|
5f216684f0 | ||
|
|
e86bd59a43 | ||
|
|
e55625e4b6 | ||
|
|
790dd3dd05 | ||
|
|
84846fb3da | ||
|
|
f45a46255b | ||
|
|
fe5b005e45 | ||
|
|
fc33280509 | ||
|
|
60ed04cf77 | ||
|
|
3439b47b0c | ||
|
|
33c5d648b5 | ||
|
|
c7b50d9706 | ||
|
|
05caed1d91 | ||
|
|
8b66fda899 | ||
|
|
1456d4303b | ||
|
|
9d2f23de7c | ||
|
|
9393a48e70 | ||
|
|
749f44d6df | ||
|
|
4f000a6be4 | ||
|
|
71a0f39ec9 | ||
|
|
7af7079a5c | ||
|
|
376eb9e56f | ||
|
|
531bc2e090 | ||
|
|
bc3ab21d75 | ||
|
|
92f591c3e7 | ||
|
|
d1811ea24b | ||
|
|
b426d5d505 | ||
|
|
1dfa22900d | ||
|
|
0eeebf437a | ||
|
|
397d4f29a1 | ||
|
|
33205c5d29 | ||
|
|
568f3e4f30 | ||
|
|
8c43fc2b76 | ||
|
|
8960d3d07c | ||
|
|
95b5c86242 | ||
|
|
c2000aa9c5 | ||
|
|
e29456bbf7 | ||
|
|
a2f8dc6cec | ||
|
|
fec095ca6b | ||
|
|
aed33dbb35 | ||
|
|
dbe8c95558 |
2
jikimo_demand_plan_queue/__init__.py
Normal file
2
jikimo_demand_plan_queue/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import models
|
||||
18
jikimo_demand_plan_queue/__manifest__.py
Normal file
18
jikimo_demand_plan_queue/__manifest__.py
Normal file
@@ -0,0 +1,18 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
{
|
||||
'name': '机企猫 需求计划排程队列',
|
||||
'version': '1.0',
|
||||
'summary': """ 使用队列进行排程 """,
|
||||
'author': 'fox',
|
||||
'website': '',
|
||||
'category': '',
|
||||
'depends': ['queue_job_batch', 'sf_demand_plan'],
|
||||
'data': [
|
||||
|
||||
],
|
||||
|
||||
'application': True,
|
||||
'installable': True,
|
||||
'auto_install': False,
|
||||
'license': 'LGPL-3',
|
||||
}
|
||||
2
jikimo_demand_plan_queue/models/__init__.py
Normal file
2
jikimo_demand_plan_queue/models/__init__.py
Normal file
@@ -0,0 +1,2 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from . import production_demand_plan
|
||||
20
jikimo_demand_plan_queue/models/production_demand_plan.py
Normal file
20
jikimo_demand_plan_queue/models/production_demand_plan.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from odoo import models, fields
|
||||
|
||||
|
||||
class ProductionDemandPlan(models.Model):
|
||||
_inherit = 'sf.production.demand.plan'
|
||||
|
||||
|
||||
def _do_production_schedule(self, pro_plan_list):
|
||||
"""使用队列进行排程"""
|
||||
batch_size = 10
|
||||
current_time = fields.Datetime.now().strftime('%Y%m%d%H%M%S')
|
||||
index = 1
|
||||
for i in range(0, len(pro_plan_list), batch_size):
|
||||
batch = self.env['queue.job.batch'].get_new_batch('plan-%s-%s' % (current_time, index))
|
||||
pro_plans = pro_plan_list[i:i+batch_size]
|
||||
pro_plans.with_context(
|
||||
job_batch=batch
|
||||
).with_delay().do_production_schedule()
|
||||
index += 1
|
||||
batch.enqueue()
|
||||
@@ -521,11 +521,6 @@ div:has(.o_required_modifier) > label::before {
|
||||
}
|
||||
}
|
||||
|
||||
// 设置表格横向滚动
|
||||
.o_list_renderer.o_renderer {
|
||||
max-width: 100%;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
// 设置表单页面label文本不换行
|
||||
.o_form_view .o_group .o_wrap_label .o_form_label {
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'views/sale_order_view.xml',
|
||||
'views/purchase_order.xml',
|
||||
'views/mrp_production.xml',
|
||||
'views/purchase_request_view.xml',
|
||||
'wizard/purchase_request_line_make_purchase_order_view.xml',
|
||||
|
||||
@@ -6,3 +6,4 @@ from . import mrp_production
|
||||
from . import purchase_order
|
||||
from . import stock_rule
|
||||
from . import stock_picking
|
||||
from . import product_product
|
||||
|
||||
@@ -12,9 +12,7 @@ class MrpProduction(models.Model):
|
||||
if item.product_id.is_customer_provided:
|
||||
item.pr_mp_count = 0
|
||||
else:
|
||||
# 由于采购申请合并了所有销售订单行的采购,所以不区分产品
|
||||
mrp_names = self.env['mrp.production'].search([('origin', '=', item.origin)]).mapped('name')
|
||||
pr_ids = self.env['purchase.request'].sudo().search([('origin', 'in', mrp_names)])
|
||||
pr_ids = item._get_purchase_request()
|
||||
item.pr_mp_count = len(pr_ids)
|
||||
# pr_ids = self.env['purchase.request'].sudo().search([('origin', 'like', item.name), ('is_subcontract', '!=', 'True')])
|
||||
|
||||
@@ -25,8 +23,7 @@ class MrpProduction(models.Model):
|
||||
self.ensure_one()
|
||||
|
||||
# 由于采购申请合并了所有销售订单行的采购,所以不区分产品
|
||||
mrp_names = self.env['mrp.production'].search([('origin', '=', self.origin)]).mapped('name')
|
||||
pr_ids = self.env['purchase.request'].sudo().search([('origin', 'in', mrp_names)])
|
||||
pr_ids = self._get_purchase_request()
|
||||
|
||||
action = {
|
||||
'res_model': 'purchase.request',
|
||||
@@ -44,3 +41,12 @@ class MrpProduction(models.Model):
|
||||
'view_mode': 'tree,form',
|
||||
})
|
||||
return action
|
||||
|
||||
def _get_purchase_request(self):
|
||||
"""获取跟制造订单相关的采购申请单(根据采购申请单行项目的产品匹配)"""
|
||||
mrp_names = self.env['mrp.production'].search([('origin', '=', self.origin)]).mapped('name')
|
||||
pr_ids = self.env['purchase.request'].sudo().search([('origin', 'in', mrp_names)])
|
||||
product_list = self.product_id._get_product_include_bom()
|
||||
pr_line_ids = pr_ids.line_ids.filtered(lambda l: l.product_id in product_list)
|
||||
return pr_line_ids.mapped('request_id')
|
||||
|
||||
17
jikimo_purchase_request/models/product_product.py
Normal file
17
jikimo_purchase_request/models/product_product.py
Normal file
@@ -0,0 +1,17 @@
|
||||
from odoo import models
|
||||
|
||||
|
||||
class ProductProduct(models.Model):
|
||||
_inherit = 'product.product'
|
||||
|
||||
|
||||
def _get_product_include_bom(self):
|
||||
"""获取产品列表(包括所有bom)"""
|
||||
self.ensure_one()
|
||||
product_list = [self]
|
||||
bom_ids = self.bom_ids
|
||||
while (bom_ids):
|
||||
bom_product_ids = bom_ids.bom_line_ids.mapped('product_id')
|
||||
product_list.append(bom_product_ids)
|
||||
bom_ids = bom_product_ids.bom_ids
|
||||
return product_list
|
||||
@@ -16,6 +16,69 @@ class PurchaseOrder(models.Model):
|
||||
('rejected', '已驳回')
|
||||
], string='Status', readonly=True, index=True, copy=False, default='draft', tracking=True)
|
||||
|
||||
# 成品采购订单对应的坯料采购申请单和采购订单数量
|
||||
purchase_request_count = fields.Integer('子·采购申请数量', compute='_compute_purchase_request')
|
||||
purchase_order_count = fields.Integer('子·采购订单数量', compute='_compute_purchase_request')
|
||||
|
||||
@api.depends('state')
|
||||
def _compute_purchase_request(self):
|
||||
for record in self:
|
||||
purchase_request_ids, purchase_order_ids = record.get_purchase_request_order()
|
||||
record.purchase_request_count = len(purchase_request_ids)
|
||||
record.purchase_order_count = len(purchase_order_ids)
|
||||
|
||||
def action_view_preform_body_purchase_request(self):
|
||||
self.ensure_one()
|
||||
name_list = self._get_pinking_name()
|
||||
purchase_request_ids = self.env['purchase.request'].search([('origin', 'in', name_list)])
|
||||
|
||||
action = {
|
||||
'res_model': 'purchase.request',
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
if len(purchase_request_ids) == 1:
|
||||
action.update({
|
||||
'view_mode': 'form',
|
||||
'res_id': purchase_request_ids[0].id,
|
||||
})
|
||||
else:
|
||||
action.update({
|
||||
'name': _("子·采购申请"),
|
||||
'domain': [('id', 'in', purchase_request_ids.ids)],
|
||||
'view_mode': 'tree,form',
|
||||
})
|
||||
return action
|
||||
|
||||
def action_view_preform_body_purchase_order(self):
|
||||
self.ensure_one()
|
||||
name_list = self._get_pinking_name()
|
||||
purchase_order_ids = self.env['purchase.order'].search([('origin', 'in', name_list)])
|
||||
|
||||
action = {
|
||||
'res_model': 'purchase.order',
|
||||
'type': 'ir.actions.act_window',
|
||||
}
|
||||
if len(purchase_order_ids) == 1:
|
||||
action.update({
|
||||
'view_mode': 'form',
|
||||
'res_id': purchase_order_ids[0].id,
|
||||
})
|
||||
else:
|
||||
action.update({
|
||||
'name': _("子·采购订单"),
|
||||
'domain': [('id', 'in', purchase_order_ids.ids)],
|
||||
'view_mode': 'tree,form',
|
||||
})
|
||||
return action
|
||||
|
||||
def get_purchase_request_order(self):
|
||||
name_list = self._get_pinking_name()
|
||||
purchase_request_ids = self.env['purchase.request'].search([('origin', 'in', name_list)])
|
||||
purchase_order_ids = self.env['purchase.order'].search([('origin', 'in', name_list)])
|
||||
return purchase_request_ids, purchase_order_ids
|
||||
|
||||
def _get_pinking_name(self):
|
||||
return [picking_id.name for picking_id in self.picking_ids if picking_id.name]
|
||||
|
||||
def button_confirm(self):
|
||||
res = super(PurchaseOrder, self).button_confirm()
|
||||
|
||||
@@ -16,6 +16,7 @@ class PurchaseRequest(models.Model):
|
||||
)
|
||||
|
||||
rule_new_add = fields.Boolean('采购请求为规则创建', default=False, compute='_compute_state', store=True)
|
||||
rule_purchase_to_request = fields.Boolean('采购单根据规则创建坯料采购申请', default=False)
|
||||
|
||||
@api.depends('state')
|
||||
def _compute_state(self):
|
||||
|
||||
@@ -42,6 +42,17 @@ class StockPicking(models.Model):
|
||||
purchase_request_lines = self.move_ids.move_orig_ids.purchase_line_id.purchase_request_lines
|
||||
if purchase_request_lines:
|
||||
purchase_request_lines.move_dest_ids = [
|
||||
(4, x.id) for x in backorder_ids.move_ids if x.product_id.id == purchase_request_lines.product_id.id
|
||||
(4, x.id) for x in backorder_ids.move_ids if x.product_id.id in purchase_request_lines.mapped('product_id.id')
|
||||
]
|
||||
return res
|
||||
|
||||
def _subcontracted_produce(self, subcontract_details):
|
||||
super()._subcontracted_produce(subcontract_details)
|
||||
|
||||
# 判断是否根据规则生成新的采购申请单据,如果生成则修改状态为 approved
|
||||
if self:
|
||||
pr_ids = self.env["purchase.request"].sudo().search(
|
||||
[('origin', 'like', self.name), ('rule_purchase_to_request', '=', True), ('state', '=', 'draft')])
|
||||
if pr_ids:
|
||||
pr_ids.write({'need_validation': False})
|
||||
pr_ids.write({"state": "approved", 'need_validation': True, 'rule_new_add': False})
|
||||
|
||||
@@ -26,7 +26,7 @@ class StockRule(models.Model):
|
||||
request_data = rule._prepare_purchase_request(
|
||||
procurement.origin, procurement.values
|
||||
)
|
||||
request_data.update({'rule_new_add': True})
|
||||
request_data = self._update_request_data(procurement, request_data)
|
||||
pr = purchase_request_model.create(request_data)
|
||||
cache[domain] = pr
|
||||
elif (
|
||||
@@ -44,6 +44,18 @@ class StockRule(models.Model):
|
||||
request_line_data.update({'origin': procurement.origin})
|
||||
purchase_request_line_model.create(request_line_data)
|
||||
|
||||
def _update_request_data(self, procurement, request_data):
|
||||
sp = self.env['stock.picking'].sudo().search([('name', '=', procurement.origin)])
|
||||
if len(sp) == 1:
|
||||
po = self.env['purchase.order'].sudo().search(
|
||||
[('name', '=', sp.origin), ('purchase_type', '=', 'outsourcing')])
|
||||
if po:
|
||||
request_data.update({'rule_purchase_to_request': True})
|
||||
else:
|
||||
request_data.update({'rule_new_add': True})
|
||||
return request_data
|
||||
|
||||
|
||||
def _run_buy(self, procurements):
|
||||
# 如果补货组相同,并且产品相同,则合并
|
||||
procurements_dict = defaultdict()
|
||||
|
||||
28
jikimo_purchase_request/views/purchase_order.xml
Normal file
28
jikimo_purchase_request/views/purchase_order.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="purchase_order_form_jikimo_purchase_request" model="ir.ui.view">
|
||||
<field name="name">purchase.order.inherited.form.jikimo.purchase.request</field>
|
||||
<field name="model">purchase.order</field>
|
||||
<field name="inherit_id" ref="mrp_subcontracting_purchase.purchase_order_form_mrp_subcontracting_purchase"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//div[hasclass('oe_button_box')]/button[@name='action_view_subcontracting_resupply']" position="before">
|
||||
<button
|
||||
class="oe_stat_button" name="action_view_preform_body_purchase_order"
|
||||
type="object" icon="fa-truck" attrs="{'invisible': [('purchase_order_count', '=', 0)]}" groups="stock.group_stock_user">
|
||||
<div class="o_field_widget o_stat_info">
|
||||
<span class="o_stat_value"><field name="purchase_order_count"/></span>
|
||||
<span class="o_stat_text">子·采购订单</span>
|
||||
</div>
|
||||
</button>
|
||||
<button
|
||||
class="oe_stat_button" name="action_view_preform_body_purchase_request"
|
||||
type="object" icon="fa-truck" attrs="{'invisible': [('purchase_request_count', '=', 0)]}" groups="stock.group_stock_user">
|
||||
<div class="o_field_widget o_stat_info">
|
||||
<span class="o_stat_value"><field name="purchase_request_count"/></span>
|
||||
<span class="o_stat_text">子·采购申请</span>
|
||||
</div>
|
||||
</button>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -67,6 +67,16 @@
|
||||
<field name="part_number"/>
|
||||
<field name="part_name" invisible="1"/>
|
||||
</xpath>
|
||||
<xpath expr="//tree" position="inside">
|
||||
<header>
|
||||
<button
|
||||
name="%(purchase_request.action_purchase_request_line_make_purchase_order)d"
|
||||
string="创建询价单"
|
||||
type="action"
|
||||
class="btn-primary"
|
||||
/>
|
||||
</header>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
|
||||
@@ -10,10 +10,12 @@
|
||||
""",
|
||||
'category': 'sf',
|
||||
'website': 'https://www.sf.jikimo.com',
|
||||
'depends': ['sf_plan', 'jikimo_printing'],
|
||||
'depends': ['sf_plan','jikimo_printing'],
|
||||
'data': [
|
||||
'security/ir.model.access.csv',
|
||||
'data/stock_route_group.xml',
|
||||
'views/demand_plan.xml',
|
||||
'views/stock_route.xml',
|
||||
'wizard/sf_demand_plan_print_wizard_view.xml',
|
||||
],
|
||||
'demo': [
|
||||
@@ -23,6 +25,7 @@
|
||||
],
|
||||
'web.assets_backend': [
|
||||
'sf_demand_plan/static/src/scss/style.css',
|
||||
'sf_demand_plan/static/src/js/print_demand.js',
|
||||
]
|
||||
},
|
||||
'license': 'LGPL-3',
|
||||
|
||||
21
sf_demand_plan/data/stock_route_group.xml
Normal file
21
sf_demand_plan/data/stock_route_group.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<data noupdate="0">
|
||||
<record id="stock_route_group_automation_sf" model="stock.route.group">
|
||||
<field name="name">自动化产线加工</field>
|
||||
<field name="code">automation</field>
|
||||
</record>
|
||||
<record id="stock_route_group_manual_sf" model="stock.route.group">
|
||||
<field name="name">人工线下加工</field>
|
||||
<field name="code">manual</field>
|
||||
</record>
|
||||
<record id="stock_route_group_purchase_sf" model="stock.route.group">
|
||||
<field name="name">外购</field>
|
||||
<field name="code">purchase</field>
|
||||
</record>
|
||||
<record id="stock_route_group_outsourcing_sf" model="stock.route.group">
|
||||
<field name="name">委外加工</field>
|
||||
<field name="code">outsourcing</field>
|
||||
</record>
|
||||
</data>
|
||||
</odoo>
|
||||
@@ -2,3 +2,4 @@
|
||||
|
||||
from . import sf_production_demand_plan
|
||||
from . import sale_order
|
||||
from . import stock_route
|
||||
|
||||
@@ -39,11 +39,7 @@ class SfProductionDemandPlan(models.Model):
|
||||
company_id = fields.Many2one(
|
||||
related='sale_order_id.company_id',
|
||||
store=True, index=True, precompute=True)
|
||||
partner_id = fields.Many2one(
|
||||
comodel_name='res.partner',
|
||||
related='sale_order_line_id.order_partner_id',
|
||||
string="客户",
|
||||
store=True, index=True)
|
||||
customer_name = fields.Char('客户', related='sale_order_id.customer_name')
|
||||
order_remark = fields.Text(related='sale_order_id.remark',
|
||||
string="订单备注", store=True)
|
||||
glb_url = fields.Char(related='sale_order_line_id.glb_url', string='glb文件地址')
|
||||
@@ -64,7 +60,7 @@ class SfProductionDemandPlan(models.Model):
|
||||
product_uom_qty = fields.Float(
|
||||
string="需求数量",
|
||||
related='sale_order_line_id.product_uom_qty', store=True)
|
||||
deadline_of_delivery = fields.Date('客户交期', related='sale_order_id.deadline_of_delivery', store=True)
|
||||
deadline_of_delivery = fields.Date('客户交期', related='sale_order_line_id.delivery_end_date', store=True)
|
||||
inventory_quantity_auto_apply = fields.Float(
|
||||
string="成品库存",
|
||||
compute='_compute_inventory_quantity_auto_apply'
|
||||
@@ -73,7 +69,11 @@ class SfProductionDemandPlan(models.Model):
|
||||
"交货数量", related='sale_order_line_id.qty_delivered')
|
||||
qty_to_deliver = fields.Float(
|
||||
"待交货数量", related='sale_order_line_id.qty_to_deliver')
|
||||
model_long = fields.Char('尺寸', compute='_compute_model_long')
|
||||
model_long = fields.Char('尺寸(mm)', compute='_compute_model_long')
|
||||
blank_type = fields.Selection([('圆料', '圆料'), ('方料', '方料')], string='坯料分类',
|
||||
related='product_id.blank_type')
|
||||
blank_precision = fields.Selection([('精坯', '精坯'), ('粗坯', '粗坯')], string='坯料类型', related='product_id.blank_precision')
|
||||
embryo_long = fields.Char('坯料尺寸(mm)', compute='_compute_embryo_long')
|
||||
materials_id = fields.Char('材料', compute='_compute_materials_id', store=True)
|
||||
model_machining_precision = fields.Selection(selection=_get_machining_precision, string='精度',
|
||||
related='product_id.model_machining_precision')
|
||||
@@ -89,6 +89,9 @@ class SfProductionDemandPlan(models.Model):
|
||||
string='订单状态',
|
||||
related='sale_order_line_id.state')
|
||||
route_id = fields.Many2one('stock.route', string='路线', related='sale_order_line_id.route_id', store=True)
|
||||
route_ids = fields.Many2many('stock.route', 'stock_route_demand_plan', 'demand_plan_id', 'route_id', '路线',
|
||||
domain=[('demand_plan_selectable', '=', True)], compute='_compute_route_ids',
|
||||
store=True)
|
||||
contract_date = fields.Date('合同日期', related='sale_order_id.contract_date')
|
||||
date_order = fields.Datetime('下单日期', related='sale_order_id.date_order')
|
||||
contract_code = fields.Char('合同号', related='sale_order_id.contract_code', store=True)
|
||||
@@ -136,6 +139,18 @@ class SfProductionDemandPlan(models.Model):
|
||||
|
||||
outsourcing_purchase_request = fields.Char('委外采购申请单')
|
||||
|
||||
@api.depends('supply_method')
|
||||
def _compute_route_ids(self):
|
||||
for pdp in self:
|
||||
if pdp.supply_method:
|
||||
group_id = self.env['stock.route.group'].sudo().search([('code', '=', pdp.supply_method)])
|
||||
route_ids = self.env['stock.route'].sudo().search(
|
||||
[('demand_plan_selectable', '=', True), ('stock_route_group_ids', '=', group_id.id)])
|
||||
if route_ids:
|
||||
pdp.route_ids = route_ids.ids
|
||||
break
|
||||
pdp.route_ids = None
|
||||
|
||||
@api.depends('sale_order_id.state', 'sale_order_id.mrp_production_ids.schedule_state', 'sale_order_id.order_line',
|
||||
'sale_order_id.mrp_production_ids.state')
|
||||
def _compute_status(self):
|
||||
@@ -197,6 +212,17 @@ class SfProductionDemandPlan(models.Model):
|
||||
else:
|
||||
line.model_long = None
|
||||
|
||||
@api.depends('product_id.model_long', 'product_id.model_width', 'product_id.model_height', 'product_id.blank_type')
|
||||
def _compute_embryo_long(self):
|
||||
for line in self:
|
||||
if line.product_id:
|
||||
if line.product_id.blank_type == '圆料':
|
||||
line.embryo_long = f"Ø{round(line.product_id.model_width, 3)}*{round(line.product_id.model_long, 3)}"
|
||||
else:
|
||||
line.embryo_long = f"{round(line.product_id.model_long, 3)}*{round(line.product_id.model_width, 3)}*{round(line.product_id.model_height, 3)}"
|
||||
else:
|
||||
line.embryo_long = None
|
||||
|
||||
@api.depends('product_id.materials_id')
|
||||
def _compute_materials_id(self):
|
||||
for line in self:
|
||||
@@ -272,18 +298,21 @@ class SfProductionDemandPlan(models.Model):
|
||||
else:
|
||||
record.actual_end_date = None
|
||||
|
||||
@api.depends('sale_order_id.mrp_production_ids.move_raw_ids.forecast_availability',
|
||||
'sale_order_id.mrp_production_ids.move_raw_ids.quantity_done')
|
||||
@api.depends('sale_order_id.mrp_production_ids.move_raw_ids.reserved_availability')
|
||||
def _compute_material_check(self):
|
||||
for record in self:
|
||||
if record.sale_order_id and record.sale_order_id.mrp_production_ids:
|
||||
manufacturing_orders = record.sale_order_id.mrp_production_ids.filtered(
|
||||
lambda mo: mo.product_id == record.product_id)
|
||||
|
||||
if manufacturing_orders and manufacturing_orders.move_raw_ids:
|
||||
total_forecast_availability = sum(manufacturing_orders.mapped('move_raw_ids.forecast_availability'))
|
||||
total_quantity_done = sum(manufacturing_orders.mapped('move_raw_ids.quantity_done'))
|
||||
total_sum = total_forecast_availability + total_quantity_done
|
||||
if float_compare(total_sum, record.product_uom_qty,
|
||||
# 获取完成的制造订单
|
||||
done_manufacturing = manufacturing_orders.filtered(lambda mo: mo.state == 'done')
|
||||
product_qty = sum(done_manufacturing.mapped('product_qty'))
|
||||
# 需求数量-完成数量
|
||||
product_uom_qty = record.product_uom_qty - product_qty
|
||||
total_reserved_availability = sum(manufacturing_orders.mapped('move_raw_ids.reserved_availability'))
|
||||
if float_compare(total_reserved_availability, product_uom_qty,
|
||||
precision_rounding=record.product_id.uom_id.rounding) >= 0:
|
||||
record.material_check = '1' # 已齐套
|
||||
else:
|
||||
@@ -308,13 +337,16 @@ class SfProductionDemandPlan(models.Model):
|
||||
[('name', '=', '1#CNC自动生产线')], limit=1)
|
||||
if sf_production_line:
|
||||
now = datetime.now()
|
||||
time_part = (now + timedelta(minutes=3)).time()
|
||||
time_part = (now + timedelta(hours=2)).time()
|
||||
date_part = fields.Date.from_string(self.planned_start_date)
|
||||
date_planned_start = datetime.combine(date_part, time_part)
|
||||
pro_plan_list.production_line_id = sf_production_line.id
|
||||
pro_plan_list.date_planned_start = date_planned_start
|
||||
for pro_plan in pro_plan_list:
|
||||
pro_plan.do_production_schedule()
|
||||
self._do_production_schedule(pro_plan_list)
|
||||
|
||||
def _do_production_schedule(self, pro_plan_list):
|
||||
for pro_plan in pro_plan_list:
|
||||
pro_plan.do_production_schedule()
|
||||
|
||||
def button_action_print(self):
|
||||
return {
|
||||
@@ -389,29 +421,30 @@ class SfProductionDemandPlan(models.Model):
|
||||
outsourcing_purchase_request.extend(pr_ids.ids)
|
||||
if record.supply_method == 'outsourcing' and not record.sale_order_line_id.is_incoming_material:
|
||||
bom_line_ids = record.product_id.bom_ids.bom_line_ids
|
||||
# BOM_数量
|
||||
total_product_qty = sum(line.product_qty for line in bom_line_ids)
|
||||
bom_product_ids = bom_line_ids.mapped('product_id')
|
||||
product_purchase_orders = self.env['purchase.order'].sudo().search([
|
||||
('state', 'in', ('purchase', 'done')),
|
||||
('order_line.product_id', 'in', bom_product_ids.ids)
|
||||
])
|
||||
# 购订单_数量
|
||||
total_outsourcing_purchase_quantity = sum(
|
||||
sum(
|
||||
order.order_line.filtered(
|
||||
lambda line: line.product_id in bom_product_ids
|
||||
).mapped('product_qty')
|
||||
if bom_line_ids:
|
||||
# BOM_数量
|
||||
total_product_qty = sum(line.product_qty for line in bom_line_ids)
|
||||
bom_product_ids = bom_line_ids.mapped('product_id')
|
||||
product_purchase_orders = self.env['purchase.order'].sudo().search([
|
||||
('state', 'in', ('purchase', 'done')),
|
||||
('order_line.product_id', 'in', bom_product_ids.ids)
|
||||
])
|
||||
# 购订单_数量
|
||||
total_outsourcing_purchase_quantity = sum(
|
||||
sum(
|
||||
order.order_line.filtered(
|
||||
lambda line: line.product_id in bom_product_ids
|
||||
).mapped('product_qty')
|
||||
)
|
||||
for order in product_purchase_orders
|
||||
)
|
||||
for order in product_purchase_orders
|
||||
)
|
||||
quantity = total_outsourcing_purchase_quantity / total_product_qty
|
||||
if float_compare(quantity, record.product_uom_qty,
|
||||
precision_rounding=record.product_id.uom_id.rounding) == -1:
|
||||
purchase_request = self.env['purchase.request'].sudo().search(
|
||||
[('line_ids.product_id', 'in', bom_product_ids.ids),
|
||||
('line_ids.purchase_state', 'not in', ('purchase', 'done')), ('state', '!=', 'done')])
|
||||
outsourcing_purchase_request.extend(purchase_request.ids)
|
||||
quantity = total_outsourcing_purchase_quantity / total_product_qty
|
||||
if float_compare(quantity, record.product_uom_qty,
|
||||
precision_rounding=record.product_id.uom_id.rounding) == -1:
|
||||
purchase_request = self.env['purchase.request'].sudo().search(
|
||||
[('line_ids.product_id', 'in', bom_product_ids.ids),
|
||||
('line_ids.purchase_state', 'not in', ('purchase', 'done')), ('state', '!=', 'done')])
|
||||
outsourcing_purchase_request.extend(purchase_request.ids)
|
||||
record.outsourcing_purchase_request = json.dumps(outsourcing_purchase_request)
|
||||
if outsourcing_purchase_request:
|
||||
record.hide_action_purchase_orders = True
|
||||
@@ -503,7 +536,10 @@ class SfProductionDemandPlan(models.Model):
|
||||
action = self.env["ir.actions.actions"]._for_xml_id("stock.action_picking_tree_all")
|
||||
picking_ids = None
|
||||
if self.supply_method in ('automation', 'manual'):
|
||||
picking_ids = self.sale_order_id.mrp_production_ids.mapped('picking_ids').filtered(
|
||||
mrp_production_ids = self.sale_order_id.mrp_production_ids.filtered(
|
||||
lambda p: p.product_id.id == self.product_id.id
|
||||
)
|
||||
picking_ids = mrp_production_ids.mapped('picking_ids').filtered(
|
||||
lambda p: p.state == 'assigned')
|
||||
elif self.supply_method in ('purchase', 'outsourcing'):
|
||||
picking_ids = self.sale_order_id.picking_ids.filtered(
|
||||
|
||||
49
sf_demand_plan/models/stock_route.py
Normal file
49
sf_demand_plan/models/stock_route.py
Normal file
@@ -0,0 +1,49 @@
|
||||
from odoo import models, fields, api, _
|
||||
|
||||
|
||||
class SfStockRoute(models.Model):
|
||||
_inherit = 'stock.route'
|
||||
|
||||
demand_plan_selectable = fields.Boolean("需求计划行")
|
||||
stock_route_group_ids = fields.Many2many('stock.route.group', 'route_to_group', string='路线组')
|
||||
demand_plan_ids = fields.Many2many('sf.production.demand.plan', 'stock_route_demand_plan', 'route_id',
|
||||
'demand_plan_id', '需求计划', copy=False, compute='_compute_demand_plan_ids',
|
||||
store=True)
|
||||
|
||||
@api.depends('demand_plan_selectable', 'stock_route_group_ids')
|
||||
def _compute_demand_plan_ids(self):
|
||||
for sr in self:
|
||||
if sr.demand_plan_selectable:
|
||||
stock_route_group = [srg.code for srg in sr.stock_route_group_ids]
|
||||
demand_plan_ids = self.env['sf.production.demand.plan'].sudo().search(
|
||||
[('supply_method', 'in', stock_route_group)])
|
||||
if demand_plan_ids:
|
||||
sr.demand_plan_ids = demand_plan_ids.ids
|
||||
break
|
||||
sr.demand_plan_ids = None
|
||||
|
||||
# def name_get(self):
|
||||
# res = super().name_get()
|
||||
# if self.env.context.get('demand_plan_search_stock_route_id'):
|
||||
# demand_plan_id = self.env['sf.production.demand.plan'].sudo().browse(
|
||||
# int(self.env.context.get('demand_plan_search_stock_route_id')))
|
||||
# if demand_plan_id and demand_plan_id.supply_method:
|
||||
# supply_method = self._set_supply_method(demand_plan_id.supply_method)
|
||||
# res = [(item[0], f'{item[1]}-{supply_method}') for item in res if len(item) == 2]
|
||||
# return res
|
||||
#
|
||||
# def _set_supply_method(self, supply_method):
|
||||
# return {
|
||||
# 'automation': "自动化产线加工",
|
||||
# 'manual': "人工线下加工",
|
||||
# 'purchase': "外购",
|
||||
# 'outsourcing': "委外加工"
|
||||
# }.get(supply_method)
|
||||
|
||||
|
||||
class SfStockRouteGroup(models.Model):
|
||||
_name = 'stock.route.group'
|
||||
_description = '路线组'
|
||||
|
||||
name = fields.Char('名称')
|
||||
code = fields.Char('编码')
|
||||
@@ -4,3 +4,6 @@ access_sf_production_demand_plan_for_dispatch,sf.production.demand.plan for disp
|
||||
|
||||
access_sf_demand_plan_print_wizard,sf.demand.plan.print.wizard,model_sf_demand_plan_print_wizard,base.group_user,1,0,0,0
|
||||
access_sf_demand_plan_print_wizard_for_dispatch,sf.demand.plan.print.wizard for dispatch,model_sf_demand_plan_print_wizard,sf_base.group_plan_dispatch,1,1,0,0
|
||||
|
||||
access_stock_route_group,stock.route.group,model_stock_route_group,base.group_user,1,0,0,0
|
||||
access_stock_route_group_dispatch,stock.route.group.dispatch,model_stock_route_group,sf_base.group_plan_dispatch,1,1,0,0
|
||||
|
||||
|
256
sf_demand_plan/static/src/js/print_demand.js
Normal file
256
sf_demand_plan/static/src/js/print_demand.js
Normal file
@@ -0,0 +1,256 @@
|
||||
odoo.define('sf_demand.print_demand', function (require) {
|
||||
"use strict";
|
||||
|
||||
var ListController = require('web.ListController');
|
||||
var ListRenderer = require('web.ListRenderer');
|
||||
var ListView = require('web.ListView');
|
||||
var viewRegistry = require('web.view_registry');
|
||||
var { url } = require("@web/core/utils/urls")
|
||||
|
||||
var CustomListRenderer = ListRenderer.extend({
|
||||
_render: function () {
|
||||
var self = this;
|
||||
this.getParent()?.$buttons.hide();
|
||||
|
||||
return this._super.apply(this, arguments).then(function () {
|
||||
if(!self.state.data || !self.state.data.length) return
|
||||
// 添加图片预览容器到页面左侧
|
||||
if (!$('.table-image-preview-container').length) {
|
||||
self.$el.parent().addClass('custom-table-image-container')
|
||||
self.$el.before(
|
||||
`<div class="custom-preview-container">
|
||||
<img class="table-image-preview-container" src="" />
|
||||
<iframe class="table-image-preview-container" src=""/>
|
||||
</div>`
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
if(!$('.denmand_set').length) {
|
||||
|
||||
const checked = self.getParent().radioCheck || 'all'
|
||||
|
||||
self.$el.prepend(`
|
||||
<form class="denmand_set">
|
||||
<span>更多设置:</span>
|
||||
<input type="radio" id="male" name="set" value="图纸">
|
||||
<label for="male">图纸</label>
|
||||
<input type="radio" id="female" name="set" value="程序单">
|
||||
<label for="female">程序单</label>
|
||||
<input type="radio" id="other" name="set" value="all" >
|
||||
<label for="other">图纸/程序单</label>
|
||||
</form>
|
||||
`)
|
||||
setTimeout(() => {
|
||||
$(`input[name=set][value=${checked}]`).prop('checked', true)
|
||||
$('.denmand_set').trigger('click')
|
||||
}, 100);
|
||||
self.$el.prepend(`
|
||||
<div class="print-button-container" style="margin-bottom:10px;">
|
||||
<button class="btn btn-primary o_print_custom">
|
||||
<i class="fa fa-print"></i> 打印
|
||||
</button>
|
||||
<button class="btn btn-secondary o_cancel_custom">
|
||||
取消
|
||||
</button>
|
||||
</div>
|
||||
`);
|
||||
}
|
||||
});
|
||||
},
|
||||
start: function() {
|
||||
setTimeout(() => {
|
||||
this.$el.find('.o_data_row').eq(0).trigger('click')
|
||||
this.getParent().$el?.find('.o_cp_top_right,.o_cp_bottom').hide()
|
||||
}, 500);
|
||||
return this._super();
|
||||
},
|
||||
events: _.extend({}, ListRenderer.prototype.events, {
|
||||
'click .o_data_row': '_onCustomRowClick',
|
||||
'click .o_print_custom': '_onPrintClick',
|
||||
'click .o_cancel_custom': '_onCancelClick',
|
||||
'click .denmand_set': '_onDenmandChange',
|
||||
}),
|
||||
_onCancelClick() {
|
||||
this.getParent()?.getParent()?.dialogs.closeAll()
|
||||
},
|
||||
_onCustomRowClick: async function (ev) {
|
||||
var self = this;
|
||||
var $row = $(ev.currentTarget);
|
||||
var index = $row.index();
|
||||
var data = this.state.data[index];
|
||||
if(data.fileData?.fileUrl) {
|
||||
|
||||
} else {
|
||||
data.fileData = { }
|
||||
if(data.res_id) {
|
||||
// 正确获取 ORM 服务的方式
|
||||
// var orm = this.getParent().getParent().env.services
|
||||
const key = data.data.type == 1 ? 'machining_drawings' : 'cnc_worksheet'
|
||||
const attachment = await this._rpc({
|
||||
model: 'ir.binary',
|
||||
method: 'attachment_info',
|
||||
args: [
|
||||
data.model,
|
||||
data.res_id,
|
||||
key
|
||||
],
|
||||
})
|
||||
|
||||
if (attachment) {
|
||||
Object.assign(data.fileData, attachment)
|
||||
this._getTypeInfo(attachment.mimetype, data.fileData)
|
||||
}
|
||||
const fileUrl = this.getFileUrl(data.fileData.attachment_type, data, key)
|
||||
data.fileData.fileUrl = fileUrl
|
||||
}
|
||||
}
|
||||
$('.table-image-preview-container').hide()
|
||||
if(data.fileData.attachment_type == 'iframe') {
|
||||
|
||||
$('iframe.table-image-preview-container').attr('src', decodeURIComponent(data.fileData.fileUrl) ).show()
|
||||
} else {
|
||||
$('img.table-image-preview-container').attr('src', data.fileData.fileUrl).show()
|
||||
}
|
||||
},
|
||||
getSelectedIds: function() {
|
||||
return this.state.data.filter(_ => !_.hide).map(_ => {
|
||||
return _.data.id
|
||||
})
|
||||
},
|
||||
_onPrintClick(e) {
|
||||
var print_ids = this.getSelectedIds();
|
||||
this._rpc({
|
||||
model: 'sf.demand.plan.print.wizard',
|
||||
method: 'demand_plan_print',
|
||||
args: [ print_ids ] ,
|
||||
// context: this.state.getContext()
|
||||
}).then((e) => {
|
||||
|
||||
this.getParent()?.getParent()?.env.services?.notification.notify( {
|
||||
type: 'info',
|
||||
message: e.message,
|
||||
})
|
||||
// self.do_notify("成功", "打印任务已发送到打印机");
|
||||
}).catch(function(error) {
|
||||
console.error("打印错误:", error);
|
||||
// self.do_warn("打印失败", error.data.message || "未知错误");
|
||||
}).finally(e => {
|
||||
this.getParent().reload()
|
||||
})
|
||||
|
||||
},
|
||||
_onDenmandChange(e) {
|
||||
const isChecked = $(e.currentTarget).find('input:checked').val()
|
||||
this.getParent().radioCheck = isChecked
|
||||
this.$el.find('tbody').find('.o_data_row').show()
|
||||
|
||||
this.state.data.forEach(_ => {
|
||||
_.hide = false
|
||||
})
|
||||
const self = this
|
||||
if(!isChecked || isChecked == 'all') return
|
||||
this.$el.find('tbody').children('.o_data_row').each(function() {
|
||||
if($(this).find('td[name=type]').text() != isChecked) {
|
||||
const i = $(this).index()
|
||||
|
||||
self.state.data[i].hide = true
|
||||
$(this).hide()
|
||||
}
|
||||
})
|
||||
},
|
||||
getFileUrl(attachment_type, data, key) {
|
||||
let fileUrl
|
||||
switch (attachment_type) {
|
||||
case 'image':
|
||||
const timer = +new Date()
|
||||
fileUrl = url("/web/image", {
|
||||
model: data.model,
|
||||
id: data.res_id,
|
||||
field: key,
|
||||
unique: '',
|
||||
timer
|
||||
});
|
||||
|
||||
break;
|
||||
case 'iframe':
|
||||
|
||||
const iframe_file_url = encodeURIComponent(
|
||||
url("/web/content", {
|
||||
model: data.model,
|
||||
id: data.res_id,
|
||||
field: key,
|
||||
})
|
||||
);
|
||||
fileUrl = `${this.state.attachment_base}?file=${iframe_file_url}`;
|
||||
case 'unknown':
|
||||
fileUrl = encodeURIComponent(
|
||||
url("/web/content", {
|
||||
model: data.model,
|
||||
id: data.res_id,
|
||||
field: key,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
return fileUrl
|
||||
},
|
||||
_getTypeInfo(type, data) {
|
||||
switch (type) {
|
||||
case 'application/pdf':
|
||||
data.attachment_base = `/web/static/lib/pdfjs/web/viewer.html`;
|
||||
data.attachment_type = 'iframe'
|
||||
break;
|
||||
case 'application/vnd.openxmlformats-officedocument.wordprocessingml.document':
|
||||
data.attachment_base = `/jikimo_attachment_viewer/static/lib/docxjs/viewer.html`;
|
||||
data.attachment_type = 'iframe'
|
||||
break;
|
||||
case 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet':
|
||||
data.attachment_base = `/jikimo_attachment_viewer/static/lib/exceljs/viewer.html`;
|
||||
data.attachment_type = 'iframe'
|
||||
break;
|
||||
case 'application/vnd.openxmlformats-officedocument.presentationml.presentation':
|
||||
data.attachment_base = '';
|
||||
data.attachment_type = 'unknown'
|
||||
break;
|
||||
case 'image/png':
|
||||
case 'image/jpeg':
|
||||
case 'image/jpg':
|
||||
data.attachment_base = ''
|
||||
data.attachment_type = 'image'
|
||||
break;
|
||||
default:
|
||||
data.attachment_base = ''
|
||||
data.attachment_type = 'unknown'
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
var CustomListController = ListController.extend({
|
||||
// 可以保留或移除,根据是否需要处理自定义事件
|
||||
// 处理打印操作
|
||||
// rpc.query({
|
||||
// model: 'sf.demand.plan.print.wizard',
|
||||
// method: 'demand_plan_print',
|
||||
// args: [recordIds]
|
||||
// }).then(function(result) {
|
||||
// self.do_notify("成功", "打印任务已发送到打印机");
|
||||
// // 刷新视图显示最新状态
|
||||
// self.reload();
|
||||
// }).catch(function(error) {
|
||||
// self.do_warn("打印失败", error.data.message || "发生未知错误");
|
||||
// });
|
||||
});
|
||||
|
||||
var PrintDemand = ListView.extend({
|
||||
config: _.extend({}, ListView.prototype.config, {
|
||||
Renderer: CustomListRenderer,
|
||||
Controller: CustomListController,
|
||||
}),
|
||||
});
|
||||
|
||||
viewRegistry.add('print_demand', PrintDemand);
|
||||
|
||||
return PrintDemand;
|
||||
});
|
||||
@@ -9,3 +9,81 @@
|
||||
.demand_plan_tree .o_list_table_ungrouped {
|
||||
min-width: 1900px;
|
||||
}
|
||||
|
||||
|
||||
.o_selected_row {
|
||||
background-color: #e6f7ff !important;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.custom-table-image-container {
|
||||
display: flex;
|
||||
height: calc(95vh - 254px);
|
||||
gap: 20px;
|
||||
position: relative;
|
||||
th.o_list_record_selector, td.o_list_record_selector{
|
||||
display: none;
|
||||
}
|
||||
.custom-preview-container, .print_demand {
|
||||
flex: 1;
|
||||
|
||||
max-width: 49%;
|
||||
tbody {
|
||||
tr:not(.o_data_row) {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
tfoot {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
.print_demand {
|
||||
.table-responsive {
|
||||
width: 100%;
|
||||
overflow-x: auto!important;
|
||||
}
|
||||
}
|
||||
.custom-preview-container {
|
||||
background-color: #dadce0;
|
||||
padding: 20px;
|
||||
img {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
}
|
||||
iframe {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
.o_print_custom, .o_cancel_custom {
|
||||
position: absolute;
|
||||
bottom: 20px;
|
||||
right: 20px;
|
||||
}
|
||||
.o_print_custom {
|
||||
right: 66px;
|
||||
}
|
||||
}
|
||||
|
||||
.denmand_set {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: 50px;
|
||||
> span {
|
||||
font-weight: bold;
|
||||
}
|
||||
input {
|
||||
margin-left: 30px;
|
||||
}
|
||||
label {
|
||||
margin-left: 5px;
|
||||
}
|
||||
input,label {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
|
||||
th[data-name=processing_time] + th::before{
|
||||
content: '待执行单据';
|
||||
line-height: 38px;
|
||||
}
|
||||
|
||||
@@ -3,17 +3,16 @@
|
||||
<field name="name">sf.production.demand.plan.tree</field>
|
||||
<field name="model">sf.production.demand.plan</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="需求计划" default_order="sequence desc,create_date desc" editable="bottom"
|
||||
class="demand_plan_tree">
|
||||
<tree string="需求计划" default_order="sequence desc,id desc" editable="bottom"
|
||||
class="demand_plan_tree freeze-columns-before-part_number">
|
||||
<header>
|
||||
<button string="打印" name="button_action_print" type="object"
|
||||
class="btn-primary"/>
|
||||
</header>
|
||||
<field name="sequence" widget="handle"/>
|
||||
<field name="id" optional="hide"/>
|
||||
<field name="priority"/>
|
||||
<field name="status"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="customer_name"/>
|
||||
<field name="order_remark"/>
|
||||
<field name="glb_url" optional="hide"/>
|
||||
<field name="product_id"/>
|
||||
@@ -28,6 +27,9 @@
|
||||
<field name="qty_delivered"/>
|
||||
<field name="qty_to_deliver"/>
|
||||
<field name="model_long"/>
|
||||
<field name="blank_type" optional="hide"/>
|
||||
<field name="blank_precision"/>
|
||||
<field name="embryo_long"/>
|
||||
<field name="materials_id"/>
|
||||
<field name="model_machining_precision"/>
|
||||
<field name="model_process_parameters_ids" widget="many2many_tags"/>
|
||||
@@ -36,12 +38,16 @@
|
||||
<field name="sale_order_id" optional="hide"/>
|
||||
<field name="sale_order_line_number" optional="hide"/>
|
||||
<field name="order_state"/>
|
||||
<field name="route_id" optional="hide"/>
|
||||
<field name="route_ids" widget="many2many_tags" optional="hide" readonly="0"
|
||||
context="{'demand_plan_search_stock_route_id': id}"/>
|
||||
<field name="contract_date"/>
|
||||
<field name="date_order"/>
|
||||
<field name="contract_code"/>
|
||||
<field name="plan_remark"/>
|
||||
<field name="processing_time"/>
|
||||
<field name="priority" decoration-danger="priority == '1'"
|
||||
decoration-warning="priority == '2'"
|
||||
decoration-info="priority == '3'"
|
||||
decoration-success="priority == '4'"/>
|
||||
<field name="material_check" optional="hide"/>
|
||||
<field name="hide_action_open_mrp_production" invisible="1"/>
|
||||
<field name="hide_action_purchase_orders" invisible="1"/>
|
||||
@@ -60,6 +66,7 @@
|
||||
<field name="planned_start_date"/>
|
||||
<field name="actual_start_date"/>
|
||||
<field name="actual_end_date"/>
|
||||
<field name="processing_time"/>
|
||||
<field name="create_date" optional="hide" string="创建时间"/>
|
||||
<field name="create_uid" optional="hide" string="创建人"/>
|
||||
<field name="write_date" string="更新时间"/>
|
||||
@@ -80,7 +87,7 @@
|
||||
<field name="product_id"/>
|
||||
<field name="part_name"/>
|
||||
<field name="part_number"/>
|
||||
<field name="partner_id"/>
|
||||
<field name="customer_name"/>
|
||||
<field name="supply_method"/>
|
||||
<field name="materials_id"/>
|
||||
<field name="model_process_parameters_ids"/>
|
||||
@@ -89,7 +96,8 @@
|
||||
<group expand="0" string="Group By">
|
||||
<filter name="group_by_priority" string="优先级" domain="[]" context="{'group_by': 'priority'}"/>
|
||||
<filter name="group_by_status" string="状态" domain="[]" context="{'group_by': 'status'}"/>
|
||||
<filter name="group_by_partner_id" string="客户" domain="[]" context="{'group_by': 'partner_id'}"/>
|
||||
<filter name="group_by_customer_name" string="客户" domain="[]"
|
||||
context="{'group_by': 'customer_name'}"/>
|
||||
<filter name="group_by_is_incoming_material" string="客供料" domain="[]"
|
||||
context="{'group_by': 'is_incoming_material'}"/>
|
||||
<filter name="group_by_supply_method" string="供货方式" domain="[]"
|
||||
@@ -120,4 +128,9 @@
|
||||
action="sf_production_demand_plan_action"
|
||||
parent="sf_plan.sf_production_plan_menu"
|
||||
/>
|
||||
|
||||
<!-- 调拨动作中屏蔽验证-->
|
||||
<record id="stock.action_validate_picking" model="ir.actions.server">
|
||||
<field name="binding_model_id" eval="False"/>
|
||||
</record>
|
||||
</odoo>
|
||||
21
sf_demand_plan/views/stock_route.xml
Normal file
21
sf_demand_plan/views/stock_route.xml
Normal file
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<odoo>
|
||||
<record id="sf_stock_location_route_form_view" model="ir.ui.view">
|
||||
<field name="name">stock.route.form</field>
|
||||
<field name="model">stock.route</field>
|
||||
<field name="inherit_id" ref="stock.stock_location_route_form_view"/>
|
||||
<field name="arch" type="xml">
|
||||
<xpath expr="//field[@name='packaging_selectable']" position="after">
|
||||
<field name="demand_plan_selectable"/>
|
||||
</xpath>
|
||||
<xpath expr="//group[@name='route_selector']" position="after">
|
||||
<group name="group_category" string="组类">
|
||||
<group>
|
||||
<field name="stock_route_group_ids" options="{'no_create': True}" widget="many2many_tags"/>
|
||||
<field name="demand_plan_ids" invisible="1" options="{'no_create': True}" widget="many2many_tags"/>
|
||||
</group>
|
||||
</group>
|
||||
</xpath>
|
||||
</field>
|
||||
</record>
|
||||
</odoo>
|
||||
@@ -27,11 +27,17 @@ class SfDemandPlanPrintWizard(models.TransientModel):
|
||||
], string='状态', default='not_start')
|
||||
machining_drawings = fields.Binary('2D加工图纸', related='product_id.machining_drawings', store=True)
|
||||
|
||||
workorder_id = fields.Many2one('mrp.workorder', string='工单')
|
||||
cnc_worksheet = fields.Binary('程序单')
|
||||
|
||||
def demand_plan_print(self):
|
||||
for record in self:
|
||||
@api.model
|
||||
def demand_plan_print(self, print_ids):
|
||||
plan_print_ids = self.env['sf.demand.plan.print.wizard'].sudo().search(
|
||||
[('id', 'in', print_ids)])
|
||||
if not plan_print_ids:
|
||||
return {'message': '记录不存在'}
|
||||
success_records = []
|
||||
failed_records = []
|
||||
for record in plan_print_ids:
|
||||
pdf_data = record.machining_drawings if record.type == '1' else record.cnc_worksheet
|
||||
if pdf_data:
|
||||
try:
|
||||
@@ -46,9 +52,20 @@ class SfDemandPlanPrintWizard(models.TransientModel):
|
||||
elif record.type == '2':
|
||||
c_num += 1
|
||||
record.demand_plan_id.print_count = f"T{t_num}C{c_num}"
|
||||
success_records.append({
|
||||
'filename_url': record.filename_url,
|
||||
})
|
||||
except Exception as e:
|
||||
record.status = 'fail'
|
||||
_logger.error(f"文件{record.filename_url}打印失败: {str(e)}")
|
||||
failed_records.append({
|
||||
'filename_url': record.filename_url,
|
||||
})
|
||||
if failed_records:
|
||||
message = f"成功打印 {len(success_records)} 个文件,失败 {len(failed_records)} 个"
|
||||
else:
|
||||
message = f"所有 {len(success_records)} 个文件打印成功"
|
||||
return {'message': message}
|
||||
|
||||
|
||||
class MrpWorkorder(models.Model):
|
||||
@@ -59,7 +76,7 @@ class MrpWorkorder(models.Model):
|
||||
for record in self:
|
||||
if 'cnc_worksheet' in vals:
|
||||
demand_plan_print = self.env['sf.demand.plan.print.wizard'].sudo().search(
|
||||
[('workorder_id', '=', record.id)])
|
||||
[('model_id', '=', record.model_id), ('type', '=', '2')])
|
||||
if demand_plan_print:
|
||||
self.env['sf.demand.plan.print.wizard'].sudo().write(
|
||||
{'cnc_worksheet': record.cnc_worksheet, 'filename_url': record.cnc_worksheet_name})
|
||||
@@ -71,7 +88,6 @@ class MrpWorkorder(models.Model):
|
||||
'demand_plan_id': demand_plan.id,
|
||||
'model_id': demand_plan.model_id,
|
||||
'type': '2',
|
||||
'workorder_id': record.id,
|
||||
'cnc_worksheet': record.cnc_worksheet,
|
||||
'filename_url': record.cnc_worksheet_name
|
||||
}
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
<field name="name">sf.demand.plan.print.wizard.tree</field>
|
||||
<field name="model">sf.demand.plan.print.wizard</field>
|
||||
<field name="arch" type="xml">
|
||||
<tree string="打印">
|
||||
<tree string="打印" class="print_demand" js_class="print_demand">
|
||||
<field name="model_id"/>
|
||||
<field name="filename_url"/>
|
||||
<field name="type"/>
|
||||
<field name="machining_drawings" widget="adaptive_viewer"/>
|
||||
<field name="cnc_worksheet" widget="pdf_viewer"/>
|
||||
<field name="machining_drawings" attrs="{'column_invisible': True }"/>
|
||||
<field name="cnc_worksheet" attrs="{'column_invisible': True }"/>
|
||||
<field name="status"/>
|
||||
</tree>
|
||||
</field>
|
||||
|
||||
@@ -3,6 +3,7 @@ import logging
|
||||
|
||||
import re
|
||||
from odoo import models, fields, api
|
||||
from odoo.exceptions import ValidationError
|
||||
|
||||
|
||||
class ResProductCategory(models.Model):
|
||||
@@ -47,11 +48,14 @@ class ResMrpBomMo(models.Model):
|
||||
item.subcontractor_name = ''
|
||||
|
||||
def bom_create_line_has(self, embryo):
|
||||
product = self.product_tmpl_id
|
||||
if product.unit_number in (0, None, False):
|
||||
raise ValidationError(f'产品{product.name}单件用量的值不能为{product.unit_number}')
|
||||
vals = {
|
||||
'bom_id': self.id,
|
||||
'product_id': embryo.id,
|
||||
'product_tmpl_id': embryo.product_tmpl_id.id,
|
||||
'product_qty': 1,
|
||||
'product_qty': product.unit_number,
|
||||
'product_uom_id': 1
|
||||
}
|
||||
return self.env['mrp.bom.line'].sudo().create(vals)
|
||||
@@ -122,7 +126,7 @@ class ResMrpBomMo(models.Model):
|
||||
# 查bom的原材料
|
||||
def get_raw_bom(self, product):
|
||||
raw_bom = self.env['product.product'].search(
|
||||
[('categ_id.type', '=', '原材料'), ('materials_type_id', '=', product.materials_type_id.id)],limit=1)
|
||||
[('categ_id.type', '=', '原材料'), ('materials_type_id', '=', product.materials_type_id.id)], limit=1)
|
||||
return raw_bom
|
||||
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ class ResProductTemplate(models.Model):
|
||||
model_name = fields.Char('模型名称')
|
||||
categ_type = fields.Selection(
|
||||
[("成品", "成品"), ("胚料", "胚料"), ("原材料", "原材料")], string='产品的类别', related='categ_id.type', store=True)
|
||||
blank_type = fields.Selection([('圆料', '圆料'), ('方料', '方料')], string='坯料分类')
|
||||
model_long = fields.Float('模型长[mm]', digits=(16, 3))
|
||||
model_width = fields.Float('模型宽[mm]', digits=(16, 3))
|
||||
model_height = fields.Float('模型高[mm]', digits=(16, 3))
|
||||
@@ -72,14 +73,20 @@ class ResProductTemplate(models.Model):
|
||||
copy_product_id.product_tmpl_id.active = True
|
||||
model_type = self.env['sf.model.type'].search([], limit=1)
|
||||
attachment = self.attachment_create(item['model_name'], item['model_data'])
|
||||
# 判断参数中是否包含 坯料尺寸(长、宽、高)
|
||||
blank_bool = any(value is not None and value != 0 for value in (
|
||||
item.get('blank_length'), item.get('blank_width'), item.get('blank_height'))) if all(
|
||||
key in item for key in ('blank_length', 'blank_width', 'blank_height')) else False
|
||||
vals = {
|
||||
'name': '%s-%s-%s' % ('P', order_id.name, i),
|
||||
'model_long': item['model_long'] + model_type.embryo_tolerance,
|
||||
'model_width': item['model_width'] + model_type.embryo_tolerance,
|
||||
'model_height': item['model_height'] + model_type.embryo_tolerance,
|
||||
'model_volume': (item['model_long'] + model_type.embryo_tolerance) * (
|
||||
item['model_width'] + model_type.embryo_tolerance) * (
|
||||
item['model_height'] + model_type.embryo_tolerance),
|
||||
'blank_type': item.get('blank_type'),
|
||||
'model_long': item.get('blank_length') if blank_bool else item['model_long'] + model_type.embryo_tolerance,
|
||||
'model_width': item.get('blank_width') if blank_bool else item['model_width'] + model_type.embryo_tolerance,
|
||||
'model_height': item.get('blank_height') if blank_bool else item['model_height'] + model_type.embryo_tolerance,
|
||||
'model_volume': ((item['model_long'] + model_type.embryo_tolerance) *
|
||||
(item['model_width'] + model_type.embryo_tolerance) *
|
||||
(item['model_height'] + model_type.embryo_tolerance)) if not blank_bool else (
|
||||
item.get('blank_length') * item.get('blank_width') * item.get('blank_height')),
|
||||
'product_model_type_id': model_type.id,
|
||||
'model_processing_panel': 'R',
|
||||
'model_machining_precision': item['model_machining_precision'],
|
||||
|
||||
@@ -95,7 +95,9 @@
|
||||
<page string="加工参数">
|
||||
<group>
|
||||
<group string="模型">
|
||||
<label for="model_long" string="尺寸[mm]"/>
|
||||
<field name="blank_type" readonly="1"/>
|
||||
<field name="blank_precision" readonly="1"/>
|
||||
<label for="model_long" string="坯料尺寸[mm]"/>
|
||||
<div class="o_address_format">
|
||||
<label for="model_long" string="长"/>
|
||||
<field name="model_long" class="o_address_zip"/>
|
||||
@@ -104,6 +106,7 @@
|
||||
<label for="model_height" string="高"/>
|
||||
<field name="model_height" class="o_address_zip"/>
|
||||
</div>
|
||||
<field name="unit_number" readonly="1"/>
|
||||
<field name="model_volume" string="体积[mm³]"/>
|
||||
<field name="product_model_type_id" string="模型类型"/>
|
||||
<field name="model_processing_panel" placeholder="例如R,U" string="加工面板"
|
||||
|
||||
@@ -45,9 +45,8 @@ class JikimoSaleRoutePicking(Sf_Bf_Connect):
|
||||
product.product_tmpl_id.is_customer_provided = True if item['embryo_redundancy_id'] else False
|
||||
order_id.with_user(request.env.ref("base.user_admin")).sale_order_create_line(product, item)
|
||||
i += 1
|
||||
if kw.get('contract_file_name') and kw.get('contract_file') and kw.get('contract_code'):
|
||||
order_id.create_sale_documents(kw.get('contract_file_name'), kw.get('contract_file'))
|
||||
order_id.write({'contract_code': kw.get('contract_code'), 'contract_date': kw.get('contract_date')})
|
||||
# BFM 内部下单 新增合同等内容补充
|
||||
order_id.write_sale_documents(kw)
|
||||
res['factory_order_no'] = order_id.name
|
||||
order_id.confirm_to_supply_method()
|
||||
except Exception as e:
|
||||
|
||||
@@ -18,4 +18,5 @@ from . import quick_easy_order
|
||||
from . import purchase_order
|
||||
from . import quality_check
|
||||
from . import purchase_request_line
|
||||
from . import bom
|
||||
# from . import stock_warehouse_orderpoint
|
||||
16
sf_manufacturing/models/bom.py
Normal file
16
sf_manufacturing/models/bom.py
Normal file
@@ -0,0 +1,16 @@
|
||||
from odoo import models
|
||||
from odoo.osv.expression import AND
|
||||
|
||||
|
||||
class MrpBom(models.Model):
|
||||
_inherit = 'mrp.bom'
|
||||
|
||||
def _bom_subcontract_find(self, product, picking_type=None, company_id=False, bom_type='subcontract', subcontractor=False):
|
||||
domain = self._bom_find_domain(product, picking_type=picking_type, company_id=company_id, bom_type=bom_type)
|
||||
if self.env.context.get('stock_picking') == 'outsourcing':
|
||||
return self.search(domain, order='sequence, product_id, id', limit=1)
|
||||
if subcontractor:
|
||||
domain = AND([domain, [('subcontractor_ids', 'parent_of', subcontractor.ids)]])
|
||||
return self.search(domain, order='sequence, product_id, id', limit=1)
|
||||
else:
|
||||
return self.env['mrp.bom']
|
||||
@@ -1709,6 +1709,7 @@ class MrpProduction(models.Model):
|
||||
vals['procurement_group_id'] = product_group_id[product_id.id]
|
||||
else:
|
||||
vals['procurement_group_id'] = is_custemer_group_id[key]
|
||||
|
||||
return super(MrpProduction, self).create(vals_list)
|
||||
|
||||
@api.depends('procurement_group_id.stock_move_ids.created_purchase_line_id.order_id',
|
||||
|
||||
@@ -26,13 +26,16 @@ class ResProductMo(models.Model):
|
||||
model_file = fields.Binary('模型文件')
|
||||
categ_type = fields.Selection(string='产品的类别', related='categ_id.type', store=True)
|
||||
model_name = fields.Char('模型名称')
|
||||
blank_type = fields.Selection([('圆料', '圆料'), ('方料', '方料')], string='坯料分类')
|
||||
blank_precision = fields.Selection([('精坯', '精坯'), ('粗坯', '粗坯')], string='坯料类型')
|
||||
model_long = fields.Float('模型长(mm)', digits=(16, 3))
|
||||
model_width = fields.Float('模型宽(mm)', digits=(16, 3))
|
||||
model_height = fields.Float('模型高(mm)', digits=(16, 3))
|
||||
unit_number = fields.Float('单件用量', digits=(16, 3), default=1)
|
||||
model_volume = fields.Float('模型体积(m³)')
|
||||
model_area = fields.Float('模型表面积(m²)')
|
||||
model_machining_precision = fields.Selection(selection=_get_machining_precision, string='加工精度')
|
||||
model_processing_panel = fields.Char('模型加工面板')
|
||||
model_processing_panel = fields.Char('模型加工面板', default='')
|
||||
model_remark = fields.Char('模型备注说明')
|
||||
length = fields.Float('长(mm)', digits=(16, 3))
|
||||
width = fields.Float('宽(mm)', digits=(16, 3))
|
||||
@@ -893,16 +896,24 @@ class ResProductMo(models.Model):
|
||||
if not embryo_redundancy_id:
|
||||
raise UserError('请先配置模型类型内的坯料冗余')
|
||||
product_name = self.generate_product_name(order_id, item, i)
|
||||
# 判断参数中是否包含 坯料尺寸(长、宽、高)
|
||||
blank_bool = any(value is not None and value != 0 for value in (
|
||||
item.get('blank_length'), item.get('blank_width'), item.get('blank_height'))) if all(
|
||||
key in item for key in ('blank_length', 'blank_width', 'blank_height')) else False
|
||||
vals = {
|
||||
'name': product_name,
|
||||
'model_long': self.format_float(item['model_long'] + embryo_redundancy_id.long),
|
||||
'model_width': self.format_float(item['model_width'] + embryo_redundancy_id.width),
|
||||
'model_height': self.format_float(item['model_height'] + embryo_redundancy_id.height),
|
||||
'model_volume': self.format_float((item['model_long'] + embryo_redundancy_id.long) * (
|
||||
item['model_width'] + embryo_redundancy_id.width) * (
|
||||
item['model_height'] + embryo_redundancy_id.height)),
|
||||
'blank_type': item.get('blank_type'),
|
||||
'blank_precision': item.get('blank_precision'),
|
||||
'model_long': item.get('blank_length') if blank_bool else self.format_float(item['model_long'] + embryo_redundancy_id.long),
|
||||
'model_width': item.get('blank_width') if blank_bool else self.format_float(item['model_width'] + embryo_redundancy_id.width),
|
||||
'model_height': item.get('blank_height') if blank_bool else self.format_float(item['model_height'] + embryo_redundancy_id.height),
|
||||
'unit_number': item.get('unit_number'),
|
||||
'model_volume': self.format_float(((item['model_long'] + embryo_redundancy_id.long) *
|
||||
(item['model_width'] + embryo_redundancy_id.width) *
|
||||
(item['model_height'] + embryo_redundancy_id.height))) if not blank_bool else (
|
||||
item.get('blank_length') * item.get('blank_width') * item.get('blank_height')),
|
||||
'product_model_type_id': model_type.id,
|
||||
'model_processing_panel': item['processing_panel_detail'],
|
||||
'model_processing_panel': item['processing_panel_detail'] if item['processing_panel_detail'] else '',
|
||||
'model_machining_precision': item['model_machining_precision'],
|
||||
'model_code': item['barcode'],
|
||||
'length': item['model_long'],
|
||||
|
||||
@@ -193,6 +193,19 @@ class SaleOrder(models.Model):
|
||||
'target': 'new',
|
||||
'res_id': wizard.id,
|
||||
}
|
||||
|
||||
def write_sale_documents(self, kw):
|
||||
"""BFM 内部下单 内容补充 """
|
||||
val = {}
|
||||
if kw.get('contract_file_name') and kw.get('contract_file'):
|
||||
document_id = self.create_sale_documents(kw.get('contract_file_name'), kw.get('contract_file'))
|
||||
val.update({'contract_document_id': document_id.id})
|
||||
if kw.get('contract_code') or kw.get('contract_date'):
|
||||
val.update({'contract_code': kw.get('contract_code'), 'contract_date': kw.get('contract_date')})
|
||||
if kw.get('customer_name'):
|
||||
val.update({'customer_name': kw.get('customer_name')})
|
||||
self.write(val)
|
||||
|
||||
def create_sale_documents(self, contract_file_name, contract_file):
|
||||
# 创建ir.attachment记录
|
||||
attachment = self.env['ir.attachment'].sudo().create({
|
||||
@@ -214,9 +227,7 @@ class SaleOrder(models.Model):
|
||||
'res_id': self.id,
|
||||
})
|
||||
|
||||
self.write({
|
||||
'contract_document_id': document.id
|
||||
})
|
||||
return document
|
||||
|
||||
class SaleOrderLine(models.Model):
|
||||
_inherit = 'sale.order.line'
|
||||
|
||||
@@ -21,6 +21,7 @@ from odoo.addons.sf_base.commons.common import Common
|
||||
from odoo.exceptions import UserError
|
||||
from io import BytesIO
|
||||
from odoo.exceptions import ValidationError
|
||||
from dateutil.relativedelta import relativedelta
|
||||
|
||||
|
||||
class stockWarehouse(models.Model):
|
||||
@@ -95,35 +96,36 @@ class StockRule(models.Model):
|
||||
precision_rounding=proc[
|
||||
0].product_uom.rounding) > 0)
|
||||
list2 = []
|
||||
for item in procurements:
|
||||
num = int(item[0].product_qty)
|
||||
for procurement, rule in procurements:
|
||||
num = int(procurement.product_qty)
|
||||
|
||||
product = self.env['product.product'].search(
|
||||
[("id", '=', item[0].product_id.id)])
|
||||
product_tmpl = self.env['product.template'].search(
|
||||
["&", ("id", '=', product.product_tmpl_id.id), ('single_manufacturing', "!=", False)])
|
||||
if product_tmpl:
|
||||
warehouse_id = rule.warehouse_id
|
||||
if not warehouse_id:
|
||||
warehouse_id = rule.location_dest_id.warehouse_id
|
||||
manu_rule = rule.route_id.rule_ids.filtered(lambda r: r.action == 'manufacture' and r.warehouse_id == warehouse_id)
|
||||
|
||||
if procurement.product_id.product_tmpl_id.single_manufacturing and manu_rule:
|
||||
if num > 1:
|
||||
for no in range(1, num + 1):
|
||||
Procurement = namedtuple('Procurement', ['product_id', 'product_qty',
|
||||
'product_uom', 'location_id', 'name', 'origin',
|
||||
'company_id',
|
||||
'values'])
|
||||
s = Procurement(product_id=item[0].product_id, product_qty=1.0, product_uom=item[0].product_uom,
|
||||
location_id=item[0].location_id,
|
||||
name=item[0].name,
|
||||
origin=item[0].origin,
|
||||
company_id=item[0].company_id,
|
||||
values=item[0].values,
|
||||
s = Procurement(product_id=procurement.product_id, product_qty=1.0, product_uom=procurement.product_uom,
|
||||
location_id=procurement.location_id,
|
||||
name=procurement.name,
|
||||
origin=procurement.origin,
|
||||
company_id=procurement.company_id,
|
||||
values=procurement.values,
|
||||
)
|
||||
item1 = list(item)
|
||||
item1[0] = s
|
||||
# item1 = list(item)
|
||||
# item1[0] = s
|
||||
|
||||
list2.append(tuple(item1))
|
||||
list2.append((s, rule))
|
||||
else:
|
||||
list2.append(item)
|
||||
list2.append((procurement, rule))
|
||||
else:
|
||||
list2.append(item)
|
||||
list2.append((procurement, rule))
|
||||
|
||||
for procurement, rule in list2:
|
||||
procure_method = rule.procure_method
|
||||
@@ -183,18 +185,6 @@ class StockRule(models.Model):
|
||||
'''创建制造订单'''
|
||||
productions = self.env['mrp.production'].with_user(SUPERUSER_ID).sudo().with_company(company_id).create(
|
||||
productions_values)
|
||||
# 将这一批制造订单的采购组根据成品设置为不同的采购组
|
||||
# product_group_id = {}
|
||||
# for index, production in enumerate(productions):
|
||||
# if production.product_id.id not in product_group_id.keys():
|
||||
# product_group_id[production.product_id.id] = production.procurement_group_id.id
|
||||
# else:
|
||||
# productions_values[index].update({'name': production.name})
|
||||
# procurement_group_vals = production._prepare_procurement_group_vals(productions_values[index])
|
||||
# production.procurement_group_id = self.env["procurement.group"].create(procurement_group_vals).id
|
||||
|
||||
# self.env['stock.move'].sudo().create(productions._get_moves_raw_values())
|
||||
# self.env['stock.move'].sudo().create(productions._get_moves_finished_values())
|
||||
|
||||
'''
|
||||
创建工单
|
||||
@@ -738,6 +728,33 @@ class StockPicking(models.Model):
|
||||
production.workorder_ids.write({'back_button_display': False})
|
||||
return res
|
||||
|
||||
def _prepare_subcontract_mo_vals(self, subcontract_move, bom):
|
||||
subcontract_move.ensure_one()
|
||||
group = self.env['procurement.group'].sudo().search([('name', '=', self.name)])
|
||||
if not group:
|
||||
group = self.env['procurement.group'].create({
|
||||
'name': self.name,
|
||||
'partner_id': self.partner_id.id,
|
||||
})
|
||||
product = subcontract_move.product_id
|
||||
warehouse = self._get_warehouse(subcontract_move)
|
||||
vals = {
|
||||
'company_id': subcontract_move.company_id.id,
|
||||
'procurement_group_id': group.id,
|
||||
'subcontractor_id': subcontract_move.picking_id.partner_id.commercial_partner_id.id,
|
||||
'picking_ids': [subcontract_move.picking_id.id],
|
||||
'product_id': product.id,
|
||||
'product_uom_id': subcontract_move.product_uom.id,
|
||||
'bom_id': bom.id,
|
||||
'location_src_id': subcontract_move.picking_id.partner_id.with_company(subcontract_move.company_id).property_stock_subcontractor.id,
|
||||
'location_dest_id': subcontract_move.picking_id.partner_id.with_company(subcontract_move.company_id).property_stock_subcontractor.id,
|
||||
'product_qty': subcontract_move.product_uom_qty,
|
||||
'picking_type_id': warehouse.subcontracting_type_id.id,
|
||||
'date_planned_start': subcontract_move.date - relativedelta(days=product.produce_delay)
|
||||
}
|
||||
return vals
|
||||
|
||||
|
||||
# 创建 外协出库入单
|
||||
def create_outcontract_picking(self, workorders, item, sorted_workorders):
|
||||
production = workorders[0].production_id
|
||||
@@ -1216,6 +1233,20 @@ class ReStockMove(models.Model):
|
||||
res['lot_id'] = self.subcontract_workorder_id.production_id.move_raw_ids.move_line_ids[0].lot_id.id
|
||||
return res
|
||||
|
||||
def _get_subcontract_bom(self):
|
||||
self.ensure_one()
|
||||
purchase_type = getattr(self.picking_id.purchase_id, 'purchase_type', False)
|
||||
if purchase_type:
|
||||
self = self.with_context(stock_picking=purchase_type)
|
||||
bom = self.env['mrp.bom'].sudo()._bom_subcontract_find(
|
||||
self.product_id,
|
||||
picking_type=self.picking_type_id,
|
||||
company_id=self.company_id.id,
|
||||
bom_type='subcontract',
|
||||
subcontractor=self.picking_id.partner_id
|
||||
)
|
||||
return bom
|
||||
|
||||
|
||||
class ReStockQuant(models.Model):
|
||||
_inherit = 'stock.quant'
|
||||
|
||||
@@ -148,7 +148,7 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<img src="/sf_quality/static/img/pass.png" style="width: 200px; height: 200px;position: absolute; bottom: 20px; right: 20%;"/>
|
||||
<img src="/sf_quality/static/img/pass.png" style="width: 100px; height: 100px; position: absolute; bottom: -100px; left: 90px;"/>
|
||||
|
||||
</div>
|
||||
<div style="clear: both; margin-top: 30px; padding-top: 10px;">
|
||||
@@ -200,11 +200,11 @@
|
||||
<p></p>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<!-- 页脚固定在底部 -->
|
||||
<!-- <div style="position: absolute; bottom: 0; left: 0; right: 0;"> -->
|
||||
<t t-call="sf_quality.report_quality_footer"/>
|
||||
<!-- </div> -->
|
||||
|
||||
<!-- <div style="position: absolute; bottom: 0; left: 0; right: 0;"> -->
|
||||
<t t-call="sf_quality.report_quality_footer"/>
|
||||
<!-- </div> -->
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
@@ -275,7 +275,7 @@
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<img src="/sf_quality/static/img/pass.png" style="width: 200px; height: 200px;position: absolute; bottom: 20px; right: 20%;"/>
|
||||
<img src="/sf_quality/static/img/pass.png" style="width: 100px; height: 100px; position: absolute; bottom: -100px; left: 90px;"/>
|
||||
|
||||
</div>
|
||||
<div style="clear: both; margin-top: 30px; padding-top: 10px;">
|
||||
@@ -329,9 +329,11 @@
|
||||
</div> -->
|
||||
|
||||
<!-- 页脚固定在底部 -->
|
||||
<!-- <div style="position: absolute; bottom: 0; left: 0; right: 0;"> -->
|
||||
<t t-call="sf_quality.html_report_quality_footer"/>
|
||||
<!-- </div> -->
|
||||
<!-- <t t-if="loop.index == len(docs) - 1">-->
|
||||
<!-- <div style="position: absolute; bottom: 0; left: 0; right: 0;"> -->
|
||||
<t t-call="sf_quality.html_report_quality_footer"/>
|
||||
<!-- </div> -->
|
||||
<!-- </t>-->
|
||||
</div>
|
||||
</t>
|
||||
</t>
|
||||
|
||||
@@ -1,59 +1,180 @@
|
||||
import logging
|
||||
|
||||
from odoo import api, models
|
||||
from odoo.exceptions import ValidationError, UserError
|
||||
|
||||
|
||||
class StockPicking(models.Model):
|
||||
_inherit = 'stock.picking'
|
||||
|
||||
def _compute_check(self):
|
||||
super()._compute_check()
|
||||
for picking in self:
|
||||
picking_to_quality = picking.get_picking_to_quality()
|
||||
if not picking_to_quality:
|
||||
picking.quality_check_todo = False
|
||||
break
|
||||
else:
|
||||
need_quality_line = picking.get_need_quality_line(picking_to_quality)
|
||||
if not need_quality_line or all(not line.get('need_done_check_ids') for line in need_quality_line):
|
||||
picking.quality_check_todo = False
|
||||
|
||||
def check_quality(self):
|
||||
self.ensure_one()
|
||||
# checkable_products = self.mapped('move_line_ids').mapped('product_id')
|
||||
# checks = self.check_ids.filtered(lambda check: check.quality_state == 'none' and (
|
||||
# check.product_id in checkable_products or check.measure_on == 'operation'))
|
||||
checks = self.env['quality.check']
|
||||
picking_to_quality = self._get_picking_to_quality()
|
||||
need_quality_line = self.get_need_quality_line(picking_to_quality)
|
||||
if need_quality_line and any(line.get('need_done_check_ids') for line in need_quality_line):
|
||||
for item in need_quality_line:
|
||||
checks += item.get('need_done_check_ids')
|
||||
if checks:
|
||||
return checks.action_open_quality_check_wizard()
|
||||
return False
|
||||
|
||||
def button_validate(self):
|
||||
"""
|
||||
"""=
|
||||
出厂检验报告上传
|
||||
"""
|
||||
|
||||
out_quality_checks = self.env['quality.check'].search(
|
||||
[('picking_id', '=', self.id), ('test_type_id.name', '=', '出厂检验报告')])
|
||||
[('picking_id', '=', self.id), ('test_type_id.name', '=', '出厂检验报告'),
|
||||
('quality_state', '=', 'pass')])
|
||||
# out_quality_checks 可能存在多个
|
||||
if out_quality_checks:
|
||||
for out_quality_check in out_quality_checks:
|
||||
if not out_quality_check.is_factory_report_uploaded:
|
||||
if out_quality_check and self.state == 'assigned':
|
||||
out_quality_check.upload_factory_report()
|
||||
quality_action = self.pinking_checkout_quality()
|
||||
if quality_action:
|
||||
return quality_action
|
||||
res = super(StockPicking, self).button_validate()
|
||||
return res
|
||||
|
||||
def pinking_checkout_quality(self):
|
||||
"""
|
||||
调拨单若关联了质量检查单,验证调拨单时,应校验是否有不合格品,若存在,应弹窗提示:
|
||||
“警告:存在不合格产品XXXX n 件、YYYYY m件,继续调拨请点“确认”,否则请取消?”
|
||||
"""
|
||||
context = self.env.context
|
||||
if not context.get('again_validate') and self.quality_check_ids.filtered(lambda qc: qc.quality_state == 'fail'):
|
||||
# 回滚事务,为二次确认/取消做准备
|
||||
self.env.cr.rollback()
|
||||
quality_check_ids = self.quality_check_ids.filtered(lambda qc: qc.quality_state == 'fail')
|
||||
product_list = list(set([quality_check_id.product_id for quality_check_id in quality_check_ids]))
|
||||
fail_check_text = ''
|
||||
for product_id in product_list:
|
||||
check_ids = quality_check_ids.filtered(lambda qc: qc.product_id == product_id)
|
||||
if all(check_id.measure_on == 'move_line' for check_id in check_ids):
|
||||
number = sum(check_ids.mapped('qty_line'))
|
||||
else:
|
||||
number = sum(self.move_ids_without_package.filtered(
|
||||
lambda ml: ml.product_id == product_id).mapped('quantity_done'))
|
||||
if number == 0:
|
||||
number = sum(self.move_ids_without_package.filtered(
|
||||
lambda ml: ml.product_id == product_id).mapped('reserved_availability'))
|
||||
if number == 0:
|
||||
number = sum(self.move_ids_without_package.filtered(
|
||||
lambda ml: ml.product_id == product_id).mapped('product_uom_qty'))
|
||||
fail_check_text = (f'{fail_check_text}、{product_id.display_name} {number}件'
|
||||
if fail_check_text != '' else f'{product_id.display_name} {number}件')
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'picking.validate.check.wizard',
|
||||
'name': '质检不合格提示',
|
||||
'view_mode': 'form',
|
||||
'target': 'new',
|
||||
'context': {
|
||||
'default_picking_id': self.id,
|
||||
'default_fail_check_text': f'警告:存在不合格产品{fail_check_text},继续调拨请点“确认”,否则请取消?',
|
||||
'again_validate': True}
|
||||
}
|
||||
res = super(StockPicking, self).button_validate()
|
||||
try:
|
||||
self.ensure_one()
|
||||
context = self.env.context
|
||||
if not context.get('pinking_checkout_quality'):
|
||||
picking_to_quality = self._get_picking_to_quality()
|
||||
if not picking_to_quality: return False
|
||||
need_quality_val = self.get_need_quality_line(picking_to_quality)
|
||||
if any(line.get('fail_check_ids') for line in need_quality_val):
|
||||
# 回滚事务,为二次确认/取消做准备
|
||||
self.env.cr.rollback()
|
||||
# 获取存在失败的 质检单 调拨单明细行
|
||||
check_list = [item for item in need_quality_val if item.get('fail_check_ids')]
|
||||
fail_check_text = ''
|
||||
for item in check_list:
|
||||
move_id, pre_done_qty = item.get('move_id'), item.get('pre_done_qty')
|
||||
fail_check_text = (f'{fail_check_text}、{move_id.product_id.display_name} {pre_done_qty}件'
|
||||
if fail_check_text != '' else f'{move_id.product_id.display_name} {pre_done_qty}件')
|
||||
return {
|
||||
'type': 'ir.actions.act_window',
|
||||
'res_model': 'picking.validate.check.wizard',
|
||||
'name': '质检不合格提示',
|
||||
'view_mode': 'form',
|
||||
'target': 'new',
|
||||
'context': {
|
||||
'default_picking_id': self.id,
|
||||
'default_fail_check_text': f'警告:存在不合格产品{fail_check_text},继续调拨请点“确认”,否则请取消?',
|
||||
'pinking_checkout_quality': True}
|
||||
}
|
||||
else:
|
||||
return False
|
||||
except Exception as e:
|
||||
logging.info('pinking_checkout_quality()方法报错:%s' % e)
|
||||
raise ValidationError('调拨单验证质检单是否合格时报错,请联系管理员处理!!')
|
||||
|
||||
def get_need_quality_line(self, picking_to_quality):
|
||||
"""
|
||||
# 对需要进行质检,还没有质检完成的明细行进行统计
|
||||
# 1、当【质量标准_控制方式】=“产品、作业”,仅校验“预完成数量”>0的产品行对应的质检单必须处理。
|
||||
2、当【质量标准_控制方式】=“数量”时,仅校验“预完成数量”>0的产品行对应的质检单必须处理:
|
||||
1)每一类的“总单数”=【调拨单_需求】时,则已处理的质检单“单数”≥“预完成数量”时,可执行调拨单验证;
|
||||
2)每一类的“总单数”<【调拨单_需求】时,则已处理的质检单“单数”≥0时,可执行调拨单验证;
|
||||
"""
|
||||
res = []
|
||||
for item in picking_to_quality:
|
||||
need_done_check_ids = self.env['quality.check']
|
||||
fail_check_ids = self.env['quality.check']
|
||||
move_id, pre_done_qty, check_ids = item.values()
|
||||
check_ids_1 = check_ids.filtered(lambda qc: qc.measure_on in ('operation', 'product'))
|
||||
if check_ids_1:
|
||||
check_ids_1_done = check_ids_1.filtered(lambda qc: qc.quality_state in ('pass', 'fail'))
|
||||
check_ids_1_fail = check_ids_1.filtered(lambda qc: qc.quality_state == 'fail')
|
||||
check_ids_1_none = check_ids_1.filtered(lambda qc: qc.quality_state == 'none')
|
||||
if check_ids_1 and not check_ids_1_done:
|
||||
need_done_check_ids += check_ids_1_none
|
||||
if check_ids_1_fail:
|
||||
fail_check_ids += check_ids_1_fail
|
||||
|
||||
check_ids_2 = check_ids.filtered(lambda qc: qc.measure_on == 'move_line')
|
||||
if check_ids_2:
|
||||
check_ids_2_done = check_ids_2.filtered(lambda qc: qc.quality_state in ('pass', 'fail'))
|
||||
check_ids_2_fail = check_ids_2.filtered(lambda qc: qc.quality_state == 'fail')
|
||||
check_ids_2_none = check_ids_2.filtered(lambda qc: qc.quality_state == 'none')
|
||||
# 每一类的“总单数”=【调拨单_需求】时,则已处理的质检单“单数”≥“预完成数量”时,可执行调拨单验证;
|
||||
if len(check_ids_2) >= move_id.product_uom_qty and len(check_ids_2_done) < pre_done_qty:
|
||||
need_done_check_ids += check_ids_2_none
|
||||
# 每一类的“总单数”<【调拨单_需求】时,则已处理的质检单“单数”≥0时,可执行调拨单验证
|
||||
elif len(check_ids_2) < move_id.product_uom_qty and len(check_ids_2_done) == 0:
|
||||
need_done_check_ids += check_ids_2_none
|
||||
if check_ids_2_fail:
|
||||
fail_check_ids += check_ids_2_fail
|
||||
|
||||
if need_done_check_ids or fail_check_ids:
|
||||
res.append({'move_id': move_id,
|
||||
'pre_done_qty': pre_done_qty,
|
||||
'check_ids': check_ids,
|
||||
'fail_check_ids': fail_check_ids,
|
||||
'need_done_check_ids': need_done_check_ids})
|
||||
return res
|
||||
|
||||
def get_picking_to_quality(self):
|
||||
self.ensure_one()
|
||||
return self._get_picking_to_quality()
|
||||
|
||||
def _get_picking_to_quality(self):
|
||||
"""
|
||||
对需要质检的明细行进行统计(针对“预完成数量”>0的行)
|
||||
"""
|
||||
quality_piking_line_list = []
|
||||
pre_done_qty_lines = self._get_pinking_pre_done_qty()
|
||||
for line in pre_done_qty_lines:
|
||||
move_id, pre_done_qty = line.values()
|
||||
if pre_done_qty == 0:
|
||||
continue
|
||||
product_id = move_id.product_id
|
||||
check_ids = self.check_ids.filtered(lambda c: c.product_id == product_id)
|
||||
quality_piking_line_list.append({'move_id': move_id, 'pre_done_qty': pre_done_qty, 'check_ids': check_ids})
|
||||
return quality_piking_line_list
|
||||
|
||||
def _get_pinking_pre_done_qty(self):
|
||||
"""
|
||||
return: 明细行 及 预完成数量
|
||||
1、若调拨单所有明细行的【完成】=0,且任意行的【预留】<【需求】,则验证时将会话是否需创建欠单。
|
||||
---->此时“预完成数量”=【预留】
|
||||
2、若调拨单任意行的0<【完成】<【需求】,且则验证时将会话是否需创建欠单
|
||||
---->此时“预完成数量”=【完成】
|
||||
"""
|
||||
# if all(move_id.quantity_done == 0 for move_id in self.move_ids_without_package):
|
||||
# pre_done_qty = [{'move_id': move_id, 'pre_done_qty': move_id.reserved_availability} for move_id in
|
||||
# self.move_ids_without_package]
|
||||
# else:
|
||||
# pre_done_qty = [{'move_id': move_id, 'pre_done_qty': move_id.quantity_done} for move_id in
|
||||
# self.move_ids_without_package]
|
||||
pre_done_qty = []
|
||||
for move_id in self.move_ids_without_package:
|
||||
if move_id.quantity_done > 0:
|
||||
pre_done_qty.append({'move_id': move_id, 'pre_done_qty': move_id.quantity_done})
|
||||
else:
|
||||
pre_done_qty.append({'move_id': move_id, 'pre_done_qty': move_id.reserved_availability})
|
||||
return pre_done_qty
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
<attribute name="string">不合格</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//header//button[@name='do_fail'][2]" position="attributes">
|
||||
<attribute name="attrs">{'invisible': ['|',('quality_state', '!=', 'pass'),('work_state','in', ('done', 'rework'))]}</attribute>
|
||||
<attribute name="attrs">{'invisible': ['|','|',('quality_state', '!=', 'pass'),('work_state','in', ('done', 'rework')),'&',('quality_state', '=', 'pass'), ('test_type', '=', 'factory_inspection')]}</attribute>
|
||||
<attribute name="string">不合格</attribute>
|
||||
</xpath>
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@ class ReSaleOrder(models.Model):
|
||||
|
||||
model_display_version = fields.Char('模型展示版本', default="v1")
|
||||
|
||||
customer_name = fields.Char('终端客户')
|
||||
contract_code = fields.Char('合同编号')
|
||||
contract_date = fields.Date('合同日期')
|
||||
contract_document_id = fields.Many2one('documents.document', string='合同文件')
|
||||
@@ -157,7 +158,7 @@ class ReSaleOrder(models.Model):
|
||||
'is_incoming_material': True if item.get('embryo_redundancy_id') else False,
|
||||
'manual_quotation': item.get('manual_quotation'),
|
||||
'model_id': item['model_id'],
|
||||
'delivery_end_date': item['delivery_end_date'],
|
||||
'delivery_end_date': item['delivery_end_date']
|
||||
}
|
||||
return self.env['sale.order.line'].with_context(skip_procurement=True).create(vals)
|
||||
|
||||
@@ -291,8 +292,7 @@ class ResaleOrderLine(models.Model):
|
||||
manual_quotation = fields.Boolean('人工编程', default=False)
|
||||
model_url = fields.Char('模型文件地址')
|
||||
model_id = fields.Char('模型ID')
|
||||
|
||||
delivery_end_date = fields.Date('交货截止日期')
|
||||
delivery_end_date = fields.Date('客户交期')
|
||||
|
||||
@api.depends('embryo_redundancy_id')
|
||||
def _compute_is_incoming_material(self):
|
||||
|
||||
@@ -90,6 +90,9 @@
|
||||
<field name="partner_id" position="replace">
|
||||
<field name="partner_id" widget="res_partner_many2one" context="{'is_customer': True }"
|
||||
options='{"always_reload": True,"no_create": True}'/>
|
||||
<field name="customer_name" readonly="1"/>
|
||||
<field name="contract_code" readonly="1"/>
|
||||
<field name="contract_date" readonly="1"/>
|
||||
</field>
|
||||
<field name="payment_term_id" position="attributes">
|
||||
<attribute name="attrs">{'readonly': [('state', 'in', ['cancel','sale'])]}</attribute>
|
||||
@@ -138,7 +141,7 @@
|
||||
<attribute name="optional">hide</attribute>
|
||||
</xpath>
|
||||
<xpath expr="//field[@name='order_line']/tree/field[@name='remark']" position="before">
|
||||
<field name="delivery_end_date" optional="hide"/>
|
||||
<field name="delivery_end_date" optional="show"/>
|
||||
</xpath>
|
||||
|
||||
<field name="user_id" position="attributes">
|
||||
|
||||
@@ -818,6 +818,7 @@ class FunctionalToolAssembly(models.Model):
|
||||
|
||||
def _get_old_tool_material_lot(self, material_ids):
|
||||
""" 根据先进先出原则选择物料批次 """
|
||||
material_ids = material_ids.filtered(lambda m: m.tracking != 'none')
|
||||
location_id = self.env['stock.location'].search([('name', '=', '刀具房')])
|
||||
stock_quant = self.env['stock.quant'].sudo().search(
|
||||
[('location_id', '=', location_id.id), ('product_id', 'in', material_ids.ids), ('quantity', '>', '0')],
|
||||
|
||||
@@ -7,8 +7,14 @@ def migrate(cr, version):
|
||||
env = api.Environment(cr, SUPERUSER_ID, {})
|
||||
sf_shelf_model = env["sf.shelf"]
|
||||
sf_shelf_location_model = env["sf.shelf.location"]
|
||||
|
||||
preproduction_shelf_ids = sf_shelf_location_model.get_preproduction_shelf_ids()
|
||||
|
||||
shelves = sf_shelf_model.search([])
|
||||
for shelf in shelves:
|
||||
if shelf.id not in preproduction_shelf_ids:
|
||||
continue
|
||||
|
||||
shelf_barcode = shelf.barcode or ""
|
||||
if not shelf_barcode:
|
||||
continue
|
||||
|
||||
@@ -13,6 +13,7 @@ from odoo import api, fields, models, _
|
||||
from odoo.osv import expression
|
||||
from odoo.exceptions import UserError, ValidationError
|
||||
|
||||
_logger = logging.getLogger(__name__)
|
||||
|
||||
class SfLocation(models.Model):
|
||||
_inherit = 'stock.location'
|
||||
@@ -459,7 +460,40 @@ class ShelfLocation(models.Model):
|
||||
product_sn_ids = fields.One2many('sf.shelf.location.lot', 'shelf_location_id', string='产品批次号')
|
||||
# 产品数量
|
||||
product_num = fields.Integer('总数量', compute='_compute_number', store=True)
|
||||
tool_rfid = fields.Char('Rfid', compute='_compute_tool', store=True)
|
||||
tool_name_id = fields.Many2one('sf.functional.cutting.tool.entity', string='功能刀具名称', compute='_compute_tool', store=True)
|
||||
display_rfid = fields.Char('RFID', compute='_compute_display_rfid', store=True)
|
||||
@api.depends('product_sn_id')
|
||||
def _compute_display_rfid(self):
|
||||
"""计算显示 RFID"""
|
||||
for record in self:
|
||||
try:
|
||||
record.display_rfid = record.product_sn_id.rfid if record.product_sn_id else ''
|
||||
except Exception as e:
|
||||
record.display_rfid = ''
|
||||
|
||||
@api.depends('product_id')
|
||||
def _compute_tool(self):
|
||||
"""计算工具 RFID"""
|
||||
for record in self:
|
||||
try:
|
||||
if record.product_id:
|
||||
if record.product_id.categ_id.name == '功能刀具':
|
||||
# 搜索关联的功能刀具实体
|
||||
tool_id = self.env['sf.functional.cutting.tool.entity'].search(
|
||||
[('barcode_id', '=', record.product_sn_id.id)], limit=1
|
||||
)
|
||||
if tool_id:
|
||||
record.tool_rfid = tool_id.rfid
|
||||
record.tool_name_id = tool_id.id
|
||||
continue
|
||||
# 默认值
|
||||
record.tool_rfid = ''
|
||||
record.tool_name_id = False
|
||||
except Exception as e:
|
||||
record.tool_rfid = ''
|
||||
record.tool_name_id = False
|
||||
_logger.error(f"计算 tool_rfid 时出错: {e}")
|
||||
@api.depends('product_num')
|
||||
def _compute_product_num(self):
|
||||
for record in self:
|
||||
@@ -563,8 +597,27 @@ class ShelfLocation(models.Model):
|
||||
else:
|
||||
_layer_capacity = _layer_capacity
|
||||
_layer = _layer+1
|
||||
_layer_capacity = f"{_layer_capacity:02d}"
|
||||
record.kanban_show_layer_info=f"{_layer}-{_layer_capacity}"
|
||||
record.kanban_show_center_control_code=f"{_cc_code}"
|
||||
@api.model
|
||||
def get_preproduction_shelf_ids(self):
|
||||
"""
|
||||
获取预生产区域的货架ID列表
|
||||
Returns:
|
||||
list: 货架ID列表
|
||||
"""
|
||||
query = """
|
||||
SELECT DISTINCT b.shelf_id
|
||||
FROM stock_location a
|
||||
LEFT JOIN sf_shelf_location b ON a.id = b.location_id
|
||||
WHERE a.barcode LIKE 'WH-PREPRODUCTION'
|
||||
"""
|
||||
self.env.cr.execute(query)
|
||||
result = self.env.cr.fetchall()
|
||||
# 将结果转换为ID列表
|
||||
shelf_ids = [record[0] for record in result if record[0]]
|
||||
return shelf_ids
|
||||
|
||||
class SfShelfLocationLot(models.Model):
|
||||
_name = 'sf.shelf.location.lot'
|
||||
@@ -583,6 +636,7 @@ class SfShelfLocationLot(models.Model):
|
||||
raise ValidationError('变更数量不能比库存数量大!!!')
|
||||
|
||||
|
||||
|
||||
class SfStockMoveLine(models.Model):
|
||||
_name = 'stock.move.line'
|
||||
_inherit = ['stock.move.line', 'printing.utils']
|
||||
|
||||
@@ -1,128 +1,198 @@
|
||||
// 定义一个 mixin 来处理重复的样式
|
||||
@mixin kanban-common-styles($record-count-each-row,
|
||||
$record-gap: 16px,
|
||||
$color-guide-width: 70px) {
|
||||
// 定义看板公共样式的Mixin
|
||||
@mixin kanban-common-styles($record-count-each-row, $record-gap: 16px) {
|
||||
$record-gap-total-width: $record-gap * ($record-count-each-row - 1);
|
||||
|
||||
display: flex !important;
|
||||
flex-wrap: wrap !important;
|
||||
overflow-x: hidden !important;
|
||||
overflow-y: auto !important;
|
||||
padding: 0px !important;
|
||||
padding: 0 !important;
|
||||
gap: $record-gap !important;
|
||||
width: 100% !important;
|
||||
height: 100% !important;
|
||||
|
||||
// 设置卡片样式
|
||||
// === 卡片基础样式(完全保留)===
|
||||
.o_kanban_record {
|
||||
flex: 0 0 calc((100% - #{$record-gap-total-width}) / #{$record-count-each-row}) !important;
|
||||
height: calc((100% - #{$record-gap * 6}) / 6) !important; // 平均分配高度
|
||||
margin: 0 !important;
|
||||
padding: 0px !important;
|
||||
background-color: white !important;
|
||||
border: 1px solid #dee2e6 !important;
|
||||
border-radius: 4px !important;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
|
||||
min-width: calc((100% - #{$record-gap-total-width}) / #{$record-count-each-row}) !important;
|
||||
max-width: calc((100% - #{$record-gap-total-width}) / #{$record-count-each-row}) !important;
|
||||
flex: 0 0 calc((100% - #{$record-gap-total-width}) / #{$record-count-each-row}) !important;
|
||||
height: calc((100% - #{$record-gap * 6}) / 6) !important;
|
||||
margin: 0 !important;
|
||||
padding: 0 !important;
|
||||
background-color: white !important;
|
||||
border: 1px solid #dee2e6 !important;
|
||||
border-radius: 4px !important;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1) !important;
|
||||
min-width: calc((100% - #{$record-gap-total-width}) / #{$record-count-each-row}) !important;
|
||||
max-width: calc((100% - #{$record-gap-total-width}) / #{$record-count-each-row}) !important;
|
||||
position: relative;
|
||||
transition: all 0.25s ease !important;
|
||||
overflow: visible !important; // 允许悬停条溢出卡片边界
|
||||
|
||||
// === 状态标签(保留原设计)===
|
||||
.status-label {
|
||||
position: absolute;
|
||||
top: 8px;
|
||||
right: 8px;
|
||||
padding: 3px 8px;
|
||||
background: rgba(255, 255, 255, 0.9);
|
||||
border: 1px solid #e0e0e0;
|
||||
border-radius: 3px;
|
||||
font-size: 11px;
|
||||
color: #424242;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
// === 优化:悬停信息条(核心改动)===
|
||||
.status-hover-bar {
|
||||
position: absolute;
|
||||
bottom: calc(100% + 8px); // 默认显示在卡片上方
|
||||
left: 0;
|
||||
z-index: 1000;
|
||||
min-width: max-content; // 宽度自适应内容
|
||||
max-width: 300px; // 防止过宽
|
||||
padding: 10px 12px;
|
||||
background: rgba(255, 255, 255, 0.95);
|
||||
border: 1px solid #e0e0e0;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
||||
font-size: 12px;
|
||||
color: #424242;
|
||||
white-space: nowrap; // 强制单行显示
|
||||
opacity: 0;
|
||||
pointer-events: none; // 避免阻挡卡片交互
|
||||
transition: opacity 0.2s ease, transform 0.2s ease;
|
||||
transform: translateY(10px);
|
||||
|
||||
// 三角形指示器
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 100%;
|
||||
left: 15px;
|
||||
border: 6px solid transparent;
|
||||
border-top-color: rgba(0, 0, 0, 0.85);
|
||||
}
|
||||
|
||||
div {
|
||||
margin-bottom: 4px;
|
||||
line-height: 1.4;
|
||||
}
|
||||
}
|
||||
|
||||
// === 悬停触发逻辑 ===
|
||||
&:hover {
|
||||
transform: translateY(-4px) !important;
|
||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08) !important;
|
||||
z-index: 10;
|
||||
|
||||
.status-hover-bar {
|
||||
background: rgba(50, 50, 50, 0.9);
|
||||
color: #fff !important;
|
||||
font-size: 12px;
|
||||
opacity: 0.9;
|
||||
transform: translateY(0);
|
||||
pointer-events: auto; // 悬停时允许交互
|
||||
}
|
||||
}
|
||||
|
||||
// === 边界保护(智能定位)===
|
||||
// 左侧卡片:左对齐
|
||||
&:nth-child(#{$record-count-each-row}n+1) .status-hover-bar {
|
||||
left: 0;
|
||||
right: auto;
|
||||
&::after { left: 15px; }
|
||||
}
|
||||
|
||||
// 右侧卡片:右对齐
|
||||
&:nth-child(#{$record-count-each-row}n) .status-hover-bar {
|
||||
left: auto;
|
||||
right: 0;
|
||||
&::after {
|
||||
left: auto;
|
||||
right: 15px;
|
||||
}
|
||||
}
|
||||
&:nth-child(#{$record-count-each-row}n + #{$record-count-each-row - 1}) .status-hover-bar {
|
||||
left: auto;
|
||||
right: 0;
|
||||
&::after {
|
||||
left: auto;
|
||||
right: 15px;
|
||||
}
|
||||
}
|
||||
// 顶部卡片:悬停条显示在下方
|
||||
&:nth-child(-n+#{$record-count-each-row}) .status-hover-bar {
|
||||
bottom: auto;
|
||||
top: calc(100% + 8px);
|
||||
&::after {
|
||||
top: auto;
|
||||
bottom: 100%;
|
||||
border-top-color: transparent;
|
||||
border-bottom-color: rgba(255, 255, 255, 0.95);
|
||||
}
|
||||
}
|
||||
|
||||
// === 禁用状态样式(保留原效果)===
|
||||
&.kanban_color_3 {
|
||||
opacity: 0.6;
|
||||
&:hover {
|
||||
transform: translateY(-1px) !important;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15) !important;
|
||||
}
|
||||
|
||||
.o_kanban_record_bottom {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.oe_kanban_card.kanban_color_3,
|
||||
.oe_kanban_card.kanban_color_1,
|
||||
.oe_kanban_card.kanban_color_2 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
.sf_kanban_custom_location_info_style {
|
||||
display: flex !important;
|
||||
justify-content: center !important;
|
||||
align-items: center !important;
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.sf_kanban_no {
|
||||
display: flex !important;
|
||||
justify-content: center !important;
|
||||
align-items: center !important;
|
||||
font-size: 18px;
|
||||
color: #000000;
|
||||
}
|
||||
opacity: 0.85;
|
||||
.status-hover-bar {
|
||||
background:rgba(0, 0, 0, 0.85);
|
||||
color: white !important;
|
||||
border: 1px solid rgba(255, 255, 255, 0.15) !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 使用 mixin 为不同的列数生成样式
|
||||
.o_kanban_view {
|
||||
.sf_kanban_location_style {
|
||||
// 设置卡片样式
|
||||
.o_kanban_record {
|
||||
|
||||
&:hover {
|
||||
transform: translateY(-1px) !important;
|
||||
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15) !important;
|
||||
}
|
||||
|
||||
.o_kanban_record_bottom {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.oe_kanban_card.kanban_color_3,
|
||||
.oe_kanban_card.kanban_color_1,
|
||||
.oe_kanban_card.kanban_color_2 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
|
||||
.sf_kanban_custom_location_info_style {
|
||||
display: flex !important;
|
||||
justify-content: center !important;
|
||||
align-items: center !important;
|
||||
width: 100%;
|
||||
font-size: 14px;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
.sf_kanban_no {
|
||||
display: flex !important;
|
||||
justify-content: center !important;
|
||||
align-items: center !important;
|
||||
font-size: 18px;
|
||||
color: #000000;
|
||||
}
|
||||
}
|
||||
// === 看板视图样式(完全保留)===
|
||||
.o_kanban_view {
|
||||
// 卡片内部结构(不修改)
|
||||
.o_kanban_record {
|
||||
.o_kanban_record_bottom {
|
||||
margin: 0;
|
||||
}
|
||||
.oe_kanban_card.kanban_color_3,
|
||||
.oe_kanban_card.kanban_color_1,
|
||||
.oe_kanban_card.kanban_color_2 {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
.sf_kanban_custom_location_info_style {
|
||||
display: flex !important;
|
||||
justify-content: center !important;
|
||||
align-items: center !important;
|
||||
width: 100%;
|
||||
font-size: 15px;
|
||||
color: #000000;
|
||||
padding:0px;
|
||||
}
|
||||
|
||||
.sf_kanban_no {
|
||||
display: flex !important;
|
||||
justify-content: center !important;
|
||||
align-items: center !important;
|
||||
font-size: 18px;
|
||||
color: #000000;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 不同列数的看板样式
|
||||
.sf_kanban_location_style12 {
|
||||
@include kanban-common-styles(12);
|
||||
@include kanban-common-styles(12);
|
||||
}
|
||||
|
||||
.sf_kanban_location_style19 {
|
||||
@include kanban-common-styles(19);
|
||||
@include kanban-common-styles(19);
|
||||
}
|
||||
|
||||
.sf_kanban_location_style4 {
|
||||
@include kanban-common-styles(4);
|
||||
@include kanban-common-styles(4);
|
||||
}
|
||||
|
||||
.sf_kanban_location_style3 {
|
||||
@include kanban-common-styles(3);
|
||||
@include kanban-common-styles(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,8 +28,18 @@ class CustomKanbanController extends KanbanController {
|
||||
isBaseStyle: true
|
||||
});
|
||||
let self = this;
|
||||
// 获取货架分层数据
|
||||
|
||||
onWillStart(async () => {
|
||||
try {
|
||||
this.preproductionShelfIds = await this.orm.call(
|
||||
'sf.shelf.location',
|
||||
'get_preproduction_shelf_ids',
|
||||
[]
|
||||
);
|
||||
} catch (error) {
|
||||
this.preproductionShelfIds = [];
|
||||
}
|
||||
|
||||
this.searchModel.on('update', self, self._onUpdate);
|
||||
await this.loadShelfLayersData();
|
||||
});
|
||||
@@ -50,7 +60,11 @@ class CustomKanbanController extends KanbanController {
|
||||
let domain = this.searchModel.domain;
|
||||
if (domain.length > 0) {
|
||||
let shelfDomain = domain.find(item => item[0] === 'shelf_id');
|
||||
this.onShelfChange(shelfDomain[2]);
|
||||
if (shelfDomain && shelfDomain[2] && this.preproductionShelfIds && this.preproductionShelfIds.includes(shelfDomain[2])) {
|
||||
this.onShelfChange(shelfDomain[2]);
|
||||
} else {
|
||||
this.setKanbanStyle('sf_kanban_location_style');
|
||||
}
|
||||
} else {
|
||||
this.setKanbanStyle('sf_kanban_location_style');
|
||||
}
|
||||
@@ -63,8 +77,7 @@ class CustomKanbanController extends KanbanController {
|
||||
let shelfDomain = domain.find(item => item[0] === 'shelf_id');
|
||||
if (shelfDomain) {
|
||||
let shelfId = shelfDomain[2];
|
||||
// 如果货架ID存在,则设置相应的样式
|
||||
if (shelfId) {
|
||||
if (shelfId && this.preproductionShelfIds.includes(shelfId)) {
|
||||
this.onShelfChange(shelfId);
|
||||
return;
|
||||
}
|
||||
@@ -75,7 +88,6 @@ class CustomKanbanController extends KanbanController {
|
||||
this.setKanbanStyle('sf_kanban_location_style');
|
||||
} catch (error) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 加载所有货架的层数数据
|
||||
@@ -107,10 +119,18 @@ class CustomKanbanController extends KanbanController {
|
||||
// 添加新类
|
||||
if (isHave) kanbanViewEl.classList.add(style);
|
||||
}
|
||||
const ghostCards = document.querySelectorAll('.o_kanban_ghost');
|
||||
ghostCards.forEach(card => {
|
||||
card.remove();
|
||||
});
|
||||
|
||||
// 获取当前的搜索域
|
||||
let domain = this.searchModel.domain;
|
||||
let shelfDomain = domain.find(item => item[0] === 'shelf_id');
|
||||
|
||||
// 只有当shelf_id在preproductionShelfIds中时才删除幽灵看板
|
||||
if (shelfDomain && this.preproductionShelfIds && this.preproductionShelfIds.includes(shelfDomain[2])) {
|
||||
const ghostCards = document.querySelectorAll('.o_kanban_ghost');
|
||||
ghostCards.forEach(card => {
|
||||
card.remove();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
updatePagerLimit(limit) {
|
||||
|
||||
@@ -193,53 +193,78 @@
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="shelf_location_kanban_view" model="ir.ui.view">
|
||||
<field name="name">shelf.location.kanban</field>
|
||||
<field name="model">sf.shelf.location</field>
|
||||
<field name="arch" type="xml">
|
||||
<kanban class="sf_kanban_location_style" js_class="custom_kanban" create="0">
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
<t t-set='isBaseStyle' t-value="user_context.isBaseStyle"/>
|
||||
<div t-attf-class="oe_kanban_card oe_kanban_global_click
|
||||
#{record.location_status.raw_value == '空闲' ? 'kanban_color_1' : ''}
|
||||
#{record.location_status.raw_value == '占用' ? 'kanban_color_2' : ''}
|
||||
#{record.location_status.raw_value == '禁用' ? 'kanban_color_3' : ''}">
|
||||
<record id="shelf_location_kanban_view" model="ir.ui.view">
|
||||
<field name="name">shelf.location.kanban</field>
|
||||
<field name="model">sf.shelf.location</field>
|
||||
<field name="arch" type="xml">
|
||||
<kanban class="sf_kanban_location_style" js_class="custom_kanban" create="0">
|
||||
<templates>
|
||||
<t t-name="kanban-box">
|
||||
<t t-set='isBaseStyle' t-value="user_context.isBaseStyle"/>
|
||||
<div t-attf-class="oe_kanban_card oe_kanban_global_click
|
||||
#{record.location_status.raw_value == '空闲' ? 'kanban_color_1' : ''}
|
||||
#{record.location_status.raw_value == '占用' ? 'kanban_color_2' : ''}
|
||||
#{record.location_status.raw_value == '禁用' ? 'kanban_color_3' : ''}">
|
||||
|
||||
<!-- 所有情况都需要的数据 (隐藏) -->
|
||||
<div style="display:none">
|
||||
<field name="location_status"/>
|
||||
<!-- 所有情况都需要的数据 (隐藏) -->
|
||||
<div style="display:none">
|
||||
<field name="location_status"/>
|
||||
<field name="tool_name_id"/>
|
||||
</div>
|
||||
|
||||
<t t-if="isBaseStyle">
|
||||
<div class="o_kanban_card_header">
|
||||
<div class="o_kanban_card_header_title">
|
||||
<field name="name"/>
|
||||
</div>
|
||||
|
||||
|
||||
<t t-if="isBaseStyle">
|
||||
<div class="o_kanban_card_header">
|
||||
<div class="o_kanban_card_header_title">
|
||||
<field name="name"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="o_kanban_record_bottom">
|
||||
<field name="product_sn_id"/>
|
||||
<span>|</span>
|
||||
<field name="product_id"/>
|
||||
</div>
|
||||
</t>
|
||||
|
||||
<t t-else="">
|
||||
<div class="o_kanban_record_bottom sf_kanban_custom_location_info_style">
|
||||
<field name="kanban_show_layer_info"/>
|
||||
</div>
|
||||
<div class="o_kanban_record_bottom sf_kanban_no">
|
||||
<field name="kanban_show_center_control_code"/>
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
<div class="o_kanban_record_bottom">
|
||||
<field name="product_sn_id"/>
|
||||
<field name="product_id"/>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
</kanban>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<t t-else="">
|
||||
<div class="o_kanban_record_bottom sf_kanban_custom_location_info_style">
|
||||
<field name="kanban_show_layer_info"/>
|
||||
</div>
|
||||
<!-- 添加RFID字段 -->
|
||||
<!-- <t t-if="record.data and record.data.display_rfid">
|
||||
<div class="o_kanban_record_bottom">
|
||||
<field name="display_rfid"/>
|
||||
</div>
|
||||
</t>
|
||||
<t t-if="record.data and record.data.tool_rfid">
|
||||
<div class="o_kanban_record_bottom">
|
||||
<field name="tool_rfid"/>
|
||||
</div>
|
||||
</t> -->
|
||||
<!-- 悬停时显示的详细信息 -->
|
||||
<div class="status-hover-bar">
|
||||
<t t-if="record.product_id.value">
|
||||
<div>产品: <t t-esc="record.product_id.value"/></div>
|
||||
</t>
|
||||
<t t-if="record.product_sn_id.value">
|
||||
<div>标签ID: <t t-esc="record.product_sn_id.value"/></div>
|
||||
</t>
|
||||
<!-- <t t-if="record.display_rfid.value">
|
||||
<div>rfid: <t t-esc="record.display_rfid.value"/></div>
|
||||
</t>
|
||||
<t t-if="record.tool_rfid.value">
|
||||
<div>rfid: <t t-esc="record.tool_rfid.value"/></div>
|
||||
</t> -->
|
||||
<t t-if="record.tool_name_id and record.tool_name_id.value">
|
||||
<div>功能刀具名称: <t t-esc="record.tool_name_id.value"/></div>
|
||||
</t>
|
||||
<div>状态: <t t-esc="record.location_status.value"/></div>
|
||||
</div>
|
||||
</t>
|
||||
</div>
|
||||
</t>
|
||||
</templates>
|
||||
</kanban>
|
||||
</field>
|
||||
</record>
|
||||
<!-- 搜索视图 -->
|
||||
<record id="shelf_location_search_view" model="ir.ui.view">
|
||||
<field name="name">shelf.location.search</field>
|
||||
|
||||
Reference in New Issue
Block a user