Overslaan naar inhoud
Odoo Menu
  • Aanmelden
  • Probeer het gratis
  • Apps
    Financiën
    • Boekhouding
    • Facturatie
    • Onkosten
    • Spreadsheet (BI)
    • Documenten
    • Ondertekenen
    Verkoop
    • CRM
    • Verkoop
    • Kassasysteem winkel
    • Kassasysteem Restaurant
    • Abonnementen
    • Verhuur
    Websites
    • Websitebouwer
    • E-commerce
    • Blog
    • Forum
    • Live Chat
    • eLearning
    Bevoorradingsketen
    • Voorraad
    • Productie
    • PLM
    • Inkoop
    • Onderhoud
    • Kwaliteit
    Personeelsbeheer
    • Werknemers
    • Werving & Selectie
    • Verlof
    • Evaluaties
    • Aanbevelingen
    • Wagenpark
    Marketing
    • Sociale media-marketing
    • E-mailmarketing
    • Sms-marketing
    • Evenementen
    • Marketingautomatisering
    • Enquêtes
    Diensten
    • Project
    • Urenstaten
    • Buitendienst
    • Helpdesk
    • Planning
    • Afspraken
    Productiviteit
    • Chat
    • Goedkeuringen
    • IoT
    • VoIP
    • Kennis
    • WhatsApp
    Apps van derden Odoo Studio Odoo Cloud Platform
  • Bedrijfstakken
    Detailhandel
    • Boekhandel
    • kledingwinkel
    • Meubelzaak
    • Supermarkt
    • Bouwmarkt
    • Speelgoedwinkel
    Food & Hospitality
    • Bar en Pub
    • Restaurant
    • Fastfood
    • Gastenverblijf
    • Drankenhandelaar
    • Hotel
    Vastgoed
    • Makelaarskantoor
    • Architectenbureau
    • Bouw
    • Vastgoedbeheer
    • Tuinieren
    • Vereniging van eigenaren
    Consulting
    • Accountantskantoor
    • Odoo Partner
    • Marketingbureau
    • Advocatenkantoor
    • Talentenwerving
    • Audit & Certificering
    Productie
    • Textiel
    • Metaal
    • Meubels
    • Eten
    • Brewery
    • Relatiegeschenken
    Gezondheid & Fitness
    • Sportclub
    • Opticien
    • Fitnesscentrum
    • Wellness-medewerkers
    • Apotheek
    • Kapper
    Trades
    • Klusjesman
    • IT-hardware & support
    • Zonne-energiesystemen
    • Schoenmaker
    • Schoonmaakdiensten
    • HVAC-diensten
    Andere
    • Non-profitorganisatie
    • Milieuagentschap
    • Verhuur van Billboards
    • Fotograaf
    • Fietsleasing
    • Softwareverkoper
    Browse all Industries
  • Community
    Leren
    • Tutorials
    • Documentatie
    • Certificeringen
    • Training
    • Blog
    • Podcast
    Versterk het onderwijs
    • Onderwijs- programma
    • Scale Up! Business Game
    • Bezoek Odoo
    Download de Software
    • Downloaden
    • Vergelijk edities
    • Releases
    Werk samen
    • Github
    • Forum
    • Evenementen
    • Vertalingen
    • Word een Partner
    • Services for Partners
    • Registreer je accountantskantoor
    Diensten
    • Vind een partner
    • Vind een boekhouder
    • Een adviseur ontmoeten
    • Implementatiediensten
    • Klantreferenties
    • Ondersteuning
    • Upgrades
    Github Youtube Twitter Linkedin Instagram Facebook Spotify
    +1 (650) 691-3277
    Vraag een demo aan
  • Prijzen
  • Help

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

  • CRM
  • e-Commerce
  • Boekhouding
  • Voorraad
  • PoS
  • Project
  • MRP
All apps
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Je moet geregistreerd zijn om te kunnen communiceren met de community.
Alle posts Personen Badges
Labels (Bekijk alle)
odoo accounting v14 pos v15
Over dit forum
Help

inject fields in ubl_bis3.xml files in Odoo 17

Inschrijven

Ontvang een bericht wanneer er activiteit is op deze post

Deze vraag is gerapporteerd
3 Antwoorden
1520 Weergaven
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
Annuleer
Georges Moes
Auteur

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
Beste antwoord

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
Annuleer
Avatar
Raymond Sterling
Beste antwoord

Life saver!!!

Thanks a trillion!

0
Avatar
Annuleer
Avatar
Georges Moes
Auteur Beste antwoord

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
Annuleer
Geniet je van het gesprek? Blijf niet alleen lezen, doe ook mee!

Maak vandaag nog een account aan om te profiteren van exclusieve functies en deel uit te maken van onze geweldige community!

Aanmelden
Community
  • Tutorials
  • Documentatie
  • Forum
Open Source
  • Downloaden
  • Github
  • Runbot
  • Vertalingen
Diensten
  • Odoo.sh Hosting
  • Ondersteuning
  • Upgrade
  • Gepersonaliseerde ontwikkelingen
  • Onderwijs
  • Vind een boekhouder
  • Vind een partner
  • Word een Partner
Over ons
  • Ons bedrijf
  • Merkelementen
  • Neem contact met ons op
  • Vacatures
  • Evenementen
  • Podcast
  • Blog
  • Klanten
  • Juridisch • Privacy
  • Beveiliging
الْعَرَبيّة 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 een suite van open source zakelijke apps die aan al je bedrijfsbehoeften voldoet: CRM, E-commerce, boekhouding, inventaris, kassasysteem, projectbeheer, enz.

Odoo's unieke waardepropositie is om tegelijkertijd zeer gebruiksvriendelijk en volledig geïntegreerd te zijn.

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