Skip to content

Commit d71a1c5

Browse files
committed
Merge branch 'develop'
2 parents a1c23a5 + fb73621 commit d71a1c5

File tree

9 files changed

+79
-65
lines changed

9 files changed

+79
-65
lines changed

.github/CONTRIBUTING.md

+22-53
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,36 @@
1-
## General Overview
1+
### Introduction (first timers)
22

3-
There are three branches where all the work happens:
3+
Thank you for your interest in raising an Issue with ERPNext. An Issue could mean a bug report or a request for a missing feature. By raising a bug report, you are contributing to the development of ERPNext and this is the first step of participating in the community. Bug reports are very helpful for developers as they quickly fix the issue before other users start facing it.
44

5-
* **master** - This is the production / stable branch for releases.
6-
* **develop** - This is bleeding edge with features and fixes. Non critical bug fixes and new features go here. All updates to master also get pushed to develop.
7-
* **hotfix** - Urgent bug fixes go here. This is merged into master for releases.
5+
Feature requests are also a great way to take the product forward. New ideas can come in any user scenario and the issue list also acts a roadmap of future features.
86

9-
## Release Cycles
7+
When you are raising an Issue, you should keep a few things in mind. Remember that the developer does not have access to your machine so you must give all the information you can while raising an Issue. If you are suggesting a feature, you should be very clear about what you want.
108

