Tryton - Issues

 

Issue9161

Title Assertion when assiging shipment_party in sale.amendment.line
Priority bug Status testing
Superseder Nosy List ced, reviewbot, rmu
Type crash Components sale_amendment
Assigned To rmu Keywords backport, review
Reviews 309141002
View: 309141002

Created on 2020-03-17.14:43:55 by rmu, last changed by ced.

Messages
msg56653 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2020-03-25.23:56:04
On 2020-03-25 12:52, Robert Schöftner wrote:
> alter table sale_amendment_line drop constraint sale_amendment_line_shipment_party_fkey;
> alter table sale_amendment_line add foreign key (shipment_party) references party_party;

Yes but we should set an explicit name for the new foreign key.

> in __register__ on condition that the reference points to party_address.

No we can not put in register because it will always be execute even
once fixed.
I would put it in the https://discuss.tryton.org/t/migration-from-5-4-to-5-6/2303
and put a reference in the changelog.
msg56635 (view) Author: [hidden] (rmu) Date: 2020-03-25.12:52:11
so something like

alter table sale_amendment_line drop constraint sale_amendment_line_shipment_party_fkey;
alter table sale_amendment_line add foreign key (shipment_party) references party_party;

in __register__ on condition that the reference points to party_address.

I fear that is outside my expertise how to implement that correctly with the tryton ORM.
msg56634 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2020-03-25.12:34:04
On 2020-03-25 12:12, Robert Schöftner wrote:
> Care to elaborate what that SQL query should do? Avoid having to run database update?

A database update will not change the foreign key because the mechanism
relies only on column names to detect changes. So we need a SQL query to
modify the foreign key in place.
msg56633 (view) Author: [hidden] (rmu) Date: 2020-03-25.12:12:23
Care to elaborate what that SQL query should do? Avoid having to run database update?
msg56631 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2020-03-25.11:11:00
We need a SQL query to fix the foreign key because the reference was not correct.
New review309141002 at https://codereview.tryton.org/309141002/#ps259041002
msg56304 (view) Author: [hidden] (rmu) Date: 2020-03-17.14:43:55
https://hg.tryton.org/modules/sale_amendment/file/tip/sale.py#l232

shipment_party in sale.amendment.line should be Many2One to party.party instead of party.address.
History
Date User Action Args
2020-03-25 23:56:04cedsetmessages: + msg56653
2020-03-25 12:52:11rmusetmessages: + msg56635
2020-03-25 12:34:04cedsetmessages: + msg56634
2020-03-25 12:12:24rmusetmessages: + msg56633
2020-03-25 11:14:55cedsettype: crash
keyword: + backport
2020-03-25 11:11:15cedsetstatus: chatting -> testing
assignedto: rmu
2020-03-25 11:11:07cedsetkeyword: - easy
2020-03-25 11:11:01cedsetnosy: + ced
messages: + msg56631
2020-03-25 11:06:04reviewbotsetstatus: unread -> chatting
nosy: + reviewbot
messages: + msg56629
2020-03-25 11:06:03reviewbotsetreviews: 309141002
keyword: + review

Showing 10 items. Show all history (warning: this could be VERY long)