Merge lp:~camptocamp/openobject-addons/extra-trunk-base_external_referentials-subexport-no-cr into lp:openobject-addons/extra-trunk
Status: | Needs review |
---|---|
Proposed branch: | lp:~camptocamp/openobject-addons/extra-trunk-base_external_referentials-subexport-no-cr |
Merge into: | lp:openobject-addons/extra-trunk |
Diff against target: |
64 lines (+19/-6) 1 file modified
base_external_referentials/external_osv.py (+19/-6) |
To merge this branch: | bzr merge lp:~camptocamp/openobject-addons/extra-trunk-base_external_referentials-subexport-no-cr |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
MagentoERPConnect core editors | Pending | ||
Alexandre Fayolle - camptocamp | Pending | ||
Review via email: mp+130386@code.launchpad.net |
Description of the change
Hi,
This fix the issue:
https:/
You'll find the explanation of why the bug occurs in the report.
Alexandre, you'll see what I meant by sub-transactions, even if there are not sub-transactions at database level, obviously, transactions are strictly parallel on the database point of view, but we really nest the exports. I had a misuse of language, but the the result is the same, we are not able to see transaction B from transaction A, because B is opened, committed & closed between the opening, committing & closing of transaction A.
My proposal is based on the current logic used in the import.
When a `export_no_new_cr` key is present in the context, it keeps the current transaction, and that sounds logical because if the export of the category fails, I expect that the export of the product (which wanted to export the category) fails too.
But, this implementation is sensible because if the context is not properly passed all the chain of calls, a new transaction would be opened and we could have the same sort of issues.
I think we would better have to apply the reverse logic, so to never open a new transaction, unless it is asked, and modify the top level exports and imports to use this new method or argument.
But it would require much more changes on the actual code base.
I have one doubt concerning the case when we are in a sub-export and we get an error. We do not rollback the cr, it has to be rollbacked by the main export. We have to raise the exception again to propagate it.
Normally, the `log_failed()` method should do it, because when we are in a sub-export, this latter raise when the key `use_external_log` is not in the context, and it is removed from the context for sub-exports. That's a bit tricky but it should do it.
Again, the problem would be if the context is not properly passed.
Unmerged revisions
- 5823. By Guewen Baconnier @ Camptocamp <email address hidden>
-
[FIX] issue lp:1068174 records created on magento during an sub-export are not visible in the export
When a new transaction is opened for an export and this export have sub-exports (exports in the mappings for example),
the sub-exports must not open new transactions, otherwise, the transaction of the main export will not be able
to read the data written by the sub-exports (external ids created principally).This implementation is sensible because the `export_no_new_cr` has to be propagated through the context,
and if the context chain is broken, it will open a new transaction regardless. It would maybe be better in
the other way, no new cr by default, and explicitely ask for a new cr on top level exports, but it would require
to search and change all the top level export, and do the same for the imports to have a consistant logic between them.