Skip to Content
Odoo Menú
  • Registra entrada
  • Prova-ho gratis
  • Aplicacions
    Finances
    • Comptabilitat
    • Facturació
    • Despeses
    • Full de càlcul (IA)
    • Documents
    • Signatura
    Vendes
    • CRM
    • Vendes
    • Punt de venda per a botigues
    • Punt de venda per a restaurants
    • Subscripcions
    • Lloguer
    Imatges de llocs web
    • Creació de llocs web
    • Comerç electrònic
    • Blog
    • Fòrum
    • Xat en directe
    • Aprenentatge en línia
    Cadena de subministrament
    • Inventari
    • Fabricació
    • PLM
    • Compres
    • Manteniment
    • Qualitat
    Recursos humans
    • Empleats
    • Reclutament
    • Absències
    • Avaluacions
    • Recomanacions
    • Flota
    Màrqueting
    • Màrqueting Social
    • Màrqueting per correu electrònic
    • Màrqueting per SMS
    • Esdeveniments
    • Automatització del màrqueting
    • Enquestes
    Serveis
    • Projectes
    • Fulls d'hores
    • Servei de camp
    • Suport
    • Planificació
    • Cites
    Productivitat
    • Converses
    • Validacions
    • IoT
    • VoIP
    • Coneixements
    • WhatsApp
    Aplicacions de tercers Odoo Studio Plataforma d'Odoo al núvol
  • Sectors
    Comerç al detall
    • Llibreria
    • Botiga de roba
    • Botiga de mobles
    • Botiga d'ultramarins
    • Ferreteria
    • Botiga de joguines
    Food & Hospitality
    • Bar i pub
    • Restaurant
    • Menjar ràpid
    • Guest House
    • Distribuïdor de begudes
    • Hotel
    Immobiliari
    • Agència immobiliària
    • Estudi d'arquitectura
    • Construcció
    • Gestió immobiliària
    • Jardineria
    • Associació de propietaris de béns immobles
    Consultoria
    • Empresa comptable
    • Partner d'Odoo
    • Agència de màrqueting
    • Bufet d'advocats
    • Captació de talent
    • Auditoria i certificació
    Fabricació
    • Textile
    • Metal
    • Mobles
    • Menjar
    • Brewery
    • Regals corporatius
    Salut i fitness
    • Club d'esport
    • Òptica
    • Centre de fitness
    • Especialistes en benestar
    • Farmàcia
    • Perruqueria
    Trades
    • Servei de manteniment
    • Hardware i suport informàtic
    • Sistemes d'energia solar
    • Shoe Maker
    • Serveis de neteja
    • Instal·lacions HVAC
    Altres
    • Nonprofit Organization
    • Agència del medi ambient
    • Lloguer de panells publicitaris
    • Fotografia
    • Lloguer de bicicletes
    • Distribuïdors de programari
    Browse all Industries
  • Comunitat
    Aprèn
    • Tutorials
    • Documentació
    • Certificacions
    • Formació
    • Blog
    • Pòdcast
    Potenciar l'educació
    • Programa educatiu
    • Scale-Up! El joc empresarial
    • Visita Odoo
    Obtindre el programari
    • Descarregar
    • Comparar edicions
    • Novetats de les versions
    Col·laborar
    • GitHub
    • Fòrum
    • Esdeveniments
    • Traduccions
    • Converteix-te en partner
    • Services for Partners
    • Registra la teva empresa comptable
    Obtindre els serveis
    • Troba un partner
    • Troba un comptable
    • Contacta amb un expert
    • Serveis d'implementació
    • Referències del client
    • Suport
    • Actualitzacions
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Programar una demo
  • Preus
  • Ajuda

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

  • CRM
  • e-Commerce
  • Comptabilitat
  • Inventari
  • PoS
  • Projectes
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Etiquetes (View all)
odoo accounting v14 pos v15
About this forum
Ajuda

Odoo 10 - Init method enough to display data in report grid view or some other method is being called ?

Subscriure's

Get notified when there's activity on this post

This question has been flagged
reportscustomizationinit
8387 Vistes
Avatar
aashfaque

Hi,

I am new to Odoo. I have customized "Asset" in "accounting" i have added 3 columns "asset_assign_to", "employee_id", "department_id" Now i am customizing report I wanted to add these 3 columns in it what I have done so far is extended "AssetAssetReport" and created column in "asset_asset_report" view:

class AssetAssetReport(models.Model):

    _inherit = "asset.asset.report"

    employee_id = fields.Many2one('account.asset.asset', string='Employee Name', track_visibility='onchange')

    department_id = fields.Many2one('account.asset.asset', string='Department Name', track_visibility='onchange')

    asset_assign_to = fields.Selection(

        [('department', 'Department'), ('employee', 'Employee'), ('other', 'Other')],

        string='Used By',

        required=True,

        default='employee')

