Skip to Content
Odoo Menu
  • Prijavi
  • Try it free
  • Aplikacije
    Finance
    • Knjigovodstvo
    • Obračun
    • Stroški
    • Spreadsheet (BI)
    • Dokumenti
    • Podpisovanje
    Prodaja
    • CRM
    • Prodaja
    • POS Shop
    • POS Restaurant
    • Naročnine
    • Najem
    Spletne strani
    • Website Builder
    • Spletna trgovina
    • Blog
    • Forum
    • Pogovor v živo
    • eUčenje
    Dobavna veriga
    • Zaloga
    • Proizvodnja
    • PLM
    • Nabava
    • Vzdrževanje
    • Kakovost
    Kadri
    • Kadri
    • Kadrovanje
    • Odsotnost
    • Ocenjevanja
    • Priporočila
    • Vozni park
    Marketing
    • Družbeno Trženje
    • Email Marketing
    • SMS Marketing
    • Dogodki
    • Avtomatizacija trženja
    • Ankete
    Storitve
    • Projekt
    • Časovnice
    • Storitve na terenu
    • Služba za pomoč
    • Načrtovanje
    • Termini
    Produktivnost
    • Razprave
    • Odobritve
    • IoT
    • Voip
    • Znanje
    • WhatsApp
    Third party apps Odoo Studio Odoo Cloud Platform
  • Industrije
    Trgovina na drobno
    • Book Store
    • Trgovina z oblačili
    • Trgovina s pohištvom
    • Grocery Store
    • Trgovina s strojno opremo računalnikov
    • Trgovina z igračami
    Food & Hospitality
    • Bar and Pub
    • Restavracija
    • Hitra hrana
    • Guest House
    • Beverage Distributor
    • Hotel
    Nepremičnine
    • Real Estate Agency
    • Arhitekturno podjetje
    • Gradbeništvo
    • Estate Management
    • Vrtnarjenje
    • Združenje lastnikov nepremičnin
    Svetovanje
    • Računovodsko podjetje
    • Odoo Partner
    • Marketinška agencija
    • Law firm
    • Pridobivanje talentov
    • Audit & Certification
    Proizvodnja
    • Tekstil
    • Metal
    • Pohištvo
    • Hrana
    • Brewery
    • Poslovna darila
    Health & Fitness
    • Športni klub
    • Trgovina z očali
    • Fitnes center
    • Wellness Practitioners
    • Lekarna
    • Frizerski salon
    Trades
    • Handyman
    • IT Hardware & Support
    • Sistemi sončne energije
    • Izdelovalec čevljev
    • Čistilne storitve
    • HVAC Services
    Ostali
    • Neprofitna organizacija
    • Agencija za okolje
    • Najem oglasnih panojev
    • Fotografija
    • Najem koles
    • Prodajalec programske opreme
    Browse all Industries
  • Skupnost
    Learn
    • Tutorials
    • Dokumentacija
    • Certifikati
    • Šolanje
    • Blog
    • Podcast
    Empower Education
    • Education Program
    • Scale Up! Business Game
    • Visit Odoo
    Get the Software
    • Prenesi
    • Compare Editions
    • Releases
    Collaborate
    • Github
    • Forum
    • Dogodki
    • Prevodi
    • Become a Partner
    • Services for Partners
    • Register your Accounting Firm
    Get Services
    • Find a Partner
    • Find an Accountant
    • Meet an advisor
    • Implementation Services
    • Sklici kupca
    • Podpora
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Get a demo
  • Določanje cen
  • Pomoč

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č

TypeError: load() missing 1 required positional argument: 'action_id'

Naroči se

Get notified when there's activity on this post

This question has been flagged
erroraddonsodoo12
2 Odgovori
74072 Prikazi
Avatar
Lima Saudara

I go this following error when I click a button on my custom addons:


Error:
Odoo Server Error
Traceback (most recent call last):
  File "/opt/odoo/odoo12/odoo/http.py", line 656, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/opt/odoo/odoo12/odoo/http.py", line 314, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/opt/odoo/odoo12/odoo/tools/pycompat.py", line 87, in reraise
    raise value
  File "/opt/odoo/odoo12/odoo/http.py", line 698, in dispatch
    result = self._call_function(**self.params)
  File "/opt/odoo/odoo12/odoo/http.py", line 346, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/opt/odoo/odoo12/odoo/service/model.py", line 97, in wrapper
    return f(dbname, *args, **kwargs)
  File "/opt/odoo/odoo12/odoo/http.py", line 339, in checked_call
    result = self.endpoint(*a, **kw)
  File "/opt/odoo/odoo12/odoo/http.py", line 941, in __call__
    return self.method(*args, **kw)
  File "/opt/odoo/odoo12/odoo/http.py", line 519, in response_wrap
    response = f(*args, **kw)
TypeError: load() missing 1 required positional argument: 'action_id'


But not sure from where that following error source since the error log does not refer to any of my customs addons.


So, what should I fix for this..?


