Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot save one2many data #144

Open
jay009id opened this issue Oct 14, 2024 · 4 comments
Open

Cannot save one2many data #144

jay009id opened this issue Oct 14, 2024 · 4 comments

Comments

@jay009id
Copy link

Hello, I cannot save form that have one2many field as picture below :

image

And the log :

2024-10-14T21:27:44.514+0700	ERROR	logging/logging.go:82	Hexya panicked	{"msg": "interface conversion: interface {} is []interface {}, not float64"}
github.com/hexya-erp/hexya/src/tools/logging.(*zapLogger).Error
	/home/indrajaya/development/golang/hexya/src/tools/logging/logging.go:82
github.com/hexya-erp/hexya/src/tools/logging.LogPanicData
	/home/indrajaya/development/golang/hexya/src/tools/logging/logging.go:185
github.com/hexya-erp/hexya/src/models.doExecuteInNewEnvironment.func1
	/home/indrajaya/development/golang/hexya/src/models/environment.go:159
runtime.gopanic
	/home/indrajaya/program/go/src/runtime/panic.go:679
runtime.panicdottypeE
	/home/indrajaya/program/go/src/runtime/iface.go:255
github.com/hexya-erp/hexya/src/models.(*RecordCollection).Scan
	/home/indrajaya/development/golang/hexya/src/models/recordcollection.go:55
github.com/hexya-erp/hexya/src/models.(*RecordCollection).convertToRecordSet
	/home/indrajaya/development/golang/hexya/src/models/recordcollection.go:977
github.com/hexya-erp/hexya/src/models.NewModelDataFromRS
	/home/indrajaya/development/golang/hexya/src/models/types.go:384
github.com/hexya-addons/web/controllers.makeModelData
	/home/indrajaya/development/golang/hexya-addons/web/controllers/model_calls.go:97
github.com/hexya-addons/web/controllers.glob..func1
	/home/indrajaya/development/golang/hexya-addons/web/controllers/model_calls.go:43
reflect.Value.call
	/home/indrajaya/program/go/src/reflect/value.go:460
reflect.Value.Call
	/home/indrajaya/program/go/src/reflect/value.go:321
github.com/hexya-addons/web/controllers.unmarshalJSONValue
	/home/indrajaya/development/golang/hexya-addons/web/controllers/model_calls.go:423
github.com/hexya-addons/web/controllers.putParamsValuesInArgs
	/home/indrajaya/development/golang/hexya-addons/web/controllers/model_calls.go:255
github.com/hexya-addons/web/controllers.Execute.func1
	/home/indrajaya/development/golang/hexya-addons/web/controllers/model_calls.go:174
github.com/hexya-erp/hexya/src/models.doExecuteInNewEnvironment
	/home/indrajaya/development/golang/hexya/src/models/environment.go:164
github.com/hexya-erp/hexya/src/models.ExecuteInNewEnvironment
	/home/indrajaya/development/golang/hexya/src/models/environment.go:141
github.com/hexya-addons/web/controllers.Execute
	/home/indrajaya/development/golang/hexya-addons/web/controllers/model_calls.go:145
github.com/hexya-addons/web/controllers.CallKW
	/home/indrajaya/development/golang/hexya-addons/web/controllers/dataset.go:18
github.com/hexya-erp/hexya/src/server.wrapContextFuncs.func1.1
	/home/indrajaya/development/golang/hexya/src/server/routes.go:24
github.com/gin-gonic/gin.(*Context).Next
	/home/indrajaya/go/pkg/mod/github.com/gin-gonic/gin@v1.4.0/context.go:124
github.com/hexya-erp/hexya/src/tools/logging.LogForGin.func1
	/home/indrajaya/development/golang/hexya/src/tools/logging/logging.go:265
github.com/gin-gonic/gin.(*Context).Next
	/home/indrajaya/go/pkg/mod/github.com/gin-gonic/gin@v1.4.0/context.go:124
github.com/gin-contrib/sessions.Sessions.func1
	/home/indrajaya/go/pkg/mod/github.com/gin-contrib/sessions@v0.0.1/sessions.go:65
github.com/gin-gonic/gin.(*Context).Next
	/home/indrajaya/go/pkg/mod/github.com/gin-gonic/gin@v1.4.0/context.go:124
github.com/gin-gonic/gin.RecoveryWithWriter.func1
	/home/indrajaya/go/pkg/mod/github.com/gin-gonic/gin@v1.4.0/recovery.go:83
github.com/gin-gonic/gin.(*Context).Next
	/home/indrajaya/go/pkg/mod/github.com/gin-gonic/gin@v1.4.0/context.go:124
github.com/gin-gonic/gin.(*Engine).handleHTTPRequest
	/home/indrajaya/go/pkg/mod/github.com/gin-gonic/gin@v1.4.0/gin.go:389
github.com/gin-gonic/gin.(*Engine).ServeHTTP
	/home/indrajaya/go/pkg/mod/github.com/gin-gonic/gin@v1.4.0/gin.go:351
net/http.serverHandler.ServeHTTP
	/home/indrajaya/program/go/src/net/http/server.go:2802
net/http.(*conn).serve
	/home/indrajaya/program/go/src/net/http/server.go:1890

Is there any clue how to fix it? Thanks in advance.

@SamyRai
Copy link

SamyRai commented Nov 1, 2024

Hey @jay009id I am also curious to make this app running. For me, it shows that "ModelName"Set methods are missing. Did you solve it or you didn't have this issue?

@jay009id
Copy link
Author

jay009id commented Nov 2, 2024

Hello @SamyRai I didn't solve it yet. I don't understand the code in line 55 that variable v as interface and need to convert float64.

Selection_539

@npiganeau
Copy link
Member

@jay009id If I remember well, since the value comes from json returned by the client, numbers are mapped to float64, even if they are integers. So the underlying value of v is a float64 and we need to cast to int64.

@SamyRai "ModelName"Set structs and methods are generated with hexya generate command.

@jay009id
Copy link
Author

jay009id commented Nov 4, 2024

Hi @npiganeau The type of variable v is interface. How to covert/map to float64 and int64? What do you means by numbers?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants