Skip ke Konten
Odoo Menu
  • Login
  • Uji coba gratis
  • Aplikasi
    Keuangan
    • Akuntansi
    • Faktur
    • Pengeluaran
    • Spreadsheet (BI)
    • Dokumen
    • Tanda Tangan
    Sales
    • CRM
    • Sales
    • POS Toko
    • POS Restoran
    • Langganan
    • Rental
    Website
    • Website Builder
    • eCommerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Rantai Pasokan
    • Inventaris
    • Manufaktur
    • PLM
    • Purchase
    • Maintenance
    • Kualitas
    Sumber Daya Manusia
    • Karyawan
    • Rekrutmen
    • Cuti
    • Appraisal
    • Referensi
    • Armada
    Marketing
    • Social Marketing
    • Email Marketing
    • SMS Marketing
    • Acara
    • Otomatisasi Marketing
    • Survei
    Layanan
    • Project
    • Timesheet
    • Layanan Lapangan
    • Meja Bantuan
    • Planning
    • Appointment
    Produktivitas
    • Discuss
    • Approval
    • IoT
    • VoIP
    • Pengetahuan
    • WhatsApp
    Aplikasi pihak ketiga Odoo Studio Platform Odoo Cloud
  • Industri-Industri
    Retail
    • Toko Buku
    • Toko Baju
    • Toko Furnitur
    • Toko Kelontong
    • Toko Hardware
    • Toko Mainan
    Makanan & Hospitality
    • Bar dan Pub
    • Restoran
    • Fast Food
    • Rumah Tamu
    • Distributor Minuman
    • Hotel
    Real Estate
    • Agensi Real Estate
    • Firma Arsitektur
    • Konstruksi
    • Estate Management
    • Perkebunan
    • Asosiasi Pemilik Properti
    Konsultansi
    • Firma Akuntansi
    • Mitra Odoo
    • Agensi Marketing
    • Firma huku
    • Talent Acquisition
    • Audit & Sertifikasi
    Manufaktur
    • Tekstil
    • Logam
    • Perabotan
    • Makanan
    • Brewery
    • Corporate Gift
    Kesehatan & Fitness
    • Sports Club
    • Toko Kacamata
    • Fitness Center
    • Wellness Practitioners
    • Farmasi
    • Salon Rambut
    Perdagangan
    • Handyman
    • IT Hardware & Support
    • Sistem-Sistem Energi Surya
    • Pembuat Sepatu
    • Cleaning Service
    • Layanan HVAC
    Lainnya
    • Organisasi Nirlaba
    • Agen Lingkungan
    • Rental Billboard
    • Fotografi
    • Penyewaan Sepeda
    • Reseller Software
    Browse semua Industri
  • Komunitas
    Belajar
    • Tutorial-tutorial
    • Dokumentasi
    • Sertifikasi
    • Pelatihan
    • Blog
    • Podcast
    Empower Education
    • Program Edukasi
    • Game Bisnis 'Scale Up!'
    • Kunjungi Odoo
    Dapatkan Softwarenya
    • Download
    • Bandingkan Edisi
    • Daftar Rilis
    Kolaborasi
    • Github
    • Forum
    • Acara
    • Terjemahan
    • Menjadi Partner
    • Layanan untuk Partner
    • Daftarkan perusahaan Akuntansi Anda.
    Dapatkan Layanan
    • Temukan Mitra
    • Temukan Akuntan
    • Temui penasihat
    • Layanan Implementasi
    • Referensi Pelanggan
    • Bantuan
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Dapatkan demo
  • Harga
  • Bantuan

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

  • CRM
  • e-Commerce
  • Akuntansi
  • Inventaris
  • PoS
  • Project
  • MRP
All apps
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Anda harus terdaftar untuk dapat berinteraksi di komunitas.
Semua Post Orang Lencana-Lencana
Label (Lihat semua)
odoo accounting v14 pos v15
Mengenai forum ini
Help

inject fields in ubl_bis3.xml files in Odoo 17

Langganan

Dapatkan notifikasi saat terdapat aktivitas pada post ini

Pertanyaan ini telah diberikan tanda
3 Replies
1533 Tampilan
Avatar
Georges Moes

We want to inject the following 3 fields in the generated ..ubl_bis3.xml files in Odoo 17 Community edition.


<cbc:ID> (bt13 = identifier of a referenced purchase order, issued by the Buyer)

