初始数,盘点

This commit is contained in:
李鹏宇
2026-07-03 19:12:53 +08:00
parent b17b696687
commit 098021a87f
3 changed files with 0 additions and 31 deletions
-1
View File
@@ -10,7 +10,6 @@
'data': [
'data/sequence.xml',
'data/inventory_sequence.xml',
'data/inventory_cron.xml',
'security/ir.model.access.csv',
'security/company_rule.xml',
'wizard/stock_picking_transfer_wizard_views.xml',
-15
View File
@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<odoo>
<!-- 盘点任务定时提醒 cron -->
<record id="cron_yuthon_inventory_reminder" model="ir.cron">
<field name="name">盘点任务提醒</field>
<field name="model_id" ref="model_yuthon_inventory_task"/>
<field name="state">code</field>
<field name="code">model.action_send_reminder()</field>
<field name="interval_number">1</field>
<field name="interval_type">days</field>
<field name="numbercall">-1</field>
<field name="active">False</field>
<field name="nextcall" eval="(datetime.now() + timedelta(days=1)).strftime('%Y-%m-%d 08:00:00')"/>
</record>
</odoo>
@@ -19,7 +19,6 @@ class YuthonInventoryTask(models.Model):
name = fields.Char(string='盘点名称', required=True, index=True)
code = fields.Char(string='编号', readonly=True, copy=False, default='New')
planned_date = fields.Datetime(string='计划盘点时间')
employee_ids = fields.Many2many(
'hr.employee',
'inventory_task_employee_rel',
@@ -57,7 +56,6 @@ class YuthonInventoryTask(models.Model):
sheet_count = fields.Integer(string='盘点表数', compute='_compute_sheet_count')
note = fields.Text(string='备注')
reminded = fields.Boolean(string='已提醒', default=False, copy=False)
create_uid = fields.Many2one('res.users', string='创建人', readonly=True)
create_date = fields.Datetime(string='创建时间', readonly=True)
@@ -339,16 +337,3 @@ class YuthonInventoryTask(models.Model):
'domain': [('task_id', '=', self.id)],
'target': 'current',
}
def action_send_reminder(self):
"""手动触发提醒(供 cron 调用)"""
now = fields.Datetime.now()
tasks = self.search([
('state', '=', 'confirmed'),
('planned_date', '!=', False),
('planned_date', '<=', now),
('reminded', '=', False),
])
for task in tasks:
# TODO: 接入企业微信后,此处发送消息给 task.employee_ids
task.reminded = True