Se rendre au contenu
Odoo Menu
  • Se connecter
  • Essai gratuit
  • Applications
    Finance
    • Comptabilité
    • Facturation
    • Notes de frais
    • Feuilles de calcul (BI)
    • Documents
    • Signature
    Ventes
    • CRM
    • Ventes
    • PdV Boutique
    • PdV Restaurant
    • Abonnements
    • Location
    Sites web
    • Site Web
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Chaîne d'approvisionnement
    • Inventaire
    • Fabrication
    • PLM
    • Achats
    • Maintenance
    • Qualité
    Ressources Humaines
    • Employés
    • Recrutement
    • Congés
    • Évaluations
    • Recommandations
    • Parc automobile
    Marketing
    • Marketing Social
    • E-mail Marketing
    • SMS Marketing
    • Événements
    • Marketing Automation
    • Sondages
    Services
    • Projet
    • Feuilles de temps
    • Services sur Site
    • Assistance
    • Planification
    • Rendez-vous
    Productivité
    • Discussion
    • Validations
    • Internet des Objets
    • VoIP
    • Connaissances
    • WhatsApp
    Applications tierces Odoo Studio Plateforme Cloud d'Odoo
  • Industries
    Commerce de détail
    • Librairie
    • Magasin de vêtements
    • Magasin de meubles
    • Épicerie
    • Quincaillerie
    • Magasin de jouets
    Food & Hospitality
    • Bar et Pub
    • Restaurant
    • Fast-food
    • Maison d’hôtes
    • Distributeur de boissons
    • Hôtel
    Immobilier
    • Agence immobilière
    • Cabinet d'architecture
    • Construction
    • Gestion immobilière
    • Jardinage
    • Association de copropriétaires
    Consultance
    • Cabinet d'expertise comptable
    • Partenaire Odoo
    • Agence Marketing
    • Cabinet d'avocats
    • Aquisition de talents
    • Audit & Certification
    Fabrication
    • Textile
    • Métal
    • Meubles
    • Alimentation
    • Brewery
    • Cadeaux d'entreprise
    Santé & Fitness
    • Club de sports
    • Opticien
    • Salle de fitness
    • Praticiens bien-être
    • Pharmacie
    • Salon de coiffure
    Trades
    • Bricoleur
    • Matériel informatique et support
    • Systèmes photovoltaïques
    • Cordonnier
    • Services de nettoyage
    • Services CVC
    Autres
    • Organisation à but non lucratif
    • Agence environnementale
    • Location de panneaux d'affichage
    • Photographie
    • Leasing de vélos
    • Revendeur de logiciel
    Browse all Industries
  • Communauté
    Apprenez
    • Tutoriels
    • Documentation
    • Certifications
    • Formation
    • Blog
    • Podcast
    Renforcer l'éducation
    • Programme éducatif
    • Business Game Scale-Up!
    • Rendez-nous visite
    Obtenir le logiciel
    • Téléchargement
    • Comparez les éditions
    • Versions
    Collaborer
    • Github
    • Forum
    • Événements
    • Traductions
    • Devenez partenaire
    • Services for Partners
    • Enregistrer votre cabinet comptable
    Nos Services
    • Trouver un partenaire
    • Trouver un comptable
    • Rencontrer un conseiller
    • Services de mise en œuvre
    • Références clients
    • Assistance
    • Mises à niveau
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Obtenir une démonstration
  • Tarification
  • Aide

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

  • CRM
  • e-Commerce
  • Comptabilité
  • Inventaire
  • PoS
  • Projet
  • MRP
All apps
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Vous devez être inscrit pour interagir avec la communauté.
Toutes les publications Personnes Badges
Étiquettes (Voir toutl)
odoo accounting v14 pos v15
À propos de ce forum
Aide

Custom report why cant access all object atributes

S'inscrire

Recevez une notification lorsqu'il y a de l'activité sur ce poste

Cette question a été signalée
customers
4438 Vues
Avatar
ged

I have created a report which is working fine (Accounting, Journal entries). What i want now is to get some data from other model (res.partner), so i need to call python function from qweb report, as i understand i need to make a custom report like in example here - https://www.odoo.com/documentation/9.0/reference/reports.html#custom-reports