<cbc:AccountingCost> (bt19 = A textual value that specifies where to book the relevant data into the Buyer's financial accounts.)

<cbc:Note> (bt22 = textual note that gives unstructured information that is relevant to the Invoice as a whole.)


The data of the 3 xml-nodes is present in the database model account_move as the fields

<cbc:ID> =  buyer_reference
<cbc:AccountingCost> = accounting_cost
<cbc:Note> = invoice_note


How can we inject these 3 xml-nodes in the generated ..ubl_bis3.xml, that is send via PEPPOL? We would like to write code in a custom module to archieve this. 



--- Update



Thx Christoph for pointing me in the right direction.

In my module I added to the class


class AccountMove(models.Model):

    _inherit = 'account.move'

    def _export_invoice_vals(self, invoice):

        vals = super()._export_invoice_vals(invoice)

        vals['vals'].update({

            'accounting_cost': invoice.accounting_cost,

            'invoice_note': invoice.invoice_note,

            'contract_document_reference_vals': [{

                'id': invoice.buyers_reference if invoice.buyers_reference else 'N/A',

            ​ ​# 'issue_date': invoice.contract_id.date_start if invoice.contract_id else None,

            }],

        })

        return vals



In the in ubl_20_template.xml

I added two lines in the section


<template id="ubl_20_CommonType">
(...)
         <cbc:AccountingCost t-out="vals.get('accounting_cost')" />
         <cbc:Note t-out="vals.get('invoice_note')"/>


But stil I don't get the desired result?

0
Avatar
Buang
Georges Moes
Penulis

I've followed your instructions, but without getting the desired result. We are using the Community edition, and it seems as if the creation of the ubl_bis3.xml slightly different.
In the whole files in the /addons directory in odoo I cannot locate the method '_export_as_ubl_invoice' that You mention. Therefore the proposed code does not give the desired result. 

Christoph Farnleitner

This is, because it's just AI generated without any proof-reading whatsoever...

Christoph Farnleitner

_export_invoice_vals() is nowhere defined in account.move but, for example, account.edi.xml.ubl_20, your inherit needs to reflect that. Also, I don't know what you template modification looks with just that snippet.

Raymond Sterling

Hi there,


Did you manage to sort this out? I have been facing the exact same issue and still cannot get the fields inserted in the final xml 

I am probably using the wrong hook in the template.xml, or odoo redoes the xml always, not sure


Cheers


Any help will be greatly appreciated

Avatar
Christoph Farnleitner
Jawaban Terbai

You're interested in investigating the module account_edi_ubl_cii from core: https://github.com/odoo/odoo/tree/17.0/addons/account_edi_ubl_cii

More so, probably in the function _export_invoice_vals() of account.edi.xml.ubl_20 at https://github.com/odoo/odoo/blob/17.0/addons/account_edi_ubl_cii/models/account_edi_xml_ubl_20.py#L521

In here, further down the line a dictionary is defined that holds the data that then is used in the actual template: https://github.com/odoo/odoo/blob/17.0/addons/account_edi_ubl_cii/data/ubl_20_templates.xml


1
Avatar
Buang
Avatar
Raymond Sterling
Jawaban Terbai

Life saver!!!

Thanks a trillion!

0
Avatar
Buang
Avatar
Georges Moes
Penulis Jawaban Terbai

Hi,

after a lot of try and error and the help of AI we got it to work.

our account_edi_xml_ubl_bis3_extension.py

from odoo import models


class AccountEdiXmlUBLBIS3Extension(models.AbstractModel):

    _inherit = "account.edi.xml.ubl_bis3"


    def _export_invoice_vals(self, invoice):

        vals = super()._export_invoice_vals(invoice)


        # Inject custom fields into the nested 'vals' dictionary

        vals['vals']['accounting_cost'] = invoice.l10n_lu_mddi_engagement_ref

        vals['vals']['note_vals'] = [{'note': invoice.l10n_lu_mddi_general_info}]

        vals['vals']['order_reference'] = invoice.l10n_lu_mddi_order_ref or '-'

        vals['vals']['buyer_reference'] = invoice.l10n_lu_mddi_order_ref or '-'


        return vals



the views/account_edi_templates.xml

<?xml version="1.0" encoding="utf-8"?>
<odoo>
    <data>
        <template id="ubl_21_invoice_type_inherit_l10n_lu_mddi" inherit_id="account_edi_ubl_cii.ubl_21_InvoiceType">
            <xpath expr="//*[local-name()='BuyerReference']" position="before">
                <t xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2">
                    <cbc:AccountingCost t-if="vals.get('accounting_cost')">
                        <t t-esc="vals.get('accounting_cost')"/>
                    </cbc:AccountingCost>
                </t>
            </xpath>
        </template>
    </data>
</odoo>

the views/account_move_view.xml

<?xml version='1.0' encoding='utf-8'?>
<odoo>
    <data>
        <record id="view_move_form_l10n_lu_mddi" model="ir.ui.view">
            <field name="name">account.move.form.l10n_lu_mddi</field>
            <field name="model">account.move</field>
            <field name="inherit_id" ref="account.view_move_form"/>
            <field name="arch" type="xml">
                <xpath expr="//notebook" position="inside">
                    <page string="MDDI" name="mddi">
                        <group>
                            <field name="l10n_lu_mddi_engagement_ref"/>
                            <field name="l10n_lu_mddi_general_info"/>
                            <field name="l10n_lu_mddi_order_ref"/>
                        </group>
                    </page>
                </xpath>
            </field>
        </record>
    </data>
</odoo>


You need to adapt the script to Your needs. 
I had to give the field 'l10n_lu_mddi_order_ref' from the relation account_move a default value '_'. Otherwise Odoo complains that this field cannot be empty.
Good luck 

0
Avatar
Buang
Menikmati diskusi? Jangan hanya membaca, ikuti!

Buat akun sekarang untuk menikmati fitur eksklufi dan agar terlibat dengan komunitas kami!

Daftar
Komunitas
  • Tutorial-tutorial
  • Dokumentasi
  • Forum
Open Source
  • Download
  • Github
  • Runbot
  • Terjemahan
Layanan
  • Odoo.sh Hosting
  • Bantuan
  • Peningkatan
  • Custom Development
  • Pendidikan
  • Temukan Akuntan
  • Temukan Mitra
  • Menjadi Partner
Tentang Kami
  • Perusahaan kami
  • Aset Merek
  • Hubungi kami
  • Tugas
  • Acara
  • Podcast
  • Blog
  • Pelanggan
  • Hukum • Privasi
  • Keamanan
الْعَرَبيّة 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 adalah rangkaian aplikasi bisnis open source yang mencakup semua kebutuhan perusahaan Anda: CRM, eCommerce, akuntansi, inventaris, point of sale, manajemen project, dan seterusnya.

Mudah digunakan dan terintegrasi penuh pada saat yang sama adalah value proposition unik Odoo.

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