Issue 9161

Title
Assertion when assiging shipment_party in sale.amendment.line
Priority
bug
Status
resolved
Nosy list
ced, reviewbot, rmu, roundup-bot
Assigned to
rmu
Keywords
review

Created on 2020-03-17.14:43:55 by rmu, last changed 7 months ago by roundup-bot.

Messages

New changeset f21eeeac5782 by Robert Schöftner in branch '5.4':
Point shipment_party to party.party
https://hg.tryton.org/modules/sale_amendment/rev/f21eeeac5782
New changeset ca260d8117c8 by Cédric Krier in branch 'default':
Point shipment_party to party.party
https://hg.tryton.org/tryton-env/rev/ca260d8117c8
New changeset 7f0b91e808a5 by Robert Schöftner in branch 'default':
Point shipment_party to party.party
https://hg.tryton.org/modules/sale_amendment/rev/7f0b91e808a5
Author: [hidden] (rmu)
Date: 2020-04-07.14:17:36
so the SQL query is:

alter table sale_amendment_line drop constraint sale_amendment_line_shipment_party_fkey;

followed by any necessary manual cleanup followed by

alter table sale_amendment_line add constraint sale_amendment_line_shipment_party foreign key (shipment_party) references party_party;
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.
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.
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.
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?
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.
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-04-17 14:52:40roundup-botsetmessages: + msg57222
keyword: - backport
2020-04-11 15:16:02roundup-botsetmessages: + msg57019
2020-04-11 15:15:58roundup-botsetstatus: testing -> resolved
nosy: + roundup-bot
messages: + msg57018
2020-04-07 14:17:36rmusetmessages: + msg56939
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

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