Order Response, order_line match
Closed this issue · 3 comments
Hi @lmignon
I have a question about to match order lines between order
and order response
line_number arg is an incremental number from 1 to the number of lines
https://github.com/OCA/edi/blob/10.0/purchase_order_ubl/models/purchase.py#L158
Here in test you assign to ID tag of your LineItem the db id of your purchase.order.line
https://github.com/OCA/edi/blob/10.0/purchase_order_import_ubl/tests/test_order_response_import.py#L52
... and here you check that ID tag is the same than order_line[i].id
https://github.com/OCA/edi/blob/10.0/purchase_order_import/wizard/order_response_import.py#L279
I think it's a good idea to match these order with database id but that's not what do the line_number in purchase_order_ubl/models/purchase.py#L158
Maybe I missed something ?
I don't know how it really works in your workflow (maybe custom code ?) but I have to make it ok in my case #226
I don't want make update your code but just want to know if your're ok my proposal to be implemented on v8 and upper than v10:
Don't use ID tag to store purchase.order.line id fields but choose a tag among these http://www.datypic.com/sc/ubl22/e-cac_LineItem.html : candidates are LineReference or SalesOrderID
I also try to use another but it seems it was a bad idea.
#297
I have to choose a more adhoc one. Could you help me here. Thanks
Hi @bealdav
Indeed, something is missing into the code of purchase_order_ubl.
In my code I've overridden the method _ubl_add_order_line
to always use the db line id as value for ID tag
@api.multi
def _ubl_add_order_line(self, parent_node, oline, line_number, ns, version="2.1"):
"""
Overrides to use the po line id as identifier
"""
return super(PurchaseOrder, self)._ubl_add_order_line(
parent_node, oline, oline.id, ns, version=version
)
According to the specification, the ID tag is the identifier for this line item, assigned by the buyer. That's therefore the tag to use to provide a reliable and immutable ID for our line. IMO, the initial implementation is not right since it depends of the order of the lines into the PO. Nothing ensures that this id always reference the same line into the PO. IMO, we should change the code into https://github.com/OCA/edi/blob/10.0/purchase_order_ubl/models/purchase.py#L158
Hi @lmignon thanks for your feedback.
Ok probably we firstly have to change in v13.0 to avoid a falsy duplicate in 14.0
There hasn't been any activity on this issue in the past 6 months, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 30 days.
If you want this issue to never become stale, please ask a PSC member to apply the "no stale" label.