采购
This commit is contained in:
@@ -82,6 +82,7 @@
|
|||||||
],
|
],
|
||||||
'data': [
|
'data': [
|
||||||
'views/ir_cron_views.xml',
|
'views/ir_cron_views.xml',
|
||||||
|
'views/product_template_views.xml',
|
||||||
# 'report/.xml',
|
# 'report/.xml',
|
||||||
],
|
],
|
||||||
'qweb': [
|
'qweb': [
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
'category': 'zhou',
|
'category': 'zhou',
|
||||||
'version': '0.1',
|
'version': '0.1',
|
||||||
'license': 'LGPL-3',
|
'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': [
|
'data': [
|
||||||
'security/ir.model.access.csv',
|
'security/ir.model.access.csv',
|
||||||
'security/company_rule.xml',
|
'security/company_rule.xml',
|
||||||
|
|||||||
@@ -37,6 +37,53 @@ class InheritPurchaseOrder(models.Model):
|
|||||||
reason_text = fields.Text(string="申请事由")
|
reason_text = fields.Text(string="申请事由")
|
||||||
pay_line_ids = fields.One2many('purchase.order.pay.line', 'order_id', 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')
|
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_context('uid', 'company')
|
||||||
@api.depends('company_id')
|
@api.depends('company_id')
|
||||||
|
|||||||
@@ -11,4 +11,43 @@
|
|||||||
</xpath>
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
|
|
||||||
|
<!-- 隐藏产品模板树视图中的字段 -->
|
||||||
|
<record id="inherit_product_template_tree_view" model="ir.ui.view">
|
||||||
|
<field name="name">product.template.tree.inherit.yuthon.purchase</field>
|
||||||
|
<field name="model">product.template</field>
|
||||||
|
<field name="inherit_id" ref="product.product_template_tree_view"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<!-- 隐藏barcode字段 -->
|
||||||
|
<xpath expr="//field[@name='barcode']" position="attributes">
|
||||||
|
<attribute name="column_invisible">1</attribute>
|
||||||
|
</xpath>
|
||||||
|
<!-- 隐藏default_code字段 -->
|
||||||
|
<xpath expr="//field[@name='default_code']" position="attributes">
|
||||||
|
<attribute name="column_invisible">1</attribute>
|
||||||
|
</xpath>
|
||||||
|
<!-- 隐藏website_id字段 -->
|
||||||
|
<xpath expr="//field[@name='website_id']" position="attributes">
|
||||||
|
<attribute name="column_invisible">1</attribute>
|
||||||
|
</xpath>
|
||||||
|
<!-- 修改detailed_type字段标签 -->
|
||||||
|
<xpath expr="//field[@name='detailed_type']" position="attributes">
|
||||||
|
<attribute name="string">详细类别</attribute>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
|
|
||||||
|
<!-- 添加搜索面板到搜索视图 -->
|
||||||
|
<record id="inherit_product_template_search_view" model="ir.ui.view">
|
||||||
|
<field name="name">product.template.search.inherit.yuthon.purchase</field>
|
||||||
|
<field name="model">product.template</field>
|
||||||
|
<field name="inherit_id" ref="product.product_template_search_view"/>
|
||||||
|
<field name="arch" type="xml">
|
||||||
|
<xpath expr="//search" position="inside">
|
||||||
|
<searchpanel>
|
||||||
|
<field name="categ_id" string="产品类别" enable_counters="1"/>
|
||||||
|
</searchpanel>
|
||||||
|
</xpath>
|
||||||
|
</field>
|
||||||
|
</record>
|
||||||
</odoo>
|
</odoo>
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
<field name="model">purchase.order</field>
|
<field name="model">purchase.order</field>
|
||||||
<field name="inherit_id" ref="purchase.purchase_order_view_tree"/>
|
<field name="inherit_id" ref="purchase.purchase_order_view_tree"/>
|
||||||
<field name="arch" type="xml">
|
<field name="arch" type="xml">
|
||||||
|
<!-- 隐藏原有字段 -->
|
||||||
<xpath expr="//field[@name='partner_ref']" position="attributes">
|
<xpath expr="//field[@name='partner_ref']" position="attributes">
|
||||||
<attribute name="column_invisible">1</attribute>
|
<attribute name="column_invisible">1</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
@@ -26,6 +27,19 @@
|
|||||||
<xpath expr="//field[@name='invoice_status']" position="attributes">
|
<xpath expr="//field[@name='invoice_status']" position="attributes">
|
||||||
<attribute name="column_invisible">1</attribute>
|
<attribute name="column_invisible">1</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
|
||||||
|
<!-- 在user_id后添加purchase_state -->
|
||||||
|
<xpath expr="//field[@name='user_id']" position="after">
|
||||||
|
<field name="purchase_state" string="审批状态" widget="badge"
|
||||||
|
decoration-info="purchase_state == 'draft'"
|
||||||
|
decoration-warning="purchase_state == 'in_progress'"
|
||||||
|
decoration-success="purchase_state == 'done'"/>
|
||||||
|
</xpath>
|
||||||
|
|
||||||
|
<!-- 在amount_total后添加display_end_time -->
|
||||||
|
<xpath expr="//field[@name='amount_total']" position="after">
|
||||||
|
<field name="display_end_time" string="办结时间" optional="show"/>
|
||||||
|
</xpath>
|
||||||
</field>
|
</field>
|
||||||
</record>
|
</record>
|
||||||
<record id="inherit_purchase_order_kpis_tree" model="ir.ui.view">
|
<record id="inherit_purchase_order_kpis_tree" model="ir.ui.view">
|
||||||
@@ -64,11 +78,6 @@
|
|||||||
class="btn-primary" invisible="not work_end"/>
|
class="btn-primary" invisible="not work_end"/>
|
||||||
<button name="btn_exec_action" string="归档" type="object" class="oe_highlight" invisible="state != 'purchase'" context="{'btn_key':'PN8N28ZNWA','active_model':'purchase.order'}"/>
|
<button name="btn_exec_action" string="归档" type="object" class="oe_highlight" invisible="state != 'purchase'" context="{'btn_key':'PN8N28ZNWA','active_model':'purchase.order'}"/>
|
||||||
</header>
|
</header>
|
||||||
<div class="col-12 text-center">
|
|
||||||
<h1>
|
|
||||||
<field name="name_title" readonly="1"/>
|
|
||||||
</h1>
|
|
||||||
</div>
|
|
||||||
</xpath>
|
</xpath>
|
||||||
<!-- 丝带插入到 sheet 的第一个子节点之前,确保始终位于表单最顶部 -->
|
<!-- 丝带插入到 sheet 的第一个子节点之前,确保始终位于表单最顶部 -->
|
||||||
<xpath expr="//form/sheet/*[1]" position="before">
|
<xpath expr="//form/sheet/*[1]" position="before">
|
||||||
@@ -78,13 +87,25 @@
|
|||||||
invisible="urgency_level != 'urgent'"/>
|
invisible="urgency_level != 'urgent'"/>
|
||||||
<widget name="web_ribbon" title="特急" bg_color="text-bg-danger"
|
<widget name="web_ribbon" title="特急" bg_color="text-bg-danger"
|
||||||
invisible="urgency_level != 'emergency'"/>
|
invisible="urgency_level != 'emergency'"/>
|
||||||
</xpath>
|
<!-- 流水号和紧急度在顶部 -->
|
||||||
<!-- 在表单首个分组内放置紧急程度字段,供 ribbon 逻辑使用 -->
|
<group col="3">
|
||||||
<xpath expr="//form/sheet/group[1]" position="inside">
|
<group>
|
||||||
<group>
|
<field name="code" string="流水号" readonly="1"/>
|
||||||
<field name="urgency_level"/>
|
</group>
|
||||||
|
<group>
|
||||||
|
<field name="urgency_level" readonly="1"/>
|
||||||
|
</group>
|
||||||
|
<group/>
|
||||||
</group>
|
</group>
|
||||||
</xpath>
|
</xpath>
|
||||||
|
<!-- 标题在顶部group之后 -->
|
||||||
|
<xpath expr="//form/sheet/group[1]" position="after">
|
||||||
|
<div class="col-12 text-center">
|
||||||
|
<h1>
|
||||||
|
<field name="name_title" readonly="1"/>
|
||||||
|
</h1>
|
||||||
|
</div>
|
||||||
|
</xpath>
|
||||||
<xpath expr="//field[@name='currency_id']" position="attributes">
|
<xpath expr="//field[@name='currency_id']" position="attributes">
|
||||||
<attribute name="invisible">1</attribute>
|
<attribute name="invisible">1</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
@@ -108,7 +129,6 @@
|
|||||||
<attribute name="invisible">1</attribute>
|
<attribute name="invisible">1</attribute>
|
||||||
</xpath>
|
</xpath>
|
||||||
<xpath expr="//field[@name='currency_id']" position="after">
|
<xpath expr="//field[@name='currency_id']" position="after">
|
||||||
<field name="code" invisible="1"/>
|
|
||||||
<field name="company_id" invisible="1"/>
|
<field name="company_id" invisible="1"/>
|
||||||
<field name="department_id" invisible="1"/>
|
<field name="department_id" invisible="1"/>
|
||||||
<field name="category_id" domain="[('parent_id', '=', False)]"/>
|
<field name="category_id" domain="[('parent_id', '=', False)]"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user