콘텐츠로 건너뛰기
메뉴
커뮤니티에 참여하려면 회원 가입을 하시기 바랍니다.
신고된 질문입니다
2 답글
2165 화면

Hello,

I want to include a count for the number of lines present in my table (include products, sections, notes).

How can I achieve that?

아바타
취소
베스트 답변

Hi,
If you need the information inside a report template, you can just add this line of code in the needed place:  len(doc.order_line)

Thanks

아바타
취소

<t t-esc="len(doc.order_line)"/>

베스트 답변

Hi,

from odoo import models, fields, api
class SaleOrder(models.Model):
    _inherit = 'sale.order'

    line_count = fields.Integer(string='Number of Lines',
                                compute='_compute_line_count')

    def _compute_line_count(self):
        for order in self:
            order.line_count = len(order.order_line)

the order_line length includes the section and note values 


Hope it helps

아바타
취소
관련 게시물 답글 화면 활동
3
10월 24
8133
3
9월 24
8215
3
9월 24
4021
1
9월 24
2195
0
12월 24
1854