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

Odoo12: TypeError: post() got an unexpected keyword argument 'invoice'

Subscriure's

Get notified when there's activity on this post

This question has been flagged
invoicetypeerrorodoo12
3 Respostes
17339 Vistes
Avatar
Syed Hamza

I get this error when i try to create invoice. 


Odoo Server Error
Traceback (most recent call last):
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/odoo/http.py", line 656, in _handle_exception
    return super(JsonRequest, self)._handle_exception(exception)
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/odoo/http.py", line 314, in _handle_exception
    raise pycompat.reraise(type(exception), exception, sys.exc_info()[2])
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/odoo/tools/pycompat.py", line 87, in reraise
    raise value
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/odoo/http.py", line 698, in dispatch
    result = self._call_function(**self.params)
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/odoo/http.py", line 346, in _call_function
    return checked_call(self.db, *args, **kwargs)
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/odoo/service/model.py", line 97, in wrapper
    return f(dbname, *args, **kwargs)
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/odoo/http.py", line 339, in checked_call
    result = self.endpoint(*a, **kw)
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/odoo/http.py", line 941, in __call__
    return self.method(*args, **kw)
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/odoo/http.py", line 519, in response_wrap
    response = f(*args, **kw)
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/addons/web/controllers/main.py", line 966, in call_button
    action = self._call_kw(model, method, args, {})
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/addons/web/controllers/main.py", line 954, in _call_kw
    return call_kw(request.env[model], method, args, kwargs)
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/odoo/api.py", line 759, in call_kw
    return _call_kw_multi(method, model, args, kwargs)
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/odoo/api.py", line 746, in _call_kw_multi
    result = method(recs, *args, **kwargs)
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/env/env_zameen/addons/rsms/real_estate/models/file.py", line 353, in create_invoice
    invoice.action_invoice_open()
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/addons/sale/models/account_invoice.py", line 59, in action_invoice_open
    res = super(AccountInvoice, self).action_invoice_open()
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/thirdparty/financials/fiscal/models/fiscal_year.py", line 256, in action_invoice_open
    return super(AccountInvoice, self).action_invoice_open()
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/addons/account/models/account_invoice.py", line 988, in action_invoice_open
    to_open_invoices.action_move_create()
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/thirdparty/financials/account_asset/models/account_invoice.py", line 33, in action_move_create
    result = super(AccountInvoice, self).action_move_create()
  File "/home/syedhamza/custom/programming/enviornments/odoo/odoo12/src/odoo/addons/account/models/account_invoice.py", line 1341, in action_move_create
    move.post(invoice = inv)
TypeError: post() got an unexpected keyword argument 'invoice'

my code:


@api.multi
def create_invoice(self):
# check duplicity
list_of_product_id = [x.product_id.id for x in self.file_payment_ids]
for i in list_of_product_id:
if list_of_product_id.count(i) > 1:
raise ValidationError(_("Duplicity of products are not allowed"))
if self.file_payment_ids:
prod = [(0, 0, {
'product_id': rec.product_id.id,
'name': rec.product_id.name,
'account_id': rec.product_id.property_account_income_id.id,
# 'price_unit': rec.value if rec.payment_type == 'fix' else [self.sale_amount * rec.value / 100][0]
'price_unit': rec.initial_payment,
# 'is_fully_paid': rec.is_fully_paid
}) for rec in self.file_payment_ids]

invoice = self.env['account.invoice'].create({
'file_id': self, # this id is just for invoice create method i will extract this field from there and push remaining values
'name': self.name,
'type' : 'out_invoice',
'user_id':self.user_id.id,
'partner_id': self.membership_id.id,
'account_id': self.membership_id.property_account_receivable_id.id,
'property_invoice_type': 'initial_payment',
'date_invoice': self.booking_date,
'date_due': self.booking_date,
'invoice_line_ids': prod
})

invoice.action_invoice_open()

self.payment_states = 'open'

self.history_log('First Owner', invoice.create_date, self.membership_id.id,self.env.user.company_id.partner_id.id)
self.initial_invoice = False
self.env['confirmation'].confirmation_popup('Invoice')
Updated my Question:
here's the post method
_inherit = "account.move"
@api.multi
def post(self):
date_jv = self.date
fiscal_year_obj = self.env['fiscal.year'].search([('start_date', '<=', date_jv), ('end_date', '>=', date_jv)])
fiscal_month_obj = self.env['fiscal.month'].search(
[('open_close', '=', False), ('start_date', '<=', date_jv), ('end_date', '>=', date_jv)])

if date_jv:
inv_date = datetime.strptime(date_jv, "%Y-%m-%d")
else:
raise ValidationError(
"Please enter journal entry date!")
invdate_year = inv_date.year
if fiscal_year_obj:
if fiscal_year_obj[0].state != 'closed':
if fiscal_month_obj:
if fiscal_month_obj[0].state != 'closed':
return super(AccountMove, self).post()
else:
raise ValidationError(
"You are trying to access %r fiscal month that is already closed" % fiscal_month_obj[
0].name)
else:
raise ValidationError("month not found")

else:
raise ValidationError(
"You are trying to access %r fiscal year that is already closed" % fiscal_year_obj[0].name)
else:
raise ValidationError("year not found")

I don't know what is wrong. Any help ?

0
Avatar
Descartar
Sudhir Arya (ERP Harbor Consulting Services)

Search for the post method in your custom module and upload the method code in your question.

Avatar
Ravi Gadhia
Best Answer

you missed the invoice parameter which parent model has

@api.multi
def post(self, invoice=False):
date_jv = self.date
    iscal_year_obj = self.env['fiscal.year
 ​   ​    ​   ​     ​   ​    ​   ​

​

1
Avatar
Descartar
Avatar
Syed Hamza
Autor Best Answer

updated my question with post method

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
Open an invoice using XMLRPC
invoice odoo12
Avatar
Avatar
2
de maig 20
5810
ODOO 12: TypeError: Mixing apples and oranges: product.product(3280,).concat( No product price at date!)
typeerror odoo12
Avatar
Avatar
2
de febr. 20
4440
How to modify validated invoice?
invoice odoo12
Avatar
Avatar
Avatar
2
de nov. 18
4970
How to control auto post for journal entry comes from invoices in Odoo12?
invoice journal_entry odoo12
Avatar
0
de gen. 22
4208
[v12] propagate custom field from invoice to invoice report
invoice invoicereport odoo12
Avatar
Avatar
3
de des. 19
5461
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