当前位置: 首页>>代码示例>>Python>>正文


Python OpenERPJobStorage.store方法代码示例

本文整理汇总了Python中openerp.addons.connector.queue.job.OpenERPJobStorage.store方法的典型用法代码示例。如果您正苦于以下问题:Python OpenERPJobStorage.store方法的具体用法?Python OpenERPJobStorage.store怎么用?Python OpenERPJobStorage.store使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在openerp.addons.connector.queue.job.OpenERPJobStorage的用法示例。


在下文中一共展示了OpenERPJobStorage.store方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _create_job

# 需要导入模块: from openerp.addons.connector.queue.job import OpenERPJobStorage [as 别名]
# 或者: from openerp.addons.connector.queue.job.OpenERPJobStorage import store [as 别名]
 def _create_job(self, func, *args):
     job = Job(func=func, args=args)
     storage = OpenERPJobStorage(self.session)
     storage.store(job)
     stored = self.QueueJob.search([("uuid", "=", job.uuid)])
     self.assertEqual(len(stored), 1)
     return stored
开发者ID:borni-dhifi,项目名称:odoo-magento-modules,代码行数:9,代码来源:test_related_action.py

示例2: _cancel_jobs

# 需要导入模块: from openerp.addons.connector.queue.job import OpenERPJobStorage [as 别名]
# 或者: from openerp.addons.connector.queue.job.OpenERPJobStorage import store [as 别名]
    def _cancel_jobs(self, cr, uid, context=None):
        """Find moves where the mark has been removed and cancel the jobs.

        For the moves that are posted already it's too late: we skip them.

        """

        if context is None:
            context = {}

        session = ConnectorSession(cr, uid, context=context)
        storage = OpenERPJobStorage(session)

        move_ids = self.search(cr, uid, [
            ('to_post', '=', False),
            ('post_job_uuid', '!=', False),
            ('state', '=', 'draft'),
        ], context=context)

        for move in self.browse(cr, uid, move_ids, context=context):
            job = storage.load(move.post_job_uuid)
            if job.state in (u'pending', u'enqueued'):
                job.set_done(result=_(
                    u'Task set to Done because the user unmarked the move'
                ))
                storage.store(job)
开发者ID:YannickB,项目名称:account-financial-tools,代码行数:28,代码来源:account.py

示例3: _create_job

# 需要导入模块: from openerp.addons.connector.queue.job import OpenERPJobStorage [as 别名]
# 或者: from openerp.addons.connector.queue.job.OpenERPJobStorage import store [as 别名]
 def _create_job(self):
     test_job = Job(func=task_a)
     storage = OpenERPJobStorage(self.session)
     storage.store(test_job)
     stored = self.queue_job.search([("uuid", "=", test_job.uuid)])
     self.assertEqual(len(stored), 1)
     return stored
开发者ID:borni-dhifi,项目名称:odoo-magento-modules,代码行数:9,代码来源:test_job.py

示例4: _create_job

# 需要导入模块: from openerp.addons.connector.queue.job import OpenERPJobStorage [as 别名]
# 或者: from openerp.addons.connector.queue.job.OpenERPJobStorage import store [as 别名]
 def _create_job(self):
     test_job = Job(func=task_a)
     storage = OpenERPJobStorage(self.session)
     storage.store(test_job)
     stored = storage.db_record_from_uuid(test_job.uuid)
     self.assertEqual(len(stored), 1)
     return stored
开发者ID:pabi2,项目名称:pb2_base_technical,代码行数:9,代码来源:test_job.py

示例5: test_job_unlinked

# 需要导入模块: from openerp.addons.connector.queue.job import OpenERPJobStorage [as 别名]
# 或者: from openerp.addons.connector.queue.job.OpenERPJobStorage import store [as 别名]
 def test_job_unlinked(self):
     test_job = Job(func=dummy_task_args, model_name="res.users", args=("o", "k"), kwargs={"c": "!"})
     storage = OpenERPJobStorage(self.session)
     storage.store(test_job)
     stored = self.queue_job.search([("uuid", "=", test_job.uuid)])
     stored.unlink()
     with self.assertRaises(NoSuchJobError):
         storage.load(test_job.uuid)
开发者ID:borni-dhifi,项目名称:odoo-magento-modules,代码行数:10,代码来源:test_job.py

示例6: test_store

# 需要导入模块: from openerp.addons.connector.queue.job import OpenERPJobStorage [as 别名]
# 或者: from openerp.addons.connector.queue.job.OpenERPJobStorage import store [as 别名]
 def test_store(self):
     job = Job(func=task_a)
     storage = OpenERPJobStorage(self.session)
     storage.store(job)
     stored = self.queue_job.search(
         self.cr, self.uid,
         [('uuid', '=', job.uuid)])
     self.assertEqual(len(stored), 1)
