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

Creating a Journal entry , and getting the journal_id value from account.payment of posted payment

Subscriure's

Get notified when there's activity on this post

This question has been flagged
account.movejournal_entryOdoo13.0account.payment
1 Respondre
15103 Vistes
Avatar
Mudassar Syed

Hi hope you will be fine 

i am working on custom module in that module i'm getting all my values from account.payment model and also a journal_id of posted payment after when i populated my all value in custom module form in this form i am creating a journal entry again 

while creating a journal entry i am getting this ERROR

you cannot modify a journal entry linked to a posted payment. 

HERE IS MY CODE WHICH I'M USING TO PASS DATA FROM ACCOUNT.PAYMENT  MODEL TO B MODEL

    def go_to_pdc(self):

        if self.pdc_enable == 'pdc':

            if self.partner_type == 'customer':

                self.pdc_created = True

                context = {

                    'default_payment_id': self.id,

                    'default_name': self.partner_id.name + '-' + self.journal_id.name,

                    'default_bank_account_id': self.journal_id.bank_account_id.id,

                    'default_payee_user_id': self.partner_id.id,

                    'default_company_id': self.company_id.id,

                    'default_amount': self.amount,

                    'default_invoice_ids': [(6, 0, rec.multi_invoice_ids.invoice_id.ids) for rec in self],

                    'default_cheque_date': self.pdc_date,

                    'default_account_cheque_type': 'incoming',

                    'default_status1': 'registered',

                }

                return {

                    'name': _('Incoming'),

                    'view_type': 'form',

                    'view_mode': 'form',

                    'res_model': 'account.cheque',

                    'view_id': self.env.ref('bi_account_cheque.account_incoming_cheque_form_view').id,

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

                    'domain': [('payment_id', '=', self.id)],

                    'context': context

                }

HERE IS MY CODE FOR CREATING AN JOURNAL ENTRY OF B MODEL DATA

    def set_to_transfer(self):

        if self.amount:

            account_move_obj = self.env['account.move']

            move_lines = []

            if self.account_cheque_type == 'incoming':

                vals = {

                    'name': self.payee_user_id.name,

                    'date': self.cheque_receive_date,

                    'journal_id': self.journal_id.id,

                    'company_id': self.company_id.id,

                    'type': 'entry',

                    'state': 'draft',

                    'ref': self.name,

                    'account_cheque_id': self.id

                }

                account_move = account_move_obj.create(vals)


                debit_vals = {

                    'partner_id': self.payee_user_id.id,

                    'account_id': self.journal_id.default_debit_account_id.id,

                    'debit': self.amount,

                    'move_id': account_move.id,

                    'payment_id': self.payment_id.id,

                    'company_id': self.company_id.id,

                }

                move_lines.append((0, 0, debit_vals))


                credit_vals = {

                    'partner_id': self.payee_user_id.id,

                    'account_id': self.journal_id.clearing_account.id,

                    'credit': self.amount,

                    'move_id': account_move.id,

                    'payment_id': self.payment_id.id,

                    'company_id': self.company_id.id,

                }

                move_lines.append((0, 0, credit_vals))

                account_move.write({'line_ids': move_lines})


                account_move.post()

 

0
Avatar
Descartar
Avatar
Mudassar Syed
Autor Best Answer

move_id = fields.Many2one('account.move')

move = { 'name': self.payment_id.name, 'date': self.cheque_receive_date, 'journal_id': self.journal_id.id, 'company_id': self.company_id.id, 'type': 'entry', 'state': 'draft', 'ref': self.sequence + '- ' + self.cheque_number + '- ' + 'Transferred', 'account_cheque_id': self.id, 'line_ids': [(0, 0, { 'name': self.payment_id.move_name, 'partner_id': self.payee_user_id.id, 'account_id': self.journal_id.default_debit_account_id.id, 'debit': self.amount}), (0, 0, { 'name': self.payment_id.move_name, 'partner_id': self.payee_user_id.id, 'account_id': self.journal_id.clearing_account.id, 'credit': self.amount })] } move_id = self.env['account.move'].create(move) move_id.post()
`               return self.write({'move_id': move_id.id})
                 By this code i just get rid of that Error , in this code i'm not creating dictionary of credit value and debit value separately 

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
Where are Journal Entries created from Account Payment Register?
account.move account.payment
Avatar
Avatar
Avatar
2
de juny 25
3085
Fill up a field in the creation of a journal entry
account.move journal_entry
Avatar
0
de jul. 24
2082
Why does the action_register_payment function of account.move needs the create right? Solved
account.move account.payment
Avatar
Avatar
1
d’ag. 23
4192
inherit 'account.move' and creating a new object 'accouont.move.oi' Solved
inheritance account.move Odoo13.0
Avatar
Avatar
1
de set. 21
6385
Getting Warning Comparing Apples and oranges while trying to cancel the advance payment which is related to payment Solved
warning Odoo13.0 account.payment
Avatar
Avatar
1
de juny 21
4629
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