mirror of
https://github.com/OCA/server-backend.git
synced 2025-02-18 09:52:42 +02:00
Use related model_id field to build domain
This commit is contained in:
@@ -7,9 +7,10 @@ import time
|
|||||||
from operator import itemgetter
|
from operator import itemgetter
|
||||||
from urllib.parse import quote_plus
|
from urllib.parse import quote_plus
|
||||||
|
|
||||||
import vobject
|
|
||||||
from odoo import api, fields, models, tools
|
from odoo import api, fields, models, tools
|
||||||
|
|
||||||
|
import vobject
|
||||||
|
|
||||||
# pylint: disable=missing-import-error
|
# pylint: disable=missing-import-error
|
||||||
from ..controllers.main import PREFIX
|
from ..controllers.main import PREFIX
|
||||||
from ..radicale.collection import Collection, FileItem, Item
|
from ..radicale.collection import Collection, FileItem, Item
|
||||||
|
|||||||
@@ -4,10 +4,11 @@
|
|||||||
|
|
||||||
import datetime
|
import datetime
|
||||||
|
|
||||||
|
from odoo import api, fields, models, tools
|
||||||
|
|
||||||
import dateutil
|
import dateutil
|
||||||
import vobject
|
import vobject
|
||||||
from dateutil import tz
|
from dateutil import tz
|
||||||
from odoo import api, fields, models, tools
|
|
||||||
|
|
||||||
|
|
||||||
class DavCollectionFieldMapping(models.Model):
|
class DavCollectionFieldMapping(models.Model):
|
||||||
@@ -34,6 +35,10 @@ class DavCollectionFieldMapping(models.Model):
|
|||||||
required=True,
|
required=True,
|
||||||
help="Field of the model the values are mapped to",
|
help="Field of the model the values are mapped to",
|
||||||
)
|
)
|
||||||
|
model_id = fields.Many2one(
|
||||||
|
'ir.model',
|
||||||
|
related='collection_id.model_id',
|
||||||
|
)
|
||||||
import_code = fields.Text(
|
import_code = fields.Text(
|
||||||
help="Code to import the value from a vobject. Use the variable "
|
help="Code to import the value from a vobject. Use the variable "
|
||||||
"result for the output of the value and item as input"
|
"result for the output of the value and item as input"
|
||||||
|
|||||||
@@ -51,9 +51,10 @@
|
|||||||
<form>
|
<form>
|
||||||
<group>
|
<group>
|
||||||
<field name="collection_id" invisible="1"/>
|
<field name="collection_id" invisible="1"/>
|
||||||
|
<field name="model_id" invisible="1"/>
|
||||||
<field name="name"/>
|
<field name="name"/>
|
||||||
<field name="mapping_type"/>
|
<field name="mapping_type"/>
|
||||||
<field name="field_id" domain="[('model_id', '=', collection_id.model_id)]"/>
|
<field name="field_id" domain="[('model_id', '=', model_id)]"/>
|
||||||
<field name="import_code" attrs="{'invisible': [('mapping_type', '!=', 'code')]}"/>
|
<field name="import_code" attrs="{'invisible': [('mapping_type', '!=', 'code')]}"/>
|
||||||
<field name="export_code" attrs="{'invisible': [('mapping_type', '!=', 'code')]}"/>
|
<field name="export_code" attrs="{'invisible': [('mapping_type', '!=', 'code')]}"/>
|
||||||
</group>
|
</group>
|
||||||
@@ -73,5 +74,4 @@
|
|||||||
action="action_dav_collection"
|
action="action_dav_collection"
|
||||||
sequence="100"
|
sequence="100"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</odoo>
|
</odoo>
|
||||||
|
|||||||
Reference in New Issue
Block a user