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

I have a report on the account.invoice model and want to show how many products in the invoice line. Below will show a picture of what I want to do.


Image: http://es.zimagez.com/zimage/progorma.php


The idea is to count how many products there are on the invoice and return the number of the quantity of products.

Maybe it may be simple, but really do not know everything about Odoo.

Thanks for your advice and help.

아바타
취소

Can You post your code ?

베스트 답변

Hi James,

You can run counter.

Before your for loop: 

<t t-set="counter" t-value="0"/>
in for loop : 

<t  t-set="counter" t-value="counter + 1"/>
After for loop you can print it like:

<t t-esc="counter"/> 

Hope this helps.

Thanks

아바타
취소

its works for me thanks

Is it possible to break a table when count of product equals 7 and to print the rest records in second page of qweb? (like printing 7 products per page)

베스트 답변

There a good modules implement what you want on v8.0 but on sales order you can find it on

https://www.odoo.com/apps/modules/8.0/sale_printout_sequence/

And for picking 

https://www.odoo.com/apps/modules/8.0/stock_picking_sequence/

Hope that's help you

Regards

아바타
취소
베스트 답변

I try to query into report, it's working...


class customer_report(models.Model):

  _name = "customer.report"

 _description = "Orders Statistics"

 _auto = False

 name = fields.Many2one('res.partner', readonly=True)

 p_id = fields.Many2one('preorder.config','PreOrder Ref')

 tot_product = fields.Integer('# of Unique Product')

 tot_piece = fields.Integer('# of Piece')

 

 def init(self, cr):

 """Initialize the sql view for the event registration """

 tools.drop_view_if_exists(cr, 'customer_report')


 # TOFIX this request won't select events that have no registration

 cr.execute(""" CREATE VIEW customer_report AS (

 select

 poc.id::varchar || '/' || coalesce(poc.id::varchar,'') AS id,

 poui.customer AS p_id,

 poui.partner_id AS name,

 count(pl.product_id) AS tot_product,

 count(poc.id) AS tot_piece

 from

 preorder_config poc

 left join preorder_user_input poui on (poui.preorder_id = poc.id)

 left join preorder_product_rel ppr on (ppr.preorder_id = poc.id)

 left join preorder_user_input_product_line pl on (pl.user_input_id = poui.id)

 group by

 poc.id, poui.preorder_id, poui.partner_id

 )

 """)

아바타
취소