添加功能
This commit is contained in:
@@ -416,6 +416,7 @@ class OvertimeApprovals(models.Model):
|
||||
'workflow_id': workflow_id.id,
|
||||
})
|
||||
|
||||
|
||||
@api.depends('users_id', 'duration', 'start_time', 'end_time')
|
||||
def _compute_name(self):
|
||||
for rec in self:
|
||||
@@ -424,7 +425,7 @@ class OvertimeApprovals(models.Model):
|
||||
if rec.duration == 0:
|
||||
rec.name = f"{rec.users_id.name}加班 {start_time_str}-{end_time_str}"
|
||||
else:
|
||||
rec.name = f"{rec.users_id.name}加班{start_time_str}-{end_time_str},共{rec.duration}小时 "
|
||||
rec.name = f"{rec.users_id.name}加班{start_time_str}-{end_time_str},共{rec.duration}小时 "
|
||||
|
||||
@api.depends('start_time', 'end_time')
|
||||
def _compute_overtime_type(self):
|
||||
|
||||
@@ -50,6 +50,25 @@ class YuthonOfficialIncomingNormal(models.Model):
|
||||
name_title = fields.Char(default=_get_default_name_title)
|
||||
self_users_ids = fields.Many2many('res.users', string="当前经办人", default=lambda self: [(6, 0, [self.env.user.id])])
|
||||
|
||||
is_company = fields.Boolean(string="本公司", default=True, compute='_compute_is_company',
|
||||
search='_search_part_of_company')
|
||||
|
||||
@api.depends_context('uid', 'company')
|
||||
@api.depends('company_id')
|
||||
def _compute_is_company(self):
|
||||
active_company_ids = self.env.companies
|
||||
for employee in self:
|
||||
employee.is_company = employee.company_id in active_company_ids
|
||||
|
||||
def _search_part_of_company(self, operator, value):
|
||||
company_ids = self.env.companies.ids
|
||||
if not value:
|
||||
operator = '!=' if operator == '=' else '='
|
||||
if operator == '=':
|
||||
return [('company_id', 'in', company_ids)]
|
||||
else:
|
||||
return [('company_id', 'not in', company_ids)]
|
||||
|
||||
@api.onchange('is_issues')
|
||||
def _onchange_is_issues(self):
|
||||
if self.is_issues:
|
||||
|
||||
@@ -47,7 +47,6 @@
|
||||
</h1>
|
||||
</div>
|
||||
<group string="审批事项" col="2">
|
||||
<!-- 隐藏字段放在单独分组且占满两列,不影响可见列宽 -->
|
||||
<group colspan="2" invisible="1">
|
||||
<field name="is_send"/>
|
||||
<field name="is_back"/>
|
||||
@@ -55,8 +54,8 @@
|
||||
<field name="department_id"/>
|
||||
<field name="work_end"/>
|
||||
</group>
|
||||
<!-- 关键字段并排:拟办人 / 标题,宽屏同列,窄屏自动换行 -->
|
||||
<group col="2">
|
||||
<field name="is_company" invisible="1"/>
|
||||
<field name="users_id"/>
|
||||
<field name="name" required="1"/>
|
||||
</group>
|
||||
@@ -97,10 +96,10 @@
|
||||
</form>
|
||||
</field>
|
||||
</record>
|
||||
|
||||
<record id="yuthon_official_incoming_normal_action" model="ir.actions.act_window">
|
||||
<field name="name">行政收文</field>
|
||||
<field name="res_model">yuthon.official.incoming.normal</field>
|
||||
<field name="domain">[('is_company','=',True)]</field>
|
||||
<field name="view_mode">tree,form</field>
|
||||
</record>
|
||||
</odoo>
|
||||
Reference in New Issue
Block a user