{"id":13601142,"url":"https://github.com/hexya-erp/hexya","last_synced_at":"2025-04-11T01:31:07.092Z","repository":{"id":41176276,"uuid":"92758329","full_name":"hexya-erp/hexya","owner":"hexya-erp","description":"Hexya business application development framework","archived":false,"fork":false,"pushed_at":"2023-02-25T04:28:47.000Z","size":2642,"stargazers_count":415,"open_issues_count":25,"forks_count":127,"subscribers_count":55,"default_branch":"master","last_synced_at":"2024-08-02T18:40:01.259Z","etag":null,"topics":["business","businessapp","erp","erp-framework","go","golang","hexya"],"latest_commit_sha":null,"homepage":"http://hexya.io","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hexya-erp.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2017-05-29T16:49:23.000Z","updated_at":"2024-07-22T22:48:28.000Z","dependencies_parsed_at":"2024-01-14T04:51:08.827Z","dependency_job_id":"3e151a89-3cdf-4e19-b4f1-84e67da4c5bd","html_url":"https://github.com/hexya-erp/hexya","commit_stats":null,"previous_names":[],"tags_count":55,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexya-erp%2Fhexya","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexya-erp%2Fhexya/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexya-erp%2Fhexya/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hexya-erp%2Fhexya/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hexya-erp","download_url":"https://codeload.github.com/hexya-erp/hexya/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223453423,"owners_count":17147675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["business","businessapp","erp","erp-framework","go","golang","hexya"],"created_at":"2024-08-01T18:00:56.466Z","updated_at":"2024-11-07T03:31:37.140Z","avatar_url":"https://github.com/hexya-erp.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.com/hexya-erp/hexya.svg?branch=master)](https://travis-ci.com/hexya-erp/hexya)\n[![Go Report Card](https://goreportcard.com/badge/hexya-erp/hexya)](https://goreportcard.com/report/hexya-erp/hexya)\n[![codecov](https://codecov.io/gh/hexya-erp/hexya/branch/master/graph/badge.svg)](https://codecov.io/gh/hexya-erp/hexya)\n[![godoc reference](https://godoc.org/github.com/hexya-erp/hexya?status.png)](https://godoc.org/github.com/hexya-erp/hexya)\n[![Gitter](https://badges.gitter.im/hexya-erp/community.svg)](https://gitter.im/hexya-erp/community?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n\n# Hexya\n\nHexya is an open source ERP and a business application development framework\nwritten in Go.\n\nThis repository houses the business application development framework.\nThe ERP is built by integrating modules of the [Hexya Addons Project](https://github.com/hexya-addons)\n\n## Features of the framework\n\nThe Hexya framework is designed to develop business applications quickly and safely.\nIt includes all needed components in a very opinionated way.\n\nThe examples below are here to give you a first idea of Hexya. \n\nHead to the `/doc` directory and especially our [Tutorial](./doc/tutorial.adoc) if you want to start developing your business application with Hexya.\n\n### ORM\n\nHexya includes a full-featured type safe ORM, including a type safe query builder.\n\nDeclare a model and add some fields\n```go\nvar fields_User = map[string]models.FieldDefinition{\n    \"Name\": fields.Char{String: \"Name\", Help: \"The user's username\", Unique: true,\n        NoCopy: true, OnChange: h.User().Methods().OnChangeName()},\n    \"Email\":    fields.Char{Help: \"The user's email address\", Size: 100, Index: true},\n    \"Password\": fields.Char{},\n    \"IsStaff\":  fields.Boolean{String: \"Is a Staff Member\", \n        Help: \"Set to true if this user is a member of staff\"},\n}\n\nfunc init() {\n\tmodels.NewModel(\"User\")\n\th.User().AddFields(fields_User)\n}\n```\n\nUse the ORM to create a record in the database with type-safe data\n```go\nnewUser := h.User().Create(env, h.User().NewData().\n\tSetName(\"John\").\n\tSetEmail(\"john@example.com\").\n\tSetIsStaff(true))\n```\n\nSearch the database using the type-safe query builder and update records directly\n```go\nmyUsers := h.User().Search(env,\n\tq.User().Name().Contains(\"John\").\n\t\tAnd().Email().NotEquals(\"contact@example.com\"))\nfor _, myUser := range myUsers.Records() {\n    if myUser.IsStaff() {\n        myUser.SetEmail(\"contact@example.com\")\n    }\t\n}\n```\n\nAdd methods to the models\n```go\n// GetEmail returns the Email of the user with the given name\nfunc user_GetEmail(rs m.UserSet, name string) string {\n    user := h.User().Search(env, q.User().Name().Equals(\"John\")).Limit(1)\n    user.Sanitize()     // Call other methods of the model\n    return user.Email() // If user is empty, then Email() will return the empty string\n}\n\nfunc init() {\n    h.User().NewMethod(\"GetEmail\", user_GetEmail)\n}\n```\n\n### Views\n\nDefine views of different types using a simple XML view definition and let the framework do the rendering:\n\n```xml\n\u003cview id=\"base_view_users_form_simple_modif\" model=\"User\" priority=\"18\"\u003e\n    \u003cform string=\"Users\"\u003e\n        \u003cfield name=\"image\" readonly=\"0\" widget='image'\n               options='{\"preview_image\": \"image_small\"}'/\u003e\n        \u003ch1\u003e\n            \u003cfield name=\"name\" readonly=\"1\"/\u003e\n        \u003c/h1\u003e\n        \u003cbutton name=\"preference_change_password\" type=\"object\" string=\"Change password\"/\u003e\n        \u003cgroup name=\"preferences\" col=\"4\"\u003e\n            \u003cfield name=\"lang\" readonly=\"0\"/\u003e\n            \u003cfield name=\"tz\" widget=\"timezone_mismatch\" options=\"{'tz_offset_field': 'tz_offset'}\"\n                   readonly=\"0\"/\u003e\n            \u003cfield name=\"tz_offset\" invisible=\"1\"/\u003e\n            \u003cfield name=\"company_id\" options=\"{'no_create': True}\" readonly=\"0\"\n                   groups=\"base_group_multi_company\"/\u003e\n        \u003c/group\u003e\n        \u003cgroup string=\"Email Preferences\"\u003e\n            \u003cfield name=\"email\" widget=\"email\" readonly=\"0\"/\u003e\n            \u003cfield name=\"signature\" readonly=\"0\"/\u003e\n        \u003c/group\u003e\n        \u003cfooter\u003e\n            \u003cbutton name=\"preference_save\" type=\"object\" string=\"Save\" class=\"btn-primary\"/\u003e\n            \u003cbutton name=\"preference_cancel\" string=\"Cancel\" special=\"cancel\" class=\"btn-default\"/\u003e\n        \u003c/footer\u003e\n    \u003c/form\u003e\n\u003c/view\u003e\n```\n\n### Controllers\n\nMost of the time, you do not need to declare controllers in Hexya. \nInstead, declare an \"Action\" with the views you want and a menu to access it.\nThe framework will take care of the UI including rendering views, navigation, CRUD, etc.\n\n```xml\n\u003caction id=\"base_action_res_users\" \n        type=\"ir.actions.act_window\" \n        name=\"Users\" \n        model=\"User\"\n        view_id=\"base_view_users_tree\" \n        search_view_id=\"base_view_users_search\" \n        view_mode=\"tree,form,calendar\"/\u003e\n\n\u003cmenuitem id=\"base_menu_action_users\" \n          name=\"Users\" \n          sequence=\"1\" \n          action=\"base_action_res_users\"\n          parent=\"base_menu_users\"/\u003e\n```\n\n### Iterative Definition and Modularity\n\nEach part of the Hexya Framework is modular and follow the Iterative Definition concept.\n\nThis means that an object (for example a model class) can be defined in a module and then extended in place by dependent modules.\nSo any subsequent modification will be made on the original model and will be available for the whole application.\n\nThis makes it possible to customize the application by creating a new module with the new features without forking and still benefiting from upstream updates.\n\nExample on models:\n```go\npackage A\n\nvar fields_User = map[string]models.FieldDefinition{\n    \"Name\": fields.Char{String: \"Name\", Help: \"The user's username\", Unique: true,\n        NoCopy: true, OnChange: h.User().Methods().OnChangeName()},\n    \"Email\":    fields.Char{Help: \"The user's email address\", Size: 100, Index: true},\n    \"Password\": fields.Char{},\n    \"IsStaff\":  fields.Boolean{String: \"Is a Staff Member\", \n        Help: \"Set to true if this user is a member of staff\"},\n}\n\nfunc init() {\n    models.NewModel(\"User\")\n    h.User().AddFields(fields_User)\n}\n```\n```go\npackage B\n\nvar fields_User = map[string]models.FieldDefinition{\n    \"Size\": models.Float{},\n}\n\nfunc init() {\n    h.User().AddFields(fields_User)\n}\n```\n```go\n// Anywhere else\nnewUser := h.User().Create(env, h.User().NewData().\n\tSetName(\"John\").\n\tSetEmail(\"john@example.com\").\n\tSetSize(185.7))\nfmt.Println(newUser.Name())\n// output : John\nfmt.Println(newUser.Size())\n// output : 185.7\n```\n\nModel methods can be extended too:\n\n```go\npackage A\n\n// GetEmail returns the Email of the user with the given name\nfunc user_GetEmail(rs m.UserSet, name string) string {\n    user := h.User().Search(rs.Env(), q.User().Name().Equals(name)).Limit(1)\n    user.Sanitize()     \n    return user.Email() \n}\n\nfunc init() {\n    h.User().NewMethod(\"GetEmail\", user_GetEmail)\n}\n```\n```go\npackage B\n\nfunc init() {\n    h.User().Methods().GetEmail().Extend(\n    \tfunc(rs m.UserSet, name string) string {\n    \t    res := rs.Super().GetEmail(name)\n    \t    return fmt.Sprintf(\"\u003c%s\u003e\", res)\n    \t})\n}\n```\n```go\n// Anywhere else\nemail := h.User().NewSet(env).GetEmail(\"John\")\nfmt.Println(email)\n// output: \u003cjohn@example.com\u003e\n```\n\nAnd it works also with views:\n```xml\n\u003c!-- Package A --\u003e\n\u003cview id=\"base_view_users_tree\" model=\"User\"\u003e\n    \u003ctree string=\"Users\"\u003e\n        \u003cfield name=\"Name\"/\u003e\n        \u003cfield name=\"Login\"/\u003e\n        \u003cfield name=\"Lang\"/\u003e\n        \u003cfield name=\"LoginDate\"/\u003e\n    \u003c/tree\u003e\n\u003c/view\u003e\n```\n```xml\n\u003c!-- Package B --\u003e\n\u003cview inherit_id=\"base_view_users_tree\"\u003e\n    \u003cfield name=\"Login\" position=\"after\"\u003e\n        \u003cfield name=\"IsStaff\"/\u003e\n    \u003c/field\u003e\n\u003c/view\u003e\n```\nAnd the rendered view will be :\n```xml\n\u003ctree string=\"Users\"\u003e\n    \u003cfield name=\"Name\"/\u003e\n    \u003cfield name=\"Login\"/\u003e\n    \u003cfield name=\"IsStaff\"/\u003e\n    \u003cfield name=\"Lang\"/\u003e\n    \u003cfield name=\"LoginDate\"/\u003e\n\u003c/tree\u003e\n```\n# Contributing\n\nIf you wish to contribute to HEXYA project, you can:\n   1. Suggest an improvement via opening an issue in this repository or related project addons\n   2. Proposing a pull request for a feature or bug fix\n   3. Helping with the documentation of this project.\n   4. Any other action that may help improve the project further such as marketing campaigns, promoting adoption etc.\n\nFor developers, we are always looking for developers to join our community and make the project feature rich. If you are interested in contributing to this project. You can join our [slack channel](https://join.slack.com/t/nuovaareadila-3id2004/shared_invite/zt-1kj6ncmas-TI4DTVaVvHfg1CFCoAm15Q). All issues and feature will be discussed here and approach or design issues addressed.\n\nIn addition, you can check the [Design guidelines](doc/design.adoc) and [contribution guide](doc/contribution.adoc) for further information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexya-erp%2Fhexya","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhexya-erp%2Fhexya","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhexya-erp%2Fhexya/lists"}