开发者ID:acsone,项目名称:connector,代码行数:10,代码来源:test_job.py

示例7: test_job_worker

# 需要导入模块: from openerp.addons.connector.queue.job import OpenERPJobStorage [as 别名]
# 或者: from openerp.addons.connector.queue.job.OpenERPJobStorage import store [as 别名]
 def test_job_worker(self):
     worker = self.env["queue.worker"].create({"uuid": "57569b99-c2c1-47b6-aad1-72f953c92c87"})
     test_job = Job(func=dummy_task_args, model_name="res.users", args=("o", "k"), kwargs={"c": "!"})
     test_job.worker_uuid = worker.uuid
     storage = OpenERPJobStorage(self.session)
     self.assertEqual(storage._worker_id(worker.uuid), worker.id)
     storage.store(test_job)
     job_read = storage.load(test_job.uuid)
     self.assertEqual(job_read.worker_uuid, worker.uuid)
开发者ID:borni-dhifi,项目名称:odoo-magento-modules,代码行数:11,代码来源:test_job.py

示例8: _create_job

# 需要导入模块: from openerp.addons.connector.queue.job import OpenERPJobStorage [as 别名]
# 或者: from openerp.addons.connector.queue.job.OpenERPJobStorage import store [as 别名]
 def _create_job(self, func, *args):
     cr, uid = self.cr, self.uid
     job = Job(func=func, args=args)
     storage = OpenERPJobStorage(self.session)
     storage.store(job)
     stored_ids = self.QueueJob.search(self.cr, self.uid,
                                       [('uuid', '=', job.uuid)])
     self.assertEqual(len(stored_ids), 1)
     return self.QueueJob.browse(cr, uid, stored_ids[0])
开发者ID:lyynocs,项目名称:magento-connector-v8,代码行数:11,代码来源:test_related_action.py

示例9: test_read

# 需要导入模块: from openerp.addons.connector.queue.job import OpenERPJobStorage [as 别名]
# 或者: from openerp.addons.connector.queue.job.OpenERPJobStorage import store [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)
开发者ID:pabi2,项目名称:pb2_base_technical,代码行数:57,代码来源:test_job.py

示例10: test_job_unlinked

# 需要导入模块: from openerp.addons.connector.queue.job import OpenERPJobStorage [as 别名]
# 或者: from openerp.addons.connector.queue.job.OpenERPJobStorage import store [as 别名]
 def test_job_unlinked(self):
     test_job = Job(func=dummy_task_args,
                    model_name='res.users',
                    args=('o', 'k'),
                    kwargs={'c': '!'})
     storage = OpenERPJobStorage(self.session)
     storage.store(test_job)
     stored = self.queue_job.search([('uuid', '=', test_job.uuid)])
     stored.unlink()
     with self.assertRaises(NoSuchJobError):
         storage.load(test_job.uuid)
开发者ID:pabi2,项目名称:pb2_base_technical,代码行数:13,代码来源:test_job.py

示例11: test_job_worker

# 需要导入模块: from openerp.addons.connector.queue.job import OpenERPJobStorage [as 别名]
# 或者: from openerp.addons.connector.queue.job.OpenERPJobStorage import store [as 别名]
 def test_job_worker(self):
     worker = self.env['queue.worker'].create(
         {'uuid': '57569b99-c2c1-47b6-aad1-72f953c92c87'}
     )
     test_job = Job(func=dummy_task_args,
                    model_name='res.users',
                    args=('o', 'k'),
                    kwargs={'c': '!'})
     test_job.worker_uuid = worker.uuid
     storage = OpenERPJobStorage(self.session)
     self.assertEqual(storage._worker_id(worker.uuid), worker.id)
     storage.store(test_job)
     job_read = storage.load(test_job.uuid)
     self.assertEqual(job_read.worker_uuid, worker.uuid)
开发者ID:pabi2,项目名称:pb2_base_technical,代码行数:16,代码来源:test_job.py

示例12: test_unicode

