Can't convert lead to opportunity, company issue - odoo

I can't convert a lead to an opportunity.
Both the lead and the partner/customer are set to the same company: Company 1.
I'm getting the following error:
Incompatible companies on records:
'Lead 1' belongs to company False and 'Customer' (partner_id: 'customer_1#mail.com') belongs to another company.
I can only convert a lead to an opportunity if I set the company of the partner/customer to empty.

Related

No default debit and credit account defined on journal - Odoo v13

I have created a point of sale and I have changed the currency in the journals from USD to MXN, when closing the point of sale, I get the following error: "No default debit and credit account defined on journal Efectivo (ids: [10 ]). "
I understand that I must go to the Efectivo journal and there place the default debit and credit data. But there is nothing like that in the journal.
I have changed the journal to Sales, Bank and each of the options in the drop-down list, none of them comes "Debit" or "Credit account"
All this happens when you change the currency from USD to MXN.
I have tried this in different ways, in different databases, with and without demo information and I always get the same error.
I don't know what to do to repair it.
I resolve this issue.
i went to the terminal and connected to my DB:
There i find the column default_credit_account_id and default_debit_account_id and it was empty on account_journal.
The others had a integer value.
select * from account_journal
So i guess these values comes from account_account, and since i am defining cash (Efectivo), i selected that.
select * from account_account
You can query that table and verify that which account do you want.
Finally i update the table account_journal.
update account_journal set default_credit_account_id = 39, default_debit_account_id = 39 where id=11;
Remember, the id is from your account_journal

VS SR Report joining data from multiple Data sets?

