Skip to Content
Menu
This question has been flagged

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

Avatar
Discard
Best Answer

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

Avatar
Discard
Author

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

Author

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

Related Posts Replies Views Activity
2
Feb 24
3101
0
Nov 23
1302
0
Nov 23
873
1
Oct 23
4233
1
Dec 23
1138