Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Apps
    Finance
    • Accounting
    • Invoicing
    • Expenses
    • Spreadsheet (BI)
    • Documents
    • Sign
    Sales
    • CRM
    • Sales
    • POS Shop
    • POS Restaurant
    • Subscriptions
    • Rental
    Websites
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Supply Chain
    • Inventory
    • Manufacturing
    • PLM
    • Purchase
    • Maintenance
    • Quality
    Human Resources
    • Employees
    • Recruitment
    • Time Off
    • Appraisals
    • Referrals
    • Fleet
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Events
    • Marketing Automation
    • Surveys
    Services
    • Project
    • Timesheets
    • Field Service
    • Helpdesk
    • Planning
    • Appointments
    Productivity
    • Discuss
    • Approvals
    • IoT
    • VoIP
    • Knowledge
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industries
    Retail
    • Book Store
    • Clothing Store
    • Furniture Store
    • Grocery Store
    • Hardware Store
    • Toy Store
    Food & Hospitality
    • Bar and Pub
    • Restaurant
    • Fast Food
    • Guest House
    • Beverage Distributor
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architecture Firm
    • Construction
    • Estate Management
    • Gardening
    • Property Owner Association
    Consulting
    • Accounting Firm
    • Odoo Partner
    • Marketing Agency
    • Law firm
    • Talent Acquisition
    • Audit & Certification
    Manufacturing
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Corporate Gifts
    Health & Fitness
    • Sports Club
    • Eyewear Store
    • Fitness Center
    • Wellness Practitioners
    • Pharmacy
    • Hair Salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Environmental Agency
    • Billboard Rental
    • Photography
    • Bike Leasing
    • Software Reseller
    Browse all Industries
  • Community
    Learn
    • Tutorials
    • Documentation
    • Certifications
    • Training
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Download
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Events
    • Translations
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Customer References
    • Support
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Pricing
  • Help

Odoo is the world's easiest all-in-one management software.
It includes hundreds of business apps:

  • CRM
  • e-Commerce
  • Knjigovodstvo
  • Zaloga
  • PoS
  • Projekt
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Ključne besede (View all)
odoo accounting v14 pos v15
About this forum
Pomoč

Can't override rml report

Naroči se

Get notified when there's activity on this post

This question has been flagged
invoicermlaccountreportaccount.invoice
3 Odgovori
11081 Prikazi
Avatar
Tomas Parnarauskas

