Odoo functions from parent - report

I have made a qweb report for res.partner that should list all the projects for that customer. But i don't know how to take the id for the current res.partner so i can search the database. I want to do something like the following code(where self.id is the id for the current partner):
data = self.env['project.project'].search([('partner_id', '=', self.id)])
I want to return the current open contact. For example if i call the function from the contact menu of Delta PC, i want the id of the contact Delta PC.
I have tried someting like this:
partner = self.env['res.users'].browse(self.env.uid).partner_id
but it returns the current logged user from the contacts table.

Try this code:
<span t-esc="env.user.partner_id.name"/>
Following code will print current partner logged in.

Related

Populate data based on the response given in Google Form

I have created two sections
First Section I have Order ID after entering the order ID and I click Next - In second section I want to populate order id's related data like (Name, Address, list of orders) All these data are available in an excel sheet, Once it is populated I would like the user to confirm their orders are correct and then hit submit.
Is this possible using google form or any add-ons for Google forms?
Thanks!
i read your question
As far i know about google form, google form don't give option to recheck your pre-filled options. So, what we can do is to give a confirm button at the end which is must required to fill.
You can see it through this example.
https://docs.google.com/forms/d/e/1FAIpQLSchhhCjcyQe-ZTdl8pFF-ETLPGFTXPcuqQGDGQ1nMbtcwOnGQ/viewform?usp=sf_link
If you want to create a more user defined form you can make it from simple html and php.
hope this will help you.
thanks!

Creating a WordPress website using a Database/Table

I am relatively new to WordPress but have a lot of coding experience so I am hoping to pick it up quite quickly.
I am looking to create a website on WordPress that uses a database.
For example, I have made a table of animals consisting of 100 rows, one for each animal, and this is accessible on phpMyAdmin. I want my website to have a page for each row entry in this database.
Ideally, I would like a page to be shown to the user which contains filters. So the user can select maybe "Small" animals which are "Nocturnal". This will then use the database to find all animals which are "Small" and "Nocturnal", and then the page will display the links to the animals which match these filters. Say only "Hamster" matches these filters in my database, then the link to the Hamster page would display on the website.
Then the user can click the Hamster page to find out more about the animal. So I need a page for each animal, but wondered if I could somehow link this to a database I have to help with the filtering options.
Thanks.
Step 1: Create the animals page and display all of them
Set up a page template to show all your animals first, without filters. That should get you started.
To retrieve them, modify the page template file you created above to fetch all the rows in the animals table, like so:
global $wpdb;
$feeds = $wpdb->get_results("SELECT * FROM animals", ARRAY_A);
Iterate through the rows to print them out into table form.
Step 2: Create the filters
Create the links on the front end using query parameters, e.g. for a link to all nocturnal animals, use something like:
echo 'Nocturnal';
Step 3: Handle a specific query variable
At the top of your animals template page, use the following code to get a query variable:
$animal_type = get_query_var('animal_type');
So if you accessed the URL http://www.example.com/animals/?animal_type=nocturnal then the value of $animal_type would now be nocturnal.
Now create a new function in functions.php to query for animals using query parameters. Something like this:
$args = array('animal_type' => $animal_type, 'animal_size' => $animal_size);
function get_animals($args);
And iterate through them to print them out.

Wordpress | generate unique link

I am turning to Stackoverflow community for a need of critical advice.
It's simple, I want a person to generate a link... and that link will have a button where whoever it is sent to, that person can click yes/no - then return the value.
user 1 > generate link > user 2 > options > return option to user 1
Please can anyone point me in the right direction?
Thanks very much!
All the code you need is in wp-login.php
Generate unique URL (for password reset)
Email URL (or you could just display it)
Set user profile metadata (so you can track it)
If you want to track individual users, then you can either generate a unique url per user, per authored page or perhaps simpler is generate one unique url per page, but check that the user is logged when the unique link is clicked.
Either way you can use that to prevent multiple votes etc

APEX - linking two report with SQL

I'm trying to link 2 reports to achieve the same functionality as with a master form on 2 pages.
table: Student(id, name, address)
MainReport: an interactive report Displaying the ID by using SQL: select id from student;
Functionality: when the ID is selected, open the other report and display the name and address
SubReport: this is a report on an SQL statement. SQL is:
select name, address from student where id = :P24_id;
Go back to the main report, go to edit page, in the region, click on interactive report and go to the report attributes. Scroll down to link column, change link column to link to custom target, set the target page to the SubReport, enter name of P24_id and value of #id# and click apply changes.
Why is this not working? When I load the main report I'm seeing the data, when I click on an ID however and I go to the subReport, I'm seeing Error ERR-1002 Unable to find item ID for item "P24_ID" in application "105".
Can anyone help?
Did you define a page item on page 24 (which seems to be your target page) with the name P24_ID ?
You can not just set a value to some arbitrary variable name. You need to actually have a page item matching the name.
So on page 24 you would need to create a page item P24_ID.

How to create prompt page driven variable view in Cognos 8.2

I am using Cognos 8.2 to create a report with a prompt page. I am trying to create a prompt page that allows the user to choose what type of item they want to see, and then the workers assigned.
Example: Show me the workers working on projects of type 'A' and that would trigger a list of workers to be displayed who are currently working on projects of type 'A' and then the user could choose a worker/workers from the list to be displayed in the report.
I am trying to use javascript in the html item, but I have never worked with javascript before, and I am having little luck. I dont know if it is even possible or not to pass a variable to another item on the prompt page. Any ideas or examples would be appreciated.
Bring your worker names into a data item (eg [People]) - then, create another data item with a case statement:
CASE
WHEN ([People] in ('John','Jessica','Jane','Jeff'))
THEN ('Group J')
WHEN ([People] in ('Adam', 'Alex', 'Anne'))
THEN ('Group A')
ELSE 'No Group'
END
Name this data item "Group"
Then create a filter on the query: [Group] = ?Group Prompt?
Then you should be able to input 'Group A' and get only those from Group A.

Resources