So i did it all like in an example, but after installing my module with custom class im getting an error:

 "'report.l10n_lt_buh_aps_forma.report_buh_aps_forma_' object has no attribute 'line_ids'" while evaluating

'o.line_ids'

As i understand after installing module with this custom class i cant access all object attributes. Here is my code:

from openerp import api, models, fields
def some_math(txt):
return txt * 5
def get_formato(self):
return 'its working'
class buh_aps_report(models.AbstractModel):
_name = 'report.l10n_lt_buh_aps_forma.report_buh_aps_forma_lt'
#_template = 'l10n_lt_buh_aps_forma.report_buh_aps_forma_lt'
# _inherit = 'account.move'
@api.multi
def render_html(self, data=None):
report_obj = self.env['report']
report = report_obj._get_report_from_name('l10n_lt_buh_aps_forma.report_buh_aps_forma_lt')
docargs = {
'doc_ids': self._ids,
'doc_model': report.model,
'docs': self,
'some_math': some_math,
'get_formato': get_formato,
}
return report_obj.render('l10n_lt_buh_aps_forma.report_buh_aps_forma_lt', docargs)


Here is my template code:

<report 
id="account.report_buh_aps"
model="account.move"
string="Buhalterinės apskaitos forma (EN text)"
report_type="qweb-pdf"
attachment_use="False"
name="l10n_lt_buh_aps_forma.report_buh_aps_forma_lt"
file="l10n_lt_buh_aps_forma.report_buh_aps_forma_lt"
/>


And i have to mention, that i have found some older way to for my problem, which is actually working:

class buh_aps_report(report_sxw.rml_parse):

  def __init__(self, cr, uid, name, context):
  super(buh_aps_report, self).__init__(cr, uid, name, context=context)
 self.localcontext.update({
  'time': time,
  'get_format':self.get_format,
                 })
 
  def get_format(self):
  return 'its working'
 
 class report_saleorderqweb(models.AbstractModel):
  _name = 'report.l10n_lt_buh_aps_forma.report_buh_aps_forma_lt'
  _inherit = 'report.abstract_report'
 _template = 'l10n_lt_buh_aps_forma.report_buh_aps_forma_lt'
  _wrapped_report_class = buh_aps_report

As i understand second method is based on old API, so i would like to understand what i did wrong in first method, what is missing?

Im completely new to python and odoo, so any help will be appreciated, thank you

0
Avatar
Ignorer
Vous appréciez la discussion ? Ne vous contentez pas de lire, rejoignez-nous !

Créez un compte dès aujourd'hui pour profiter de fonctionnalités exclusives et échanger avec notre formidable communauté !

S'inscrire
Publications associées Réponses Vues Activité
branches customer
customers
Avatar
Avatar
1
avr. 23
4367
User/Employee can't view all customers Résolu
customers
Avatar
Avatar
Avatar
Avatar
Avatar
6
mai 24
11329
Client listing ordered by Credit Limit fails
customers
Avatar
0
janv. 17
3959
How can I find the customer who purchased a particular serial number? Résolu
customers
Avatar
Avatar
1
mars 15
6068
a user have permision to sales own leads but the customers not shown in dropdown list in sales order
customers
Avatar
0
mars 15
3706
Communauté
  • Tutoriels
  • Documentation
  • Forum
Open Source
  • Téléchargement
  • Github
  • Runbot
  • Traductions
Services
  • Hébergement Odoo.sh
  • Assistance
  • Migration
  • Développements personnalisés
  • Éducation
  • Trouver un comptable
  • Trouver un partenaire
  • Devenez partenaire
À propos
  • Notre société
  • Actifs de la marque
  • Contactez-nous
  • Emplois
  • Événements
  • Podcast
  • Blog
  • Clients
  • Informations légales • Confidentialité
  • Sécurité.
الْعَرَبيّة 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 est une suite d'applications open source couvrant tous les besoins de votre entreprise : CRM, eCommerce, Comptabilité, Inventaire, Point de Vente, Gestion de Projet, etc.

Le positionnement unique d'Odoo est d'être à la fois très facile à utiliser et totalement intégré.

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