Frappe HR: Changes to Branching and Versioning

Dear Community,

We have made some changes in the branching for Frappe HR

Reason for the change in branching

Since the inception of Frappe HR as a separate app, its develop branch has been compatible with both ERPNext’s version-14 and develop. However, due to some breaking changes in APIs in the framework, we are introducing a new branch called version-14 that will be compatible with ERPNext’s version-14. This branch has been named version-14 to keep it consistent with Frappe & ERPNext’s versioning.

Compatibility

In order to continue the convention of introducing breaking changes in develop, the branch compatibility will be as follows:

Frappe/ERPNext’s Branch Frappe HR’s Branch
version-14 version-14
develop develop
  • If you are on version-14 of ERPNext (except Frappe Cloud users): Some manual intervention will be required to switch HR to the stable branch (steps mentioned below). If you are using Frappe/ERPNext v14 and HR’s v15(develop), then a patch will stop your migration and ask you to switch the branch using this wiki before migrating.

  • If you are on develop branch of ERPNext: You don’t need to do anything.

New PRs and cloning:

  • A new branch called version-14-hotfix will serve as the staging area for code that is pending to be released into version-14 (similar to ERPNext). All pull requests intended for version-14 need to be made to this branch.

  • The develop branch of Frappe HR will continue to be compatible with ERPNext/Frappe’s develop branch.

  • develop will also be the default branch for all new clones (bench get-app …). If you want to clone and install a stable version of Frappe HR, you will have to use the --branch flag like:

bench get-app hrms --branch version-14

Steps to switch to the desired branch from the develop branch

For general users

Execute the following commands from your bench directory (e.g. frappe-bench):

cd apps/hrms
git fetch upstream version-14:version-14
git checkout version-14
cd ../..

And then proceed with the migration with

bench --site [sitename] migrate
or
bench update

If you want to use version-14-hotfix replace version-14 with version-14-hotfix in the above set of commands.

For Frappe Cloud Users

For all the benches (public/private) using Frappe v14, HR’s branch has been changed to version-14 already. They will receive an update for the site.

Make sure you select version-14 while creating new production sites.

Just for reference, here is how you can switch branches on FC from Bench > Apps:

  • Click on the menu against the Frappe HR app and Change Branch.

    change-branch

  • Select version-14 and update your bench and sites

    change-branch-2

23 Likes

Awesome communication, thank you @rucha_mahabal !

3 Likes
git fetch upstream version-14:version-14

fatal: Refusing to fetch into current branch refs/heads/version-14 of non-bare repository

After fetching branch version-14, unable to create or make changes in employee master.

App Versions

{
	"erpnext": "14.11.1",
	"frappe": "14.21.0",
	"hrms": "1.0.0"
}

Trackeback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 69, in application
    response = frappe.api.handle()
  File "apps/frappe/frappe/api.py", line 54, in handle
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 45, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 83, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1590, in call
    and not local.flags.in_install
  File "apps/frappe/frappe/desk/form/save.py", line 23, in savedocs
    "Cancel": DocStatus.cancelled(),
  File "apps/frappe/frappe/model/document.py", line 304, in save
    """Wrapper for _save"""
  File "apps/frappe/frappe/model/document.py", line 326, in _save
    if self.get("__islocal") or not self.get("name"):
  File "apps/frappe/frappe/model/document.py", line 258, in insert
    self.flags.in_insert = True
  File "apps/frappe/frappe/model/document.py", line 1039, in run_before_save_methods
    if self._action == "save":
  File "apps/frappe/frappe/model/document.py", line 908, in run_method
    fn.__name__ = str(method)
  File "apps/frappe/frappe/model/document.py", line 1255, in composer
    ):
  File "apps/frappe/frappe/__init__.py", line 1580, in get_attr
    raise OSError(f"{path} Not Found")
AttributeError: module 'hrms.overrides.employee_master' has no attribute 'update_to_date_in_work_history'

Can you try this

git checkout -b version-14 upstream/version-14

Did you checkout the version-14 branch and migrate the site after fetching? Your Frappe HR version is still v1.0.0. It should be v14.0.0

Hi
After following the above steps, I am getting the below error while running bench update

From https://github.com/frappe/hrms
 * branch            version-14 -> FETCH_HEAD
