Skip to content

Conversation

@kouffsamuel
Copy link
Contributor

@kouffsamuel kouffsamuel commented Apr 28, 2023

This PR will allow users to modify or create new records from the geoengine view.

lmignon and others added 30 commits February 13, 2023 11:52
- separate view and widgets in 2 files
- change js models using 'odoo.define'
…isplay values of selection field instead of technical value in info map box in geoengine view
The feature to set a symbol with symbol_url or symbol_binary on vector
layers was broken. This replace those fields by a new object vector
symbol on which you can specify which symbol to use depending on a field
value.
geo_contains calls St_Contains SQL search.

Plus fix search to set SRID to avoid mixin srid issue.
And extract Swisstopo to move it in a new module
Otherwise partial value is interpreted as context and it will fails on
Odoo loading
Copy link

@ged-odoo ged-odoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as I was pinged, I just did a quick review. I hope that's ok. This is only my comments after a quick look. This is way too big for me to have a serious look in 30min.

However, my overall impression is that it feels like a pretty good work. It involves so many different parts of the JS framework, and it looks like they are all used properly. So congratulation to everyone who worked on this.

@@ -0,0 +1,36 @@
/** @odoo-module */
const {reactive} = owl;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

random remark: you can import owl from @odoo/owl, and it is now the recommended way to do it.

import { reactive } from "@odoo/owl"

@@ -0,0 +1,402 @@
/* OpenLayers Style */

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in odoo, we decided to remove the /css, /js and /xml subfolders. The new guideline is to put everything in /static/src, and locate related code together (so, typically, the xml/js/scss for a component should be located at the same place

return this.rasters.length;
}
}
export const rasterLayersStore = reactive(new RasterLayersStore());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me. The reactive function opened up a lot of new ways of organizing the code.

const activeFields = {};
const geoengineAttr = {};

this.visitXML(xmlDoc, (node) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am not a fan of our archparser system. it feels way too complicated. sorry for that.


export class LayersPanel extends Component {
setup() {
super.setup();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't have to call super.setup if you inherit from Component. Owl guarantees that the setup function of Component is always empty

}

.ol-scale-bar-inner {
display: flex;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the guideline in odoo is now to prefer using boostrap css class above custom css. It helped a lot to reduce repetitive common css properties, such as display flex. So, for example, here, you could simply set d-flex on the element. (note that it may not work here, if you don't own the code that render this css class). Just saying that if you want, you can probably replace some of your css with bootstrap.

this.id = `map_${Date.now()}`;
this.orm = useService("orm");

onWillStart(() => Promise.all([this.loadJsFiles()]));

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can now create a bundle and just load the bundle here

}
}

registry.category("fields").add("domain", DomainFieldExtend);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can use the force: true option, and not have to remove it from the registry before

@@ -0,0 +1,34 @@
/** @odoo-module **/

import {DomainField} from "@web/views/fields/domain/domain_field";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

be aware that we changed the domain selector a lot in master, so sadly, there will be some migration work to migrate this addon to 17.0 in the future

});
}

