Skip to content

Commit 547538b

Browse files
committed
[IMP] avoid base_sparse_field --load
`base_sparse_field` patches odoo fields in order to be able to use `fields.Serialized`. To "pay" this shortcut you have to load it at server load which makes harder to test it with external tools (ie: pytest) and disorient first users as they always miss this step. Now we load the field straight from the module: easy, neat, works.
1 parent e9da1b7 commit 547538b

2 files changed

Lines changed: 7 additions & 2 deletions

File tree

queue_job/README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ Configuration
7676

7777
- if ``xmlrpc_port`` is not set: ``ODOO_QUEUE_JOB_PORT=8069``
7878

79-
* Start Odoo with ``--load=web,base_sparse_field,queue_job``
79+
* Start Odoo with ``--load=web,queue_job``
8080
and ``--workers`` greater than 1. [1]_
8181

8282

queue_job/models/queue_job.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
from datetime import datetime, timedelta
77

88
from odoo import models, fields, api, exceptions, _
9+
# Import `Serialized` field straight to avoid:
10+
# * remember to use --load=base_sparse_field...
11+
# * make pytest happy
12+
# * make everybody happy :
13+
from odoo.addons.base_sparse_field.models.fields import Serialized
914

1015
from ..job import STATES, DONE, PENDING, Job
1116
from ..fields import JobSerialized
@@ -41,7 +46,7 @@ class QueueJob(models.Model):
4146

4247
model_name = fields.Char(string='Model', readonly=True)
4348
method_name = fields.Char(readonly=True)
44-
record_ids = fields.Serialized(readonly=True)
49+
record_ids = Serialized(readonly=True)
4550
args = JobSerialized(readonly=True)
4651
kwargs = JobSerialized(readonly=True)
4752
func_string = fields.Char(string='Task', compute='_compute_func_string',

0 commit comments

Comments
 (0)