Odoo models XML import/export using xsdata to generate bindings from arbitrary XSD schemas

Proposed by Raphaël Valyi

In this talk I will show you how you can generate Odoo mixins from an arbitrary XSD grammar and I will be using UBL (Universal Business Language) as an example.

You can then inject these mixins into existing Odoo models and get them import from XML and export as XML enforcing the grammar. In many countries, electronic invoicing can be done with 10 extra invoice fields and hand written XML serialization code. But that was not possible in Brazil where only our electronic invoicing schema is 8000 lines long and we have other such very complex fiscal documents...

From my Java expertise and XML courses, I knew we could do better than manually coding kilometers of XML serialization code and having to maintain it later. I started a POC with the generateDS generator in 2017 that was inspired from a Django model generator and I presented it during the 2020 OCA Days. It was used in production for electronic invoicing in Brazil over 2019, 2020 and 2021. But in 2021 we decided xsdata is an amazing drop in replacement for generateDS and is making our framework even simpler and cleaner.

Today it is in production in OCA/l10n-brazil and literally saved us hundreds of thousands lines of code, making our localization sustainable as an open source model. But the OCA modules were done in a very generic manner and it may help you to get Odoo talk with your own specific XSD grammar. This can also be used for the Unified Business Language (UBL) for instance.

About The Speaker

Raphaël Valyi is a MS degree engineer from the Ecole Centrale de Lyon. He started his first open source project in 2003, started working with Odoo in 2007 at Smile. He then founded Akretion in Sao Paulo Brazil in 2009 who was later extended to France and is one of the OCA founder and main contributor. Akretion Brazil, Raphaël Valyi

Practical Info

29/10/2021 15:50 (Europe/Brussels)
30 minutes
Track 2