Getting error "Unknown error during import: <class Keyerror> : 'Field1' at row 2 resolve other errors first" in odoo 14 - import

I have a custom module in which i want to import some of the updated data but getting an error
Unknown error during import: <class 'KeyError'>: 'field1'
at row 2 Resolve other errors first
I am getting this error in some of the fields not all.
Below are the type and description and parameters of the field in which i am getting this error:-
field1 = fields.Many2one(comodel_name="a.b", string="Field1", required=False, )
field2 = fields.Many2one(comodel_name="b.c", string="Field2", required=False, )
field3 = fields.Char('Field3', size=30, required=True)
field4 = fields.Char('Field4', size=30)
field5 = fields.Char('Field5', size=30, required=True)
After including these fields in export and import resolve this issue but if i remove any of the fields in export and import of data gives this issue again. Why is this happening?
Is this error related to migration or something else i am missing? Do anyone have any idea how to solve this issue?

Related

Django rest_framework generic, got `.models.DoesNotExist` error when use new database

Why start a project with new postgresql database through docker, and below function got called before database migration and caused models.DoesNotExist.
url.py file
from .views import (
StudentListReview,
)
urlpatterns = [
path("student/", StudentListReview.as_view(), name="view_doctors")
]
view.py file
from rest_framework import generics
class StudentListReview(generics.ListAPIView):
role_id = Role.objects.get(role_name="Student").role_id
queryset = Profile.objects.filter(role_obj=role_id)
serializer_class = ProfileSerializer
Traceback
apps.roles.models.DoesNotExist: Role matching query does not exist.
2022-11-28 07:56:26,776 celery.utils.dispatch.signal ERROR Signal handler <bound method DjangoFixup.on_import_modules of <celery.fixups.django.DjangoFixup object at 0x7f150ca13700>> raised: DoesNotExist('Role matching query does not exist.')

i am getting error while using window functions in pyspark

i am trying to run the below code
employees = (spark.read.format('csv')
.option('sep', '\t')
.schema('''EMP_ID INT,F_NAME STRING,L_NAME STRING,
EMAIL STRING,PHONE_NR STRING,HIRE_DATE STRING,
JOB_ID STRING,SALARY FLOAT,
COMMISSION_PCT STRING,
MANAGER_ID STRING,DEP_ID STRING''')
.load('C:/data/hr_db/employees')
)
spec = Window.partitionBy('DEP_ID')
emp = (employees
.select('JOB_ID', 'DEP_ID', 'SALARY')
.withColumn('Total Salary', sum('SALARY').over(spec))
.orderBy('DEP_ID')
)
emp.show()
and getting the below error
File "C:\spark-2.4.4-bin-hadoop2.7\python\lib\py4j-0.10.7-src.zip\py4j\protocol.py", line 328, in get_return_value
py4j.protocol.Py4JJavaError: An error occurred while calling o60.showString.java.lang.IllegalArgumentException: Unsupported class file major version 56
could you please anyone help me on this error?

Exception in thread "main" java.sql.SQLSyntaxErrorException: ORA-00936: missing expression

While executing insert and update command in oracle 11g I'm getting below error.
val stmt = con.createStatement()
//Insert
val query1 = "insert into audit values('D','abc','T','01-NOV-18','Inprogress')"
stmt.executeUpdate(query1)
//Update
val query2 = "Update audit Set status='test' where where product= = 'D'"
stmt.executeUpdate(query2)
I'm getting below error
//Error while updating record
Exception in thread "main" java.sql.SQLSyntaxErrorException: ORA-00936: missing expression
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:447)
at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:396)
at oracle.jdbc.driver.T4C8Oall.processError(T4C8Oall.java:951)
at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:513)
at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:227)
at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
at oracle.jdbc.driver.T4CStatement.doOall8(T4CStatement.java:195)
at oracle.jdbc.driver.T4CStatement.executeForRows(T4CStatement.java:1036)
at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1336)
at oracle.jdbc.driver.OracleStatement.executeUpdateInternal(OracleStatement.java:1845)
at oracle.jdbc.driver.OracleStatement.executeUpdate(OracleStatement.java:1810)
at oracle.jdbc.driver.OracleStatementWrapper.executeUpdate(OracleStatementWrapper.java:294)
at com.oracle.OracleConnection$.main(OracleConnection.scala:21)
at com.oracle.OracleConnection.main(OracleConnection.scala)
Process finished with exit code 1
Any help will be appreciated. Thanks in advance
You have two where and two = in your update query.
val query2 = "Update audit Set status='test' where product='D'"

pg8000.core.ProgrammingError: 'could not determine data type of parameter $2'

I'm using pg.8000 (Postgres) and trying to run the following SELECT query
cursor.execute(
"""
SELECT orders.name, orders.order_price, orders.selling_price, orders.earnings
FROM member, orders
WHERE member.id=orders.member_id
AND member.name = %s
""",
member_username
)
Where member.username is a String.
But I am getting the following error.
pg8000.core.ProgrammingError: ('ERROR', 'ERROR', '42P18', 'could not determine data type of parameter $2', 'postgres.c', '1350', 'exec_parse_message', '', '')
However, when I run same query using GUI tool, everything runs fine and I get the results. What is the problem?
You passed the parameter wrong, you should give a tuple, a list or a dictionary
Example with a tuple:
cursor.execute(
"""
SELECT orders.name, orders.order_price, orders.selling_price, orders.earnings
FROM member, orders
WHERE member.id=orders.member_id
AND member.name = %s
""",
(member_username,)
)
Example with a list:
cursor.execute(
"""
SELECT orders.name, orders.order_price, orders.selling_price, orders.earnings
FROM member, orders
WHERE member.id=orders.member_id
AND member.name = %s
""",
[member_username]
)
Example with a dictionary:
cursor.execute(
"""
SELECT orders.name, orders.order_price, orders.selling_price, orders.earnings
FROM member, orders
WHERE member.id=orders.member_id
AND member.name = %(mname)s
""",
{'mname' : member_username}
)
http://initd.org/psycopg/docs/usage.html#query-parameters

Drools Expert and Workflow: Unable to resolve ObjectType

I have these validation rule in Drools Expert which I have tested and works fine:
package com.myapp.validationPackage
import com.myapp.model.*;
declare Message
type : String
text : String
end
function Message error(String text) {
Message message = new Message();
message.setType("ERROR");
message.setText(text);
return message;
}
rule "First Validation"
ruleflow-group "Entity Validation"
when
Entity( $h : history )
not ( exists EntityHistory(closeDate == null) from $h
)
then
insert( error("Entity must be open") );
end
Now I want to use this rule in a workflow but give me this error when I try to build the .rf file on Eclipse:
Unable to resolve ObjectType 'Message' : [Rule name='RuleFlow-Split-XX'] ..
How should I use the delcared type to avoid the error?
Thanks.