axelor / axelor-open-platform

Open source Java framework for business application development
http://axelor.com
Other
391 stars 298 forks source link

O2M MetaFile - file not uploaded when an entity in edit mode #108

Open CITIZENGATE opened 2 years ago

CITIZENGATE commented 2 years ago

Hi,

When an O2M field of MetaFile is used inside an entity, a file added in an existing entity is not uploaded. The file is uploaded only when the entity is created, not when updated. It works on create and edit mode only if the field is M2M (not with O2M).

M2M field could be used as well, but using an O2M instead of a M2M allows the use of orphanRemoval="true".

<?xml version="1.0" encoding="UTF-8"?> <domain-models xmlns="http://axelor.com/xml/ns/domain-models" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://axelor.com/xml/ns/domain-models http://axelor.com/xml/ns/domain-models/domain-models_5.4.xsd">

    <module name="acme" package="org.acme.db"/>
    <entity name="TestMeta" lang="java" table="test_meta">     
          <string name="name" namecolumn="true"/>
         <one-to-many name="attachments" ref="com.axelor.meta.db.MetaFile" title="Attachments" orphanRemoval="true"/>
   </entity>

Thank u

Regards