diff --git a/yuthon_purchase/__manifest__.py b/yuthon_purchase/__manifest__.py
index b95ca8471..23056c460 100644
--- a/yuthon_purchase/__manifest__.py
+++ b/yuthon_purchase/__manifest__.py
@@ -15,5 +15,10 @@
],
'installable': True,
'application': True,
+ 'assets': {
+ 'web.assets_backend': [
+ 'yuthon_purchase/static/xml/misc.xml'
+ ],
+ }
}
diff --git a/yuthon_purchase/models/inherit_purchase_order.py b/yuthon_purchase/models/inherit_purchase_order.py
index c2b513f7d..5cd2cedaa 100644
--- a/yuthon_purchase/models/inherit_purchase_order.py
+++ b/yuthon_purchase/models/inherit_purchase_order.py
@@ -1,10 +1,49 @@
# -*- coding: utf-8 -*-
from odoo import api, fields, models
+import json
class InheritPurchaseOrder(models.Model):
_inherit = 'purchase.order'
+ json_display = fields.Char(
+ string="物品详情",
+ compute='_compute_json_display',
+ store=True
+ )
+
+ @api.depends(
+ 'order_line.product_id',
+ 'order_line.product_qty',
+ 'order_line.product_uom',
+ 'order_line.price_unit',
+ 'order_line.price_subtotal'
+ )
+ def _compute_json_display(self):
+ for record in self:
+ json_data = {
+ "template": "json_widget_purchase.table_purchase",
+ "title": f"{record.name}的明细数据",
+ "lines": [
+ {
+ 'sequence': idx + 1,
+ 'barcode': line.product_id.barcode or '',
+ 'product_id': line.product_id.name or '',
+ 'product_qty': line.product_uom_qty or '',
+ 'product_uom': line.product_uom.name or '',
+ 'price_unit': line.price_unit or '',
+ }
+ for idx, line in enumerate(record.order_line)
+ ]
+ }
+ record.json_display = json.dumps(json_data, ensure_ascii=False)
+
+ def action_refresh_json_display(self):
+ """手动刷新json_display字段"""
+ for record in self:
+ record._compute_json_display()
+ return True
+
def get_no_read_count(self):
domain = [
('company_id', '=', self.env.user.company_id.id),
diff --git a/yuthon_purchase/static/xml/misc.xml b/yuthon_purchase/static/xml/misc.xml
new file mode 100644
index 000000000..51b83b8b8
--- /dev/null
+++ b/yuthon_purchase/static/xml/misc.xml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+ | 序号 |
+ 产品编号 |
+ 产品 |
+ 数量 |
+ 单位 |
+ 单价 |
+
+
+
+
+ |
+ |
+ |
+ |
+ |
+ |
+
+
+
+
+
+
+ 暂无物品数据
+
+
+
+
+
+
\ No newline at end of file
diff --git a/yuthon_purchase/views/inherit_purchase_order_views.xml b/yuthon_purchase/views/inherit_purchase_order_views.xml
index 2031d7336..2106de444 100644
--- a/yuthon_purchase/views/inherit_purchase_order_views.xml
+++ b/yuthon_purchase/views/inherit_purchase_order_views.xml
@@ -17,6 +17,19 @@
1
+
+
+
+
+ purchase.order.form
+ purchase.order
+
+
+
+ 1
+
+
+
diff --git a/yuthon_stock/models/inherit_stock_picking.py b/yuthon_stock/models/inherit_stock_picking.py
index 37b5e3e1c..b8c841b2c 100644
--- a/yuthon_stock/models/inherit_stock_picking.py
+++ b/yuthon_stock/models/inherit_stock_picking.py
@@ -38,3 +38,8 @@ class StockPicking(models.Model):
}
record.json_display = json.dumps(json_data, ensure_ascii=False)
+ def action_refresh_json_display(self):
+ """手动刷新json_display字段"""
+ for record in self:
+ record._compute_json_display()
+ return True
\ No newline at end of file
diff --git a/yuthon_stock/static/xml/misc.xml b/yuthon_stock/static/xml/misc.xml
index 3138d6f6a..9a92c94f2 100644
--- a/yuthon_stock/static/xml/misc.xml
+++ b/yuthon_stock/static/xml/misc.xml
@@ -9,7 +9,7 @@
| 序号 |
- 物业编号 |
+ 产品编号 |
产品 |
数量 |
单位 |
diff --git a/yuthon_stock/views/inherit_stock_picking.xml b/yuthon_stock/views/inherit_stock_picking.xml
index 6239c0b28..dbbb07dfd 100644
--- a/yuthon_stock/views/inherit_stock_picking.xml
+++ b/yuthon_stock/views/inherit_stock_picking.xml
@@ -27,10 +27,13 @@
目的位置
- 验收人
+ 供应商
- 经手人
+ 采购人员
+
+
+ 验收人