Odoo Help

0

0
2 Відповіді
1
Аватар

Ibrahim Boudmir Марокко

--Ibrahim Boudmir--
4537
| 6 3 7
Casablanca, Марокко
--Ibrahim Boudmir--


Ibrahim Boudmir Марокко
03.01.19, 09:29

Hi, 

@api.multi
def _compute_attachment_count(self):
        Attachment = self.env['ir.attachment']
        for record in self:
            record.attachment_count = Attachment.search_count([('res_model', '=', self._name), ('res_id', '=', record.id)])

Upvote if this helps.

Thanks.


0
Paul В'єтнам
03.01.19, 10:03

thank you ibrahim, it does not work properly. I don't understand why it happened like that.

The problem becomes more complex than I think. when create does not manually res_model and res_id, so it cannot be counted.

2 Коментар
Ibrahim Boudmir Марокко
03.01.19, 11:22

does my answer work properly for you ? or is there a problem with it ?

Paul В'єтнам
03.01.19, 20:54

nó không hoạt động trong khi create or import. tôi không biết nó ra lỗi gì mà không oạt động

Задайте запитання
Автор
Продовжити інформувати
1 підписник(и)
Про цю спільноту

This platform is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

Register
Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now