Skip to Content
Odoo Menu
  • Prisijungti
  • Išbandykite nemokamai
  • Programėlės
    Finansai
    • Apskaita
    • Pateikimas apmokėjimui
    • Sąnaudos
    • Skaičiuoklė (BI)
    • Dokumentai
    • Pasirašymas
    Pardavimai
    • CRM
    • Pardavimai
    • Kasų sistema - Parduotuvė
    • Kasų sistema - Restoranas
    • Prenumeratos
    • Nuoma
    Svetainės
    • Svetainių kūrėjimo įrankis
    • El. Prekyba
    • Internetinis Tinklaraštis
    • Forumas
    • Tiesioginis pokalbis
    • eMokymasis
    Tiekimo grandinė
    • Atsarga
    • Gamyba
    • PLM
    • Įsigijimai
    • Priežiūra
    • Kokybė
    Žmogaus ištekliai
    • Darbuotojai
    • Įdarbinimas
    • Atostogos
    • Įvertinimai
    • Rekomendacijos
    • Transporto priemonės
    Rinkodara
    • Socialinė rinkodara
    • Rinkodara el. paštu
    • SMS rinkodara
    • Renginiai
    • Rinkodaros automatizavimas
    • Apklausos
    Paslaugos
    • Projektas
    • Darbo laiko žiniaraščiai
    • Priežiūros tarnyba
    • Pagalbos tarnyba
    • Planavimas
    • Rezervacijos
    Produktyvumas
    • Diskucija
    • Patvirtinimai
    • IoT
    • VoIP
    • Žinių biblioteka
    • WhatsApp
    Trečiųjų šalių programos Odoo Studija Odoo debesijos platforma
  • Pramonės šakos
    Mažmeninė prekyba
    • Knygynas
    • Drabužių parduotuvė
    • Baldų parduotuvė
    • Maisto prekių parduotuvė
    • Techninės įrangos parduotuvė
    • Žaislų parduotuvė
    Food & Hospitality
    • Barai ir pub'ai
    • Restoranas
    • Greitasis maistas
    • Guest House
    • Gėrimų platintojas
    • Hotel
    Real Estate
    • Real Estate Agency
    • Architektūros įmonė
    • Konstrukcija
    • Estate Managament
    • Sodininkauti
    • Turto savininkų asociacija
    Consulting
    • Accounting Firm
    • Odoo Partneris
    • Marketing Agency
    • Teisinė firma
    • Talentų paieška
    • Auditai & sertifikavimas
    Gamyba
    • Textile
    • Metal
    • Furnitures
    • Food
    • Brewery
    • Įmonių dovanos
    Sveikata & Fitnesas
    • Sporto klubas
    • Akinių parduotuvė
    • Fitneso Centras
    • Sveikatos praktikai
    • Vaistinė
    • Kirpėjas
    Trades
    • Handyman
    • IT įranga ir palaikymas
    • Solar Energy Systems
    • Shoe Maker
    • Cleaning Services
    • HVAC Services
    Others
    • Nonprofit Organization
    • Aplinkos agentūra
    • Reklaminių stendų nuoma
    • Fotografavimas
    • Dviračių nuoma
    • Programinės įrangos perpardavėjas
    Browse all Industries
  • Bendrija
    Mokykitės
    • Mokomosios medžiagos
    • Dokumentacija
    • Sertifikatai
    • Mokymai
    • Internetinis Tinklaraštis
    • Tinklalaidės
    Skatinkite švietinimą
    • Švietimo programa
    • Scale Up! Verslo žaidimas
    • Aplankykite Odoo
    Gaukite programinę įrangą
    • Atsisiųsti
    • Palyginkite versijas
    • Leidimai
    Bendradarbiauti
    • Github
    • Forumas
    • Renginiai
    • Vertimai
    • Tapkite partneriu
    • Services for Partners
    • Registruokite jūsų apskaitos įmonę
    Gaukite paslaugas
    • Susiraskite partnerį
    • Susirask buhalterį
    • Susitikti su konsultantu
    • Diegimo paslaugos
    • Klientų rekomendavimas
    • Palaikymas
    • Atnaujinimai
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Gaukite demo
  • Kainodara
  • Pagalba

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

  • CRM
  • e-Commerce
  • Apskaita
  • Atsarga
  • PoS
  • Projektas
  • MRP
All apps
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
You need to be registered to interact with the community.
All Posts People Badges
Žymos (View all)
odoo accounting v14 pos v15
About this forum
Pagalba

Form view could not be loaded in odoo 10

Prenumeruoti

Get notified when there's activity on this post

This question has been flagged
pythonxmlpopupodoo10
2 Replies
7749 Rodiniai
Portretas
Silviaa

Hi,

I have a button, when i click this button it  shows a form in popup. But when i click it  will shows an error "Form could not be loaded"

My Code:

In Python,

class AccountInvoice(models.Model):

    _inherit = "account.invoice"


    def attach_documents(self):

        return {

            'type': 'ir.actions.act_window',

            'view_type': 'form',

            'view_mode': 'form',

            'res_model': 'upload.file',

            'res_id': self.id,

            'target': 'new',

            'context': {'default_invoice_id': self.id}

        }