Wondering if anyone can help me, I am currently learning, SRSS Reports and have been tasked with a Pay & Display vehicle registration report, for staff and student carparks, to show if they are registered for P&D. I have the report laid out as a 3 table column; Name, Vehicle Number and Vehicle Registration. I have from the below code set out in my datasets the Vehicle Number and Vehicle Registrations pulling through, with a parameter to filter out if is staff or student pay and display. However I am having difficulty with pulling the Staff and Student names into one name column as they are through two different datasets. Can anyone be of help at all please? TIA
**-- Pay & Display Carpark Details Dataset**
SELECT * FROM Carpark_Vehicles
WHERE VehicleCustNo IN (SELECT CustID FROM [dbo].[Carpark_Customer]
WHERE CarParkID IN (SELECT CarParkID FROM [dbo].[Carpark_CarPark]
WHERE CTypeID IN ('PD', 'SPD')))
--and CTypeID IN (#Carpark_type))
**--Vehicle Details Dataset**
SELECT
Carpark_Vehicles.VehicleID
,Carpark_Vehicles.RegNo
,VehicleCustNo
FROM
Carpark_Vehicles
WHERE CarPark_Vehicles.RegNo = #RegNo
**--Staff details dataset**
SELECT
StaffDetails_StaffandLeaverDetails.StaffNumber
,StaffDetails_StaffandLeaverDetails.LastName
,StaffDetails_StaffandLeaverDetails.Name1
FROM
StaffDetails_StaffandLeaverDetails
**--Student details dataset**
SELECT
Student_CurrentStudentDetails.StudentNumber
,Student_CurrentStudentDetails.StudentID
,Student_CurrentStudentDetails.LastName
,Student_CurrentStudentDetails.FirstName
FROM
Student_CurrentStudentDetails
**--Carpark permit type (Pay & Display) parameter**
SELECT DISTINCT
CTypeID, CASE CTypeID WHEN 'abc' THEN 'Students' WHEN 'abc' THEN 'Staff' END AS Label
FROM
Carpark_Customer
WHERE CTypeID IN ('abc', 'Abc')
For your req I just took some sample data. This entire example will give you Idea how to achieve your final result.
Note: this is just showing you way how to achieve it, you have to modify as per your req.
Student and Staff Info from 2 different Tables
Registration Info from another separate Table
Your Final Result when Student as parameter is selected
Your Final Result when Staff as parameter is selected
Now how did I achieved this?
My Design for Final Result
Row visibilty expression for your final result Table in SSRS
Expressiion as below
=IIF(Parameters!ReportParameter1.Value=1,
IIF(Isnothing(Lookup(Fields!PersonId.Value,Fields!PersonId.Value,Fields!Name.Value, "DSStudentInfo")),true,false),
IIF(Isnothing(Lookup(Fields!PersonId.Value,Fields!PersonId.Value,Fields!Name.Value, "DSStaffInfo")),true,
false)
)
first Name column visibility
second column name visibility
First Name data value expression
=Lookup(Fields!PersonId.Value,Fields!PersonId.Value,Fields!Name.Value, "DSStudentInfo")
second name data value expression
=Lookup(Fields!PersonId.Value,Fields!PersonId.Value,Fields!Name.Value, "DSStaffInfo")

Shipping Report - Distinct Order with Two Dates - Status Missing from Table THEN

Links to the tables in the screenshot can be found at the link below:
https://www.dropbox.com/l/scl/AAAX85i7QE4zr1S-zr-_Lo00VUnIkE02XWo
First Issue:
Normally this table (See Load Tracking Table) would have a Field in Check Call Name that is "Pickup - Actual" signalling that this has been picked up. However in certain circumstances the CheckCallName will bypass the pickup and move to Delivered status. In cases like this I want to pull the query to treat the "Delivered" status in the same manner that Pickup Actual was being used.
Said another way, where kpo.loadtracking does not have Pickup - Actual in the Check Call Name field for any one order, I want to pull the Check Call Name for Delivered and the KeypointStatusDate.
Second Issue:
The DISTINCT clause does not work perfectly in my case, as an order can have the Pickup - Actual status updated multiple times. Here, we should take the oldest Keypoint Status Date. I've tried to use the MIN(KeypointStatusDate) and grouping by Order ID but I'm getting the following message
Msg 8120, Level 16, State 1, Line 14
Column 'KPO.LOAD.LoadId' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause.
The code I have currently is below. I'm new to SQL (about a week in) so apologies if this is simple.
SELECT
Distinct LOAD.LoadNumber
,LOAD.LoadId
,CustomerName
,OrderStatus
,CheckCallName
,PickedUpOn
,LoadTracking.KeypointStatusDate
,LOAD.OriginEarliest
,LOAD.DestinationEarliest
,CustomerRate
,CarrierCost
,Miles
FROM KPO.LOAD
Inner JOIN kpo.LoadExtension ON LOAD.LoadId = LoadExtension.LoadId
Inner JOIN kpo.Customer ON customer.CustomerId = LOAD.CustomerID
Inner JOIN kpo.LoadTracking ON LoadTracking.LoadId = LOAD.LoadId
WHERE
DATEDIFF(MONTH, GETDATE(), LoadTracking.KeypointStatusDate) = - 2
AND OrderStatus <> 'VOID'
AND CheckCallName = 'Pickup - Actual'
ORDER BY CustomerName, LoadNumber, LoadTracking.KeypointStatusDate
Load Tracking Table with Question Inside:
Data Result from Query:

Google's Big Query using SQL: Associate the assignee name and harmonized assignee name when there are multiple assignees

My goal is to create a table from Google's Big Query patents-public-data.patents.publications_201710 table using standard SQL that has one row for the publication_number, assignee and assignee_harmonized.name where the publication_number is repeated for records that have multiple assignees. Here's an example of my desired output:
publication_number|assignee|assignee_harm
US-6044964-A|Sony Corporation|SONY CORP
US-6044964-A|Digital Audio Disc Corporation|DIGITAL AUDIO DISC CORP
US-8746747-B2|IPS Corporation—Weld-On Division|IPS CORPORATION—WELD ON DIVISION
US-8746747-B2|null|MCPHERSON TERRY R
I've tried the following query based off of the UNNEST suggestion found in this post
#standard SQL
SELECT
p.publication_number,
p.assignee,
a.name AS assignee_harm
FROM
`patents-public-data.patents.publications_201710` AS p,
UNNEST(assignee_harmonized) AS a
WHERE
p.publication_number IN ('US-6044964-A',
'US-8746747-B2')
However, the output appears as follows:
row|publication_number|assignee|assignee_harm
1|US-6044964-A|Sony Corporation|SONY CORP
||Digital Audio Disc Corporation|
2|US-6044964-A|Sony Corporation|DIGITAL AUDIO DISC CORP
||Digital Audio Disc Corporation|
3|US-8746747-B2|IPS Corporation—Weld-On Division|MCPHERSON TERRY R
4|US-8746747-B2|IPS Corporation—Weld-On Division|IPS CORPORATION—WELD ON DIVISION
You can see that the "Sony Corporation" assignee is inappropriately associated with the "DIGITAL AUDIO DISC CORP" harmonized name in row 2 with a similar issue appearing in row 3. Also, rows 1 and 2 contain two lines each but don't repeat the publication_number identifier. I don't see a straightforward way to do this because the number of "assignee" doesn't always equal the number of "assignee_harmonized.name" and they don't always appear in the same order (otherwise I could try creating two tables and merging them somehow). On the other hand, there has to be a way to associate the "assignee" variable with its harmonized value "assignee_harmonized.name", otherwise the purpose of having a harmonized value is lost. Could you please suggest a query (or set of queries) that will produce the desired output when there are either multiple "assignee" or multiple "assignee_harmonized.name" or both?
You're querying for a string and two arrays - the whole thing basically looks like this:
{
"publication_number": "US-8746747-B2",
"assignee": [
"IPS Corporation—Weld-On Division"
],
"assignee_harm": [
"MCPHERSON TERRY R",
"IPS CORPORATION—WELD ON DIVISION"
]
}
So that's the data and you somehow need to decide how to treat the combination of them ... either you cross join everything:
#standard SQL
SELECT
p.publication_number,
assignee,
assignee_harmonized.name AS assignee_harm
FROM
`patents-public-data.patents.publications_201710` AS p
,p.assignee assignee
,p.assignee_harmonized AS assignee_harmonized
WHERE
p.publication_number IN ('US-6044964-A','US-8746747-B2')
.. which gives you relational data .. or you leave it as two separate arrays:
#standard SQL
SELECT
p.publication_number,
assignee,
ARRAY( (SELECT name FROM p.assignee_harmonized)) AS assignee_harm
FROM
`patents-public-data.patents.publications_201710` AS p
WHERE
p.publication_number IN ('US-6044964-A','US-8746747-B2')
You can save this nested result as a table in bq as well.

How can I set and change the value in one field from query? Can I get the exact results some other way? - Access 2010

I have two tables. One is the -reqtable- in which i have
ID_request, PK
ID_Student,
ID_Professor,
Date,
ID_TypeofReq 1 meaning 'change mentor' , 3 meaning ' rejected by mentor'
ID_approved-rejected 1 menains approved , 2 meaning rejected
The other table is STUDENTStable:
ID_STUDENT as primary key
ID_Professor acting like a foreign key but not directly connected to any table.
The idea is to get the current mentor for each student. Students can change mentors and I want to always have the current one. I tried to achieve that with query but I didn't get the right results jet.
So I got an idea to to make a query that will update the ID_professor in the table STUDENTStable and I want the query to be that connection.
Type of request-> ID_typeofreq can be 1 meaning 'choosing mentor' and if the professor approves (ID_approved-rejected = 1) then the student has its mentor.
Type of request can also be 3, which means that mentor was mentoring the student but doesn't want to mentor the student anymore (the id_approved-rejected in that case is always 1 meaning approved). If that is the last entry than the student doesn't have the mentor anymore and should not be in the result of 'currently mentoring query'. But the student can later choose a new mentor and if is accepted he will get into the result 'currently mentoring query' again
The two tables are not connected, but its no problem to join them if will do the job.
SELECT a.ID_request,
a.ID_Student,
a.ID_Professor,
a.Date,
a.ID_typeofreq
FROM [reqtable] AS a
WHERE (((a.ID_typeofreq)=1 Or (a.ID_typeofreq)=3) AND ((a.ID_approved-rejected)=1)
AND ((a.Date)=(SELECT MAX(b.date)
FROM [reqtable] AS b
WHERE b.ID_request = a.ID_request)))
ORDER BY a.ID_Student DESC;
I need the code that will catch the last entry and if the type of request is 1 and ID_ aprooved-rejected = 1 to put the new id_professor in the STUDENTStable
And if the last ID_typeofreq is 3 and ID_aprooved-rejected = 1 to set the value of ID_Professor to Null again.