Maintainers
+Maintainers
This module is part of the nuobit/odoo-addons project on GitHub.
You are welcome to contribute.
diff --git a/connector_extension/models/binding/binding.py b/connector_extension/models/binding/binding.py
index 53de6e30e..0ac681242 100644
--- a/connector_extension/models/binding/binding.py
+++ b/connector_extension/models/binding/binding.py
@@ -38,6 +38,27 @@ def import_data(self, backend_record, domain=None, delayed=True):
@api.model
def export_data(self, backend_record, domain=None, delayed=True):
"""Prepare the batch export records to Channel"""
+ # Cursor-rebind workaround for OCA/queue queue_job (16.0+).
+ # `Job.in_temporary_env()` (added by OCA/queue#910 / commit f2bfda90)
+ # only rebinds `self.recordset` to the new cursor opened when
+ # `allow_commit=True`; it does NOT rebind args. Without this manual
+ # rebind, `backend_record.work_on()` builds a `WorkContext` whose
+ # `env` is the OUTER cursor (with `_prevent_commit` patched on
+ # `cr.commit`), so `binder.bind_export()` at `binder.py:315` still
+ # raises RuntimeError("Commit is forbidden in queue jobs") despite
+ # `allow_commit=True` being set. Pattern (cursor-only swap, preserves
+ # uid/su/context captured at `_job_prepare_context_before_enqueue`)
+ # matches what queue_job uses internally for `self.recordset`, and
+ # what @guewen (queue_job maintainer) himself suggested in
+ # OCA/queue#889 ("such export_record and such are implementation
+ # specific and need to be fixed in many places"). The OCA wiki page
+ # https://github.com/OCA/queue/wiki/Upgrade-warning:-commits-inside-jobs
+ # does NOT document this args-rebinding limitation.
+ # Same fix applied below in export_batch, export_record,
+ # export_delete_record. Imports do not need it because bind_import
+ # does not commit.
+ # Refs: OCA/queue#889, OCA/queue#910, OCA/connector#522.
+ backend_record = backend_record.with_env(backend_record.env(cr=self.env.cr))
if delayed:
model = self.with_delay()
return model.export_batch(
@@ -61,6 +82,8 @@ def import_batch(self, backend_record, domain=None, delayed=True, use_data=True)
@api.model
def export_batch(self, backend_record, domain=None, delayed=True):
"""Prepare the batch export of records modified on Odoo"""
+ # Cursor-rebind workaround for queue_job; see export_data for rationale.
+ backend_record = backend_record.with_env(backend_record.env(cr=self.env.cr))
if not domain:
domain = []
with backend_record.work_on(self._name) as work:
@@ -102,6 +125,9 @@ def import_record(self, backend_record, external_id, sync_date, external_data=No
@api.model
def export_record(self, backend_record, relation):
"""Export Odoo record"""
+ # Cursor-rebind workaround for queue_job; see export_data for rationale.
+ backend_record = backend_record.with_env(backend_record.env(cr=self.env.cr))
+ relation = relation.with_env(relation.env(cr=self.env.cr))
with backend_record.work_on(self._name) as work:
exporter = work.component(usage="record.direct.exporter")
return exporter.run(relation)
@@ -109,6 +135,9 @@ def export_record(self, backend_record, relation):
@api.model
def export_delete_record(self, backend_record, relation):
"""Export Odoo record"""
+ # Cursor-rebind workaround for queue_job; see export_data for rationale.
+ backend_record = backend_record.with_env(backend_record.env(cr=self.env.cr))
+ relation = relation.with_env(relation.env(cr=self.env.cr))
with backend_record.work_on(self._name) as work:
deleter = work.component(usage="record.direct.export.deleter")
return deleter.run(relation)
diff --git a/connector_sapb1/README.rst b/connector_sapb1/README.rst
index d11a32361..655cfe4ac 100644
--- a/connector_sapb1/README.rst
+++ b/connector_sapb1/README.rst
@@ -1,3 +1,7 @@
+.. image:: https://odoo-community.org/readme-banner-image
+ :target: https://odoo-community.org/get-involved?utm_source=readme
+ :alt: Odoo Community Association
+
================
Connector SAP B1
================
@@ -13,7 +17,7 @@ Connector SAP B1
.. |badge1| image:: https://img.shields.io/badge/maturity-Beta-yellow.png
:target: https://odoo-community.org/page/development-status
:alt: Beta
-.. |badge2| image:: https://img.shields.io/badge/licence-AGPL--3-blue.png
+.. |badge2| image:: https://img.shields.io/badge/license-AGPL--3-blue.png
:target: http://www.gnu.org/licenses/agpl-3.0-standalone.html
:alt: License: AGPL-3
.. |badge3| image:: https://img.shields.io/badge/github-nuobit%2Fodoo--addons-lightgray.png?logo=github
diff --git a/connector_sapb1/__manifest__.py b/connector_sapb1/__manifest__.py
index c641ccf28..e780bcbe5 100644
--- a/connector_sapb1/__manifest__.py
+++ b/connector_sapb1/__manifest__.py
@@ -3,7 +3,7 @@
{
"name": "Connector SAP B1",
- "version": "16.0.1.0.0",
+ "version": "16.0.1.0.1",
"author": "NuoBiT Solutions SL",
"license": "AGPL-3",
"category": "Connector",
diff --git a/connector_sapb1/data/queue_job_function_data.xml b/connector_sapb1/data/queue_job_function_data.xml
index c78e149d2..8802e8c3f 100644
--- a/connector_sapb1/data/queue_job_function_data.xml
+++ b/connector_sapb1/data/queue_job_function_data.xml
@@ -17,4 +17,60 @@ License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl)-->
SAP Business One connector
Table of contents
Bugs are tracked on GitHub Issues. In case of trouble, please check there if your issue has already been reported. If you spotted it first, help us to smash it by providing a detailed and welcomed @@ -392,15 +397,15 @@
Do not contact contributors directly about support or help with technical issues.
This module is part of the nuobit/odoo-addons project on GitHub.
You are welcome to contribute.