Howcan I change the visible name of a many2many field? - many-to-many

I am using Odoo8.
I have two models: x_items and project.task.work.
I have a field called name and a custom field called x_wo_ref in the project.task.work.
I have a many2many field x_item_wo in the model x_items which is related with the model project.task.work.
Currently when I fill the field x_item_wo, the field name from project.task.work is showed.
How can I customise it in order to use the field x_wo_ref instead of the default field name for this many2many field?
Thank you

You need to define the _rec_name attribute of the model. _rec_name takes as default the field name and if this does not exist it does not take anything unless you specify it. For instance if you need to see the field phone you must write:
_rec_name = 'phone'
In case you want a _rec_name depending on anything you need to change the function name_get(). You can see examples in other models.

Related

Lotus Domino data as JSON - Propertie Names

I have created a custom view in my Notes database. The view has its own column headers.
Now when I get the JSON output, the object looks like this.
"#href":"\yourdatabase.nsf\/api\/data\/collections\/name\/MYVIEW\/unid\/FF235B724095ADDAC12585F300453467",
"#link":
{
"rel":"document",
"href":"\yourdatabase.nsf\/api\/data\/documents\/unid\/FF235B724095ADDAC12585F300453467"
},
"#entryid":"1-FF235B724095ADDAC12585F300453467",
"#unid":"FF235B724095ADDAC12585F300453467",
"#noteid":"1B752",
"#position":"1",
"#read":true,
"#siblings":761,
"#form":"Person",
"eName":"Doe",
"eNAM_D":"John",
"eAddress":"Mr.",
I had thought that the property names come from the column headings.
as an example:
"Name":"Doe",
"Forename":"John",
"Address":"Mr.",
instead of
"eName":"Doe",
"eNAM_D":"John",
"eAddress":"Mr.",
Is there a way to set the properties yourself?
The name used as the property name is the programmatic name of the column (check the last tab on the column properties dialog box).
This is usually the field name if the column shows just a field. It is a computed unique name e.g. $21 if the column shows something other than a field.
You can change the name of a column that does not show only a field.
In your case, you are showing a field called eName and the programmatic name is eName. You can't change this.
You can however change the column to be a computed value that isn't just a field e.g. "" + eName and then change the programmatic name. Do not change the programmatic name to the name of another field in the database.

How do I set a default value for a combo box that draws values from a table/query?

Since I'm new to Access but it is what I have available, I am customizing a database template to fit my needs. The template came with a table called "Donations" that records all the received money from contributors. I have added another table called "Descriptions" that has labels for the common types of contributions we receive (Donation, Participant, Sponsor, Anonymous, Memorial, Honorarium).
In the "Donation" table I have added a combo box called "Label" that imports the values from "Description" to populate the list.
SELECT Descriptions.ID, Descriptions.Label
FROM Descriptions ORDER BY Descriptions.[Label];
This lookup is working correctly.
Since most of the contributions we receive fall under the Description/Label of Donation, in the name of efficiency, I would like to set this to be the default value. However, I have no idea how to do this.
Failed Methods:
"Donation" - Error 'Type mismatch' in the default value.
[Donation] - Could not find field "Donation"
[Description].[Label] - Could not find field "Description].[Label".
Since your lookup query SELECT Descriptions.ID, Descriptions.Label includes the ID, I assume the ID is what is internally stored.
Open your Descriptions table, find the ID of "Donation", and use that number as Default value in the main table.

SSRS Multiple Parameters in a single dropdown

