How can I add searchable InventoryID (User Defined Field) in the Cases module of Acumatica? - customization

How can I add a searchable inventoryID field in the cases module on Acumatica? I already added a custom field but can I make it searchable?
Is it possible to make this InventoryID User Defined Field searchable from the inventoryItem table? Screenshot Below:

You could put the [StockItem] attribute on the field if you want it to be a selector of all Stock Items. If you want to use a different query you could just use a regular PXSelector like
[PXSelector(typeof(Search<InventoryItem.inventoryID, Where<... etc.

Related

django view filter ManyToMany field to guard view

I have a tag model, with ManyToMany field "parents" to tag model, to itself. There is also "allowed_users" field.
I need to guard a view in such a way, that the user won't see any tags in parents field, to which he is not allowed.
I try to modify queryset, removing the corresponding tags from parents. But when I change the instance, tag_instance.parents.set(my_new_list) it gets saved automatically so I'm altering the database and changing the real value of the instance.
So the general question is "how to guard my view in such a way, that object's ManyToMany field is filtered by custom logic".
Another question is "how to set manytomany field without altering database", as this would be a solution to the former one.
yes I use DRF
You can use the Prefetch object to filter related table when SQL queries are executed.
For instance:
Tag.objects.preftech_related(Prefetch("parents", queryset=Tag.objects.filter(allowed_users=current_user).distinct()))
This will prefetch "parents" (meaning no additionnal sql query will run when accessing my_tag.parent.all()) and filter parents to keep only those with the current user in allowed_user
Note: Tag.objects.filter(allowed_users=current_user) will duplicate tag entries for each user in allowed_user, ence the .distinct() to keep one of each

How to add column with drop-down list on Django admin change list template?

I have a TaskRequest model that contains a column named 'owner'. This column contains users from a group named 'owners'.
I want to have an option to select users directly from the change list view without clicking on the task name.
How can I implement a drop-down list so it is visible in the table in my TaskRequest app. Do I really need to overwrite the admin template or is another way to do that?
Ok thanks to #solarissmole I managed to achieve what I needed. In admin.py you just need to put list_editable = ("owner",).

Change one django form field value relative to another

Let say I have two fields in a django form country and state.I want the values of state to relatively change with the values of country.i.e. I want the state field to list out the states of the country that user has selected. Also the state field should be empty during form initiation.I know that this can be done using java script and other scripts.But,I would like to know if there are any conventional methods exists in django to do the same.???
Sounds like you need to create a model for Country and State.
State model should have a foreign key linking to Country. This means many states can be related to one country. Then, populate the tables with all countries and states you want.
In your form, you can override the 'init' method with custom behavior. So, if you have declared a field 'state' then you can do something like self.fields['state'].choices = State.object.filter(country_id=some_country_id). This assumes you have some_country_id already and you can pass this through as a kwarg during instantiation.

Dropdown values customization in NetSuite

There is a custom record type configured in NS. It has a name and a free-form text field called full_name. Name is a standard field, full_name is a custom field. There is another record type which has a field of type List/Record with the previous type. On the form this field is present as drop-down. The drop-down show names of records. The goal is to show full names instead of names in the drop-down. Is it possible to mark somehow full_name field so it is available in the drop-down view instead of just name? Any ideas how to achieve this with NS?
Depending on your exact needs, it may make sense to add another custom field to the record containing your drop down. You can source this field from the full_name field on the custom record. This field does not need to store the value if it's only for display purposes.
Add a new field to the record containing the drop down
Set the type to be text
Name it appropriately
Under the 'Sourcing and Filtering' tab, set the source by field to the drop down
A field with type List/Record type can only show standard Name field. However, you can create a custom field dynamically on before record load of a user event script. Check the nlobjForm.addField. Please keep in mind that the value of it will not be saved. Saving the value is another story.

Create Template Custom Field Field in Sitecore

I want add a custom field in a Sitecore template.
Field will be a drop down of hours (1 -23) and used to show open and close time.
Ex: 8am to 7pm.
How can I add a custom field for that?
You can use a droplist field and set it's datasource to a folder that contains numbered items 1-23.
You could also just use a plain text field and optionally add a validator, or a date-time field if you actually want the time (+date) formatted.