本文整理汇总了Python中openerp.addons.connector.queue.job.Job.company_id方法的典型用法代码示例。如果您正苦于以下问题:Python Job.company_id方法的具体用法?Python Job.company_id怎么用?Python Job.company_id使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openerp.addons.connector.queue.job.Job
的用法示例。
在下文中一共展示了Job.company_id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_read
# 需要导入模块: from openerp.addons.connector.queue.job import Job [as 别名]
# 或者: from openerp.addons.connector.queue.job.Job import company_id [as 别名]
def test_read(self):
eta = datetime.now() + timedelta(hours=5)
test_job = Job(func=dummy_task_args,
model_name='res.users',
args=('o', 'k'),
kwargs={'c': '!'},
priority=15,
eta=eta,
description="My description")
test_job.user_id = 1
test_job.company_id = self.env.ref("base.main_company").id
storage = OpenERPJobStorage(self.session)
storage.store(test_job)
job_read = storage.load(test_job.uuid)
self.assertEqual(test_job.uuid, job_read.uuid)
self.assertEqual(test_job.model_name, job_read.model_name)
self.assertEqual(test_job.func, job_read.func)
self.assertEqual(test_job.args, job_read.args)
self.assertEqual(test_job.kwargs, job_read.kwargs)
self.assertEqual(test_job.func_name, job_read.func_name)
self.assertEqual(test_job.func_string, job_read.func_string)
self.assertEqual(test_job.description, job_read.description)
self.assertEqual(test_job.state, job_read.state)
self.assertEqual(test_job.priority, job_read.priority)
self.assertEqual(test_job.exc_info, job_read.exc_info)
self.assertEqual(test_job.result, job_read.result)
self.assertEqual(test_job.user_id, job_read.user_id)
self.assertEqual(test_job.company_id, job_read.company_id)
delta = timedelta(seconds=1) # DB does not keep milliseconds
self.assertAlmostEqual(test_job.date_created, job_read.date_created,
delta=delta)
self.assertAlmostEqual(test_job.date_started, job_read.date_started,
delta=delta)
self.assertAlmostEqual(test_job.date_enqueued, job_read.date_enqueued,
delta=delta)
self.assertAlmostEqual(test_job.date_done, job_read.date_done,
delta=delta)
self.assertAlmostEqual(test_job.eta, job_read.eta,
delta=delta)
test_date = datetime(2015, 3, 15, 21, 7, 0)
job_read.date_enqueued = test_date
job_read.date_started = test_date
job_read.date_done = test_date
job_read.canceled = True
storage.store(job_read)
job_read = storage.load(test_job.uuid)
self.assertAlmostEqual(job_read.date_started, test_date,
delta=delta)
self.assertAlmostEqual(job_read.date_enqueued, test_date,
delta=delta)
self.assertAlmostEqual(job_read.date_done, test_date,
delta=delta)
self.assertEqual(job_read.canceled, True)