async loadJsFiles() {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can just put all your js/css files in a new bundle, and load that bundle at once

@kouffsamuel kouffsamuel force-pushed the 16.0-add_editable_geoengine_view branch from 3ca04d8 to f965e55 Compare May 23, 2023 12:04
@lmignon
Copy link
Contributor

lmignon commented May 25, 2023

@ged-odoo I'm so grateful for your review. Thank you!!!!

@kouffsamuel kouffsamuel force-pushed the 16.0-add_editable_geoengine_view branch from 37b0295 to a55af4f Compare May 25, 2023 14:46
@bealdav
Copy link
Member

bealdav commented Jun 1, 2023

Hi thanks for your contributions, I don't understand here

#338 depends on #334

#334 depends on #338

How to solve it ?

@lmignon
Copy link
Contributor

lmignon commented Jun 5, 2023

ocabot merge nobump

@lmignon
Copy link
Contributor

lmignon commented Jun 5, 2023

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 16.0-ocabot-merge-pr-338-by-lmignon-bump-nobump, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Jun 5, 2023
Signed-off-by lmignon
@OCA-git-bot
Copy link
Contributor

@lmignon The merge process could not be finalized, because command oca-gen-addon-readme --org-name OCA --repo-name geospatial --branch 16.0 --addons-dir /tmp/tmpfqpslyb0 --commit failed with output:

/tmp/tmpfqpslyb0/base_geoengine/README.rst:271: (SEVERE/4) Title level inconsistent:

Authors
~~~~~~~
Traceback (most recent call last):
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 349, in check_subsection
    level = title_styles.index(style) + 1
ValueError: '~' is not in list

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/oca-gen-addon-readme", line 11, in <module>
    load_entry_point('oca-maintainers-tools', 'console_scripts', 'oca-gen-addon-readme')()
  File "/ocamt-readme/lib/python3.8/site-packages/click/core.py", line 1137, in __call__
    return self.main(*args, **kwargs)
  File "/ocamt-readme/lib/python3.8/site-packages/click/core.py", line 1062, in main
    rv = self.invoke(ctx)
  File "/ocamt-readme/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/ocamt-readme/lib/python3.8/site-packages/click/core.py", line 763, in invoke
    return __callback(*args, **kwargs)
  File "/ocamt-readme/src/oca-maintainers-tools/tools/gen_addon_readme.py", line 312, in gen_addon_readme
    check_rst(readme_filename)
  File "/ocamt-readme/src/oca-maintainers-tools/tools/gen_addon_readme.py", line 239, in check_rst
    publish_file(
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/core.py", line 370, in publish_file
    output, pub = publish_programmatically(
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/core.py", line 664, in publish_programmatically
    output = pub.publish(enable_exit_status=enable_exit_status)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/core.py", line 216, in publish
    self.document = self.reader.read(self.source, self.parser,
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/readers/__init__.py", line 71, in read
    self.parse()
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/readers/__init__.py", line 77, in parse
    self.parser.parse(self.input, document)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/__init__.py", line 191, in parse
    self.statemachine.run(inputlines, document, inliner=self.inliner)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 170, in run
    results = StateMachineWS.run(self, input_lines, input_offset,
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/statemachine.py", line 238, in run
    context, next_state, result = self.check_line(
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/statemachine.py", line 460, in check_line
    return method(match, context, next_state)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 3007, in text
    self.section(title.lstrip(), source, style, lineno + 1, messages)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 327, in section
    self.new_subsection(title, lineno, messages)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 393, in new_subsection
    newabsoffset = self.nested_parse(
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 281, in nested_parse
    state_machine.run(block, input_offset, memo=self.memo,
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 196, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/statemachine.py", line 238, in run
    context, next_state, result = self.check_line(
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/statemachine.py", line 460, in check_line
    return method(match, context, next_state)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 2771, in underline
    self.section(title, source, style, lineno - 1, messages)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 327, in section
    self.new_subsection(title, lineno, messages)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 393, in new_subsection
    newabsoffset = self.nested_parse(
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 281, in nested_parse
    state_machine.run(block, input_offset, memo=self.memo,
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 196, in run
    results = StateMachineWS.run(self, input_lines, input_offset)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/statemachine.py", line 238, in run
    context, next_state, result = self.check_line(
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/statemachine.py", line 460, in check_line
    return method(match, context, next_state)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 2771, in underline
    self.section(title, source, style, lineno - 1, messages)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 326, in section
    if self.check_subsection(source, style, lineno):
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 355, in check_subsection
    self.parent += self.title_inconsistent(source, lineno)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/parsers/rst/states.py", line 371, in title_inconsistent
    error = self.reporter.severe(
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/utils/__init__.py", line 237, in severe
    return self.system_message(self.SEVERE_LEVEL, *args, **kwargs)
  File "/ocamt-readme/lib/python3.8/site-packages/docutils/utils/__init__.py", line 195, in system_message
    raise SystemMessage(msg, level)
docutils.utils.SystemMessage: /tmp/tmpfqpslyb0/base_geoengine/README.rst:271: (SEVERE/4) Title level inconsistent:

Authors
~~~~~~~

@lmignon
Copy link
Contributor

lmignon commented Jun 6, 2023

/ocabot merge nobump

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 16.0-ocabot-merge-pr-338-by-lmignon-bump-nobump, awaiting test results.

@OCA-git-bot OCA-git-bot merged commit e936d92 into OCA:16.0 Jun 6, 2023
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at c1cd92d. Thanks a lot for contributing to OCA. ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.