# 需要导入模块: from openerp.addons.connector.queue.job import OpenERPJobStorage [as 别名]
# 或者: from openerp.addons.connector.queue.job.OpenERPJobStorage import store [as 别名]
 def test_unicode(self):
     test_job = Job(func=dummy_task_args,
                    model_name='res.users',
                    args=(u'öô¿‽', u'ñě'),
                    kwargs={'c': u'ßø'},
                    priority=15,
                    description=u"My dé^Wdescription")
     test_job.user_id = 1
     storage = OpenERPJobStorage(self.session)
     storage.store(test_job)
     job_read = storage.load(test_job.uuid)
     self.assertEqual(test_job.args, job_read.args)
     self.assertEqual(job_read.args, ('res.users', u'öô¿‽', u'ñě'))
     self.assertEqual(test_job.kwargs, job_read.kwargs)
     self.assertEqual(job_read.kwargs, {'c': u'ßø'})
     self.assertEqual(test_job.description, job_read.description)
     self.assertEqual(job_read.description, u"My dé^Wdescription")
开发者ID:pabi2,项目名称:pb2_base_technical,代码行数:19,代码来源:test_job.py

示例13: test_accented_bytestring

# 需要导入模块: from openerp.addons.connector.queue.job import OpenERPJobStorage [as 别名]
# 或者: from openerp.addons.connector.queue.job.OpenERPJobStorage import store [as 别名]
 def test_accented_bytestring(self):
     job = Job(func=dummy_task_args,
               model_name='res.users',
               args=('öô¿‽', 'ñě'),
               kwargs={'c': 'ßø'},
               priority=15,
               description="My dé^Wdescription")
     job.user_id = 1
     storage = OpenERPJobStorage(self.session)
     storage.store(job)
     job_read = storage.load(job.uuid)
     self.assertEqual(job.args, job_read.args)
     self.assertEqual(job_read.args, ('res.users', 'öô¿‽', 'ñě'))
     self.assertEqual(job.kwargs, job_read.kwargs)
     self.assertEqual(job_read.kwargs, {'c': 'ßø'})
     # the job's description has been created as bytestring but is
     # decoded to utf8 by the ORM so make them comparable
     self.assertEqual(job.description, job_read.description.encode('utf8'))
     self.assertEqual(job_read.description, "My dé^Wdescription".decode('utf8'))
开发者ID:OmarQuiroz,项目名称:prestashoperpconnect-install,代码行数:21,代码来源:test_job.py

示例14: test_unicode

# 需要导入模块: from openerp.addons.connector.queue.job import OpenERPJobStorage [as 别名]
# 或者: from openerp.addons.connector.queue.job.OpenERPJobStorage import store [as 别名]
 def test_unicode(self):
     test_job = Job(
         func=dummy_task_args,
         model_name="res.users",
         args=(u"öô¿‽", u"ñě"),
         kwargs={"c": u"ßø"},
         priority=15,
         description=u"My dé^Wdescription",
     )
     test_job.user_id = 1
     storage = OpenERPJobStorage(self.session)
     storage.store(test_job)
     job_read = storage.load(test_job.uuid)
     self.assertEqual(test_job.args, job_read.args)
     self.assertEqual(job_read.args, ("res.users", u"öô¿‽", u"ñě"))
     self.assertEqual(test_job.kwargs, job_read.kwargs)
     self.assertEqual(job_read.kwargs, {"c": u"ßø"})
     self.assertEqual(test_job.description, job_read.description)
     self.assertEqual(job_read.description, u"My dé^Wdescription")
开发者ID:borni-dhifi,项目名称:odoo-magento-modules,代码行数:21,代码来源:test_job.py

示例15: test_accented_bytestring

# 需要导入模块: from openerp.addons.connector.queue.job import OpenERPJobStorage [as 别名]
# 或者: from openerp.addons.connector.queue.job.OpenERPJobStorage import store [as 别名]
 def test_accented_bytestring(self):
     test_job = Job(
         func=dummy_task_args,
         model_name="res.users",
         args=("öô¿‽", "ñě"),
         kwargs={"c": "ßø"},
         priority=15,
         description="My dé^Wdescription",
     )
     test_job.user_id = 1
     storage = OpenERPJobStorage(self.session)
     storage.store(test_job)
     job_read = storage.load(test_job.uuid)
     self.assertEqual(test_job.args, job_read.args)
     self.assertEqual(job_read.args, ("res.users", "öô¿‽", "ñě"))
     self.assertEqual(test_job.kwargs, job_read.kwargs)
     self.assertEqual(job_read.kwargs, {"c": "ßø"})
     # the job's description has been created as bytestring but is
     # decoded to utf8 by the ORM so make them comparable
     self.assertEqual(test_job.description, job_read.description.encode("utf8"))
     self.assertEqual(job_read.description, "My dé^Wdescription".decode("utf8"))
开发者ID:borni-dhifi,项目名称:odoo-magento-modules,代码行数:23,代码来源:test_job.py


注:本文中的openerp.addons.connector.queue.job.OpenERPJobStorage.store方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。