UPDATE: Add code.

Here is my models.py

from odoo import api, fields, models, _
import time
from odoo.exceptions import UserError
import logging

_logger = logging.getLogger(__name__)


class invoice(models.Model):
_name = 'account.invoice'
_inherit = 'account.invoice'

printer_data = fields.Text(string="Printer Data", required=False)

@api.multi
def generate_printer_data(self):
tpl = self.env['mail.template'].search([('name', '=', 'Dot Matrix Invoice')])
data = tpl._render_template(tpl.body_html, 'account.invoice', self.id, post_process=False)
self.printer_data = data

@api.multi
def action_invoice_cancel(self):
self.printer_data = ''
return super(invoice, self).action_cancel()

@api.multi
def action_invoice_open(self):
res = super(invoice, self).action_invoice_open()
self.generate_printer_data()
return res


And here is my invoice.xml where the button I click got that error.

<?xml version="1.0" encoding="utf-8"?>
<odoo>
<record id="view_dotmatrix_invoice" model="ir.ui.view">
<field name="name">view_dotmatrix_invoice</field>
<field name="model">account.invoice</field>
<field name="inherit_id" ref="account.invoice_form"/>
<field name="arch" type="xml">
<header position="inside">
                # I got error when I click this button bellow
<button type="action" string="Dot Matrix" icon="fa-print" custom="print"/>
</header>

<notebook position="inside">
<page string="Dot Matrix">
<button string="Refresh Printer Data" icon="fa-print" states="open" type="object" name="generate_printer_data"/>
<pre>
<field name="printer_data"/>
</pre>
</page>
</notebook>
</field>
</record>
</odoo>




and here is the print_button.js

odoo.define('vit_dotmatrix.print_button', function (require) {
'use strict';

var form_widget = require('web.form_widgets');
var core = require('web.core');

var QWeb = core.qweb;
var _t = core._t;


form_widget.WidgetButton.include({
on_click: function() {
if(this.node.attrs.custom === "print" ){
console.log("print triggered");
var url = "http://localhost/dotmatrix/print.php";

var view = this.getParent();
var printer_data = view.datarecord.printer_data;
if (!printer_data){
alert('No data to print. Please click Update Printer Data');
return;
}
// code ajax printer
console.log(printer_data);

$.ajax({
method : "POST",
url: url,
data: {
printer_data: printer_data
},
success: function(data){
console.log('Success');
console.log(data);
},
error: function(data){
console.log('Failed');
console.log(data);
},
});
}
else{
this._super();
}
}
});
});


That is three related code from my addons.

0
Avatar
Opusti
Avatar
Niyas Raphy (Walnut Software Solutions)
Best Answer

Hi,

The reason of this error is function might be expecting three arguments and you might be called the same function with only two arguments, where the function is expected to call with three arguments, in this case you will get such an error message.


So in your case if you are getting error on clicking the custom button, check the code and corresponding function of the button and see. Or update the question with the necessary code that you have added for the button.


UPDT:

You haven't specified the action to the button, that's why you get the error, you have given the button type as action, so using the name you have to specify which action to execute.


Sample:

<button type="action"
name="%(mrp.action_change_production_qty)d"
string="Update" states="confirmed,planned,progress" class="oe_link"/>

Button Types in Odoo: https://www.youtube.com/watch?v=_aCRtK0xOpQ

Thanks

1
Avatar
Opusti
Lima Saudara
Avtor

Hi, thanks for this response, I have updated my questions.

Look forward to your next response :)

Niyas Raphy (Walnut Software Solutions)

See the updated answer

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
odoo 12 in ubuntu 18.04.4 Error ModuleNotFoundError: No module named 'werkzeug.contrib' Solved
error odoo12
Avatar
Avatar
Avatar
3
sep. 21
13272
Can not tabbing over readonly field in odoo 12. Help me please !!!
error bug odoo12
Avatar
0
apr. 24
2211
Error when installing "G.C.C - Arabic/English" 'l10n_gcc_invoice' or "K.S.A - Invoice" 'l10n_sa_invoice' Solved
error install addons
Avatar
Avatar
1
avg. 24
4635
Problems migrating from odoo 12 to odoo 14 Solved
error odoo12 v14
Avatar
Avatar
2
jan. 21
6049
the open box many times in iot box
error Posbox odoo12
Avatar
0
dec. 19
3763
Community
  • Tutorials
  • Dokumentacija
  • Forum
Open Source
  • Prenesi
  • Github
  • Runbot
  • Prevodi
Services
  • Odoo.sh Hosting
  • Podpora
  • Nadgradnja
  • Custom Developments
  • Izobraževanje
  • Find an Accountant
  • Find a Partner
  • Become a Partner
About us
  • Our company
  • Sredstva blagovne znamke
  • Kontakt
  • Zaposlitve
  • Dogodki
  • Podcast
  • Blog
  • Stranke
  • Pravno • Zasebnost
  • Varnost
الْعَرَبيّة 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