Can Assemblies inherit or display the attributes of member items? The source of truth for the Assembly is not the fields on the Assembly record, but rather lives at the member item level below, so I want to avoid duplicating data.
We're manufacturing assemblies of electronics, the BOM has many entries of member items and one of the member items is an LED array. LED array comes in 5 different types, each with a different wattage W, 8W or 12W etc.
If the member items have an attribute for 8W or 12W etc, can the Assembly/BOM record inherit or otherwise display the attribute from the member item?
Again I want to avoid duplicating data that already exists elsewhere.
Related
I'm setting up an an admin page that handles the storage of data of a product, in this case it is shoes which most of you might realize usually comes in pairs of left and right. The shoes have a differing number of fields and that's why i've implemented an eav system where the forms for the shoes are contained in an inline.
All i would like to do now is to group the forms in the inline in two columns depending on the value of the field shoe_side (can be 'L' or 'R' for left and right)
This is regarding the change view since the system is set up so that it creates all the neccessary fields depending on another model we can call a product recipe.
I did this in javascript with templates before in a similar situation but that was without the inline fields so it's not applicable. I think if I could just group the fields of the two columns into two formsets I could edit the template to get the needed layout but I don't know if one can create formsets based on a field in the model, I haven't really grasped the concept of formsets.
# The inline model
class Component(models.Model):
part_name=models.ForeignKey(PartRecipe)
shoe_side=models.CharField(choices=[('L', "Left"),('R', "Right")
product_id = ForeignKey(ProductModel)
....
# The 'parent' model
class ProductModel(models.Model):
product = ForeignKey(Productrecipe)
....
# a lot of not relevant fields
# The admin classes
class ComponentInline(admin.StackedInline):
template = 'admin/componentinline/stacked.html'
model = Component
class ProductAdmin(admin.ModelAdmin):
...
inlines = [ComponentInline,]
We have a requirement to delete certain products from everywhere in hybris (including cart, orders, promotions) and all its references as well like Media, Category, Stocks, etc.
I found this one solution:
REMOVE Product [batchmode=true];itemType(code)[unique=true]
;Product;
I was wondering if just deleting the product, would remove all its references from hybris, or is there any better solution to do this.
Any help is greatly appreciated!
Removing the product will remove references to it, but not the objects which are refering to it (like Media, Category, Stocks, etc.)
The only objects which will be deleted are those refered by attributes with the partOf modifier.
A Part Of relationship between two classes extends an aggregation
relationship by ensuring that the lifecycle of the dependant object
(the part) is bound to the lifecycle of the parent object. When you
delete the parent object, all instances of its attribute types that
are marked as partOf will then be cascade-deleted.
Hybris doesn't know if a Media or a Category is no longer needed after a Product is removed. Therefore you must delete those objects explicitly.
Removing product will remove only instances of product type, but not all data like media.
To remove from cart : it should inform user that product no longer available in store
For successfully placed orders : you should be able to display basic details of product with message as in cart [ :) :) But you should deliver if order is placed successfully and payment is received otherwise its a bad eCommerce impression]
For promotions : you should remove all promotions related to this product Or reconfigure according to business need.
I have an odd issue.
I have client that wants a sharepoint list what is populated from a WCFService. That part is working quite well.
I have a bdcmodel that is mapping the WCF data and I can create an external list from the bdcmodel as well so that is working fine.
The issue I have is that one of the properties in the model is actually a collection of entities called Attributes. The objects in this collection simply have 2 properties Name and Value so really they are just a key value pair.
The client wants to see the list of attributes of the parent entity in the external list. So there would be an Attributes column and within that column would be the list of attributes for each parent object.
Is there even a way to do this? I am looking into Custom Field Types, but it seems like these are really intended to be singular values.
How would I create a list within and external list?
Any help anyone can give would be great even if its just to tell me that there really isn't a stable way to do this so I can go back to the client and tell them we will need to build a custom list to support this because the OOB external list and custom fields and custom field types won't support this kind of nested listing.
I decided to set up the custom field as a string and when I get my collection in from the BdcModel I am serializing it to JSON and then passing it to the field. When the field is viewed in display, edit or new I have overridden the FieldRenderingControl and I am tiling the collection out that way.
The issue
I have a popup button (NSPopUpButton) that is bound to an NSArrayController. This array controller handles parent objects that each have a collection of child objects. I have an NSTableView in which I need to show these children for the selected item in popup. In addition, the list of children needs to be manipulated (add/remove).
I've tried to accomplish this in many ways but always run into some thing that complicates the solution. What is the best way to implement this?
The data is managed here by Core Data and thus, the collections are NSSets. I've tried adding a conversion method in the parent to return a sorted NSArray (in order to bind it with NSArrayController) but this approach prevents the KVO and the array controller is not updated properly.
Thank you in advance.
An example
To clarify, here's a hypothetic example:
Let's say I have a list of countries that is maintained elsewhere. One of these countries is selected in a popup button. Each country has a set of cities. When a country is selected a table view is populated by it's cities.
There is a solution for this without the delegate/datasource setup.
My context is this:
CoreData model with Parents and Children, one Parent has multiple Children via a relationship named children. Both have a attribute name.
The two Entities must be available as classes (each with a .m and a .h). (Xcode will write them for you if you go to File-New-File-CoreData-NSManagedObjectSubclass.) Now the ChildObjects of a ParentObject can be accessed by ParentObject.children
Two NSArrayControllers: ParentArrayController and ChildArrayController.
Two NSTableViews: ParentTable and ChildTable, each with one column for name. (It should not matter whether you use a Popup or a table as long as it's controlled by a NSArrayController.)
The steps to take are as follows:
Connect both NSArrayControllers to the MangagedObjectContext as usual and set them to Mode: Entity Name with their respective Entity (Parent or Child)
Bind both TableViews (their columns) to their NSArrayController as usual.
Now comes the magic: In the ChildArrayControllers binding section under ControllerContent-ContentSet bind to the ParentArrayController with ControllerKey: selection and ModelKeyPath: children.
Done. If you select a ParentObject in the ParentTable the ChildTable shows its children.
To add and remove children to parents you can use the (void)addChildrenObject:(Child *)value; method that Xcode wrote for you in the Parents.m class file.
I didn't find any way to implement this by simply with dragging and dropping. I had to implement a delegate and data source for the table of cities (from the example). The window controller is notified of the selection changes in the popup button and this updates the content on the table view delegate / data source.
I actually feel this is little bit better way to implement the issue (than with bindings and array controllers) since it gives more control over special cases.
I have a core data app that is using the sectionNameKeyPath "group.name" with the fetchRequest in order to group the results by the group entity's name attribute. I'm grouping by group.name but I'd like to sort the sections by something other than group.name. According to the NSFetchedResultsController docs:
If the controller generates sections,
the first sort descriptor in the array
is used to group the objects into
sections; its key must either be the
same as sectionNameKeyPath or the
relative ordering using its key must
match that using sectionNameKeyPath.
Which means that the sections must be sorted in the same order the are grouped in. Despite the documentation, prior to iOS 4.2 you could get away without specifying the sectionNameKeyPath as the first sort descriptor which allowed you to sort the sections, but no longer.
What is the best way to sort sections in an NSFetechedResultsController? For example, I want my sections to be grouped by "group.name" but sorted by "group.timestamp".
From the NSFetchedResultsController docs:
You create a subclass of this class if
you want to customize the creation of
sections and index titles. You
override
sectionIndexTitleForSectionName: if
you want the section index title to be
something other than the capitalized
first letter of the section name. You
override sectionIndexTitles if you
want the index titles to be something
other than the array created by
calling
sectionIndexTitleForSectionName: on
all the known sections.