- 04 Feb, 2021 3 commits
-
-
Jérome Perrin authored
Let's be consistent and use the default size.
-
Jérome Perrin authored
-
Jérome Perrin authored
When `Form.proxifyField` is used to make a proxy field from a field which has only a TALES and no value, it creates a proxy field with inconsistent internal data structures where `has_value` method does not work as expected. As a consequence, proxy fields to list fields are often broken in the ods/odt rendering. Here is a scenario to reproduce the problem: * add `Base_viewDummyFieldLibrary` ERP5 Form * add a `LinesField`, with id `your_test_base_field`. Change `size` to 1 (not really required but I did this in screenshots here) * add another `LinesField`, with id `your_test_field` and in this field: * set a `default` (`2`) in values, it's only needed to visualise the problem in ods style: ![set default and no items](/uploads/0cb9e229b0ca6761bb15f3d8845ea3f8/image.png) * set `items` in TALES (`python: [('one', '1'), ('two', '2')]`) , this will be the problem ![set items in TALES](/uploads/93d90f57e15afdcca60324675b59086a/image.png) * So far, when this is rendered as ODS, everything is fine: ![ODS before](/uploads/ce387cd7a5146585104470bf099f890b/image.png) this is also what we see in html style view: ![html before](/uploads/650330951ed286576f8366bbd5c44139/image.png) * use the proxify action, to make `your_test_field` be a proxy field to `your_test_base_field` ![proxify action](/uploads/9ff7b29141ce7f170f340c842fd76830/image.png) * result of proxify action looks good, both for values: ![values after proxify](/uploads/a9f7df3cd2d0af1e036aeff352624760/image.png) and for TALES: ![TALES after proxify](/uploads/aeaaa45cc9e91e9327781d85ec1efd57/image.png) * but after this rendering the form with ODS becomes broken: ![ODS after proxify](/uploads/d4e7be3251c596de35333526d4f6277a/image.png) even though it looks fine with html views. `erp5_ods_style` knows how to render list fields and it uses the "display" (two) and not the "value" (2), this is done [here](https://lab.nexedi.com/nexedi/erp5/blob/451ce4137dc1d006bc2cd155535523d51a928150/bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/field_ods_macro.zpt#L60) with a check depending on `field.has_value("items")`. `has_value` is implemented like [this](https://lab.nexedi.com/nexedi/erp5/blob/451ce4137dc1d006bc2cd155535523d51a928150/product/ERP5Form/ProxyField.py#L598-611) for proxy fields: ```python def has_value(self, id): """ Return true if the field defines such a value. """ result = None if (id in self.widget.property_names) or \ (not self.is_delegated(id)): result = ZMIField.has_value(self, id) else: proxy_field = self.getTemplateField() if proxy_field is not None: result = proxy_field.has_value(id) return result ``` and like [this](https://lab.nexedi.com/nexedi/erp5/blob/451ce4137dc1d006bc2cd155535523d51a928150/product/Formulator/Field.py#L80-86) for traditional fields: ```python def has_value(self, id): """Return true if the field defines such a value. """ if self.values.has_key(id) or self.form.has_field(id): return 1 else: return 0 ``` when the value is defined on the proxy field and not delegated to template field, the condition is `self.values.has_key(id)`. But `Form.proxifyField` when transforming a traditional field in a proxy field does not keep the `id` in `self.values` if it's only needed in `self.tales`. This is the root cause of this problem, if we inspect the field, it is something like this: ``` (Pdb) self <ProxyField at /erp5/portal_skins/custom/Base_viewDummyFieldLibrary/your_test_field> (Pdb) pp self.tales {'field_id': '', 'form_id': '', 'items': <Products.Formulator.TALESField.TALESMethod object at 0x7ffa705c7450 oid 0x572626 in <Connection at 7ffa42c1a610>>} (Pdb) pp self.values {'default': '2', 'field_id': 'your_test_base_field', 'form_id': 'Base_viewDummyFieldLibrary', 'title': 'Test Field'} (Pdb) self.has_value('items') 0 (Pdb) ``` If we edit the proxy field, it will repair itself, because the proxy field edit method maintain `self.tales` and `self.values` consistent, but this is not the case with`Form.proxifyField`, which mutate directly `.tales` and `.values` and can make them have different keys - which is not supposed to happen. The problem is that most of the proxy fields we have have been generated by `Form.proxifyField`, so for most of our fields the XML data of business template has this inconsistency. We could have took the easy way and make change `ProxyField.has_value` to understand this case, but it's probably better to fix the data. `erp5_hal_json` also uses `field.has_value` in some places, so it's better to fix at field level and not to address this in `erp5_ods_style` and `erp5_odt_style`. These changes: - add a little more test coverage for `ProxyField.has_value` ( at first I thought the problem was only in `has_value`) - Fix `Form.proxifyField` - add a `ProxyField.checkConsistency` to check that `.values` and `.tales` are in sync - or more exactly that all entries from `.tales` are also in `.values`, because this is what cause the problem with `has_value`. - re-export all proxy fields after cleaning up their `.values` and `.tales`, using `checkConsistency(fixit=True)` on all proxy fields. See merge request nexedi/erp5!1352
-
- 03 Feb, 2021 2 commits
-
-
Kazuhiko Shiozaki authored
-
Romain Courteaud authored
Try to support displaying web js site from google cache, which can not access original gadget, due to cross origin ajax query forbidden. Display original content instead and load the default CSS in such case.
-
- 02 Feb, 2021 4 commits
-
-
Romain Courteaud authored
-
Romain Courteaud authored
-
Romain Courteaud authored
Most ERP5 web sites use a global form wrapping the content. Modify the html viewer to not drop this content.
-
Romain Courteaud authored
-
- 01 Feb, 2021 9 commits
-
-
Romain Courteaud authored
-
Romain Courteaud authored
Stop using ck_editor in read_only to display HTML. This allows to get rid of the ck_editor iframe, allowing a faster load and removing the iframe scroll. The maximise button is no more needed in such case. It also removes all ck_editor links handling: links can be open in another browser tab now. This changes impacts both xhtml style and erp5js.
-
Romain Courteaud authored
-
Romain Courteaud authored
This gadget take an HTML string as parameter. It first cleans it up (with hardcoded behaviour currently) by dropping unknown tag elements, unknown/unsafe tag attributes. It is another protection layer on top of asStrippedHTML inside ERP5. Then, it displays the output HTML and style it with an hardcoded set of rules.
-
Romain Courteaud authored
-
Romain Courteaud authored
-
Romain Courteaud authored
-
Romain Courteaud authored
erp5_ui_test: check empty percent
-
Gabriel Monnerat authored
fixup! erp5_web_renderjs_ui_test: cover case of orange highlight not displayed in rjs_gadget_erp5_emailfield_js with test
-
- 29 Jan, 2021 15 commits
-
-
Gabriel Monnerat authored
erp5_web_renderjs_ui_test: cover case of orange highlight not displayed in rjs_gadget_erp5_emailfield_js with test
-
Georgios Dagkakis authored
store error_text to be propagate to render()
-
Romain Courteaud authored
This allows crawlers like wget to also fetch the rendering gadget without executing any JS
-
Xiaowu Zhang authored
See merge request nexedi/erp5!1344
-
Jérome Perrin authored
-
Jérome Perrin authored
For now this only checks that every entries in .tales are also in .values so that .has_value works as expected. This also supports repairing the structures with fixit argument. We could check more, because there are other problems with proxy fields internal structures: - sometimes some keys are in .values / .tales but not in .delegated_list this seem to happen after changing the target to a field of a different type, with different keys. - .delegated_list are not always sorted
-
Jérome Perrin authored
The internal data structures are made of two dicts: .values for values and .tales for TALES. Formulator expect that these two dicts have keys for all properties, because of the implementation of Field.has_value which checks for the presence of the key in .values When making a field with only TALES, this method was setting the value only in .tales but the same key needs to be present also in .values, otherwise get_value would return False for this key.
-
Jérome Perrin authored
For same reasons as 5b1c03c8 (sort delegated lists to make proxy field representations more stable., 2009-05-18)
-
Jérome Perrin authored
This was not much tested
-
Georgios Dagkakis authored
-
Xiaowu Zhang authored
-
Arnaud Fontaine authored
This will be needed for DCWorkflow to ERP5Workflow migration so this will be a core Document and make bootstrap easier.
-
Jérome Perrin authored
Nowadays Line Report works fine in ERP5JS. It is also useful in context of MRP. See merge request nexedi/erp5!1347
-
Jérome Perrin authored
This shows the asset price from `stock.total_price` which can be just the movement prices or the evaluated prices if getDestinationAssetPrice and/or getSourceAssetPrice type based methods are defined.
-
Jérome Perrin authored
erp5_trade contains Base_viewTradeFieldLibrary which contain my_dialog_mode_portal_type, which is a multi list field where user can select multiple lines portal types. It is used in DeliveryModule_viewDeliveryLineReportDialog/your_portal_type erp5_item also contains Base_viewTradeFieldLibrary , for cases where erp5_item extend trade module to select items. It also contains a my_dialog_mode_portal_type field, where user can select item portal type. That field is not a multi-list field, but a list-field. It is used in DeliveryLine_viewSelectItemListDialog So when erp5_item is installed, it overrides Base_viewTradeFieldLibrary/my_dialog_mode_portal_type with a list field instead of a multi-list field and breaks DeliveryModule_viewDeliveryLineReportDialog, because user can no longer select more than one portal type. This renames the field in erp5_item, now we have: * Base_viewTradeFieldLibrary/my_dialog_mode_portal_type for movement portal types * Base_viewTradeFieldLibrary/my_dialog_mode_item_portal_type for item portal type
-
- 28 Jan, 2021 4 commits
-
-
Romain Courteaud authored
-
Arnaud Fontaine authored
Until now it was only used in ERP5Catalog where the expression property is `expression` for both Python Script and SQL Method but this is a common pattern and will also needed for ERP5Workflow.
-
Jérome Perrin authored
Instead of generating the report in one big activity, split the calculation in several batches, so that the processing can be distributed on zope nodes. The limit for the number of lines was also increased from 10000 to 100000
-
Jérome Perrin authored
Using an absolute URL for gadgets cause the gadget to have a different URL per language when the web site uses "Language in URL" feature. Using absolute URL is not good for cache and also it seems to cause incompatibilities with recent versions of ERP5JS. Using relative URL is what we usually do, it does not have cache problem and works fine.
-
- 27 Jan, 2021 3 commits
-
-
Romain Courteaud authored
-
Kazuhiko Shiozaki authored
-
Jérome Perrin authored
These modules contain movements and this export is a generic export usable on any movement type, that can also be useful in MRP modules.
-