class UploadFile(models.Model):

    _name = "upload.file"

    attachment_ids = fields.Many2many(

                        'ir.attachment',

                        string='Attachments',

                        help='Attachments are linked to a document through model / res_id')


In XML,

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

<field name="name">account.invoice.supplier.tree.inherit</field>

<field name="model">account.invoice</field>

<field name="inherit_id" ref="account.invoice_supplier_tree" />

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

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

<button name="attach_documents" string="Attach" type="object"

icon="fa fa-paperclip" class="fa-paperclip" />

</xpath>

</field>

</record>


can anyone help me to resolve this issue.

0
Portretas
Atmesti
Portretas
Hilar Andikkadavath
Best Answer

change your action varsas :-

optionally you can add views as a tuple like

tree = self.env.ref('yourmodel.tree_view_id')

form = self.env.ref('yourmodel.form_view_id')

return {

            'model': 'ir.actions.act_window',

            'type': 'ir.actions.act_window',

            'view_type': 'form',

            'view_mode': 'tree,form',

            'views': [(tree, 'tree'), (form, 'form')],

            'res_model': 'upload.file',

            'res_id': self.id,

            'target': 'new',

            'context': {'default_invoice_id': self.id}

        }

1
Portretas
Atmesti
Silviaa
Autorius

Hi Hilar,

I have changed my code but it still shows an error 'Form view could not be loaded'

form = self.env.ref('skit_attachment.upload_file_form').id

return {

'model': 'ir.actions.act_window',

'type': 'ir.actions.act_window',

'view_type': 'form',

'view_mode': 'form',

'views': [(form, 'form')],

'res_model': 'upload.file',

'res_id': self.id,

'create': False,

'target': 'new',

'context': {'default_invoice_id': self.id, 'default_res_id': self.id}

}

Mohammed Ajmal

view_id = self.env.ref('skit_attachment.upload_file_form').id

return {

'type': 'ir.actions.act_window',

'view_type': 'form',

'view_mode': 'form',

'view_id': view_id,

'res_model': 'upload.file',

'res_id': self.id,

'create': False,

'target': 'new',

'context': {'default_invoice_id': self.id, 'default_res_id': self.id}

}

Silviaa
Autorius

Hi Mohammed,

I also tried your code modifications, but still i got the same error

I dont know what to do..

In this issue if i remove the 'res_id:self.id' form will open, otherwise it shows an error..

But i need res_id because i want to display the uploaded documents for each row

Portretas
Synodica Solutions Pvt. Ltd.
Best Answer

Hi,Problem :

You're passing res_id=self.id, but self refers to the account.invoice record. However, in the action res_model='uplod.file', the res_id is from account.invoice, which doesn't match the uplod.file model. There might be a mismatch as the res_id doesn't exist in the 'upload.file' model.Solution :
You need to first create record of upload.file after you can use it in res_id. we can do like this.

class AccountInvoice(models.Model):
  _inherit = "account.invoice"  def attach_documents(self):
    upload_file = self.env['upload.file'].create({
     # your values
    })
    return {
      'type': 'ir.actions.act_window',
      'view_type': 'form',
      'view_mode': 'form',
      'res_model': 'upload.file',
      'res_id': upload_file.id,
      'target': 'new',
      'context': {'default_invoice_id': self.id}
    }

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

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

Registracija
Related Posts Replies Rodiniai Veikla
How can i get parent form value in one2many form view or pop up form view ?? Solved
python xml odoo10
Portretas
Portretas
Portretas
2
spal. 22
10660
change field color depending on its value (condition)
python xml odoo10
Portretas
Portretas
Portretas
2
lapkr. 19
11712
Inherit Customers Form View
python xml odoo10
Portretas
0
rugp. 18
3211
ODOO10: How to close Popup based on python
python popup odoo10
Portretas
0
lapkr. 17
5289
How to add a new column in Purchase Order invoice Solved
python xml odoo10
Portretas
Portretas
1
geg. 17
8356
Bendrija
  • Mokomosios medžiagos
  • Dokumentacija
  • Forumas
Atvirasis kodas
  • Atsisiųsti
  • Github
  • Runbot
  • Vertimai
Paslaugos
  • Odoo.sh talpinimas
  • Palaikymas
  • Atnaujinti
  • Pritaikytas programavimo kūrimas
  • Švietimas
  • Susirask buhalterį
  • Susiraskite partnerį
  • Tapkite partneriu
Apie mus
  • Mūsų įmonė
  • Prekės ženklo turtas
  • Susisiekite su mumis
  • Darbo pasiūlymai
  • Renginiai
  • Tinklalaidės
  • Internetinis Tinklaraštis
  • Klientai
  • Teisinis • Privatumas
  • Saugumas
الْعَرَبيّة 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 yra atvirojo kodo verslo programų rinkinys, kuris apima visas įmonės poreikius: CRM, El. Prekybą, Apskaitą, Atsargų, Kasų sistemą, Projektų valdymą ir kt.

Unikali Odoo vertės pasiūla – būti tuo pačiu metu labai lengvai naudojama ir visiškai integruota sistema.

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