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

Hello,

I have installed the module base_report_to_printer to directly print some reports to printer.

Now, I would like to trigger the reporting when using a validate button (ex : produce invoice from sale.order). So that means I want the server to produce the report and to send it to cups.

Is there any way to do it?

Thanks,

David

아바타
취소

Have you tried making the method to return a report action?

베스트 답변

hi david

try this

.xml

<button name="Method_name" string="Print Report" type="object"/>

.py

def Method_name(self, cr, uid, ids, context=None):

    model_obj = self.pool.get("model.name")

    domain = [('assort_id', 'in', ids)]

    model_ids= model_obj.search(cr, uid, domain,context=context)

return self.pool.get('report').get_action(cr, uid, model_ids, 'report_name', context=context)

  Thank you

아바타
취소
베스트 답변

On button click you will call this method and in method you will put validation you want and return report after validation.

def METHOD_NAME(self, cr, uid, ids, context=None):

datas = {

'active_ids': ids,

'active_model': 'MODEL OBJECT',

}

return {'type': 'ir.actions.report.xml', 'report_name': 'rREPORT NAME', 'datas': datas, 'nodestroy': True}

Hope you will get your answer.

아바타
취소