Then inherited init method and modified it to display my custom columns too:

@api.model_cr

    def init(self):

        rec = super(AssetAssetReport, self).init()

        tools.drop_view_if_exists(self._cr, 'asset_asset_report')

        self._cr.execute("""

                    create or replace view asset_asset_report as (

                        select

                            min(dl.id) as id,

                            dl.name as name,

                            dl.depreciation_date as depreciation_date,

                            a.date as date,

                            (CASE WHEN dlmin.id = min(dl.id)

                              THEN a.value

                              ELSE 0

                              END) as gross_value,

                            dl.amount as depreciation_value,

                            dl.amount as installment_value,

                            (CASE WHEN dl.move_check

                              THEN dl.amount

                              ELSE 0

                              END) as posted_value,

                            (CASE WHEN NOT dl.move_check

                              THEN dl.amount

                              ELSE 0

                              END) as unposted_value,

                            dl.asset_id as asset_id,

                            dl.move_check as move_check,

                            a.category_id as asset_category_id,

                            a.partner_id as partner_id,

                            a.asset_assign_to as asset_assign_to,

                            a.employee_id as employee_id,

                            a.department_id as department_id,

                            a.state as state,

                            count(dl.*) as installment_nbr,

                            count(dl.*) as depreciation_nbr,

                            a.company_id as company_id

                        from account_asset_depreciation_line dl

                            left join account_asset_asset a on (dl.asset_id=a.id)

                            left join (select min(d.id) as id,ac.id as ac_id from account_asset_depreciation_line as d inner join account_asset_asset as ac ON (ac.id=d.asset_id) group by ac_id) as dlmin on dlmin.ac_id=a.id

                        group by

                            dl.amount,dl.asset_id,dl.depreciation_date,dl.name,

                            a.date, dl.move_check, a.state, a.category_id, a.partner_id, a.company_id,

                            a.value, a.id, a.salvage_value, dlmin.id

                )""")

        return rec

AssetAssetReport()

and here is the extended view:

<record model="ir.ui.view" id="action_account_asset_report_pivot">

<field name="name">asset.asset.report.pivot</field>

<field name="model">asset.asset.report</field>

    <field name="inherit_id" ref="account_asset.action_account_asset_report_pivot"/>

<field name="arch" type="xml">

    <xpath expr="//field[@name='unposted_value']" position="after">

      <field name="employee_id" type="measure"/>

    </xpath>

</field>

</record>

my custom columns are not showing data while there is data in the report view

I have separately executed query it is showing correct columns and data please guide me what i am doing wrong..

I also wanted to ask how can add something in measure list but not hardcore it in view :

I want it like "# of Installment Lines" ,"Amount of Installment Lines "

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

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

Registrar-se
Related Posts Respostes Vistes Activitat
Quotation Report Customazation Solved
reports customization
Avatar
Avatar
Avatar
2
de febr. 24
4428
Custom Report
reports customization
Avatar
Avatar
1
d’oct. 23
8493
Printing custom invoice from the accounting module
reports customization odoo16features
Avatar
Avatar
1
d’oct. 25
3002
Looking for alternative GL reports - without aggregated transactions.
reports customization financialreport
Avatar
Avatar
1
de març 15
5540
How to add a page break on your pdf report using Studio ? Solved
reports customization quickstart Studio
Avatar
Avatar
Avatar
Avatar
Avatar
5
de febr. 24
10710
Community
  • Tutorials
  • Documentació
  • Fòrum
Codi obert
  • Descarregar
  • GitHub
  • Runbot
  • Traduccions
Serveis
  • Allotjament a Odoo.sh
  • Suport
  • Actualització
  • Desenvolupaments personalitzats
  • Educació
  • Troba un comptable
  • Troba un partner
  • Converteix-te en partner
Sobre nosaltres
  • La nostra empresa
  • Actius de marca
  • Contacta amb nosaltres
  • Llocs de treball
  • Esdeveniments
  • Pòdcast
  • Blog
  • Clients
  • Informació legal • Privacitat
  • Seguretat
الْعَرَبيّة 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 és un conjunt d'aplicacions empresarials de codi obert que cobreix totes les necessitats de la teva empresa: CRM, comerç electrònic, comptabilitat, inventari, punt de venda, gestió de projectes, etc.

La proposta única de valor d'Odoo és ser molt fàcil d'utilitzar i estar totalment integrat, ambdues alhora.

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