11-
Usually, hotfix / develop is pushed to master roughly every week.
9+
The Issue list is not the right place to ask a question or start a general discussion. If you want to do that , then the right place is the forum [https://discuss.erpnext.com](https://discuss.erpnext.com).
1210

13-
If we are close to a major release, then all bugfixes get pushed to hotfix and a release is done every week or as necessary.
11+
### Reply and Closing Policy
1412

15-
***
13+
If your issue is not clear or does not meet the guidelines, then it will be closed. If it is closed, please supply the information asked and re-open it.
1614

15+
### General Issue Guidelines
1716

18-
## Contributing
17+
1. **Search existing Issues:** Before raising a Issue, search if it has been raised before. Maybe add a 👍 or give additional help by creating a mockup if it is not already created.
18+
1. **Report each issue separately:** Don't club multiple, unreleated issues in one note.
19+
1. **Brief:** Please don't include long explanations. Use screenshots and bullet points instead of descriptive paragraphs.
1920

20-
Contributing to ERPNext is not very different from the usual Pull Request workflow on GitHub.
21+
### Bug Report Guidelines
2122

22-
### Prerequisites :
23+
1. **Steps to Reproduce:** The bug report must have a list of steps needed to reproduce a bug. If we cannot reproduce it, then we cannot solve it.
24+
1. **Version Number:** Please add the version number in your report. Often a bug is fixed in the latest version
25+
1. **Clear Title:** Add a clear subject to your bug report like "Unable to submit Purchase Order without Basic Rate" instead of just "Cannot Submit"
26+
1. **Screenshots:** Screenshots are a great way of communicating the issues. Try adding annotations or using LiceCAP to take a screencast in `gif`.
2327

24-
* You need to know [Git and Github basics](https://try.github.io/levels/1/challenges/1)
25-
* You need to have a Fork of the [ERPNext repo](https://github.com/frappe/erpnext) in your personal Github account
26-
* You need to add a [remote](#glossary) for your Forked repository. `git remote add origin [your-erpnext-repo-url]`
28+
### Feature Request Guidelines
2729

28-
### The Process:
30+
1. **Clarity:** Clearly specify how do you want the feature to behave. Don't just say "I would like multiple PDF formats", say that "Ability to add multiple print formats for customers with different languages".
31+
1. **Solution:** Try and identify how the feature should look like.
32+
1. **Mockups:** Mockups are a great way to explain your requirement.
2933

30-
1. Make sure you're in the right branch. **develop** for adding features / fixing issues and **hotfix** for urgent bug fixes
31-
2. Make your changes
32-
3. Create and checkout a new branch for the changes you've made. `git checkout -b [branch-name]`
33-
4. Add and commit your changes `git commit -am "[commit-message]"
34-
5. If you have been working on sometime for a long time, you should [rebase](#glossary) your branch with main develop branch. `git pull upstream develop --rebase` where `upstream` is the remote name of our repo
35-
6. Now, push your changes to your fork. `git push origin [branch-name]`
36-
If you rebased your commits, you will have to [force push](http://vignette2.wikia.nocookie.net/starwars/images/e/ea/Yodapush.png/revision/latest?cb=20130205190454) `git push origin [branch-name] --force`
37-
7. You should now be able to see your pushed branch on Github, now create a pull request against the branch that you want to merge to.
38-
8. Wait for us to review it
34+
### What if my Issue is closed
3935

40-
### Your Pull Request Should have
41-
42-
1. Clear explanation of the use case
43-
1. Screenshots / Screecast GIF
44-
1. Test Cases (if applicable)
45-
1. Update to documentation
46-
47-
### Common Problems:
48-
49-
* During rebase you might face _merge conflicts_. A merge conflict occurs when you have made changes to the same file that someone else has, in the commits you're pulling. You need to resolve these conflicts by picking which code you want to keep, yours or theirs. You can use `git mergetool` for help.
50-
* Sometimes you don't have a local branch to which you want to make changes to. In that case you first run `git fetch` followed by `git checkout --track -b upstream/[branch-name]`
51-
52-
53-
### Good practices:
54-
55-
* You should rebase your branch with the branch you plan to make a Pull Request (PR) to as often as you can.
56-
* Your commit messages should be precise and explain exactly what the commit does. Same goes for the Pull Request title.
57-
* When making a PR make sure that all your code is committed properly by checking the diffs.
58-
* If you're working on different things at the same time, make sure you make separate branches for each.
59-
* Don't create new DocTypes unless absolutely necessary. If you find that there is a another DocType with a similar functionality, then please try and extend that functionality.
60-
* DRY. Don't Repeat Yourself. Before writing up a similar function /feature make sure it doesn't exist in the codebase already.
61-
* Tabs, not spaces.
62-
63-
64-
### Glossary
65-
66-
* remote - A remote is a connection to a Github repo. You should have two remotes, one that points to your repo and one to ours.
67-
* rebase - When you rebase a branch, you pull commits from your remote branch and move your commits on top of it. This allows you to update your branch with the latest changes without losing your changes.
36+
Don't worry, take the feedback, supply the correct information and re-open it!

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ The ERPNext code is licensed as GNU General Public License (v3) and the Document
4040

4141
## Contributing
4242

43-
1. [Pull Request Requirements](https://github.com/frappe/erpnext/wiki/Pull-Request-Guidelines)
43+
1. [Issue Guidelines](https://github.com/frappe/erpnext/wiki/Issue-Guidelines)
44+
1. [Pull Request Requirements](https://github.com/frappe/erpnext/wiki/Contribution-Guidelines)
4445
1. [Translations](https://translate.erpnext.com)
4546
1. [Chart of Accounts](https://charts.erpnext.com)
4647

erpnext/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from __future__ import unicode_literals
33
import frappe
44

5-
__version__ = '8.0.20'
5+
__version__ = '8.0.21'
66

77
def get_default_company(user=None):
88
'''Get default company for user'''

erpnext/accounts/doctype/asset/asset.py

+11-2
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,17 @@ def make_depreciation_schedule(self):
114114

115115
def set_accumulated_depreciation(self):
116116
accumulated_depreciation = flt(self.opening_accumulated_depreciation)
117-
for d in self.get("schedules"):
118-
accumulated_depreciation += flt(d.depreciation_amount, d.precision("depreciation_amount"))
117+
value_after_depreciation = flt(self.value_after_depreciation)
118+
for i, d in enumerate(self.get("schedules")):
119+
depreciation_amount = flt(d.depreciation_amount, d.precision("depreciation_amount"))
120+
value_after_depreciation -= flt(depreciation_amount)
121+
122+
if i==len(self.get("schedules"))-1 and self.depreciation_method == "Straight Line":
123+
depreciation_amount += flt(value_after_depreciation - flt(self.expected_value_after_useful_life),
124+
d.precision("depreciation_amount"))
125+
126+
d.depreciation_amount = depreciation_amount
127+
accumulated_depreciation += d.depreciation_amount
119128
d.accumulated_depreciation_amount = flt(accumulated_depreciation, d.precision("accumulated_depreciation_amount"))
120129

121130
def get_depreciation_amount(self, depreciable_value):

erpnext/accounts/doctype/asset/test_asset.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import frappe
77
import unittest
8-
from frappe.utils import cstr, nowdate, getdate
8+
from frappe.utils import cstr, nowdate, getdate, flt
99
from erpnext.accounts.doctype.asset.depreciation import post_depreciation_entries, scrap_asset, restore_asset
1010
from erpnext.accounts.doctype.asset.asset import make_sales_invoice, make_purchase_invoice
1111

@@ -243,6 +243,23 @@ def test_asset_sale(self):
243243

244244
self.assertEqual(frappe.db.get_value("Asset", "Macbook Pro 1", "status"), "Partially Depreciated")
245245

246+
def test_asset_expected_value_after_useful_life(self):
247+
asset = frappe.get_doc("Asset", "Macbook Pro 1")
248+
asset.depreciation_method = "Straight Line"
249+
asset.is_existing_asset = 1
250+
asset.total_number_of_depreciations = 400
251+
asset.gross_purchase_amount = 16866177.00
252+
asset.expected_value_after_useful_life = 500000
253+
asset.save()
254+
255+
accumulated_depreciation_after_full_schedule = \
256+
max([d.accumulated_depreciation_amount for d in asset.get("schedules")])
257+
258+
asset_value_after_full_schedule = (flt(asset.gross_purchase_amount) -
259+
flt(accumulated_depreciation_after_full_schedule))
260+
261+
self.assertTrue(asset.expected_value_after_useful_life >= asset_value_after_full_schedule)
262+
246263
def tearDown(self):
247264
asset = frappe.get_doc("Asset", "Macbook Pro 1")
248265

erpnext/patches.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -390,4 +390,5 @@ erpnext.patches.v8_0.enable_booking_asset_depreciation_automatically
390390
erpnext.patches.v8_0.set_project_copied_from
391391
erpnext.patches.v8_0.update_status_as_paid_for_completed_expense_claim
392392
erpnext.patches.v7_2.stock_uom_in_selling
393-
erpnext.patches.v8_0.revert_manufacturers_table_from_item
393+
erpnext.patches.v8_0.revert_manufacturers_table_from_item
394+
erpnext.patches.v8_0.disable_instructor_role
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
2+
# License: GNU General Public License v3. See license.txt
3+
4+
from __future__ import unicode_literals
5+
import frappe
6+
7+
def execute():
8+
"""
9+
disable the instructor role for companies with domain other than
10+
Education.
11+
"""
12+
13+
domains = frappe.db.sql_list("select domain from tabCompany")
14+
if "Education" not in domains:
15+
role = frappe.get_doc("Role", "Instructor")
16+
role.disabled = 1
17+
role.save(ignore_permissions=True)

erpnext/setup/setup_wizard/domainify.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def get_domain(domain):
1111
'desktop_icons': ['Item', 'BOM', 'Customer', 'Supplier', 'Sales Order',
1212
'Production Order', 'Stock Entry', 'Purchase Order', 'Task', 'Buying', 'Selling',
1313
'Accounts', 'HR', 'ToDo'],
14-
'remove_roles': ['Academics User'],
14+
'remove_roles': ['Academics User', 'Instructor'],
1515
'properties': [
1616
{'doctype': 'Item', 'fieldname': 'manufacturing', 'property': 'collapsible_depends_on', 'value': 'is_stock_item'},
1717
],
@@ -24,7 +24,7 @@ def get_domain(domain):
2424
'Retail': {
2525
'desktop_icons': ['POS', 'Item', 'Customer', 'Sales Invoice', 'Purchase Order',
2626
'Warranty Claim', 'Accounts', 'Task', 'Buying', 'ToDo'],
27-
'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User'],
27+
'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User', 'Instructor'],
2828
'properties': [
2929
{'doctype': 'Item', 'fieldname': 'manufacturing', 'property': 'hidden', 'value': 1},
3030
{'doctype': 'Customer', 'fieldname': 'credit_limit_section', 'property': 'hidden', 'value': 1},
@@ -38,7 +38,7 @@ def get_domain(domain):
3838
'Distribution': {
3939
'desktop_icons': ['Item', 'Customer', 'Supplier', 'Lead', 'Sales Order', 'Task',
4040
'Sales Invoice', 'CRM', 'Selling', 'Buying', 'Stock', 'Accounts', 'HR', 'ToDo'],
41-
'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User'],
41+
'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User', 'Instructor'],
4242
'set_value': [
4343
['Stock Settings', None, 'show_barcode_field', 1]
4444
],
@@ -48,7 +48,7 @@ def get_domain(domain):
4848
'Services': {
4949
'desktop_icons': ['Project', 'Timesheet', 'Customer', 'Sales Order', 'Sales Invoice',
5050
'Lead', 'Opportunity', 'Task', 'Expense Claim', 'Employee', 'HR', 'ToDo'],
51-
'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User'],
51+
'remove_roles': ['Manufacturing User', 'Manufacturing Manager', 'Academics User', 'Instructor'],
5252
'properties': [
5353
{'doctype': 'Item', 'fieldname': 'is_stock_item', 'property': 'default', 'value': 0},
5454
],
@@ -62,7 +62,7 @@ def get_domain(domain):
6262
'Fees', 'Task', 'ToDo', 'Schools'],
6363
'allow_roles': ['Academics User', 'Accounts User', 'Accounts Manager', 'Item Manager',
6464
'Website Manager', 'HR User', 'HR Manager', 'Purchase User', 'Purchase Manager',
65-
'Student', 'Projects User'],
65+
'Student', 'Projects User', 'Instructor'],
6666
'default_portal_role': 'Student'
6767
},
6868
}

erpnext/stock/doctype/serial_no/serial_no.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def after_rename(self, old, new, merge=False):
165165
for item in frappe.db.sql("""select name, serial_no from `tab%s`
166166
where serial_no like '%%%s%%'""" % (dt[0], frappe.db.escape(old))):
167167

168-
serial_nos = map(lambda i: i==old and new or i, item[1].split('\n'))
168+
serial_nos = map(lambda i: new if i.upper()==old.upper() else i, item[1].split('\n'))
169169
frappe.db.sql("""update `tab%s` set serial_no = %s
170170
where name=%s""" % (dt[0], '%s', '%s'),
171171
('\n'.join(serial_nos), item[0]))

0 commit comments

Comments
 (0)