I created module that overrides default invoice and it should use different rml file making it easy to change without changing anything in original account module. But somehow it still used old rml file even though in settings/actions/reports, it shows that report is using my custom rml which is located in my module. When I edit my rml file, nothing changes. When I edit original rml file (that should be overriden and shouldn't affect what will be printed in invoice) it changes my printed invoice, when I edit my rml file nothing changes. Is something went wrong?

My module: print_invoice.py

import time
from openerp.report import report_sxw

class account_invoice(report_sxw.rml_parse):
    def __init__(self, cr, uid, name, context):
        super(account_invoice, self).__init__(cr, uid, name, context=context)
        self.localcontext.update({
            'time': time,
        })

report_sxw.report_sxw(
    'report.custom.account.invoice',
    'account.invoice',
    'addons/report_custom_invoice/report/account_print_invoice_custom.rml',
    parser=account_invoice
)

xml file:

<?xml version="1.0" encoding="utf-8"?>
<openerp>
<data>
    <report
        auto="False"
        id="account.account_invoices"
        model="account.invoice"
        name="custom.account.invoice"
        rml="report_custom_invoice/report/account_print_invoice_custom.rml"
        string="Invoices"
        attachment="(object.state in ('open','paid')) and ('INV'+(object.number or '').replace('/','')+'.pdf')"
        usage="default"
        multi="True" 
     />
</data>
</openerp>

__openerp__.py:

{
    'name': 'Custom Invoice template',
    'version': '1.0',
    'depends': ['base_registry_code'],
    'author': 'OERP',
    'description': """
Account Print Invoice
==========================================

This module customizes default invoice. It adds company registry code in invoice template.

    """,
    'website': '',
    'category': 'report',
    'demo': [],
    'test': [],
    'data': ['account_invoice_report.xml'
    ],
    'auto_install': False,
    'installable': True,
}
0
Avatar
Opusti
Sudhir Arya (ERP Harbor Consulting Services)

Make sure you have import py file in __init__.py.

Tomas Parnarauskas
Avtor

I have import py file in report/__init__.py

Sudhir Arya (ERP Harbor Consulting Services)

Did you add xml file in __openerp__.py?

Avatar
herbert6453
Best Answer

Did you use OpenERP Version 7 ?

In V7 there are different solutions to print. (A top print button with pulldown list, B below print button eg red) Print Button A maybe disappear if multi="True". The report id is hard coded in the method called if you click on print button B.

I have overwritten the invoice_print method and changed the return value to my report. It works for me, maybe there are better solutions.

invoice.py

from osv import osv, fields
from tools.translate import _

class account_invoice(osv.osv):
    _inherit='account.invoice'
    _name='account.invoice'

    def invoice_print(self, cr, uid, ids, context=None):
        res = super(account_invoice, self).invoice_print( cr, uid, ids,context) #self, cr, uid, ids, context)
        res["report_name"] = "custom.account.invoice"
        return res

account_invoice()

__init__.py

import invoice
1
Avatar
Opusti
Tomas Parnarauskas
Avtor

Yes I did use OpenERP 7. I used your code and it worked. Just needed a bit of modifications, because newer openerp revisions changed where osv and tools are located. Now it should be: from openerp.osv import osv, fields from openerp.tools.translate import _ .Thanks.

Avatar
Sudhir Arya (ERP Harbor Consulting Services)
Best Answer

I tried your code and I have doubt that you didn't add your xml file in __openerp__.py.

There is one more thing you need to change in xml that is you need to remove multi="True". Else everything is ok.

multi="True" is used when you want to remove your report from Print option in form view.

Make this changes, restart server and update your module.


Inherit Custom RML Report this may be help you.

1
Avatar
Opusti
Tomas Parnarauskas
Avtor

Don't understan't why it does not work. I removed multi="True". I updated my answer with __openerp__.py file data.

Avatar
Borni DHIFI
Best Answer

Hi,

see this subject Change report in a custom module?

0
Avatar
Opusti
Tomas Parnarauskas
Avtor

I looked into this this one. But it seems like its code is the same as mine (just for different report)

Enjoying the discussion? Don't just read, join in!

Create an account today to enjoy exclusive features and engage with our awesome community!

Prijavi
Related Posts Odgovori Prikazi Aktivnost
how to modify residual in account invoice?
invoice account account.invoice
Avatar
Avatar
1
maj 17
8909
Want to manually edit rml, but which file
invoice rml report
Avatar
Avatar
Avatar
2
avg. 15
10228
Proper way to customize Invoice reports on Odoo 7
invoice rml report
Avatar
Avatar
Avatar
2
mar. 15
9940
Replace invoice template with my own rml file
invoice rml report template
Avatar
4
dec. 23
15793
How can I create a demo data for account invoice?
invoice account account.invoice demo_data
Avatar
1
apr. 22
1887
Community
  • Tutorials
  • Documentation
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Translations
Services
  • Odoo.sh Hosting
  • Support
  • Upgrade
  • Custom Developments
  • Education
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Brand Assets
  • Contact us
  • Jobs
  • Events
  • Podcast
  • Blog
  • Customers
  • Legal • Privacy
  • Security
الْعَرَبيّة Català 简体中文 繁體中文 (台灣) Čeština Dansk Nederlands English Suomi Français Deutsch हिंदी Bahasa Indonesia Italiano 日本語 한국어 (KR) Lietuvių kalba Język polski Português (BR) română русский язык Slovenský jazyk slovenščina Español (América Latina) Español ภาษาไทย Türkçe українська Tiếng Việt

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Odoo's unique value proposition is to be at the same time very easy to use and fully integrated.

Website made with

Odoo Experience on YouTube

1. Use the live chat to ask your questions.
2. The operator answers within a few minutes.

Live support on Youtube
Watch now