Plone dexterity model-driven type relationfield - plone

Is it possible to add a relationfield to plones dexterity through the web? I mean by editing the field model xml file.
I know how to add relationfields to the schema model (.py), but how to accomplish the same in the xml?

This field is currently lacking from plone.schemaeditor code. There's an issue open: https://github.com/plone/Products.CMFPlone/issues/1671

Related

How to make a dexterity reference field?

Using Plone 4.3 (from https://raw.github.com/plock/pins/master/plone-4-3) and trying to make a reference field between two dexterity contents: from IConsumibleEntry to IConsumibleItem.
If I'm understand correctly, I have to add a RelationChoice into IConsumibleEntry with a ObjPathSourceBinder and then all related IConsumibleItem will appear in the add form. I'm following http://docs.plone.org/external/plone.app.dexterity/docs/advanced/references.html so I did:
from mypackage.consumibles.consumible_item import IConsumibleItem
class IConsumibleEntry(form.Schema, IImageScaleTraversable):
item = RelationChoice(
title=_(u"Item"),
source=ObjPathSourceBinder(object_provides=IConsumibleItem.__identifier__),
required=True,
)
I run plone and created several IConsumibleItem instances, but when I try to create an IConsumibleEntry, there's nothing to chose for the 'item' field.
I tried using other expressions for ObjPathSourceBinder, like chosing by content type, but I still can't get any reference to IConsumibleItem instances.
What else is needed to do to get reference fields populated? Is in needed to modify IConsumibleItem? What am I missing?
Thanks in advance.

Custom report translation in OpenERP

Basically all the reports are changed language as per the customer language in OpenERP 7.0. But I have customized a new accounting report as same as default accounting(invoice) report.
While printing my custom report that is not translating based on customer language. Please help to solve this. I am trying this more than two days and not yet any solution.
Note: I have also used setLang function in my report.
Most probably the best solution is to add the i18n folder to your custom addon. In there you add the appropriate .po file and the trick is done.
Remember to add:
folder called i18n
In there
file module_name.pot
file language.po (example it.po)
Salam !
just make [[ setLang('code_lang*') ]] up report
example for french country fr_FR
I hop that help you

How to undo TTW changes to dexterity content type

I have notices that types created with paster on the file system can be changed using the TTW editor.
When I reinstall the product the TTW changes persist, and the model file seems to be ignored. How can I discard these changes? Is there a guide to the relationship between web changes and file system changes?
A content type's entry in the portal_types tool has 3 properties related to where the model is loaded from. They are checked in this order:
model_source: The XML model, inline
model_file: Path to a file which contains the XML model
schema: Dotted path to a Python schema
My guess is that you need to make your filesystem product's installation profile explicitly empty model_source, so that it won't take precedence over model_file and schema.

Converting Archetype Content to Folderish

I have an archetype content type that previously was not folderish. Now I have set it as folderish. What attribute or properties need to be changed so that any data created before can be migrated?
I have read the following documents:
Generic Setup Upgrade Steps
Converting one Content Type into another
I followed the above tutorial on upgrade steps but I do not know which attribute or properties to change.
You could use Products.contentmigration. See it's doc to find out how to use it, it shouldn't be too difficult: just define your CustomQueryWalker and the mapping between your two content types. In order to find out what field you have to map, just put a pdb somewhere in the content's view and inspect the content schema.
similar question here: Migrating from (now obsolete) custom ATImage content type
i stumbled accross the same issue when trying to migrate non-folderish types to folderish ones based on: http://pypi.python.org/pypi/collective.folderishtypes
that helped: on a context to convert, call ##migrate-btrees view [1] to initialize the btree structure [2]. I assume your new Archetype content is plone.app.folder based.
[1] defined in: plone.app.folder.migration.BTreeMigrationView.
[2] Main work is done by: Products.BtreeFolder2.BTreeFolder2Base._initBtrees.

How do I add taxonomy terms using Drupal Migrate

I'm using the migrate module to copy data from several sources to a new drupal installation. So far, I'm able to replicate a lot of what I need from the examples provided with the module. I'm currently stuck on adding terms or taxonomy to newly created nodes. The example shows:
// These are related terms, which by default will be looked up by name
$this->addFieldMapping('migrate_example_beer_styles', 'terms')
->separator(',');
I've tracked down the migrate_example_beer_styles destination mapping and it seems to be the machine name for that taxonomy.
I've tried imitating this behavior with every variation of what my machine_name should be, but the terms never seem to get associated:
By id:
// where source breed_id is '1,100' - it finds mapped values accordingly
$this->addFieldMapping('breeds', 'breed_id')
->sourceMigration('BreedMigration')
->separator(',')
And, by name:
// where source breeds is 'Dogs,German Shepherd'
$this->addFieldMapping('breeds', 'breeds')
->separator(',');
Am I wrong assuming the destination mapping is the machine name for a taxonomy?
This version of the migrate module was released recently, I haven't found any other helpful examples on the web.
This question still seems to be getting some views, so I thought I'd add what else I've discovered. While the accepted answer works, you are able to map Vocabs on ID:
$this->addFieldMapping('Exact Case Sensitive Vocab Name', 'source_field_name')
->sourceMigration('ExactSourceClassName')
->arguments(array('source_type' => 'tid'))
->separator(',');
->separator(',') used for passing a delimited string of source ids. Obviously, leave that off if you're mapping an array of values.
I'm currently working with migrate module myself, and I agree that the documentation is somewhat wanting at this point. :)
The 'machine name' of a vocabulary is listed in the Vocabulary table, in the field 'module'. Try using that value. Do note that you need to feed the text into the mapping, not the ids.
This is my first post on stackoverflow, so I apologize in advance if this isn't the accepted way to submit more information concerning this issue...
I've been stumbling around with the Migrate module for the past few days and was looking for a way to do this in Drupal 7. I had a comma-delimited list of taxonomy ids within an XML field that I wanted to use, but every example I found was retrieving from an external class, or from a database source.
Anyway, through trial and error, I found that you can use a field within the migrate class, rather than reference an external term migration class.
$this->addFieldMapping('field_article_type', 'category_id')
->arguments(array('source_type' => 'tid'))
->xpath('/article/category_id')
->separator(',');
Check out the taxonomy csv import module at http://drupal.org/project/taxonomy_csv.
It was easy to use and did what it was supposed to and more.
I ended up only using the migrate module for importin gNodes and used this module for the taxonomy. It was a pleasure to use.

Resources