添加功能

This commit is contained in:
李鹏宇
2026-04-29 09:56:31 +08:00
parent ab45fc483f
commit 6fd670b4c1
2 changed files with 14 additions and 1 deletions
+6 -1
View File
@@ -11,7 +11,6 @@ class YuthonWillTask(models.Model):
_name = 'yuthon.will.task'
_description = '日程'
_rec_name = 'name'
_order = 'task_time desc'
time_list = [
('0', '0:00'), ('0.25', '0:15'), ('0.5', '0:30'), ('0.75', '0:45'),
@@ -93,6 +92,12 @@ class YuthonWillTask(models.Model):
is_company = fields.Boolean(string="本公司", default=True, compute='_compute_is_company',
search='_search_part_of_company')
def update_task_state(self):
will_ids = self.env["yuthon.will.task"].browse(
self._context.get('active_ids', self._context.get('active_id')))
for will in will_ids:
will.state = 'done'
def _compute_is_company(self):
active_company_ids = self.env.companies
for employee in self:
@@ -401,4 +401,12 @@
<field name="state">code</field>
<field name="code">action = model.one_time()</field>
</record>
<record id="all_update_task_state" model="ir.actions.server">
<field name="name">状态改为已办</field>
<field name="model_id" ref="yuthon_will_task.model_yuthon_will_task"/>
<field name="binding_model_id" ref="yuthon_will_task.model_yuthon_will_task"/>
<field name="state">code</field>
<field name="code">action = model.update_task_state()</field>
<field name="groups" eval="[(4, ref('base.group_system'))]"/>
</record>
</odoo>