添加功能

This commit is contained in:
李鹏宇
2025-12-13 16:34:36 +08:00
parent 4f721609ea
commit 2870c5fe6f
11 changed files with 102 additions and 51 deletions
@@ -53,6 +53,7 @@ class SoongWorkflowCommentWizard(models.TransientModel):
help='并:任何人均给意见,最后一个完成的人转交到下一节点.'
'串:都会收到消息,但任意一个人转交后,即到下一节点,其他人将不再显示,相当于收回.')
is_automatic = fields.Boolean('是否自动匹配')
is_this_company = fields.Boolean('本公司', default=True)
employee_ids1 = fields.Many2many(
'hr.employee',
'employee_ids1_rel',
@@ -58,8 +58,9 @@
<field name="document_ids" string="附件" widget="preview_many2many" force_save="1"/>
</group>
<group>
<field name="is_this_company"/>
<field name="employee_ids1" widget="many2many_tags" string="人员范围" invisible="1"/>
<field name="employee_ids" widget="many2many_tags" string="人员范围" domain="[('id', 'in', employee_ids1)]" options="{'no_create': True}"/>
<field name="employee_ids" widget="many2many_tags" string="人员范围" domain = "[('company_id', '=', company_id), ('id', 'in', employee_ids1)] if is_this_company else []" options="{'no_create': True}"/>
</group>
</group>
<group invisible="node_btn_name != '结束'">
+1
View File
@@ -0,0 +1 @@
from . import models
+14
View File
@@ -0,0 +1,14 @@
# -*- coding: utf-8 -*-
{
'name': "yuthon_partner",
'category': 'Tools',
'version': '0.1',
'license': 'LGPL-3',
'depends': ['base', 'hr'],
'data': [
'security/ir.model.access.csv',
'views/inherit_res_partner.xml',
],
}
+2
View File
@@ -0,0 +1,2 @@
# -*- coding: utf-8 -*-
from . import inherit_res_partner
@@ -0,0 +1,16 @@
# -*- coding: utf-8 -*-
from odoo import api, fields, models, modules
class InheritResPartner(models.Model):
_inherit = 'res.partner'
is_employee = fields.Boolean(string='员工', default=False)
def update_is_employee(self):
partner_ids = self.env["res.partner"].browse(
self._context.get('active_ids', self._context.get('active_id')))
for partner in partner_ids:
employee = self.env['hr.employee'].search([('name', '=', partner.display_name)])
if employee:
partner.is_employee = True
@@ -0,0 +1,5 @@
id,name,model_id:id,group_id:id,perm_read,perm_write,perm_create,perm_unlink
1 id name model_id:id group_id:id perm_read perm_write perm_create perm_unlink
@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8" ?>
<odoo>
<record id="view_partner_form_inherit" model="ir.ui.view">
<field name="name">res.partner.form.inherit</field>
<field name="model">res.partner</field>
<field name="inherit_id" ref="base.view_partner_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='vat']" position="after">
<field name="is_employee" invisible="1"/>
</xpath>
</field>
</record>
<record id="all_is_employee" model="ir.actions.server">
<field name="name">更新</field>
<field name="model_id" ref="base.model_res_partner"/>
<field name="binding_model_id" ref="base.model_res_partner"/>
<field name="state">code</field>
<field name="code">action = model.update_is_employee()</field>
</record>
</odoo>
@@ -14,6 +14,8 @@ class InheritPurchaseOrder(models.Model):
compute='_compute_json_display',
store=True
)
document_ids = fields.Many2many('ir.attachment', string="附件")
@api.depends(
'order_line.product_id',
@@ -22,44 +22,33 @@
</xpath>
</field>
</record>
<!-- <record id="inherit_purchase_order_form" model="ir.ui.view">-->
<!-- <field name="name">purchase.order.form</field>-->
<!-- <field name="model">purchase.order</field>-->
<!-- <field name="inherit_id" ref="purchase.purchase_order_form"/>-->
<!-- <field name="arch" type="xml">-->
<!-- <xpath expr="//button[@name='action_rfq_send']" position="attributes">-->
<!-- <attribute name="invisible">1</attribute>-->
<record id="inherit_purchase_order_form" model="ir.ui.view">
<field name="name">purchase.order.form</field>
<field name="model">purchase.order</field>
<field name="inherit_id" ref="purchase.purchase_order_form"/>
<field name="arch" type="xml">
<xpath expr="//field[@name='currency_id']" position="after">
<field name="document_ids" widget="preview_many2many"/>
</xpath>
<xpath expr="//field[@name='partner_id']" position="attributes">
<attribute name="domain">[('is_employee', '=', False)]</attribute>
</xpath>
<!-- <xpath expr="//page[@string='purchase_delivery_invoice']" position="after">-->
<!-- <page string="关联流程">-->
<!-- <field name="issue_library_approval_line_ids" readonly="1">-->
<!-- <tree editable="bottom">-->
<!-- <field name="issue_library_id" column_invisible="1"/>-->
<!-- <field name="res_model" column_invisible="1"/>-->
<!-- <field name="res_id" column_invisible="1"/>-->
<!-- <field name="code"/>-->
<!-- <field name="workflow_name"/>-->
<!-- <field name="approval_type"/>-->
<!-- <field name="approval_date"/>-->
<!-- <button name="open_record" type="object" string="详情" class="btn-primary"/>-->
<!-- </tree>-->
<!-- </field>-->
<!-- </page>-->
<!-- </xpath>-->
<!-- <xpath expr="//field[@name='user_id']" position="attributes">-->
<!-- <attribute name="invisible">1</attribute>-->
<!-- </xpath>-->
<!-- <xpath expr="//field[@name='company_id']" position="attributes">-->
<!-- <attribute name="invisible">1</attribute>-->
<!-- </xpath>-->
<!--&lt;!&ndash; <xpath expr="//field[@name='incoterm_id']" position="attributes">&ndash;&gt;-->
<!--&lt;!&ndash; <attribute name="invisible">1</attribute>&ndash;&gt;-->
<!--&lt;!&ndash; </xpath>&ndash;&gt;-->
<!-- <xpath expr="//field[@name='incoterm_location']" position="attributes">-->
<!-- <attribute name="invisible">1</attribute>-->
<!-- </xpath>-->
<!-- <xpath expr="//field[@name='receipt_status']" position="attributes">-->
<!-- <attribute name="invisible">1</attribute>-->
<!-- </xpath>-->
<!-- <xpath expr="//field[@name='invoice_status']" position="attributes">-->
<!-- <attribute name="invisible">1</attribute>-->
<!-- </xpath>-->
<!-- <xpath expr="//field[@name='payment_term_id']" position="attributes">-->
<!-- <attribute name="invisible">1</attribute>-->
<!-- </xpath>-->
<!-- <xpath expr="//field[@name='fiscal_position_id']" position="attributes">-->
<!-- <attribute name="invisible">1</attribute>-->
<!-- </xpath>-->
<!-- <xpath expr="//field[@name='partner_ref']" position="attributes">-->
<!-- <attribute name="invisible">1</attribute>-->
<!-- </xpath>-->
<!-- <xpath expr="//field[@name='currency_id']" position="attributes">-->
<!-- <attribute name="invisible">1</attribute>-->
<!-- </xpath>-->
<!-- </field>-->
<!-- </record>-->
</field>
</record>
</odoo>
@@ -47,7 +47,7 @@
<field name="company_id" invisible="1"/>
<field name="start_date"/>
<field name="user_id" string="申请人" required="1"/>
<field name="purchase_type" required="1" widget="radio" />
<field name="purchase_type" required="1"/>
<field name="partner_id" domain="[('user_ids', '=', False)]" required="1"/>
<field name="pay_way" required="1"/>
</group>
@@ -63,6 +63,16 @@
<group>
<field name="reason_text"/>
</group>
<group col="2">
<group>
<field name="document_ids" string="附件" widget="preview_many2many"/>
<field name="license_id" invisible="purchase_type != 'service'" widget="preview_many2one"/>
</group>
<group>
<field name="aptitude_id" invisible="purchase_type != 'service'" widget="preview_many2one"/>
<field name="contract_id" string="服务合同" invisible="purchase_type != 'service'" widget="preview_many2one"/>
</group>
</group>
<notebook string="采购明细" >
<page string="固定资产明细" invisible="purchase_type != 'fixed'">
<field name="fixed_line_ids">
@@ -125,16 +135,6 @@
</field>
</page>
</notebook>
<group col="2">
<group>
<field name="document_ids" string="附件" widget="preview_many2many"/>
<field name="license_id" invisible="purchase_type != 'service'" widget="preview_many2one"/>
</group>
<group>
<field name="aptitude_id" invisible="purchase_type != 'service'" widget="preview_many2one"/>
<field name="contract_id" string="服务合同" invisible="purchase_type != 'service'" widget="preview_many2one"/>
</group>
</group>
</sheet>
</form>
</field>