I exported the default solution and saved it to my local drive. Then on the online CRM i changed lot of things in the default solution. For example i added two fields.
I went back and imported the default solution , i was expecting that those two fields should be removed and the old solution should be applied back. But then neither the default solution is seen in my imported list and neither it reverted back.
Am i thinking something wrong ? or this is a expected behavior.
First,It won't delete any fields that you have created, you need to manually delete them if required. But if you have done any changes on entity forms, unmanaged solution will overwrite that changes, so you won't be able to see any changes that you have done after exporting solution.
Second as you have exported your default solution and re-imported that again, it won't show you different solution imported (because it's same solution right)
Related
I have created a custom form in a custom module but No matter what I do, the form is still is using core/themes/classy/templates/form/form.html.twig as the template. i've tried everything (that I can find) on the web but still no way to have own template applied. Please help!
Tried everything google can find me.
Just need my custom template to be applied instead of the default one.
My only requirement is for the module to contain its own theme templates and not rely on a specific theme.
Having tried everything I could find, I resulted to overwriting the template in a new theme rather than in the module. I wanted something else, but better than continuing to waste time. I hope this helps someone else.
I imported a translation in my Odoo 8 but some of the buttons are not changing. They remain in English.
Here's an example:
I changed the strings manually by exporting the language and importing it again.
I don't know if that has to be changed in the code itself.
But each time I upload the language again, it remains the same.
Any helpo would be really appreciated.
You can try to updating the base module, and the respective module what you want to generate the translate, in this case account.
I'm using a DS.attr() data type in one of my Ember-Data models (note, no attribute type specified) to allow me to store nested JSON data. For the most part, it works fine, however, when I make changes (e.g. with an input bound to one of its properties) the record isn't marked as 'modified' in the Ember inspector, although the view bindings are all working properly (i.e. if I echo the same property as text, it changes when the input changes). Similarly, after making a change to one of these properties, if I call the rollback() function on the model, the data isn't rolled back.
Of course, the regular properties work just fine, so I'm assuming this has something to do with the DS.attr() type not being specified.
Is there a way to make this work efficiently? I would try to use embedded records, but this data doesn't use any record IDs.
Thanks
To answer my own question, the best solution I've been able to come up with is to use the ember-data.model-fragments addon. It's pretty slick, and solves both problems that I listed above.
I've seen this answer, so perhaps it's Django's behavior that I'm not understanding, or perhaps I changed something myself without realizing it, but, after deleting several instances of a table (perhaps I deleted the parent instance and ON DELETE CASCADE occurred), I found that the automatically-generated IDs of other instances in that table had changed. I believe that I'd called .delete() on the models. Would Django ever do this? The database was Postgres.
I have no evidence that this was the case, but I'll guess that human error was involved in order to close the question.
Instead of deleting records in my Django application, I want to just mark them as "deleted" and have them hidden from my active queries. My main reason to do this is to give the user an undelete option in case they accidentally delete a record (these records may also be needed for certain backend audit tracking.)
There are a lot of foreign key relationships, so when I mark a record as deleted I'd have to "Cascade" this delete flag to those records as well. What tools, existing projects, or methods should I use to do this?
Warning: this is an old answer and it seems that the documentation is recommending not to do that now: https://docs.djangoproject.com/en/dev/topics/db/managers/#don-t-filter-away-any-results-in-this-type-of-manager-subclass
Django offers out of the box the exact mechanism you are looking for.
You can change the manager that is used for access through related objects. If you new custom manager filters the object on a boolean field, the object flagged inactive won't show up in your requests.
See here for more details :
http://docs.djangoproject.com/en/dev/topics/db/managers/#using-managers-for-related-object-access
Nice question, I've been wondering how to efficiently do this myself.
I am not sure if this will do the trick, but django-reversion seems to do what you want, although you probably want to examine to see how it achieves this goal, as there are some inefficient ways to do it.
Another thought would be to have the dreaded boolean flag on your Models and then creating a custom manager that automatically adds the filter in, although this wouldn't work for searches across different Models. Yet another solution suggested here is to have duplicate models of everything, which seems like overkill, but may work for you. The comments there also discuss different options.
I will add that for the most part I don't consider any of these solutions worth the hassle; I usually just suck it up and filter my searches on the boolean flag. It avoids many issues that can come up if you try to get too clever. It is a pain and not very DRY, of course. A reasonable solution would be a mixture of the Custom manager while being aware of its limitations if you try searching a related model through it.
I think using a boolean 'is_active' flag is fine - you don't need to cascade the flag to related entries at the db level, you just need to keep referring to the status of the parent. This is what happens with contrib.auth's User model, remember - marking a user as not is_active doesn't prompt django to go through related models and magically try to deactivate records, rather you just keep checking the is_active attribute of the user corresponding to the related item.
For instance if each user has many bookmarks, and you don't want an inactive user's bookmarks to be visible, just ensure that bookmark.user.is_active is true. There's unlikely to be a need for an is_active flag on the bookmark itself.
Here's a quick blog tutorial from Greg Allard from a couple of years ago, but I implemented it using Django 1.3 and it was great. I added methods to my objects named soft_delete, undelete, and hard_delete, which set self.deleted=True, self.deleted=False, and returned self.delete(), respectively.
A Django Model Manager for Soft Deleting Records and How to Customize the Django Admin
There are several packages which provide this functionality: https://www.djangopackages.com/grids/g/deletion/
I'm developing one https://github.com/meteozond/django-permanent/
It replaces default Manager and QuerySet delete methods to bring in logical deletion.
It completely shadows default Django delete methods with one exception - marks models which are inherited from PermanentModel instead of deletion, even if their deletion caused by relation.