Skip to content

[19.0][MIG] purchase_order_import: Migration to 19.0#1335

Open
yankinmax wants to merge 20 commits into
OCA:19.0from
camptocamp:19.0-mig-purchase_order_import
Open

[19.0][MIG] purchase_order_import: Migration to 19.0#1335
yankinmax wants to merge 20 commits into
OCA:19.0from
camptocamp:19.0-mig-purchase_order_import

Conversation

@yankinmax
Copy link
Copy Markdown
Contributor

@yankinmax yankinmax commented Apr 27, 2026

@OCA-git-bot OCA-git-bot added series:19.0 mod:purchase_order_import Module purchase_order_import labels Apr 27, 2026
@yankinmax yankinmax force-pushed the 19.0-mig-purchase_order_import branch 2 times, most recently from 99c0744 to deccd3f Compare April 28, 2026 06:18
@yankinmax yankinmax force-pushed the 19.0-mig-purchase_order_import branch from deccd3f to 22d3f77 Compare April 28, 2026 12:40
@yankinmax
Copy link
Copy Markdown
Contributor Author

Hello @vvrossem @ivantodorovich
Can you pls take a look?

Comment thread purchase_order_import/tests/common.py Outdated
Comment thread purchase_order_import/tests/test_order_response_import_wizard.py Outdated
Comment thread purchase_order_import/tests/common.py Outdated
Comment thread purchase_order_import/wizard/purchase_order_import_wizard.py Outdated
Comment thread purchase_order_import/wizard/purchase_order_import_wizard.py Outdated
@yankinmax yankinmax force-pushed the 19.0-mig-purchase_order_import branch from 22d3f77 to 5dc53fb Compare April 29, 2026 07:10
Comment thread test-requirements.txt Outdated
@yankinmax yankinmax force-pushed the 19.0-mig-purchase_order_import branch from 5dc53fb to 1fca1af Compare April 29, 2026 11:17
@yankinmax
Copy link
Copy Markdown
Contributor Author

Hello @OCA/edi-maintainers can you pls take a look and possibly trigger merge?

Comment thread purchase_order_import/tests/__init__.py Outdated
@@ -0,0 +1,2 @@
from . import common
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never import common files here

Comment thread purchase_order_import/tests/common.py Outdated
@classmethod
def setUpClass(cls):
super().setUpClass()
cls.env = cls.env(context=dict(cls.env.context, tracking_disable=True))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BaseCommon already disables tracking if I'm not wrong



class OrderResponseImportWizard(models.TransientModel):
_name = "order.response.import.wizard"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
_name = "order.response.import.wizard"
_name = "purchase.order.response.import.wizard"

purchase_order.button_approve()

@api.model
def _process_conditional(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this method looks too big

vals["incoterm_id"] = incoterm.id
return vals

def update_order_lines(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quite big...

"product_qty": import_line.get("qty") or 1.0,
"product_uom_id": uom.id,
}
vals.update(polo.play_onchanges(vals, ["product_id"]))
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
vals.update(polo.play_onchanges(vals, ["product_id"]))

I believe we can drop this, as all relevant fields have been moved to computed fields in core.
Then, we can drop the onchange_helper dependency

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see your point and agree.

  1. onchange_helper as dependency is only needed for this call vals.update(polo.play_onchanges(vals, ["product_id"]))
  2. In Odoo 19, pucrhase.order.line::create calls _prepare_add_missing_fields which is doing the same:
@api.model
def _prepare_add_missing_fields(self, values):
    """ Deduce missing required fields from the onchange """
    res = {}
    onchange_fields = ['name', 'price_unit', 'product_qty', 'product_uom_id', 'tax_ids', 'date_planned']
    if values.get('order_id') and values.get('product_id') and any(f not in values for f in onchange_fields):
        line = self.new(values)
        line.onchange_product_id()
        for field in onchange_fields:
            if field not in values:
                res[field] = line._fields[field].convert_to_write(line[field], line)
    return res
  1. Leave imported price_unit, product_qty and product_uom_id.

alexis-via and others added 15 commits May 20, 2026 10:45
because we want to have access to the code of the modules that inherit business.document.import
Add support for partner bank matching on invoice update (before, it was only supported on invoice creation)
Rename __openerp__.py to __manifest__.py and set installable to False
… module

Fix spelling mistake and other remarks on README by Tarteo
Add ubl invoice generation option in accounting config page
… has visible discounts

Code improvements in sale_order_import
Add unit tests in sale_order_import
Use display_name instead of name_get()[0][1]
…iness document is imported in the right company
Updated by Actualizar ficheiros PO com o novo POT (msgmerge) hook in Weblate.
the method play_onchange in server-tools/onchange_helper
only returns the changed keys in the dictionary it receives as first arguement.
The code in account_invoice_import, purchase_order_import and sale_order_import
was written as if all the keys were returned. Maybe the behavior of play_onchange
was updated in a recent version, but this nevertheless needs fixing in this module.

This should fix the unit tests which are red on this branch.
The ORderResponce document allows a supplier to communicate the ack and the confirmation of an Order documnet. Depending of its content, the PO will be cancelled or confirmed. If the OrderResponse document contains some amended line, the import process will update the picking to reflect the changes
@yankinmax yankinmax force-pushed the 19.0-mig-purchase_order_import branch from 0e4d197 to 9321421 Compare May 20, 2026 07:45
@yankinmax
Copy link
Copy Markdown
Contributor Author

Hello @simahawk @ivantodorovich your suggestions are applied.
Can you pls trigger merge here?

Copy link
Copy Markdown
Contributor

@jbaudoux jbaudoux left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG but I wouldn't rename the wizard files as it prevents to see the migration changes and won't be convenient for later porting imp/fixes

@yankinmax
Copy link
Copy Markdown
Contributor Author

LG but I wouldn't rename the wizard files as it prevents to see the migration changes and won't be convenient for later porting imp/fixes

Can you pls check if this is ok for you now?

@cyrilmanuel
Copy link
Copy Markdown

hi @jbaudoux can i ask you a quick review :P

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:purchase_order_import Module purchase_order_import series:19.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.