Skip to content
Snippets Groups Projects
Commit 0acdbaf4ba83 authored by Etienne Ferriere's avatar Etienne Ferriere
Browse files

In the converter of Many2one relations, the model name must be a keyword

argument, optional and not compulsory, as in Odoo 11. Moreover, when the
Many2one is empty and a value has to be returned, the converter tries to return
the class of the Many2one model. The converter must be able to automatically
identify the model name from the Many2one definition, without requiring the
model name to be given in arguments.
parent 60237a779bcc
No related branches found
Tags 15.0.3.1.0
1 merge request!39In the converter of Many2one relations, the model name must be a keyword
Changelog
=========
15.0.3.3.1
----------
* In the converter of Many2one relations, the model name must be a keyword
argument, optional and not compulsory, as in Odoo 11. Moreover, when the
Many2one is empty and a value has to be returned, the converter tries to
return the class of the Many2one model. The converter must be able to
automatically identify the model name from the Many2one definition, without
requiring the model name to be given in arguments.
15.0.3.3.0
----------
......
......@@ -22,7 +22,7 @@
"name": "Converter",
"license": "AGPL-3",
"summary": "Convert odoo records to/from plain data structures.",
"version": "15.0.3.3.0",
"version": "15.0.3.3.1",
"category": "Hidden",
"author": "XCG Consulting",
"website": "https://orbeet.io/",
......
......@@ -2,7 +2,7 @@
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2014, 2018, 2022 XCG Consulting
# Copyright © 2014, 2018, 2022 XCG Consulting
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
......
......@@ -11,7 +11,6 @@
import configparser
import os
import sys
from importlib.metadata import version
from odoo_scripts.config import Configuration
......@@ -35,7 +34,7 @@
"sphinx.ext.coverage",
"sphinx.ext.graphviz",
"sphinx.ext.viewcode",
"sphinxodoo.ext.autodoc",
"sphinxodooautodoc.ext.autodoc",
]
# Add any paths that contain templates here, relative to this directory.
......@@ -51,12 +50,7 @@
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
# The full version, including alpha/beta/rc tags.
release = version("odoo-addon-converter")
# The short X.Y version.
version = ".".join(release.split(".")[:2])
#
with open(os.path.join("..", "__manifest__.py"), "r") as f:
read_data = f.read()
d = ast.literal_eval(read_data)
......@@ -60,6 +54,10 @@
with open(os.path.join("..", "__manifest__.py"), "r") as f:
read_data = f.read()
d = ast.literal_eval(read_data)
# The full version, including alpha/beta/rc tags.
release = d["version"]
# The short X.Y version.
version = ".".join(release.split(".")[:4])
# General information about the project.
project = d["name"]
......@@ -63,7 +61,7 @@
# General information about the project.
project = d["name"]
copyright = "2020, 2022 XCG Consulting"
copyright = "2021, 2022 XCG Consulting"
author = d["author"]
module_nospace = project.replace(" ", "")
module_description = d.get("summary", "")
......@@ -172,7 +170,7 @@
c.read(setup_path)
if c.has_section("odoo_scripts"):
# reload with odoo_scripts
c = Configuration(os.path.dirname(setup_path))
c = Configuration(directory)
else:
c = None
if not c:
......
......@@ -33,7 +33,7 @@
def __init__(
self,
field_name: str,
model_name: str,
model_name: Optional[str],
converter: Converter,
send_empty: bool = True,
context: Optional[ContextBuilder] = None,
......@@ -54,6 +54,8 @@
if not self._send_empty:
return Skip
else:
if not self.model_name:
self.model_name = instance._fields[self.field_name].comodel_name
relation_instance = instance.env[self.model_name]
return self.converter.odoo_to_message(relation_instance, ctx)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment