Discussion:
[tryton] Delete Class Attributes
Francisco Maria Moyano Casco
2018-03-25 14:37:42 UTC
Permalink
Hi,
I'm working on Tryton 4-2. I'm trying to delete some class attributes, due to a migration, but I had no success.

The code I use is the next one:
......
if table.column_exist('water'):
table.drop_column('water')
if hasattr(cls,'water'):
del cls.water
.......

Any clue why this doesn't work?

Thanks
Francisco
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/ad830319-141e-43e1-84ac-609cb62e1dbd%40googlegroups.com.
Cédric Krier
2018-03-25 14:51:29 UTC
Permalink
Post by Francisco Maria Moyano Casco
Hi,
I'm working on Tryton 4-2. I'm trying to delete some class attributes, due to a migration, but I had no success.
......
table.drop_column('water')
del cls.water
.......
Any clue why this doesn't work?
Why are you deleting it? Just remove the definition from the class.
--
Cédric Krier - B2CK SPRL
Email/Jabber: ***@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/20180325145129.GE5880%40kei.
Francisco Maria Moyano Casco
2018-03-25 20:11:38 UTC
Permalink
Post by Cédric Krier
Post by Francisco Maria Moyano Casco
Hi,
I'm working on Tryton 4-2. I'm trying to delete some class attributes, due to a migration, but I had no success.
......
table.drop_column('water')
del cls.water
.......
Any clue why this doesn't work?
Why are you deleting it? Just remove the definition from the class.
Because, the attributes I want to remove are part of a module base class. So, if I remove the definifinition from it, next time the module would be update to a newer version, I will have to remove again.
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/2f16ab2c-406b-4580-a4b8-79dc76be0ff6%40googlegroups.com.
Cédric Krier
2018-03-25 21:28:53 UTC
Permalink
Post by Francisco Maria Moyano Casco
Post by Cédric Krier
Why are you deleting it? Just remove the definition from the class.
Because, the attributes I want to remove are part of a module base
class. So, if I remove the definifinition from it, next time the
module would be update to a newer version, I will have to remove
again.
You can not remove field from other modules. This will break the other
module.
--
Cédric Krier - B2CK SPRL
Email/Jabber: ***@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/20180325212853.GA3910%40kei.
Francisco Maria Moyano Casco
2018-03-25 21:51:13 UTC
Permalink
Post by Cédric Krier
Post by Francisco Maria Moyano Casco
Post by Cédric Krier
Why are you deleting it? Just remove the definition from the class.
Because, the attributes I want to remove are part of a module base
class. So, if I remove the definifinition from it, next time the
module would be update to a newer version, I will have to remove
again.
You can not remove field from other modules. This will break the other
module.
Ok!

I'm sorry, but why it would break the other modules? Those fields that I want to remove, are not pointed or use by anyother module or report.
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/ab67dbe3-8c3c-45b6-b968-ac7f9a70b0f6%40googlegroups.com.
Cédric Krier
2018-03-25 22:28:48 UTC
Permalink
Post by Francisco Maria Moyano Casco
I'm sorry, but why it would break the other modules? Those fields that
I want to remove, are not pointed or use by anyother module or report.
I guess if the module adds such field, it is because it is used.
If it is not really used, you should request to remove it.
--
Cédric Krier - B2CK SPRL
Email/Jabber: ***@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/20180325222848.GB3910%40kei.
Nicolas Évrard
2018-03-25 21:44:11 UTC
Permalink
Post by Francisco Maria Moyano Casco
Post by Cédric Krier
Post by Francisco Maria Moyano Casco
Hi,
I'm working on Tryton 4-2. I'm trying to delete some class attributes, due to a migration, but I had no success.
......
table.drop_column('water')
del cls.water
.......
Any clue why this doesn't work?
Why are you deleting it? Just remove the definition from the class.
Because, the attributes I want to remove are part of a module base
class. So, if I remove the definifinition from it, next time the
module would be update to a newer version, I will have to remove
again.
Why do you want to remove a field from a base module?
--
Nicolas Évrard - B2CK SPRL
E-mail/Jabber: ***@b2ck.com
Tel: +32 472 54 46 59
Website: http://www.b2ck.com/
--
You received this message because you are subscribed to the Google Groups "tryton" group.
To view this discussion on the web visit https://groups.google.com/d/msgid/tryton/20180325214411.jd5wi4bqxptatsg2%40localhost.localdomain.
Loading...