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

Hello

I am trying to customize the invoice layout in the accounting module in odoo 16 but I dont want to mess with the default views so I want to create another option under the print menu. 

I have inherited account.move​ model into my custom model ice.report​ as follows:

from odoo import fields, api, models

class CustomIceReport(models.Model):

_name = 'ice.report'
_inherits = {'account.move': 'transaction_ids'}
_description = 'Custom industrial control equipment'

transaction_ids = fields.Many2one('account.move', string='Transaction ID', required=True, ondelete="cascade")

I can confirm the fields in my custom model have been extended taking from account.move​.


I defined the report like so  




using the binding model I thought it would automatically include it under the print menu but I cannot see it. The template file ice_report.ice_report_template​ exists under the ice_report​ directory. 


record id="ice_report_action" model="ir.actions.report"
field name="name" Ice Invoice field
field name="model" ice.report /
field name="report_type" qweb-pdf /
field name="report_name" ice_report.ice_report_template /
field name="report_file" ice_report.ice_report_template /
field name="binding_model_id" ref="account.model_account_move" /
field name="binding_type" report field
record



I assume this is where I am missing something. I am new to the job and the system and still trying to wrap my head around it. I get that an action would be triggered if the custom button is clicked, the data defined in the model would be rendered through the template. Don't know which part I overlooked.

Thank you for the help

아바타
취소
베스트 답변

Hi,

Please refer to our blog. It may seem to be helpful

https://www.cybrosys.com/blog/how-to-create-a-custom-pdf-report-in-odoo-16


Hope it helps

아바타
취소
작성자

Thank you
I have read the blog three times and everytime i am able to create a custom app, create the report and print it however for my use case i am inheriting from account.move, a standard odoo model using the _inherits option
That worked well but then upon binding my action to the account.move model my custom option does not appear.
setting the binding id to model_account_move and model_ice_report(my custom model inheriting from account.move) still it does not appear

작성자

Like in the blog what if product.product inherited account.move and we want to add the print option in the view of account.move

관련 게시물 답글 화면 활동
2
2월 24
3779
0
11월 23
2147
0
11월 23
1647
1
10월 23
6487
1
12월 23
2081