Skip to content

Sale Order Line on change not updating product name #73

@john-herholz-dt

Description

@john-herholz-dt

I was investigating why the product name was not updated after the onchange event on sale order line product_id field.
The onchange was triggered but I found following problem that I cannot explain:

Module

connector-ecommerce

Describe the bug

Product name not updating via sale_order_onchange component

To Reproduce

14.0

Steps to reproduce the behavior:

  1. Import sale order through connector framework (I used Magento Connector customized)

Expected behavior
Product name in the sale order line updating

Problem found here

 def get_new_values(self, record, on_change_result, model=None):
        vals = on_change_result.get("value", {})
        new_values = {}
        for fieldname, value in vals.items():
            if fieldname not in record:
                if model:
                    column = self.env[model]._fields[fieldname]
                    if column.type == "many2one":
                        value = value[0]  # many2one are tuple (id, name)
                new_values[fieldname] = value
        return new_values

file components/sale_order_onchange.py line 17:
if fieldname not in record

This prevents the update, because the name field is in the record.
Can it be the "not" is wrong here? Why is it there actually?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions