diff --git a/app_common/__manifest__.py b/app_common/__manifest__.py
index 4dc000153..3d39e18a4 100644
--- a/app_common/__manifest__.py
+++ b/app_common/__manifest__.py
@@ -82,6 +82,7 @@
],
'data': [
'views/ir_cron_views.xml',
+ 'views/product_template_views.xml',
# 'report/.xml',
],
'qweb': [
diff --git a/yuthon_purchase/__manifest__.py b/yuthon_purchase/__manifest__.py
index 3e1d32efc..25ede34f1 100644
--- a/yuthon_purchase/__manifest__.py
+++ b/yuthon_purchase/__manifest__.py
@@ -6,7 +6,7 @@
'category': 'zhou',
'version': '0.1',
'license': 'LGPL-3',
- 'depends': ['base', 'soong_workflow', 'hr', 'product', 'documents', 'purchase','sun_badge_menu'],
+ 'depends': ['base', 'soong_workflow', 'hr', 'product', 'documents', 'purchase','sun_badge_menu', 'website_sale'],
'data': [
'security/ir.model.access.csv',
'security/company_rule.xml',
diff --git a/yuthon_purchase/models/inherit_purchase_order.py b/yuthon_purchase/models/inherit_purchase_order.py
index cf26baefa..0fbedcdd3 100644
--- a/yuthon_purchase/models/inherit_purchase_order.py
+++ b/yuthon_purchase/models/inherit_purchase_order.py
@@ -37,6 +37,53 @@ class InheritPurchaseOrder(models.Model):
reason_text = fields.Text(string="申请事由")
pay_line_ids = fields.One2many('purchase.order.pay.line', 'order_id', string="付款详情")
is_company = fields.Boolean(string="本公司", default=True, compute='_compute_is_company',search='_search_part_of_company')
+
+ # 审批状态字段
+ purchase_state = fields.Selection([
+ ('draft', '草稿'),
+ ('in_progress', '审批中'),
+ ('done', '完成')
+ ], string="审批状态", compute='_compute_purchase_state', store=True)
+
+ # 显示用的办结时间(使用write_date作为办结时间)
+ display_end_time = fields.Datetime(
+ string="办结时间",
+ compute='_compute_display_end_time',
+ store=True
+ )
+
+ @api.depends('log_ids', 'work_end')
+ def _compute_purchase_state(self):
+ """
+ 计算审批状态
+ - log_ids为空:草稿
+ - log_ids有值且work_end=False:审批中
+ - work_end=True:完成
+ """
+ for record in self:
+ if record.work_end:
+ record.purchase_state = 'done'
+ elif record.log_ids:
+ record.purchase_state = 'in_progress'
+ else:
+ record.purchase_state = 'draft'
+
+ @api.depends('log_ids', 'write_date')
+ def _compute_display_end_time(self):
+ """
+ 计算显示用的办结时间
+ 逻辑:如果有审批日志,取最后一条日志的时间;否则使用write_date
+ """
+ for record in self:
+ if record.log_ids:
+ # 按ID排序,取最后一条日志的时间
+ sorted_logs = record.log_ids.sorted(lambda l: l.id)
+ if sorted_logs and hasattr(sorted_logs[-1], 'lase_click_date') and sorted_logs[-1].lase_click_date:
+ record.display_end_time = sorted_logs[-1].lase_click_date
+ else:
+ record.display_end_time = record.write_date
+ else:
+ record.display_end_time = record.write_date
@api.depends_context('uid', 'company')
@api.depends('company_id')
diff --git a/yuthon_purchase/views/inherit_product_product_views.xml b/yuthon_purchase/views/inherit_product_product_views.xml
index 6edf9a0da..64319e615 100644
--- a/yuthon_purchase/views/inherit_product_product_views.xml
+++ b/yuthon_purchase/views/inherit_product_product_views.xml
@@ -11,4 +11,43 @@
+
+
+
+ product.template.tree.inherit.yuthon.purchase
+ product.template
+
+
+
+
+ 1
+
+
+
+ 1
+
+
+
+ 1
+
+
+
+ 详细类别
+
+
+
+
+
+
+ product.template.search.inherit.yuthon.purchase
+ product.template
+
+
+
+
+
+
+
+
+
\ 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 b504e40aa..86dbed911 100644
--- a/yuthon_purchase/views/inherit_purchase_order_views.xml
+++ b/yuthon_purchase/views/inherit_purchase_order_views.xml
@@ -5,6 +5,7 @@
purchase.order
+
1
@@ -26,6 +27,19 @@
1
+
+
+
+
+
+
+
+
+
+
@@ -64,11 +78,6 @@
class="btn-primary" invisible="not work_end"/>
-
-
-
-
-
@@ -78,13 +87,25 @@
invisible="urgency_level != 'urgent'"/>
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
1
@@ -108,7 +129,6 @@
1
-