Tryton - Issues

 

Issue6342

Title Attachment Delete and Undelete
Priority bug Status testing
Superseder Nosy List ced, mike_arbib, pokoli, reviewbot
Type behavior Components sao, tryton
Assigned To ced Keywords review
Reviews 32121002,30131002
View: 32121002, 30131002

Created on 2017-03-08.17:23:12 by mike_arbib, last changed by pokoli.

Files
File name Uploaded Type Edit Remove
attach_1.png mike_arbib, 2017-03-08.17:23:12 image/png
attach_2.png mike_arbib, 2017-03-08.17:23:33 image/png
attach_3.png mike_arbib, 2017-03-08.17:23:40 image/png
attach_4.png mike_arbib, 2017-03-08.17:23:45 image/png
attach_5.png mike_arbib, 2017-03-08.17:23:52 image/png
Messages
msg32672 (view) Author: [hidden] (pokoli) (Tryton committer) Date: 2017-03-22.12:13:14
Here are my steps to reproduce: 

1. Go to Parties -> Parties menu
2. From the list view open the attachments of the first record
3. Add a new attachment and save with the OK button
4. Reopen the attachments and select the delete button to remove the attachment. The record is marked as to delete.
5. When I click the OK button to save the deletion the error permision error is shown

Indeed I can only reproduce it on tryton but not on sao.
msg32635 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-03-21.20:49:04
I can not reproduce such traceback on tryton neither on sao.
msg32443 (view) Author: [hidden] (pokoli) (Tryton committer) Date: 2017-03-13.12:50:20
> I do not understand msg32441. Why is it on this issue?

Because I only get it with the applied patch
msg32442 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-03-13.12:48:52
I do not understand msg32441. Why is it on this issue?
msg32441 (view) Author: [hidden] (pokoli) (Tryton committer) Date: 2017-03-13.12:34:44
I got the following traceback after deleting an existing attachment on tryton:

13110 139633896908544 [2017-03-13 11:30:29,403] DEBUG trytond.protocols.dispatcher <class 'trytond.ir.attachment.ir.attachment'>.read(*([4], [u'resource', u'name', u'type', u'summary', u'last_modification', u'last_user', u'data', u'resource.rec_name', u'rec_name', u'_timestamp'], {u'language': u'es', u'locale': {u'date': u'%d/%m/%Y', u'thousands_sep': u'.', u'decimal_point': u',', u'grouping': [3, 3, 0]}, u'language_direction': u'ltr', '_check_access': True, u'company.rec_name': u'Demo Company, S.L', u'groups': [9, 10, 15, 14, 18, 8, 7, 1, 19, 23, 24, 5, 16, 33, 32, 6, 2, 17, 4, 30, 21, 22, 3, 26, 25, 29, 27, 28, 31, 12, 11, 13, 20], u'employee': None, u'company': 1, u'ir.attachment.data': u'size'}), **{}) from admin@127.0.0.1//demo/
Traceback (most recent call last):
  File "/home/sergi/projectes/develop/trytond/trytond/protocols/dispatcher.py", line 162, in _dispatch
    result = rpc.result(meth(*c_args, **c_kwargs))
  File "/home/sergi/projectes/develop/trytond/trytond/ir/resource.py", line 76, in read
    cls.check_access(ids, mode='read')
  File "/home/sergi/projectes/develop/trytond/trytond/ir/resource.py", line 69, in check_access
    if record.resource:
  File "/home/sergi/projectes/develop/trytond/trytond/model/fields/field.py", line 267, in __get__
    return inst.__getattr__(self.name)
  File "/home/sergi/projectes/develop/trytond/trytond/model/modelstorage.py", line 1367, in __getattr__
    read_data = self.read(list(ids), ffields.keys())
  File "/home/sergi/projectes/develop/trytond/trytond/ir/resource.py", line 77, in read
    return super(ResourceMixin, cls).read(ids, fields_names=fields_names)
  File "/home/sergi/projectes/develop/trytond/trytond/model/modelsql.py", line 726, in read
    cls.raise_user_error('read_error', cls.__name__)
  File "/home/sergi/projectes/develop/trytond/trytond/error.py", line 74, in raise_user_error
    raise UserError(error)
UserError: ('UserError', (u'Est\xe1 intentando leer registros que ya no existen.\n(Tipo de documento: ir.attachment)', ''))
13110 139633896908544 [2017-03-13 11:30:29,406] INFO werkzeug 127.0.0.1 - - [13/Mar/2017 11:30:29] "POST /demo/ HTTP/1.1" 200 -

This is raised on the server after clicking the OK button with a record marked as to remove.

I'm using latest trunk client.
msg32390 (view) Author: [hidden] (mike_arbib) Date: 2017-03-09.13:59:36
I understand.
Despite this, I had to fix it so I looked for the solution and found it here : https://bugs.tryton.org/issue5558

Thank you
msg32379 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-03-09.11:20:13
No, we have a strict rules about backport and this behaviour improvement are not part of.
msg32378 (view) Author: [hidden] (mike_arbib) Date: 2017-03-09.10:54:21
I currently work on a 3.8 client, I think it's why it only works partially.
I also applied the patch on 4.0 client and it works fine, as on 4.2.

Do you think it's possible to fix the 3.8 client ? Thanks
msg32374 (view) Author: [hidden] (mike_arbib) Date: 2017-03-09.09:19:40
My mistake, it effectively works fine on 4.2
msg32369 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-03-08.19:55:09
On 2017-03-08 18:49, Michael Arbib wrote:
> The undelete button doesn't reset the line to its initial state but it's only a visual issue. When clicking it and validate, the attachment is well restored.

I can not reproduce, it works as expected here.
msg32368 (view) Author: [hidden] (mike_arbib) Date: 2017-03-08.18:49:56
Thanks for the patch.

I applied it and the delete button grey tints the line instead of delete it directly.

The undelete button doesn't reset the line to its initial state but it's only a visual issue. When clicking it and validate, the attachment is well restored.
review30131002 updated at https://codereview.tryton.org/30131002/#ps1
review32121002 updated at https://codereview.tryton.org/32121002/#ps1
msg32365 (view) Author: [hidden] (ced) (Tryton committer) (Tryton translator) Date: 2017-03-08.17:56:41
This happens since r 6dfb2a0a7211 because Group.remove actually remove the record if there is no parent. But I think this test should not exist because we have the force_remove flag. Indeed this removal should only happen on main record and the delete button set the force_remove.
msg32364 (view) Author: [hidden] (mike_arbib) Date: 2017-03-08.17:23:12
Hi, 

When deleting an attachment via the client, I can't undelete it by clicking the "Undelete selected record" because the attachment line is immediately removed.

I tried on another view (Party) with the party adresses : it works fine, i can delete a record then its line is grey tinted.

I would have expected the same behavior.
History
Date User Action Args
2017-03-22 12:13:14pokolisetmessages: + msg32672
2017-03-21 20:49:04cedsetmessages: + msg32635
2017-03-13 12:50:20pokolisetmessages: + msg32443
2017-03-13 12:48:52cedsetmessages: + msg32442
2017-03-13 12:34:45pokolisetnosy: + pokoli
messages: + msg32441
2017-03-09 13:59:36mike_arbibsetmessages: + msg32390
2017-03-09 11:20:14cedsetmessages: + msg32379
2017-03-09 10:54:21mike_arbibsetmessages: + msg32378
2017-03-09 09:19:40mike_arbibsetmessages: + msg32374
2017-03-08 19:55:09cedsetmessages: + msg32369

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