$ git reset --hard upstream/version-14
fatal: ambiguous argument 'upstream/version-14': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
ERROR:
Traceback (most recent call last):
  File "/usr/local/bin/bench", line 8, in <module>
    sys.exit(cli())
  File "/usr/local/lib/python3.10/dist-packages/bench/cli.py", line 127, in cli
    bench_command()
  File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3/dist-packages/click/core.py", line 1659, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
    return __callback(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/bench/commands/update.py", line 59, in update
    update(
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/bench.py", line 432, in update
    pull_apps(apps=apps, bench_path=bench_path, reset=reset)
  File "/usr/local/lib/python3.10/dist-packages/bench/app.py", line 657, in pull_apps
    bench.run(reset_cmd, cwd=app_dir)
  File "/usr/local/lib/python3.10/dist-packages/bench/bench.py", line 48, in run
    return exec_cmd(cmd, cwd=cwd or self.cwd)
  File "/usr/local/lib/python3.10/dist-packages/bench/utils/__init__.py", line 158, in exec_cmd
    raise CommandFailedError
bench.exceptions.CommandFailedError

Please help as my system has gone offline
Thanks

That was smooth. :blush:

This worked for me.

1 Like

I uninstalled the app and after installation my branch is updated to v14, working fine now.
thanks

1 Like

Try migrating your site

bench --site [sitename] migrate

Hi
Thanks for prompt reply.
I have tried this, migrating successfully, but bench update failing with the same error.
Thanks

bench version

erpnext 14.15.1
frappe 14.25.1
frappedesk 0.6.0
hrms 14.0.0

App erpnext already installed

Installing hrms…
Updating DocTypes for hrms : [========================================] 100%
Setting up Frappe HR…

Patching Existing Data…
Installation for Frappe HR app failed due to an error. Please try re-installing the app or report the issue on Sign in to GitHub · GitHub if not resolved.
An error occurred while installing hrms: [Salary Component, Income Tax]: payment_type
Traceback (most recent call last):
File “apps/frappe/frappe/commands/site.py”, line 413, in install_app
_install_app(app, verbose=context.verbose, force=force)
File “apps/frappe/frappe/installer.py”, line 304, in install_app
frappe.get_attr(after_install)()
File “apps/hrms/hrms/install.py”, line 21, in after_install
raise e
File “apps/hrms/hrms/install.py”, line 9, in after_install
setup()
File “apps/hrms/hrms/setup.py”, line 23, in after_install
run_post_install_patches()
File “apps/hrms/hrms/setup.py”, line 662, in run_post_install_patches
frappe.get_attr(f"hrms.patches.post_install.{patch_name}.execute")()
File “apps/hrms/hrms/patches/post_install/create_country_fixtures.py”, line 9, in execute
make_salary_components(country)
File “apps/hrms/hrms/overrides/company.py”, line 74, in make_salary_components
doc.insert(ignore_if_duplicate=True)
File “apps/frappe/frappe/model/document.py”, line 260, in insert
self._validate()
File “apps/frappe/frappe/model/document.py”, line 528, in _validate
self._validate_mandatory()
File “apps/frappe/frappe/model/document.py”, line 858, in _validate_mandatory
raise frappe.MandatoryError(
frappe.exceptions.MandatoryError: [Salary Component, Income Tax]: payment_type

There is no standard field called “payment_type” in salary component. Looks like you have a mandatory custom field in salary component called payment_type

Will add a PR to ignore mandatory fields while installing fixtures.

2 Likes

yes, you are right. after uninstall the custom app which has some custom field, the HRMS reinstall works fine

the bench update fail after following the steps with

$ git reset --hard upstream/version-14
fatal: ambiguous argument 'upstream/version-14': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
1 Like

console message:

The develop branch of Frappe HR is no longer compatibl e with Frappe & ERPNext’s version-14.

Since you are using ERPNext/Frappe version-14 please s witch Frappe HR’s branch to version-14 and then proceed with the update.

You can switch the branch by following the steps mention ed here: Changes to branching and versioning · frappe/hrms Wiki · GitHub

as indicated:

cd apps/hrms
git fetch upstream version-14:version-14
git checkout version-14
cd ../..

then i did was get the branch again → hrms

bench get-app hrms --branch version-14

I check the branch that each application has:

+------------------------+---------+------------+---------+
| App                    | Version | Branch     | Commit  |
+------------------------+---------+------------+---------+
| ecommerce_integrations | 1.14.1  | main       | ------- |
| erpnext                | 14.15.1 | version-14 | ------- |
| frappe                 | 14.25.1 | version-14 | ------- |
| hrms                   | 14.0.0  | version-14 | ------- |
| payments               | 0.0.1   | develop    | ------- |
+------------------------+---------+------------+---------+

At the end

bench update --reset
3 Likes

if your ERPnext website shows “Updating… The system is being updated”. Please refresh again after a few moments", you can goto folder … frappe-bench/sites and change "maintenance mode from “1” tp “0” in the file name “common_site_config.json”

( Just adding this comment here, glad if it helps )

Faced error
fatal: ambiguous argument ‘upstream/version-14’: unknown revision or path not in the working tree.

Solved it by
bench get-app hrms --branch version-14

2 Likes