I have a report I need to develop where all Quotes should be listed where a specific Product is present. The product can be identified based on Product ID/Price/Product Name etc. I was looking to develop one report where all there fields are present as part of a dropdown. When the user selects one value such as Product ID and enters a value in the text box next to the ID, the report is filtered on this parameter. If the user selects name, the name can be entered in the text box and the report is filtered based on the Vendor ID etc.
Is there a way to do this? I have the parameters showing up next to each other instead.
It is doable if I understand correctly and here are the steps for achieving your report purpose.
I will use a simple query as an example data set for your reference.
1.Create source and datasets, in this example I skip the data sources and here is the short query for my exmaple
SELECT * FROM Table
WHERE
(ID = #ID or #ID = '')
and
(Name = #Name or #Name = '')
2.Add another dataset named Control, the query for Control is:
SELECT 'ID' as option
UNION
SELECT 'Name' as option
The purpose of creating this dataset is to provide the available values later when you need to choose either name or ID.
3.After step1, you should already have two parameters generated by system, which are ID and Name, if not, create them by yourself and go to each parameter page, DO MAKE SURE CHECK Allow blank value''
4.Create the 3rd parameter called Control, go to parameter setting page, go to Available Values, Choose Control dataset, Choose option (which is the customize column name you set in Controldataset) for both Value field and Label field
5.Go to ID parameter setting page, go to Default Values, choose Specify values, click fx, type this:
=Switch(Parameters!Control.Value="Name","")
Click ok
6.Go to Name parameter setting page, go to Default Values, choose Specify values, click fx, type this:
=Switch(Parameters!Control.Value="ID","")
Click ok
The ID and Name expression are correct, not set wrong
7.Change the parameter order to make Control on the VERY TOP, no matter ID or Name comes for the 2nd, but Control should be in the 1st place.
8.Drag and drop a table, place Name and ID. Preview the report, at this time, only Control will be available for you to choose value, choose either ID or Name to see the difference. When you choose ID, Name will be gray out, only ID light up and type any ID you want, actually, what the system does internally is passing the "" (blank value) to Name, that is why you need to make sure the Name parameter could accept blank value. Same for selecting Name
Update me if you have any run time issue

Filter rows in SSRS based on parameter and Field

I am new to using the filters in SSRS. But I would like to filter Accessories (Yes, No). This is a parameter with a yes and no Value which would display/ filter rows based on the field Field!class.Value= "I" or "A" accordingly.
So If the drop down is yes it should only display rows with class "I" otherwise All "I" and "A"
How would I do this in the Taxlib filters property. It is not working for me, the way I need it to.
Help would be immensely appreciated as usual! :)
Modified as per OP corrected logic ..
Create your parameter Label Yes with value ="I" and No with value ="*"
In your table properties, filter section, click add button.
Below I am filtering type field against the parameter. You need to select the class field from the drop down list.

Assigning a default value to a Microsoft Access Table Field?

I have a database table in Microsoft Access. I want to assign the default value of one of those fields to another field that happens earlier in the same table.
I tried the value =[Form1].[AssignedByes] with no luck and the same for =[AssignedByes] but with no luck.
Can anyone help?
The field name I'm assigning the value to is [RemainingByes] and the field that assigning the value of is [AssignedByes].
To get around this problem, I create a Query that basically functions as the table. I use it instead of the table when creating other queries, forms, etc.
I'm guessing that you copy [AssignedByes] into [RemainingByes], because [RemainingByes] will start off with the value of [AssignedByes], but you want to be able to change it later.
So, you can set up the Query with a calcualted field called [xRemaningByes]. You would enter the changed values in [RemainingByes]. Then set up a formulat in [xRemainingByes] that returns the value of [RemainingByes] if there is one, and it not, it returns the value of [AssignedByes].
[xRemainingByes]: Iif([IsNull([RemainingByes],[AssignedByes], [RemainingByes].
When you use the Query instead of the Table, you will use [xRemainingByes], which is the Query's calculated field, instead of the Table's field [RemainingByes].
ANOTHER OPTION ---
Create a field in the Table such as [RemainingByesOverride], and that would be where you hard enter the changing data. Then get rid of [RemainingByes] in the table and only have it in the Query as a calculated field.
[xRemainingByes]: Iif([IsNull([RemainingByesOverride],[AssignedByes], [RemainingByesOverride]
A field's default value is applied at the instant a new record is created. So you can't use [AssignedByes] as the default value for [RemainingByes], because [AssignedByes] doesn't have a value yet.
OTOH, if you've assigned a default value property for [AssignedByes], use that same property for [RemainingByes].
If your Access version is 2010, see whether you can use a data macro as a pseudo-trigger to accomplish what you want.
You could also try binding a form to the table. In the after update event of the control bound to [AssignedByes], you can assign a value to another control bound to [RemainingByes]. This could allow you to do what you need in the form, but won't apply for changes made outside the form.