Odoo Ajuda

0

0
2 Respostas
1
Avatar

Ibrahim Boudmir Marrocos

--Ibrahim Boudmir--
4537
| 6 3 7
Casablanca, Marrocos
--Ibrahim Boudmir--


Ibrahim Boudmir Marrocos
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 Vietnã
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 Comentários
Ibrahim Boudmir Marrocos
03/01/19 11:22

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

Paul Vietnã
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

Faça uma Pergunta
Writer
Keep Informed
1 seguidor (es)
About This Community

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