Merge branch 'develop'
This commit is contained in:
commit
e8eccf1a49
61
.github/CONTRIBUTING.md
vendored
Normal file
61
.github/CONTRIBUTING.md
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
##General Overview
|
||||
|
||||
We have three branches where all the work happens:
|
||||
|
||||
* **master** - This is the stable branch based on which we do releases. This branch is for production.
|
||||
* **develop** - This is an unstable branch for development purposes, it has bleeding edge features and fixes, but it's not recommended for production. Bug fixes and new features go here.
|
||||
* **hotfix** - This is a branch dedicated to hotfixes on the master branch. Urgent bug fixes go here.
|
||||
|
||||
|
||||
Once we deem the develop branch to be stable, we merge it into the master and do a major release. The hotfix branch is solely for making urgent bug fixes on the current master branch, which we then merge into master.
|
||||
|
||||
We almost never push directly to master.
|
||||
|
||||
|
||||
***
|
||||
|
||||
|
||||
##Workflow
|
||||
|
||||
Contributing to ERPNext is not very different from the usual Pull Request workflow on GitHub.
|
||||
|
||||
###Prerequisites :
|
||||
|
||||
* You need to know [Git and Github basics](https://try.github.io/levels/1/challenges/1)
|
||||
* You need to have a Fork of the [ERPNext repo](https://github.com/frappe/erpnext) in your personal Github account
|
||||
* You need to add a [remote](#glossary) for your Forked repository. `git remote add origin [your-erpnext-repo-url]`
|
||||
|
||||
|
||||
###The Process:
|
||||
|
||||
1. Make sure you're in the right branch. **develop** for adding features / fixing issues and **hotfix** for urgent bug fixes
|
||||
2. Make your changes
|
||||
3. Create and checkout a new branch for the changes you've made. `git checkout -b [branch-name]`
|
||||
4. Add and commit your changes `git commit -am "[commit-message]"
|
||||
5. If you have been working on sometime for a long time, you should [rebase](#glossary) your branch with our develop branch. `git pull upstream develop --rebase` where `upstream` is the remote name of our repo
|
||||
6. Now, push your changes to your fork. `git push origin [branch-name]`
|
||||
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`
|
||||
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.
|
||||
8. Wait for us to review it
|
||||
|
||||
###Common Problems:
|
||||
|
||||
* 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.
|
||||
* 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]`
|
||||
|
||||
|
||||
###Good practices:
|
||||
|
||||
* You should rebase your branch with the branch you plan to make a Pull Request to as often as you can.
|
||||
* Your commit messages should be precise and explain exactly what the commit does. Same goes for the Pull Request title.
|
||||
* When making a PR make sure that all your code is committed properly by checking the diffs.
|
||||
* If you're working on different things at the same time, make sure you make separate branches for each.
|
||||
* 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.
|
||||
* DRY. Don't Repeat Yourself. Before writing up a similar function /feature make sure it doesn't exist in the codebase already.
|
||||
* Tabs, not spaces.
|
||||
|
||||
|
||||
###Glossary
|
||||
|
||||
* 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.
|
||||
* 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.
|
@ -13,7 +13,7 @@ before_install:
|
||||
install:
|
||||
- sudo apt-get purge -y mysql-common
|
||||
- wget https://raw.githubusercontent.com/frappe/bench/master/install_scripts/setup_frappe.sh
|
||||
- sudo bash setup_frappe.sh --skip-setup-bench --mysql-root-password travis
|
||||
- sudo bash setup_frappe.sh --skip-setup-bench --mysql-root-password travis --bench-branch develop
|
||||
- sudo pip install --upgrade pip
|
||||
- rm $TRAVIS_BUILD_DIR/.git/shallow
|
||||
- bash $TRAVIS_BUILD_DIR/travis/bench_init.sh
|
||||
@ -25,7 +25,6 @@ script:
|
||||
- bench use test_site
|
||||
- bench reinstall
|
||||
- bench build
|
||||
- bench build-website
|
||||
- bench start &
|
||||
- sleep 10
|
||||
- bench --verbose run-tests --driver Firefox
|
||||
|
@ -1,68 +0,0 @@
|
||||
# Contributing to Frappe / ERPNext
|
||||
|
||||
## Questions
|
||||
|
||||
If you have questions on how to use ERPNext or want help in customization or debugging of your scripts, please post on https://discuss.erpnext.com. This is only for bug reports and feature requests.
|
||||
|
||||
## Reporting issues
|
||||
|
||||
We only accept issues that are bug reports or feature requests. Bugs must be isolated and reproducible problems. Please read the following guidelines before opening any issue.
|
||||
|
||||
1. **Search for existing issues:** We want to avoid duplication, and you'd help us out a lot by first checking if someone else has reported the same issue. The issue may have already been resolved with a fix available.
|
||||
1. **Report each issue separately:** Don't club multiple, unreleated issues in one note.
|
||||
1. **Mention the version number:** Please mention the application, browser and platform version numbers.
|
||||
|
||||
### Issues
|
||||
|
||||
1. **Share as much information as possible:** Include operating system and version, browser and version, when did you last update ERPNext, how is it customized, etc. where appropriate. Also include steps to reproduce the bug.
|
||||
1. **Include Screenshots if possible:** Consider adding screenshots annotated with what goes wrong.
|
||||
1. **Find and post the trace for bugs:** If you are reporting an issue from the browser, Open the Javascript Console and paste us any error messages you see.
|
||||
1. **Security Issues:** If you are reporting a security issue, please send a private email to <info@frappe.io>.
|
||||
|
||||
|
||||
### Feature Requests
|
||||
|
||||
1. We need as much information you can to consider a feature request.
|
||||
1. Think about **how** you want us to build the feature. Consider including:
|
||||
1. Mockups (wireframes of features)
|
||||
1. Screenshots (annotated with what should change)
|
||||
1. Screenshots from other products if you want us to implement features present in other products.
|
||||
1. Basically, the more you help us, the faster your request is likely to be completed.
|
||||
1. A one line feature request like **Implement Capacity Planning** will be closed.
|
||||
|
||||
## Pull Requests
|
||||
|
||||
General guidelines for sending pull requests:
|
||||
|
||||
#### Don't Repeat Yourself (DRY)
|
||||
|
||||
We believe that the most effective way to manage a product like this is to ensure that
|
||||
there is minimum repetition of code. So before contributing a function, please make sure
|
||||
that such a feature or function does not exist else where. If it does, the try and extend
|
||||
that function to accommodate your use case.
|
||||
|
||||
#### Don't create new DocTypes Unless Absolutely Necessary
|
||||
|
||||
DocTypes are easy to create but hard to maintain. If you find that there is a another DocType with a similar functionality, then please try and extend that functionality. For example, by adding a "type" field to classify the new type of record.
|
||||
|
||||
#### Tabs or spaces?
|
||||
|
||||
Tabs!
|
||||
|
||||
#### Release Checklist
|
||||
|
||||
- Describe, in detail, what is in the pull request
|
||||
- How to use the new feature?
|
||||
- Test cases
|
||||
- Change log
|
||||
- Manual Pull Request Link
|
||||
- Screencast. Should include:
|
||||
- New Forms
|
||||
- Linked Forms
|
||||
- Linked Reports
|
||||
- Print Views
|
||||
|
||||
### Copyright
|
||||
|
||||
Please see README.md
|
||||
|
@ -4,7 +4,7 @@
|
||||
|
||||
[https://erpnext.com](https://erpnext.com)
|
||||
|
||||
Includes: Accounting, Inventory, CRM, Sales, Purchase, Projects, HRMS. Requires MariaDB.
|
||||
Includes: Accounting, Inventory, Manufacturing, CRM, Sales, Purchase, Project Management, HRMS. Requires MariaDB.
|
||||
|
||||
ERPNext is built on the [Frappe](https://github.com/frappe/frappe) Framework, a full-stack web app framework in Python & JavaScript.
|
||||
|
||||
|
@ -1,4 +1,26 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
__version__ = '6.27.26'
|
||||
__version__ = '7.0.0'
|
||||
|
||||
def get_default_company(user=None):
|
||||
'''Get default company for user'''
|
||||
from frappe.defaults import get_user_default_as_list
|
||||
|
||||
if not user:
|
||||
user = frappe.session.user
|
||||
|
||||
companies = get_user_default_as_list(user, 'company')
|
||||
if companies:
|
||||
default_company = companies[0]
|
||||
else:
|
||||
default_company = frappe.db.get_single_value('Global Defaults', 'default_company')
|
||||
|
||||
return default_company
|
||||
|
||||
def get_default_currency():
|
||||
'''Returns the currency of the default company'''
|
||||
company = get_default_company()
|
||||
if company:
|
||||
return frappe.db.get_value('Company', company, 'default_currency')
|
||||
|
@ -1,7 +1,6 @@
|
||||
// Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
// License: GNU General Public License v3. See license.txt
|
||||
|
||||
cur_frm.list_route = "Accounts Browser/Account";
|
||||
|
||||
cur_frm.cscript.refresh = function(doc, cdt, cdn) {
|
||||
if(doc.__islocal) {
|
||||
@ -42,13 +41,13 @@ cur_frm.add_fetch('parent_account', 'root_type', 'root_type');
|
||||
cur_frm.cscript.account_type = function(doc, cdt, cdn) {
|
||||
if(doc.is_group==0) {
|
||||
cur_frm.toggle_display(['tax_rate'], doc.account_type == 'Tax');
|
||||
cur_frm.toggle_display('warehouse', doc.account_type=='Warehouse');
|
||||
cur_frm.toggle_display('warehouse', doc.account_type=='Stock');
|
||||
}
|
||||
}
|
||||
|
||||
cur_frm.cscript.add_toolbar_buttons = function(doc) {
|
||||
cur_frm.add_custom_button(__('Chart of Accounts'),
|
||||
function() { frappe.set_route("Accounts Browser", "Account"); }, __("View"))
|
||||
function() { frappe.set_route("Tree", "Account"); }, __("View"))
|
||||
|
||||
if (doc.is_group == 1) {
|
||||
cur_frm.add_custom_button(__('Group to Non-Group'),
|
||||
@ -64,7 +63,7 @@ cur_frm.cscript.add_toolbar_buttons = function(doc) {
|
||||
frappe.set_route("query-report", "General Ledger");
|
||||
}, __("View"));
|
||||
|
||||
cur_frm.add_custom_button(__('Group to Group'),
|
||||
cur_frm.add_custom_button(__('Non-Group to Group'),
|
||||
function() { cur_frm.cscript.convert_to_group(); }, 'icon-retweet', 'btn-default')
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
"allow_copy": 1,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"beta": 0,
|
||||
"creation": "2013-01-30 12:49:46",
|
||||
"custom": 0,
|
||||
"description": "Heads (or groups) against which Accounting Entries are made and balances are maintained.",
|
||||
@ -17,6 +18,7 @@
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "",
|
||||
@ -41,6 +43,7 @@
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"length": 0,
|
||||
@ -64,6 +67,7 @@
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 1,
|
||||
"label": "Account Name",
|
||||
@ -90,6 +94,7 @@
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Is Group",
|
||||
@ -114,6 +119,7 @@
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Company",
|
||||
@ -140,6 +146,7 @@
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Root Type",
|
||||
@ -164,6 +171,7 @@
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Report Type",
|
||||
@ -189,6 +197,7 @@
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Currency",
|
||||
@ -214,6 +223,7 @@
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"length": 0,
|
||||
@ -237,6 +247,7 @@
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 1,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Parent Account",
|
||||
@ -264,6 +275,7 @@
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Account Type",
|
||||
@ -271,7 +283,7 @@
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "account_type",
|
||||
"oldfieldtype": "Select",
|
||||
"options": "\nBank\nCash\nDepreciation\nTax\nChargeable\nWarehouse\nReceivable\nPayable\nEquity\nFixed Asset\nCost of Goods Sold\nExpense Account\nRound Off\nIncome Account\nStock Received But Not Billed\nExpenses Included In Valuation\nStock Adjustment\nStock\nTemporary",
|
||||
"options": "\nAccumulated Depreciation\nBank\nCash\nChargeable\nCost of Goods Sold\nDepreciation\nEquity\nExpense Account\nExpenses Included In Valuation\nFixed Asset\nIncome Account\nPayable\nReceivable\nRound Off\nStock\nStock Adjustment\nStock Received But Not Billed\nTax\nTemporary",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
@ -291,6 +303,7 @@
|
||||
"fieldtype": "Float",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Rate",
|
||||
@ -317,6 +330,7 @@
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Frozen",
|
||||
@ -343,6 +357,7 @@
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Warehouse",
|
||||
@ -367,6 +382,7 @@
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Balance must be",
|
||||
@ -391,6 +407,7 @@
|
||||
"fieldtype": "Int",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Lft",
|
||||
@ -414,6 +431,7 @@
|
||||
"fieldtype": "Int",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Rgt",
|
||||
@ -437,6 +455,7 @@
|
||||
"fieldtype": "Data",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Old Parent",
|
||||
@ -457,13 +476,14 @@
|
||||
"hide_toolbar": 0,
|
||||
"icon": "icon-money",
|
||||
"idx": 1,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2015-12-12 10:19:54.365839",
|
||||
"modified": "2016-06-24 13:33:45.504882",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Account",
|
||||
@ -570,7 +590,10 @@
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"search_fields": ""
|
||||
"search_fields": "",
|
||||
"sort_order": "ASC",
|
||||
"track_seen": 0
|
||||
}
|
@ -16,7 +16,7 @@ class Account(Document):
|
||||
frozen_accounts_modifier = frappe.db.get_value("Accounts Settings", "Accounts Settings",
|
||||
"frozen_accounts_modifier")
|
||||
if not frozen_accounts_modifier or frozen_accounts_modifier in frappe.get_roles():
|
||||
self.get("__onload").can_freeze_account = True
|
||||
self.set_onload("can_freeze_account", True)
|
||||
|
||||
def autoname(self):
|
||||
# first validate if company exists
|
||||
@ -91,11 +91,11 @@ class Account(Document):
|
||||
return
|
||||
|
||||
existing_is_group = frappe.db.get_value("Account", self.name, "is_group")
|
||||
if self.is_group != existing_is_group:
|
||||
if cint(self.is_group) != cint(existing_is_group):
|
||||
if self.check_gle_exists():
|
||||
throw(_("Account with existing transaction cannot be converted to ledger"))
|
||||
elif self.is_group:
|
||||
if self.account_type:
|
||||
if self.account_type and not self.flags.exclude_account_type_check:
|
||||
throw(_("Cannot covert to Group because Account Type is selected."))
|
||||
elif self.check_if_child_exists():
|
||||
throw(_("Account with child nodes cannot be set as ledger"))
|
||||
@ -139,7 +139,7 @@ class Account(Document):
|
||||
def convert_ledger_to_group(self):
|
||||
if self.check_gle_exists():
|
||||
throw(_("Account with existing transaction can not be converted to group."))
|
||||
elif self.account_type:
|
||||
elif self.account_type and not self.flags.exclude_account_type_check:
|
||||
throw(_("Cannot covert to Group because Account Type is selected."))
|
||||
else:
|
||||
self.is_group = 1
|
||||
@ -164,23 +164,28 @@ class Account(Document):
|
||||
def validate_warehouse_account(self):
|
||||
if not cint(frappe.defaults.get_global_default("auto_accounting_for_stock")):
|
||||
return
|
||||
|
||||
if self.account_type == "Warehouse":
|
||||
|
||||
if self.account_type == "Stock" and not cint(self.is_group):
|
||||
if not self.warehouse:
|
||||
throw(_("Warehouse is mandatory if account type is Warehouse"))
|
||||
|
||||
throw(_("Warehouse is mandatory"))
|
||||
|
||||
old_warehouse = cstr(frappe.db.get_value("Account", self.name, "warehouse"))
|
||||
if old_warehouse != cstr(self.warehouse):
|
||||
if old_warehouse:
|
||||
self.validate_warehouse(old_warehouse)
|
||||
if self.warehouse:
|
||||
self.validate_warehouse(self.warehouse)
|
||||
|
||||
elif self.warehouse:
|
||||
self.warehouse = None
|
||||
|
||||
|
||||
def validate_warehouse(self, warehouse):
|
||||
if frappe.db.get_value("Stock Ledger Entry", {"warehouse": warehouse}):
|
||||
throw(_("Stock entries exist against warehouse {0}, hence you cannot re-assign or modify Warehouse").format(warehouse))
|
||||
lft, rgt = frappe.db.get_value("Warehouse", warehouse, ["lft", "rgt"])
|
||||
|
||||
if lft and rgt:
|
||||
if frappe.db.sql_list("""select sle.name from `tabStock Ledger Entry` sle where exists (select wh.name from
|
||||
tabWarehouse wh where lft >= %s and rgt <= %s and sle.warehouse = wh.name)""", (lft, rgt)):
|
||||
throw(_("Stock entries exist against Warehouse {0}, hence you cannot re-assign or modify it").format(warehouse))
|
||||
|
||||
def update_nsm_model(self):
|
||||
"""update lft, rgt indices for nested set model"""
|
||||
|
52
erpnext/accounts/doctype/account/account_tree.js
Normal file
52
erpnext/accounts/doctype/account/account_tree.js
Normal file
@ -0,0 +1,52 @@
|
||||
frappe.treeview_settings["Account"] = {
|
||||
breadcrumbs: "Accounts",
|
||||
title: __("Chart Of Accounts"),
|
||||
get_tree_root: false,
|
||||
filters: [{
|
||||
fieldname: "company",
|
||||
fieldtype:"Select",
|
||||
options: $.map(locals[':Company'], function(c) { return c.name; }).sort(),
|
||||
label: __("Company"),
|
||||
default: frappe.defaults.get_default('company') ? frappe.defaults.get_default('company'): ""
|
||||
}],
|
||||
root_label: "Accounts",
|
||||
get_tree_nodes: 'erpnext.accounts.utils.get_children',
|
||||
add_tree_node: 'erpnext.accounts.utils.add_ac',
|
||||
menu_items:[
|
||||
{
|
||||
label: __('New Company'),
|
||||
action: function() { frappe.new_doc("Company", true) },
|
||||
condition: 'frappe.boot.user.can_create.indexOf("Company") !== -1'
|
||||
}
|
||||
],
|
||||
fields: [
|
||||
{fieldtype:'Data', fieldname:'account_name', label:__('New Account Name'), reqd:true,
|
||||
description: __("Name of new Account. Note: Please don't create accounts for Customers and Suppliers")},
|
||||
{fieldtype:'Check', fieldname:'is_group', label:__('Is Group'),
|
||||
description: __('Further accounts can be made under Groups, but entries can be made against non-Groups')},
|
||||
{fieldtype:'Select', fieldname:'root_type', label:__('Root Type'),
|
||||
options: ['Asset', 'Liability', 'Equity', 'Income', 'Expense'].join('\n')},
|
||||
{fieldtype:'Select', fieldname:'account_type', label:__('Account Type'),
|
||||
options: ['', 'Bank', 'Cash', 'Stock', 'Tax', 'Chargeable', 'Fixed Asset'].join('\n'),
|
||||
description: __("Optional. This setting will be used to filter in various transactions.")
|
||||
},
|
||||
{fieldtype:'Float', fieldname:'tax_rate', label:__('Tax Rate'),
|
||||
depends_on: 'eval:doc.is_group==1&&doc.account_type=="Tax"'},
|
||||
{fieldtype:'Link', fieldname:'warehouse', label:__('Warehouse'), options:"Warehouse",
|
||||
depends_on: 'eval:(!doc.is_group&&doc.account_type=="Warehouse")'},
|
||||
{fieldtype:'Link', fieldname:'account_currency', label:__('Currency'), options:"Currency",
|
||||
description: __("Optional. Sets company's default currency, if not specified.")}
|
||||
],
|
||||
onrender: function(node) {
|
||||
var dr_or_cr = node.data.balance < 0 ? "Cr" : "Dr";
|
||||
if (node.data && node.data.balance!==undefined) {
|
||||
$('<span class="balance-area pull-right text-muted small">'
|
||||
+ (node.data.balance_in_account_currency ?
|
||||
(format_currency(Math.abs(node.data.balance_in_account_currency),
|
||||
node.data.account_currency) + " / ") : "")
|
||||
+ format_currency(Math.abs(node.data.balance), node.data.company_currency)
|
||||
+ " " + dr_or_cr
|
||||
+ '</span>').insertBefore(node.$ul);
|
||||
}
|
||||
}
|
||||
}
|
@ -37,12 +37,15 @@ def create_charts(chart_name, company):
|
||||
"root_type": root_type,
|
||||
"report_type": report_type,
|
||||
"account_type": child.get("account_type"),
|
||||
"account_currency": frappe.db.get_value("Company", company, "default_currency")
|
||||
"account_currency": frappe.db.get_value("Company", company, "default_currency"),
|
||||
"tax_rate": child.get("tax_rate")
|
||||
})
|
||||
|
||||
if root_account or frappe.local.flags.allow_unverified_charts:
|
||||
account.flags.ignore_mandatory = True
|
||||
|
||||
account.flags.ignore_permissions = True
|
||||
|
||||
account.insert()
|
||||
|
||||
accounts.append(account_name_in_db)
|
||||
@ -86,8 +89,9 @@ def get_charts_for_country(country):
|
||||
def _get_chart_name(content):
|
||||
if content:
|
||||
content = json.loads(content)
|
||||
if content and content.get("disabled", "No") == "No":
|
||||
charts.append(content["name"])
|
||||
if (content and content.get("disabled", "No") == "No") \
|
||||
or frappe.local.flags.allow_unverified_charts:
|
||||
charts.append(content["name"])
|
||||
|
||||
country_code = frappe.db.get_value("Country", country, "code")
|
||||
if country_code:
|
||||
|
@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "ar",
|
||||
"name": "Plan de Cuentas",
|
||||
"disabled": "Yes",
|
||||
"name": "Argentina - Plan de Cuentas",
|
||||
"tree": {
|
||||
"Cuentas Patrimoniales": {
|
||||
"ACTIVO": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "be",
|
||||
"name": "Belgian PCMN",
|
||||
"name": "Belgian - PCMN",
|
||||
"tree": {
|
||||
"CLASSE 1": {
|
||||
"BENEFICE (PERTE) REPORTE(E)": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "br",
|
||||
"name": "Planilha de Contas Brasileira",
|
||||
"name": "Brasileira - Planilha de Contas",
|
||||
"tree": {
|
||||
"ATIVO": {
|
||||
"CIRCULANTE": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "ca",
|
||||
"name": "Chart of Accounts for english-speaking provinces",
|
||||
"name": "Canada - Chart of Accounts for english-speaking provinces",
|
||||
"tree": {
|
||||
"ASSETS": {
|
||||
"CURRENT ASSETS": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "ca",
|
||||
"name": "Plan comptable pour les provinces francophones",
|
||||
"name": "Canada - Plan comptable pour les provinces francophones",
|
||||
"tree": {
|
||||
"ACTIF": {
|
||||
"ACTIFS COURANTS": {
|
||||
|
@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "ch",
|
||||
"name": "Plan comptable STERCHI",
|
||||
"disabled": "Yes",
|
||||
"name": "Switzerland - Plan comptable STERCHI",
|
||||
"tree": {
|
||||
"Actif": {
|
||||
"Actifs circulants": {
|
||||
|
@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "cl",
|
||||
"name": "Plan de Cuentas",
|
||||
"disabled": "Yes",
|
||||
"name": "Chile - Plan de Cuentas",
|
||||
"tree": {
|
||||
"Cuentas de Movimiento": {
|
||||
"Compras": {
|
||||
|
@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "cn",
|
||||
"disabled": "Yes",
|
||||
"name": "\u4e2d\u56fd\u4f1a\u8ba1\u79d1\u76ee\u8868 \uff08\u8d22\u4f1a[2006]3\u53f7\u300a\u4f01\u4e1a\u4f1a\u8ba1\u51c6\u5219\u300b\uff09",
|
||||
"name": "China - \u4e2d\u56fd\u4f1a\u8ba1\u79d1\u76ee\u8868 \uff08\u8d22\u4f1a[2006]3\u53f7\u300a\u4f01\u4e1a\u4f1a\u8ba1\u51c6\u5219\u300b\uff09",
|
||||
"tree": {
|
||||
"\u4e3b\u8425\u4e1a\u52a1\u6210\u672c": {
|
||||
"root_type": ""
|
||||
|
@ -1,199 +0,0 @@
|
||||
{
|
||||
"country_code": "cn",
|
||||
"disabled": "Yes",
|
||||
"name": "\u5c0f\u4f01\u4e1a\u4f1a\u8ba1\u79d1\u76ee\u8868\uff08\u8d22\u4f1a[2011]17\u53f7\u300a\u5c0f\u4f01\u4e1a\u4f1a\u8ba1\u51c6\u5219\u300b\uff09",
|
||||
"tree": {
|
||||
"\u4e3b\u8425\u4e1a\u52a1\u6210\u672c": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u4e3b\u8425\u4e1a\u52a1\u6536\u5165": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5176\u4ed6\u4e1a\u52a1\u6210\u672c": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5176\u4ed6\u4e1a\u52a1\u6536\u5165": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5176\u4ed6\u5e94\u6536\u6b3e": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5176\u4ed6\u8d27\u5e01\u8d44\u91d1": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5229\u6da6\u5206\u914d": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5236\u9020\u8d39\u7528": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u539f\u6750\u6599": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5468\u8f6c\u6750\u6599": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5546\u54c1\u8fdb\u9500\u5dee\u4ef7": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u56fa\u5b9a\u8d44\u4ea7": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u56fa\u5b9a\u8d44\u4ea7\u6e05\u7406": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5728\u5efa\u5de5\u7a0b": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5728\u9014\u7269\u8d44": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u59d4\u6258\u52a0\u5de5\u7269\u8d44": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5b9e\u6536\u8d44\u672c": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5de5\u7a0b\u65bd\u5de5": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5de5\u7a0b\u7269\u8d44": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5e93\u5b58\u5546\u54c1": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5e94\u4ea4\u7a0e\u8d39": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5e94\u4ed8\u5229\u606f": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5e94\u4ed8\u5229\u6da6": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5e94\u4ed8\u7968\u636e": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5e94\u4ed8\u804c\u5de5\u85aa\u916c": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5e94\u4ed8\u8d26\u6b3e": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5e94\u6536\u5229\u606f": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5e94\u6536\u7968\u636e": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5e94\u6536\u80a1\u5229": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5e94\u6536\u8d26\u6b3e": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u5f85\u5904\u7406\u8d22\u4ea7\u635f\u6ea2": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u6240\u5f97\u7a0e": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u6295\u8d44\u6536\u76ca": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u65e0\u5f62\u8d44\u4ea7": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u672c\u5e74\u5229\u6da6": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u673a\u68b0\u4f5c\u4e1a": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u6750\u6599\u6210\u672c\u5dee\u5f02": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u6750\u6599\u91c7\u8d2d": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u6d88\u8017\u6027\u751f\u7269\u8d44\u4ea7": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u73b0\u91d1": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u751f\u4ea7\u6027\u751f\u7269\u8d44\u4ea7": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u751f\u4ea7\u6027\u751f\u7269\u8d44\u4ea7\u7d2f\u8ba1\u6298\u65e7": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u751f\u4ea7\u6210\u672c": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u76c8\u4f59\u516c\u79ef": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u77ed\u671f\u501f\u6b3e": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u77ed\u671f\u6295\u8d44": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u7814\u53d1\u652f\u51fa": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u7ba1\u7406\u8d39\u7528": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u7d2f\u8ba1\u644a\u9500": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u8425\u4e1a\u5916\u652f\u51fa": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u8425\u4e1a\u5916\u6536\u5165": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u8425\u4e1a\u7a0e\u91d1\u53ca\u9644\u52a0": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u8d22\u52a1\u8d39\u7528": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u8d44\u672c\u516c\u79ef": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u9012\u5ef6\u6536\u76ca": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u94f6\u884c\u5b58\u6b3e": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u9500\u552e\u8d39\u7528": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u957f\u671f\u501f\u6b3e": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u957f\u671f\u503a\u5238\u6295\u8d44": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u957f\u671f\u5e94\u4ed8\u6b3e": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u957f\u671f\u5f85\u644a\u8d39\u7528": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u957f\u671f\u80a1\u6743\u6295\u8d44": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u9884\u4ed8\u8d26\u6b3e": {
|
||||
"root_type": ""
|
||||
},
|
||||
"\u9884\u6536\u8d26\u6b3e": {
|
||||
"root_type": ""
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "co",
|
||||
"name": "Unique Account Chart - PUC",
|
||||
"name": "Colombia - Unique Account Chart - PUC",
|
||||
"tree": {
|
||||
"ACTIVO": {
|
||||
"DEUDORES": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "cr",
|
||||
"name": "Costa Rica - Company 0",
|
||||
"name": "Costa Rica - Chart of Accounts 1",
|
||||
"tree": {
|
||||
"0-Activo": {
|
||||
"0-Activo circulante": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "cr",
|
||||
"name": "Costa Rica - Company 1",
|
||||
"name": "Costa Rica - Chart of Accounts 2",
|
||||
"tree": {
|
||||
"xActivo": {
|
||||
"root_type": "Asset",
|
||||
|
@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "de",
|
||||
"name": "Deutscher Kontenplan SKR04",
|
||||
"disabled": "Yes",
|
||||
"name": "Germany - Kontenplan SKR04",
|
||||
"tree": {
|
||||
"Bilanz - Aktiva": {
|
||||
"Anlageverm\u00f6gen": {
|
||||
@ -222,24 +221,8 @@
|
||||
"Forderungen aus Lieferungen und Leistungen gegen Gesellschafter - Restlaufzeit bis 1 Jahr": {},
|
||||
"Forderungen aus Lieferungen und Leistungen gegen Gesellschafter - Restlaufzeit gr\u00f6\u00dfer 1 Jahr": {}
|
||||
},
|
||||
"Forderungen geg. Untern.- m. d. e. Beteiligungsverh\u00e4ltnis besteht od. Verbindl. gegen Untern. - mit denen ein Beteiligungsverh\u00e4ltnis besteht": {
|
||||
"Forderungen gegen Unternehmen- mit denen ein Beteiligungsverh\u00e4ltnis besteht": {
|
||||
"Besitzwechsel gegen Unternehmen- mit denen ein Beteiligungsverh\u00e4ltnis besteht": {},
|
||||
"Besitzwechsel gegen Unternehmen- mit denen ein Beteiligungsverh\u00e4ltnis besteht - Restlaufzeit bis 1 Jahr": {},
|
||||
"Besitzwechsel gegen Unternehmen- mit denen ein Beteiligungsverh\u00e4ltnis besteht - Restlaufzeit gr\u00f6\u00dfer 1 Jahr": {},
|
||||
"Besitzwechsel gegen Unternehmen- mit denen ein Beteiligungsverh\u00e4ltnis besteht- bundesbankf\u00e4hig": {},
|
||||
"Forderungen aus Lieferungen und Leistungen gegen Unternehmen- mit denen ein Beteiligungsverh\u00e4ltnis besteht": {
|
||||
"account_type": "Receivable"
|
||||
},
|
||||
"Forderungen aus Lieferungen und Leistungen gegen Unternehmen- mit denen ein Beteiligungsverh\u00e4ltnis besteht - Restlaufzeit bis 1 Jahr": {},
|
||||
"Forderungen aus Lieferungen und Leistungen gegen Unternehmen- mit denen ein Beteiligungsverh\u00e4ltnis besteht - Restlaufzeit gr\u00f6\u00dfer 1 Jahr": {},
|
||||
"Forderungen gegen Unternehmen- mit denen ein Beteiligungsverh\u00e4ltnis besteht - Restlaufzeit bis 1 Jahr": {},
|
||||
"Forderungen gegen Unternehmen- mit denen ein Beteiligungsverh\u00e4ltnis besteht - Restlaufzeit gr\u00f6\u00dfer 1 Jahr": {}
|
||||
}
|
||||
},
|
||||
"Forderungen gegen Unternehmen- mit denen ein Beteiligungsverh\u00e4ltnis besteht H-Saldo": {
|
||||
"Wertberichtigungen zu Forderungen mit einer Restlaufzeit bis zu 1 Jahr gegen Unternhemen- mit denen ein Beteiligungsverh\u00e4ltnis besteht": {},
|
||||
"Wertberichtigungen zu Forderungen mit einer Restlaufzeit von mehr als 1 Jahr gegen Unternhemen- mit denen ein Beteiligungsverh\u00e4ltnis besteht": {}
|
||||
"is_group": 1
|
||||
},
|
||||
"Forderungen gegen verbundene Unternehmen H-Saldo": {
|
||||
"Wertberichtigungen zu Forderungen mit einer Restlaufzeit bis zu 1 Jahr gegen verbundene Unternehmen": {},
|
||||
@ -459,7 +442,7 @@
|
||||
"Gezeichnetes Kapital": {}
|
||||
},
|
||||
"Nicht eingeforderte ausstehende Einlagen": {
|
||||
"Ausstehende Einlagen auf das gezeichnete Kapital- nicht eingefordert (Passivausweis- von gezeichnetem Kapital offen abgesetzt eingeforderte ausstehende Einlagen s. Konto 1298)": {}
|
||||
"is_group": 1
|
||||
}
|
||||
},
|
||||
"Kapital Teilhaber": {
|
||||
@ -758,19 +741,6 @@
|
||||
"Verbindlichkeiten gegen\u00fcber Kreditinstituten aus Teilzahlungsvertr\u00e4gen Restlaufzeit gr\u00f6\u00dfer 5 Jahre": {}
|
||||
}
|
||||
},
|
||||
"Verbindlichkeiten gegen\u00fcber Unternehmen- mit denen ein Beteiligungsverh\u00e4ltnis besteht oder Forderungen gegen Unternehmen- mit denen ein Beteiligungsverh\u00e4ltnis besteht": {
|
||||
"Verbindlichkeiten gegen\u00fcber Unternehmen- mit denen ein Beteiligungsverh\u00e4ltnis besteht ": {
|
||||
"Verbindlichkeiten aus Lieferungen und Leistungen gegen\u00fcber Unternehmen- mit denen ein Beteiligungsverh\u00e4ltnis besteht": {
|
||||
"account_type": "Payable"
|
||||
},
|
||||
"Verbindlichkeiten aus Lieferungen und Leistungen gegen\u00fcber Unternehmen- mit denen ein Beteiligungsverh\u00e4ltnis besteht - Restlaufzeit 1 bis 5 Jahre": {},
|
||||
"Verbindlichkeiten aus Lieferungen und Leistungen gegen\u00fcber Unternehmen- mit denen ein Beteiligungsverh\u00e4ltnis besteht - Restlaufzeit bis 1 Jahr": {},
|
||||
"Verbindlichkeiten aus Lieferungen und Leistungen gegen\u00fcber Unternehmen- mit denen ein Beteiligungsverh\u00e4ltnis besteht - Restlaufzeit gr\u00f6\u00dfer 5 Jahre": {},
|
||||
"Verbindlichkeiten gegen\u00fcber Unternehmen- mit denen ein Beteiligungsverh\u00e4ltnis besteht Restlaufzeit 1 bis 5 Jahre": {},
|
||||
"Verbindlichkeiten gegen\u00fcber Unternehmen- mit denen ein Beteiligungsverh\u00e4ltnis besteht Restlaufzeit bis 1 Jahr": {},
|
||||
"Verbindlichkeiten gegen\u00fcber Unternehmen- mit denen ein Beteiligungsverh\u00e4ltnis besteht Restlaufzeit gr\u00f6\u00dfer 5 Jahre": {}
|
||||
}
|
||||
},
|
||||
"Verbindlichkeiten gegen\u00fcber verbundenen Unternehmen oder Forderungen gegen verbundene Unternehmen": {
|
||||
"Verbindlichkeiten gegen\u00fcber verbundenen Unternehmen": {
|
||||
"Verbindlichkeiten aus Lieferungen und Leistungen gegen\u00fcber verbundenen Unternehmen": {
|
||||
@ -884,10 +854,6 @@
|
||||
"Statistische Konten f\u00fcr den Gewinnzuschlag nach \u00a7\u00a7 6b- 6c und 7g EStG (Haben-Buchung)": {},
|
||||
"Statistische Konten f\u00fcr den Gewinnzuschlag- Gegenkonto zu 9890": {}
|
||||
},
|
||||
"Statistische Konten f\u00fcr den GuV-Ausweis in \"Gutschrift bzw. Belastung auf Verbindlichkeitskonten\" bei den Zuordnungstabellen f\u00fcr PersHG nach KapCoRiLiG": {
|
||||
"Anteil f\u00fcr Verbindlichkeitskonten": {},
|
||||
"Verrechnungskonto f\u00fcr Anteil Verbindlichkeitskonten": {}
|
||||
},
|
||||
"Statistische Konten f\u00fcr den Kennziffernteil der Bilanz": {
|
||||
"Besch\u00e4ftigte Personen": {},
|
||||
"Gegenkonto zu 9200": {},
|
||||
@ -1028,7 +994,6 @@
|
||||
"Verbindlichkeiten aus Gew\u00e4hrleistungsvertr\u00e4gen": {},
|
||||
"Verbindlichkeiten aus Gew\u00e4hrleistungsvertr\u00e4gen gegen\u00fcber verbundenen Unternehmen": {},
|
||||
"Verbindlichkeiten aus der Begebung und \u00fcbertragung von Wechseln": {},
|
||||
"Verbindlichkeiten aus der Begebung und \u00fcbertragung von Wechseln gegen\u00fcber verbundenen Unternehmen": {},
|
||||
"Verpflichtungen aus Treuhandverm\u00f6gen": {}
|
||||
},
|
||||
"Statistische Konten zu \u00a7 4 (4a) EStG": {
|
||||
@ -1110,30 +1075,6 @@
|
||||
"Vorwegnahme k\u00fcnftiger Wertschwankungen im Umlaufverm\u00f6gen (soweit un\u00fcblich hoch)": {}
|
||||
}
|
||||
},
|
||||
"Abschreibungen auf immaterielle Verm\u00f6gensgegenst\u00e4nde des Anlageverm\u00f6gens und Sachanlagen sowie auf aktivierte Aufwendungen f\u00fcr die Ingangsetzung und Erweiterung des Gesch\u00e4ftsbetriebs": {
|
||||
"Abschreibungen auf immaterielle Verm\u00f6gensgegenst\u00e4nde des Anlageverm\u00f6gens und Sachanlagen sowie auf aktivierte Aufwendungen f\u00fcr die Ingangsetzung und Erweiterung des Gesch\u00e4ftsbetriebs": {
|
||||
"Abschreibungen auf Aufwendungen f\u00fcr die Ingangsetzung und Erweiterung des Gesch\u00e4ftsbetriebs": {},
|
||||
"Abschreibungen auf Aufwendungen f\u00fcr die W\u00e4hrungsumstellung auf den Euro": {},
|
||||
"Abschreibungen auf Geb\u00e4ude": {},
|
||||
"Abschreibungen auf Geb\u00e4udeteil des h\u00e4uslischen Arbeitszimmers": {},
|
||||
"Abschreibungen auf Kfz": {},
|
||||
"Abschreibungen auf Sachanlagen (ohne AfA auf Kfz und Geb\u00e4ude)": {},
|
||||
"Abschreibungen auf Sachanlagen auf Grund steuerlicher Sondervorschriften ": {},
|
||||
"Abschreibungen auf aktivierte- geringwertige Wirtschaftsg\u00fcter": {},
|
||||
"Abschreibungen auf den Gesch\u00e4fts- oder Firmenwert": {},
|
||||
"Abschreibungen auf immaterielle Verm\u00f6gensgegenst\u00e4nde": {},
|
||||
"Absetzung f\u00fcr Au\u00dfergew\u00f6hnliche technische und wirtschaftliche Abnutzung der Geb\u00e4ude": {},
|
||||
"Absetzung f\u00fcr Au\u00dfergew\u00f6hnliche technische und wirtschaftliche Abnutzung des Kfz": {},
|
||||
"Absetzung f\u00fcr Au\u00dfergew\u00f6hnliche technische und wirtschaftliche Abnutzung sonstiger Wirtschaftsg\u00fcter": {},
|
||||
"Au\u00dferplanma\u00dfige Abschreibungen auf aktivierte- geringwertige Wirtschaftsg\u00fcter": {},
|
||||
"Au\u00dferplanm\u00e4\u00dfige Abschreibungen auf Sachanlagen": {},
|
||||
"Au\u00dferplanm\u00e4\u00dfige Abschreibungen auf immaterielle Verm\u00f6gensgegenst\u00e4nde": {},
|
||||
"Kaufleasing": {},
|
||||
"Sofortabschreibungen geringwertiger Wirtschaftsg\u00fcter": {},
|
||||
"Sonderabschreibungen nach \u00a7 7g Abs. 1 u. 2 EStG (f\u00fcr Kfz)": {},
|
||||
"Sonderabschreibungen nach \u00a7 7g Abs. 1 u. 2 EStG (ohne Kfz)": {}
|
||||
}
|
||||
},
|
||||
"Kalkulatorische Kosten": {
|
||||
"Sonstige betriebliche Aufwendungen": {
|
||||
"Kalkulatorische Abschreibungen": {},
|
||||
@ -1369,16 +1310,6 @@
|
||||
"Vorwegnahme k\u00fcnftiger Wertschwankungen bei Wertpapieren des Umlaufverm\u00f6gens": {}
|
||||
}
|
||||
},
|
||||
"Aufwendungen aus Verlust\u00fcbernahme und auf Grund einer Gewinngemeinschaft- eines Gewinn- oder Teilgewinnabf\u00fchrungsvertrags abgef\u00fchrte Gewinne": {
|
||||
"Auf Grund einer Gewinngemeinschaft- eines Gewinn- oder Teilgewinnabf\u00fchrungsvertrags abgef\u00fchrte Gewinne": {
|
||||
"Abgef\u00fchrte Gewinnanteile an stille Gesellschafter \u00a7 8 GewStG": {},
|
||||
"Abgef\u00fchrte Gewinne auf Grund einer Gewinngemeinschaft": {},
|
||||
"Abgef\u00fchrte Gewinne auf Grund eines Gewinn- oder Teilgewinnabf\u00fchrungsvertrags": {}
|
||||
},
|
||||
"Aufwendungen aus Verlust\u00fcbernahme": {
|
||||
"Aufwendungen aus Verlust\u00fcbernahme": {}
|
||||
}
|
||||
},
|
||||
"Au\u00dferordentliche Aufwendungen": {
|
||||
"Au\u00dferordentliche Aufwendungen": {
|
||||
"Au\u00dferordentliche Aufwendungen": {},
|
||||
@ -1494,18 +1425,13 @@
|
||||
"Anlagenabg\u00e4nge immaterielle Verm\u00f6gensgegenst\u00e4nde (Restbuchwert bei Buchgewinn)": {},
|
||||
"Bank Bewertungsertrag": {},
|
||||
"Bank Waehrungsverlust (Konto)": {},
|
||||
"Erl. a. Verk. v. Wirtschaftsg. d. Umlaufv.- umsatzsteuerf. \u00a7 4 Nr. 8 ff UStG i. V. m. \u00a7 4 Abs. 3 Satz 4 EStG- 100%/50% steuerf.(inlandische Kap. Ges.)": {},
|
||||
"Erl\u00f6se aus Verkauen von Wirtschaftsg\u00fctern des Umlaufverm\u00f6gens 19% USt f\u00fcr \u00a7 4 Abs. 3 Satz 4 EStG": {},
|
||||
"Erl\u00f6se aus Verkauen von Wirtschaftsg\u00fctern des Umlaufverm\u00f6gens- umsatzsteuerfrei \u00a7 4 Nr. 8 ff UStG i. V. m. \u00a7 4 Abs. 3 Satz 4 EStG": {},
|
||||
"Erl\u00f6se aus Verkauf immaterieller Verm\u00f6gensgegenst\u00e4nde (bei Buchgewinn)": {},
|
||||
"Erl\u00f6se aus Verk\u00e4ufen Finanzanlagen (bei Buchgewinn)": {},
|
||||
"Erl\u00f6se aus Verk\u00e4ufen Finanzanlagen 100% / 50% steuerfrei (inlandische Kap.Ges.)(bei Buchgewinn)": {},
|
||||
"Erl\u00f6se aus Verk\u00e4ufen Sachanlageverm\u00f6gen (bei Buchgewinn)": {},
|
||||
"Erl\u00f6se aus Verk\u00e4ufen Sachanlageverm\u00f6gen 16% USt (bei Buchgewinn)": {},
|
||||
"Erl\u00f6se aus Verk\u00e4ufen Sachanlageverm\u00f6gen 19% USt (bei Buchgewinn)": {},
|
||||
"Erl\u00f6se aus Verk\u00e4ufen Sachanlageverm\u00f6gen steuerfrei \u00a7 4 Nr. 1a UStG (bei Buchgewinn)": {},
|
||||
"Erl\u00f6se aus Verk\u00e4ufen Sachanlageverm\u00f6gen steuerfrei \u00a7 4 Nr. 1b UStG (bei Buchgewinn)": {},
|
||||
"Erl\u00f6se aus Verk\u00e4ufen von Wirtschaftsg\u00fctern des Umlaufverm\u00f6gens nach \u00a7 4 Abs. 3 Satz 4 EStG": {},
|
||||
"Ertraege a. Waehrungsumstellung auf Euro": {},
|
||||
"Ertr\u00e4ge aus Bewertung Finanzmittelfonds": {},
|
||||
"Ertr\u00e4ge aus Kursdifferenzen": {},
|
||||
@ -1715,27 +1641,11 @@
|
||||
"Ertr\u00e4ge aus Beteiligungen": {},
|
||||
"Ertr\u00e4ge aus Beteiligungen an verbundenen Unternehmen": {},
|
||||
"Gewinnanteile aus Mitunternehmerschaften \u00a7 9 GewStG": {},
|
||||
"Gewinne aus Anteilen an nicht steuerbefreiten inl\u00e4ndischen Kapitalgesellschaften \u00a7 9 Nr. 2a GewStG": {},
|
||||
"Laufende Ertr\u00e4ge aus Anteilen an Kapitalgesellschaften (Beteiligung) 100% / 50% steuerfrei (inl\u00e4ndische Kap. Ges.)": {},
|
||||
"Laufende Ertr\u00e4ge aus Anteilen an Kapitalgesellschaften (verbundene Unternehmen) 100% / 50% steuerfrei (inl\u00e4ndische Kap. Ges.)": {}
|
||||
}
|
||||
},
|
||||
"Ertr\u00e4ge aus Verlust\u00fcbernahme und auf Grund einer Gewinngemeinschaft- eines Gewinn- oder Teilgewinnabf\u00fchrungsvertrags erhaltene Gewinne": {
|
||||
"Auf Grund einer Gewinngemeinschaft- eines Gewinn- oder Teilgewinnabf\u00fchrungsvertrags erhaltene ": {
|
||||
"Erhaltene Gewinne auf Grund einer Gewinngemeinschaft": {},
|
||||
"Erhaltene Gewinne auf Grund eines Gewinn- oder Teilgewinnabf\u00fchrungsvertrags": {}
|
||||
},
|
||||
"Ertr\u00e4ge aus Verlust\u00fcbernahme ": {
|
||||
"Ertr\u00e4ge aus Verlust\u00fcbernahme": {}
|
||||
"Gewinne aus Anteilen an nicht steuerbefreiten inl\u00e4ndischen Kapitalgesellschaften \u00a7 9 Nr. 2a GewStG": {}
|
||||
}
|
||||
},
|
||||
"Ertr\u00e4ge aus anderen Wertpapieren und Ausleihungen des Finanzanlageverm\u00f6gens": {
|
||||
"Ertr\u00e4ge aus anderen Wertpapieren und Ausleihungen des Finanzanlageverm\u00f6gens": {
|
||||
"Ertr\u00e4ge aus anderen Wertpapieren und Ausleihungen des Finanzanlageverm\u00f6gens": {},
|
||||
"Etr\u00e4ge aus anderen Wertpapieren und Ausleihungen des Finanzanlageverm\u00f6gens aus verbundenen Unternehmen": {},
|
||||
"Laufende Ertr\u00e4ge aus Anteilen an Kapitalgesellschaften (Finanzanlageverm\u00f6gen) 100% / 50% steuerfrei (inl\u00e4ndische Kap. Ges.)": {},
|
||||
"Laufende Ertr\u00e4ge aus Anteilen an Kapitalgesellschaften (verbundene Unternehmen) 100% / 50% steuerfrei (inl\u00e4ndische Kap. Ges.)": {}
|
||||
}
|
||||
"Ertr\u00e4ge aus anderen Wertpapieren und Ausleihungen des Finanzanlageverm\u00f6gens": {}
|
||||
},
|
||||
"Gewinnvortrag": {
|
||||
"Gewinnvortrag nach Verwendung": {}
|
||||
|
@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "de",
|
||||
"name": "Deutscher Kontenplan SKR03",
|
||||
"disabled": "Yes",
|
||||
"name": "Germany - Kontenplan SKR03",
|
||||
"tree": {
|
||||
"Aktiva": {
|
||||
"Abgrenzung latenter Steuern": {
|
||||
@ -399,8 +398,7 @@
|
||||
"Jahres\u00fcberschuss Jahresfehlbetrag": {}
|
||||
},
|
||||
"Rechnungsabgrenzungsposten": {
|
||||
"Passive Rechnungsabgrenzung": {},
|
||||
"Verbindlichkeiten aus der Begebung und \u00dcbertragung von Wechseln, aus B\u00fcrgschaften, Wechsel- und Scheckb\u00fcrgschaften und aus Gew\u00e4hrleistungsvertr\u00e4gen sowie Haftung aus Bestellung von Sicherheiten f\u00fcr fremde Verbindlichkeiten": {}
|
||||
"Passive Rechnungsabgrenzung": {}
|
||||
},
|
||||
"R\u00fcckstellungen": {
|
||||
"R\u00fcckstellungen f\u00fcr Pensionen und \u00e4hnliche Verpflichtungen": {
|
||||
@ -1346,10 +1344,6 @@
|
||||
"Statistische Konten f\u00fcr den Gewinnzuschlag nach \u00a7\u00a7 6b- 6c und 7g EStG (Haben-Buchung)": {},
|
||||
"Statistische Konten f\u00fcr den Gewinnzuschlag- Gegenkonto zu 9890": {}
|
||||
},
|
||||
"Statistische Konten f\u00fcr den GuV-Ausweis in \"Gutschrift bzw. Belastung auf Verbindlichkeitskonten\" bei den Zuordnungstabellen f\u00fcr PersHG nach KapCoRiLiG": {
|
||||
"Anteil f\u00fcr Verbindlichkeitskonten": {},
|
||||
"Verrechnungskonto f\u00fcr Anteil Verbindlichkeitskonten": {}
|
||||
},
|
||||
"Statistische Konten f\u00fcr den Kennziffernteil der Bilanz": {
|
||||
"Besch\u00e4ftigte Personen": {},
|
||||
"Gegenkonto zu 9200": {},
|
||||
|
@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "es",
|
||||
"name": "PGCE com\u00fan",
|
||||
"disabled": "Yes",
|
||||
"name": "Spain - PGCE com\u00fan",
|
||||
"tree": {
|
||||
"Acreedores y deudores por operaciones comerciales": {
|
||||
"Acreedores varios": {
|
||||
@ -1482,10 +1481,7 @@
|
||||
}
|
||||
},
|
||||
"Deterioro del valor de inversiones financieras a corto plazo y de activos no corrientes mantenidos para la venta": {
|
||||
"Deterioro de valor de activos no corrientes mantenidos para la venta": {
|
||||
"Deterioro de valor de existencias, deudores comerciales y otras cuentas a cobrar integrados en un grupo enajenable mantenido para la venta": {
|
||||
"Deterioro de valor de existencias, deudores comerciales y otras cuentas a cobrar integrados en un grupo enajenable mantenido para la venta": {}
|
||||
},
|
||||
"Deterioro de valor de activos no corrientes mantenidos para la venta": {
|
||||
"Deterioro de valor de inmovilizado no corriente mantenido para la venta": {
|
||||
"Deterioro de valor de inmovilizado no corriente mantenido para la venta": {}
|
||||
},
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "et",
|
||||
"name": "Ethiopia Tax and Account Chart Template",
|
||||
"name": "Ethiopia - Chart of Accounts",
|
||||
"tree": {
|
||||
"ASSETS": {
|
||||
"Cash and Cash Equivalents": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "fr",
|
||||
"name": "Plan Comptable G\u00e9n\u00e9ral (France)",
|
||||
"name": "France - Plan Comptable G\u00e9n\u00e9ral",
|
||||
"tree": {
|
||||
"Comptes de bilan": {
|
||||
"Comptes d'immobilisations": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "gr",
|
||||
"name": "\u03a0\u03c1\u03cc\u03c4\u03c5\u03c0\u03bf \u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03bf\u03cd \u039b\u03bf\u03b3\u03b9\u03c3\u03c4\u03b9\u03ba\u03bf\u03cd \u03a3\u03c7\u03b5\u03b4\u03af\u03bf\u03c5",
|
||||
"name": "Greece - \u03a0\u03c1\u03cc\u03c4\u03c5\u03c0\u03bf \u0395\u03bb\u03bb\u03b7\u03bd\u03b9\u03ba\u03bf\u03cd \u039b\u03bf\u03b3\u03b9\u03c3\u03c4\u03b9\u03ba\u03bf\u03cd \u03a3\u03c7\u03b5\u03b4\u03af\u03bf\u03c5",
|
||||
"tree": {
|
||||
"\u0391\u03a0\u0391\u0399\u03a4\u0397\u03a3\u0395\u0399\u03a3 \u039a\u0391\u0399 \u0394\u0399\u0391\u0398\u0395\u03a3\u0399\u039c\u0391": {
|
||||
"root_type": "",
|
||||
|
@ -1,133 +0,0 @@
|
||||
{
|
||||
"country_code": "gt",
|
||||
"name": "Plantilla de cuentas de Guatemala (sencilla)",
|
||||
"tree": {
|
||||
"Activo": {
|
||||
"Activo Corriente": {
|
||||
"Caja y Bancos": {
|
||||
"Caja Chica": {}
|
||||
},
|
||||
"Cuentas y Documentos por Cobrar": {
|
||||
"Cuentas por Cobrar Empresas Afilidas": {},
|
||||
"Cuentas por Cobrar Generales": {},
|
||||
"Otras Cuentas por Cobrar": {},
|
||||
"Prestamos al Personal": {}
|
||||
},
|
||||
"IVA por Cobrar": {
|
||||
"IVA por Cobrar": {},
|
||||
"Retenciones de IVA recibidas": {}
|
||||
},
|
||||
"Inventario": {}
|
||||
},
|
||||
"Diferido": {
|
||||
"Gastos Anticipados": {
|
||||
"Gastos Anticipados": {}
|
||||
},
|
||||
"Gastos de Organizaci\u00f3n": {
|
||||
"Gastos de Organizaci\u00f3n": {}
|
||||
},
|
||||
"Gastos por Amortizar": {
|
||||
"Gastos por Amortizar": {}
|
||||
},
|
||||
"Otros Activos": {
|
||||
"Otros Activos": {}
|
||||
}
|
||||
},
|
||||
"No Corriente": {
|
||||
"Depreciaciones Acumuladas": {
|
||||
"Depreciaciones Acumuladas": {}
|
||||
},
|
||||
"Propiedad, Planta y Equipo": {
|
||||
"Propiedad, Planta y Equipo": {}
|
||||
}
|
||||
},
|
||||
"root_type": "Asset"
|
||||
},
|
||||
"Pasivo": {
|
||||
"Cr\u00e9ditos Diferidos": {
|
||||
"Cr\u00e9ditos Diferidos": {
|
||||
"Anticipos": {}
|
||||
}
|
||||
},
|
||||
"Pasivo Corto Plazo": {
|
||||
"Cuentas y Documentos por Pagar": {
|
||||
"Cuentas y Documentos por Pagar": {}
|
||||
},
|
||||
"IVA por Pagar": {
|
||||
"IVA por Pagar": {}
|
||||
},
|
||||
"Impuestos": {
|
||||
"Impuestos": {}
|
||||
}
|
||||
},
|
||||
"Pasivo a Largo Plazo": {
|
||||
"Provisi\u00f3n para Indemnizaciones": {
|
||||
"Provisi\u00f3n para Indemnizaciones": {}
|
||||
}
|
||||
},
|
||||
"root_type": "Liability"
|
||||
},
|
||||
"Patrimonio": {
|
||||
"Patrimonio de los Accionistas": {
|
||||
"Patrimonio de los Accionistas": {
|
||||
"Capital Autorizado, Suscr\u00edto y Pagado": {},
|
||||
"Perdidas y Ganancias": {},
|
||||
"Reservas": {}
|
||||
}
|
||||
},
|
||||
"root_type": "Asset"
|
||||
},
|
||||
"Egresos": {
|
||||
"Costos": {
|
||||
"Costos de Ventas": {
|
||||
"Costos de Ventas": {}
|
||||
}
|
||||
},
|
||||
"root_type": "Expense"
|
||||
},
|
||||
"Gastos": {
|
||||
"Gastos de Operaci\u00f3n": {
|
||||
"Gastos de Administraci\u00f3n": {
|
||||
"Gastos de Administraci\u00f3n": {}
|
||||
},
|
||||
"Otros Gastos de Operaci\u00f3n": {
|
||||
"Otros Gastos de Operaci\u00f3n": {}
|
||||
}
|
||||
},
|
||||
"Gastos de Ventas": {
|
||||
"Gastos de Ventas": {
|
||||
"Gastos de Ventas": {}
|
||||
}
|
||||
},
|
||||
"Gastos no Deducibles": {
|
||||
"Gastos no Deducibles": {
|
||||
"Gastos no Deducibles": {}
|
||||
}
|
||||
},
|
||||
"root_type": "Expense"
|
||||
},
|
||||
"Ingresos": {
|
||||
"Otros Ingresos": {
|
||||
"Otros Ingresos": {
|
||||
"Otros Ingresos": {}
|
||||
}
|
||||
},
|
||||
"Ventas": {
|
||||
"Ventas Netas": {
|
||||
"Descuentos Sobre Ventas": {},
|
||||
"Ventas": {}
|
||||
}
|
||||
},
|
||||
"root_type": "Income"
|
||||
},
|
||||
"Otros Gastos y Productos Financieros": {
|
||||
"Otros Gastos y Productos Financieros": {
|
||||
"Otros Gastos y Productos Financieros": {
|
||||
"Intereses": {},
|
||||
"Otros Gastos Financieros": {}
|
||||
}
|
||||
},
|
||||
"root_type": "Expense"
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "hn",
|
||||
"name": "Plantilla de cuentas de Honduras (sencilla)",
|
||||
"name": "Honduras - Plantilla de cuentas de",
|
||||
"tree": {
|
||||
"Activo": {
|
||||
"Activo Corriente": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "hr",
|
||||
"name": "RRIF-ov ra\u010dunski plan za poduzetnike",
|
||||
"name": "Croatia - RRIF-ov ra\u010dunski plan za poduzetnike",
|
||||
"tree": {
|
||||
"FINANCIJSKI REZULTAT POSLOVANJA": {
|
||||
"DOBITAK ILI GUBITAK RAZDOBLJA": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "hu",
|
||||
"name": "Magyar f\u0151k\u00f6nyvi kivonat",
|
||||
"name": "Hungary - Magyar f\u0151k\u00f6nyvi kivonat",
|
||||
"tree": {
|
||||
"Eredm\u00e9ny sz\u00e1ml\u00e1k": {
|
||||
"AZ \u00c9RT\u00c9KES\u00cdT\u00c9S \u00c1RBEV\u00c9TELE, BEV\u00c9TELEK": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "it",
|
||||
"name": "Generic Chart of Accounts",
|
||||
"name": "Italy - Generic Chart of Accounts",
|
||||
"tree": {
|
||||
"ATTIVO": {
|
||||
"CREDITI COMMERCIALI": {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "ma",
|
||||
"name": "compta Kazacube",
|
||||
"name": "Morocco - Compta Kazacube",
|
||||
"tree": {
|
||||
"COMPTES DE BILAN": {
|
||||
"COMPTES D'ACTIF CIRCULANT (HORS TRESORERIE)": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "mx",
|
||||
"name": "Plan de Cuentas para Mexico",
|
||||
"name": "Mexico - Plan de Cuentas",
|
||||
"tree": {
|
||||
"ACTIVO": {
|
||||
"ACTIVO CIRCULANTE": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "nl",
|
||||
"name": "Nederlands Grootboekschema",
|
||||
"name": "Nederlands - Grootboekschema",
|
||||
"tree": {
|
||||
"FABRIKAGEREKENINGEN": {
|
||||
"root_type": ""
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "pa",
|
||||
"name": "Plan de Cuentas",
|
||||
"name": "Panama - Plan de Cuentas",
|
||||
"tree": {
|
||||
"ACTIVOS": {
|
||||
"Activo Fijo": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "pe",
|
||||
"name": "Plan de Cuentas 2011",
|
||||
"name": "Peru - Plan de Cuentas",
|
||||
"tree": {
|
||||
"Cuentas de Balance": {
|
||||
"Acciones de inversi\u00f3n ": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "pl",
|
||||
"name": "Plan kont",
|
||||
"name": "Poland - Plan kont",
|
||||
"tree": {
|
||||
"Aktywa Trwa\u0142e": {
|
||||
"D\u0142ugoterminowe aktywa finansowe": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "pt",
|
||||
"name": "Template do Plano de Contas SNC",
|
||||
"name": "Portugal - Template do Plano de Contas SNC",
|
||||
"tree": {
|
||||
"Capital, reservas e resultados transitados": {
|
||||
"Ac\u00e7\u00f5es (quotas) pr\u00f3prias": {
|
||||
|
@ -1,7 +1,6 @@
|
||||
{
|
||||
"country_code": "ro",
|
||||
"name": "Romania - Chart of Accounts",
|
||||
"disabled": "Yes",
|
||||
"tree": {
|
||||
"CONTURI FINANCIARE": {
|
||||
"CONTURI DE BILANT": {
|
||||
@ -91,7 +90,6 @@
|
||||
"Rezultatul reportat": {
|
||||
"Rezultatul reportat provenit din adoptarea pentru prima data a IAS, mai pu\u00fein IAS 29": {},
|
||||
"Rezultatul reportat provenit din corectarea erorilor contabile": {},
|
||||
"Rezultatul reportat provenit din trecerea la aplicarea Reglementarilor contabile conforme cu Directiva a patra a Comunitatilor Economice Europene": {},
|
||||
"Rezultatul reportat reprezentand profitul nerepartizat sau pierderea neacoperita": {}
|
||||
}
|
||||
}
|
||||
@ -154,8 +152,7 @@
|
||||
}
|
||||
},
|
||||
"IMOBILIZARI CORPORALE IN CURS DE APROVIZIONARE": {
|
||||
"Instalatii tehnice, mijloace de transport, animale si plantatii in curs de aprovizionare": {},
|
||||
"Mobilier, aparatura birotica, echipamente de protectie a valorilor umane si materiale si alte active corporale in curs de aprovizionare": {}
|
||||
"Instalatii tehnice, mijloace de transport, animale si plantatii in curs de aprovizionare": {}
|
||||
},
|
||||
"IMOBILIZARI FINANCIARE": {
|
||||
"Actiuni detinute la entitatile afiliate": {},
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "syscohada",
|
||||
"name": "Plan de compte",
|
||||
"name": "Syscohada - Plan de compte",
|
||||
"tree": {
|
||||
"Comptes de bilan": {
|
||||
"Comptes d'immobilisations": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "th",
|
||||
"name": "Thailand Chart of Accounts",
|
||||
"name": "Thailand - Chart of Accounts",
|
||||
"tree": {
|
||||
"Assets": {
|
||||
"Account Receivable": {},
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "tr",
|
||||
"name": "Tek D\u00fczen Hesap Plan\u0131",
|
||||
"name": "Turkey - Tek D\u00fczen Hesap Plan\u0131",
|
||||
"tree": {
|
||||
"Duran Varl\u0131klar": {
|
||||
"Di\u011fer Alacaklar": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "uy",
|
||||
"name": "Plan de Cuentas",
|
||||
"name": "Uruguay - Plan de Cuentas",
|
||||
"tree": {
|
||||
"ACTIVO": {
|
||||
"ACTIVO CORRIENTE": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "ve",
|
||||
"name": "Venezuelan - Account",
|
||||
"name": "Venezuelan - Chart of Accounts",
|
||||
"tree": {
|
||||
"ACTIVO": {
|
||||
"ACTIVO CIRCULANTE": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "ae",
|
||||
"name": "U.A.E Chart of Accounts",
|
||||
"name": "U.A.E - Chart of Accounts",
|
||||
"tree": {
|
||||
"Assets": {
|
||||
"Current Assets": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "at",
|
||||
"name": "Austria - Chart of Accounts - Einheitskontenrahmen provided by fairkom.eu",
|
||||
"name": "Austria - Chart of Accounts - Einheitskontenrahmen",
|
||||
"tree": {
|
||||
"Klasse 0 Aktiva: Anlageverm\u00f6gen": {
|
||||
"0100 Konzessionen ": {"account_type": "Fixed Asset"},
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "gt",
|
||||
"name": "Cuentas de Guatemala",
|
||||
"name": "Guatemala - Cuentas",
|
||||
"tree": {
|
||||
"Activos": {
|
||||
"Activo Corriente": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "in",
|
||||
"name": "Chart of Accounts - India",
|
||||
"name": "India - Chart of Accounts",
|
||||
"tree": {
|
||||
"Application of Funds (Assets)": {
|
||||
"Current Assets": {
|
||||
@ -37,18 +37,24 @@
|
||||
"Capital Equipments": {
|
||||
"account_type": "Fixed Asset"
|
||||
},
|
||||
"Computers": {
|
||||
"Electronic Equipments": {
|
||||
"account_type": "Fixed Asset"
|
||||
},
|
||||
"Furniture and Fixture": {
|
||||
"Furnitures and Fixtures": {
|
||||
"account_type": "Fixed Asset"
|
||||
},
|
||||
"Office Equipments": {
|
||||
"account_type": "Fixed Asset"
|
||||
},
|
||||
"Plant and Machinery": {
|
||||
"Plants and Machineries": {
|
||||
"account_type": "Fixed Asset"
|
||||
}
|
||||
},
|
||||
"Buildings": {
|
||||
"account_type": "Fixed Asset"
|
||||
},
|
||||
"Accumulated Depreciations": {
|
||||
"account_type": "Accumulated Depreciation"
|
||||
}
|
||||
},
|
||||
"Investments": {
|
||||
"is_group": 1
|
||||
@ -71,67 +77,37 @@
|
||||
},
|
||||
"Stock Adjustment": {
|
||||
"account_type": "Stock Adjustment"
|
||||
},
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"account_type": "Expense Account"
|
||||
}
|
||||
}
|
||||
},
|
||||
"Indirect Expenses": {
|
||||
"Administrative Expenses": {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"Commission on Sales": {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"Administrative Expenses": {},
|
||||
"Commission on Sales": {},
|
||||
"Depreciation": {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"Entertainment Expenses": {
|
||||
"account_type": "Expense Account"
|
||||
"account_type": "Depreciation"
|
||||
},
|
||||
"Entertainment Expenses": {},
|
||||
"Freight and Forwarding Charges": {
|
||||
"account_type": "Chargeable"
|
||||
},
|
||||
"Legal Expenses": {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"Marketing Expenses": {
|
||||
"account_type": "Chargeable"
|
||||
},
|
||||
"Miscellaneous Expenses": {
|
||||
"account_type": "Chargeable"
|
||||
},
|
||||
"Office Maintenance Expenses": {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"Office Rent": {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"Postal Expenses": {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"Print and Stationary": {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"Legal Expenses": {},
|
||||
"Marketing Expenses": {},
|
||||
"Miscellaneous Expenses": {},
|
||||
"Office Maintenance Expenses": {},
|
||||
"Office Rent": {},
|
||||
"Postal Expenses": {},
|
||||
"Print and Stationary": {},
|
||||
"Rounded Off": {
|
||||
"account_type": "Expense Account"
|
||||
"account_type": "Round Off"
|
||||
},
|
||||
"Salary": {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"Sales Expenses": {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"Telephone Expenses": {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"Travel Expenses": {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"Utility Expenses": {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"account_type": "Expense Account"
|
||||
"Salary": {},
|
||||
"Sales Expenses": {},
|
||||
"Telephone Expenses": {},
|
||||
"Travel Expenses": {},
|
||||
"Utility Expenses": {},
|
||||
"Write Off": {},
|
||||
"Exchange Gain/Loss": {},
|
||||
"Gain/Loss on Asset Disposal": {}
|
||||
},
|
||||
"root_type": "Expense"
|
||||
},
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "ni",
|
||||
"name": "Catalogo de Cuentas Nicaragua",
|
||||
"name": "Nicaragua - Catalogo de Cuentas",
|
||||
"tree": {
|
||||
"Activo": {
|
||||
"Activo Corriente": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "sg",
|
||||
"name": "Singapore Default Chart of Accounts",
|
||||
"name": "Singapore - Chart of Accounts",
|
||||
"tree": {
|
||||
"Assets": {
|
||||
"Current assets": {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"country_code": "sg",
|
||||
"name": "Singapore F&B Chart of Accounts",
|
||||
"name": "Singapore - F&B Chart of Accounts",
|
||||
"tree": {
|
||||
"Assets": {
|
||||
"Current assets": {
|
||||
|
@ -41,17 +41,26 @@ def get():
|
||||
_("Capital Equipments"): {
|
||||
"account_type": "Fixed Asset"
|
||||
},
|
||||
_("Computers"): {
|
||||
_("Electronic Equipments"): {
|
||||
"account_type": "Fixed Asset"
|
||||
},
|
||||
_("Furniture and Fixture"): {
|
||||
_("Furnitures and Fixtures"): {
|
||||
"account_type": "Fixed Asset"
|
||||
},
|
||||
_("Office Equipments"): {
|
||||
"account_type": "Fixed Asset"
|
||||
},
|
||||
_("Plant and Machinery"): {
|
||||
_("Plants and Machineries"): {
|
||||
"account_type": "Fixed Asset"
|
||||
},
|
||||
_("Buildings"): {
|
||||
"account_type": "Fixed Asset"
|
||||
},
|
||||
_("Softwares"): {
|
||||
"account_type": "Fixed Asset"
|
||||
},
|
||||
_("Accumulated Depreciation"): {
|
||||
"account_type": "Accumulated Depreciation"
|
||||
}
|
||||
},
|
||||
_("Investments"): {
|
||||
@ -68,92 +77,60 @@ def get():
|
||||
_("Direct Expenses"): {
|
||||
_("Stock Expenses"): {
|
||||
_("Cost of Goods Sold"): {
|
||||
"account_type": "Expense Account"
|
||||
"account_type": "Cost of Goods Sold"
|
||||
},
|
||||
_("Expenses Included In Valuation"): {
|
||||
"account_type": "Expenses Included In Valuation"
|
||||
},
|
||||
_("Stock Adjustment"): {
|
||||
"account_type": "Stock Adjustment"
|
||||
},
|
||||
"account_type": "Expense Account"
|
||||
}
|
||||
},
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
_("Indirect Expenses"): {
|
||||
_("Administrative Expenses"): {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
_("Commission on Sales"): {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
_("Administrative Expenses"): {},
|
||||
_("Commission on Sales"): {},
|
||||
_("Depreciation"): {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
_("Entertainment Expenses"): {
|
||||
"account_type": "Expense Account"
|
||||
"account_type": "Depreciation"
|
||||
},
|
||||
_("Entertainment Expenses"): {},
|
||||
_("Freight and Forwarding Charges"): {
|
||||
"account_type": "Chargeable"
|
||||
},
|
||||
_("Legal Expenses"): {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
_("Legal Expenses"): {},
|
||||
_("Marketing Expenses"): {
|
||||
"account_type": "Chargeable"
|
||||
},
|
||||
_("Miscellaneous Expenses"): {
|
||||
"account_type": "Chargeable"
|
||||
},
|
||||
_("Office Maintenance Expenses"): {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
_("Office Rent"): {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
_("Postal Expenses"): {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
_("Print and Stationary"): {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
_("Office Maintenance Expenses"): {},
|
||||
_("Office Rent"): {},
|
||||
_("Postal Expenses"): {},
|
||||
_("Print and Stationary"): {},
|
||||
_("Round Off"): {
|
||||
"account_type": "Round Off"
|
||||
},
|
||||
_("Salary"): {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
_("Sales Expenses"): {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
_("Telephone Expenses"): {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
_("Travel Expenses"): {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
_("Utility Expenses"): {
|
||||
"account_type": "Expense Account"
|
||||
},
|
||||
"account_type": "Expense Account"
|
||||
_("Salary"): {},
|
||||
_("Sales Expenses"): {},
|
||||
_("Telephone Expenses"): {},
|
||||
_("Travel Expenses"): {},
|
||||
_("Utility Expenses"): {},
|
||||
_("Write Off"): {},
|
||||
_("Exchange Gain/Loss"): {},
|
||||
_("Gain/Loss on Asset Disposal"): {}
|
||||
},
|
||||
"root_type": "Expense"
|
||||
},
|
||||
_("Income"): {
|
||||
_("Direct Income"): {
|
||||
_("Sales"): {
|
||||
"account_type": "Income Account"
|
||||
},
|
||||
_("Service"): {
|
||||
"account_type": "Income Account"
|
||||
},
|
||||
"account_type": "Income Account"
|
||||
_("Sales"): {},
|
||||
_("Service"): {}
|
||||
},
|
||||
_("Indirect Income"): {
|
||||
"account_type": "Income Account",
|
||||
"is_group": 1
|
||||
},
|
||||
"root_type": "Income"
|
||||
"root_type": "Income"
|
||||
},
|
||||
_("Source of Funds (Liabilities)"): {
|
||||
_("Current Liabilities"): {
|
||||
|
@ -12,6 +12,7 @@ def _make_test_records(verbose):
|
||||
["_Test Bank", "Bank Accounts", 0, "Bank", None],
|
||||
["_Test Bank USD", "Bank Accounts", 0, "Bank", "USD"],
|
||||
["_Test Bank EUR", "Bank Accounts", 0, "Bank", "EUR"],
|
||||
["_Test Cash", "Cash In Hand", 0, "Cash", None],
|
||||
|
||||
["_Test Account Stock Expenses", "Direct Expenses", 1, None, None],
|
||||
["_Test Account Shipping Charges", "_Test Account Stock Expenses", 0, "Chargeable", None],
|
||||
@ -32,10 +33,16 @@ def _make_test_records(verbose):
|
||||
["_Test Account CST", "Direct Expenses", 0, "Tax", None],
|
||||
["_Test Account Discount", "Direct Expenses", 0, None, None],
|
||||
["_Test Write Off", "Indirect Expenses", 0, None, None],
|
||||
["_Test Exchange Gain/Loss", "Indirect Expenses", 0, None, None],
|
||||
|
||||
# related to Account Inventory Integration
|
||||
["_Test Account Stock In Hand", "Current Assets", 0, None, None],
|
||||
["_Test Account Fixed Assets", "Current Assets", 0, None, None],
|
||||
|
||||
# fixed asset depreciation
|
||||
["_Test Fixed Asset", "Current Assets", 0, "Fixed Asset", None],
|
||||
["_Test Accumulated Depreciations", "Current Assets", 0, None, None],
|
||||
["_Test Depreciations", "Expenses", 0, None, None],
|
||||
["_Test Gain/Loss on Asset Disposal", "Expenses", 0, None, None],
|
||||
|
||||
# Receivable / Payable Account
|
||||
["_Test Receivable", "Current Assets", 0, "Receivable", None],
|
||||
|
@ -0,0 +1,8 @@
|
||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Accounts Settings', {
|
||||
refresh: function(frm) {
|
||||
|
||||
}
|
||||
});
|
@ -2,11 +2,14 @@
|
||||
"allow_copy": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
"creation": "2013-06-24 15:49:57",
|
||||
"custom": 0,
|
||||
"description": "Settings for Accounts",
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Other",
|
||||
"editable_grid": 1,
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
@ -18,6 +21,7 @@
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Make Accounting Entry For Every Stock Movement",
|
||||
@ -42,6 +46,7 @@
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Accounts Frozen Upto",
|
||||
@ -66,6 +71,7 @@
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Role Allowed to Set Frozen Accounts & Edit Frozen Entries",
|
||||
@ -82,6 +88,30 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "column_break_4",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
@ -91,6 +121,7 @@
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Credit Controller",
|
||||
@ -115,6 +146,7 @@
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Check Supplier Invoice Number Uniqueness",
|
||||
@ -136,13 +168,14 @@
|
||||
"hide_toolbar": 0,
|
||||
"icon": "icon-cog",
|
||||
"idx": 1,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 1,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2015-12-24 21:42:01.274459",
|
||||
"modified": "2016-07-14 14:32:06.056888",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Accounts Settings",
|
||||
@ -169,6 +202,9 @@
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0
|
||||
"read_only_onload": 0,
|
||||
"sort_order": "ASC",
|
||||
"track_seen": 0
|
||||
}
|
273
erpnext/accounts/doctype/asset/asset.js
Normal file
273
erpnext/accounts/doctype/asset/asset.js
Normal file
@ -0,0 +1,273 @@
|
||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.provide("erpnext.asset");
|
||||
|
||||
frappe.ui.form.on('Asset', {
|
||||
onload: function(frm) {
|
||||
frm.set_query("item_code", function() {
|
||||
return {
|
||||
"filters": {
|
||||
"disabled": 0,
|
||||
"is_fixed_asset": 1,
|
||||
"is_stock_item": 0
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
frm.set_query("warehouse", function() {
|
||||
return {
|
||||
"filters": {
|
||||
"company": frm.doc.company
|
||||
}
|
||||
};
|
||||
});
|
||||
},
|
||||
|
||||
refresh: function(frm) {
|
||||
frappe.ui.form.trigger("Asset", "is_existing_asset");
|
||||
frm.toggle_display("next_depreciation_date", frm.doc.docstatus < 1);
|
||||
|
||||
if (frm.doc.docstatus==1) {
|
||||
if (frm.doc.status=='Submitted' && !frm.doc.is_existing_asset && !frm.doc.purchase_invoice) {
|
||||
frm.add_custom_button("Make Purchase Invoice", function() {
|
||||
erpnext.asset.make_purchase_invoice(frm);
|
||||
});
|
||||
}
|
||||
if (in_list(["Submitted", "Partially Depreciated", "Fully Depreciated"], frm.doc.status)) {
|
||||
frm.add_custom_button("Transfer Asset", function() {
|
||||
erpnext.asset.transfer_asset(frm);
|
||||
});
|
||||
|
||||
frm.add_custom_button("Scrap Asset", function() {
|
||||
erpnext.asset.scrap_asset(frm);
|
||||
});
|
||||
|
||||
frm.add_custom_button("Sale Asset", function() {
|
||||
erpnext.asset.make_sales_invoice(frm);
|
||||
});
|
||||
|
||||
} else if (frm.doc.status=='Scrapped') {
|
||||
frm.add_custom_button("Restore Asset", function() {
|
||||
erpnext.asset.restore_asset(frm);
|
||||
});
|
||||
}
|
||||
|
||||
frm.trigger("show_graph");
|
||||
}
|
||||
},
|
||||
|
||||
show_graph: function(frm) {
|
||||
var x_intervals = ["x", frm.doc.purchase_date];
|
||||
var asset_values = ["Asset Value", frm.doc.gross_purchase_amount];
|
||||
var last_depreciation_date = frm.doc.purchase_date;
|
||||
|
||||
if(frm.doc.opening_accumulated_depreciation) {
|
||||
last_depreciation_date = frappe.datetime.add_months(frm.doc.next_depreciation_date,
|
||||
-1*frm.doc.frequency_of_depreciation);
|
||||
|
||||
x_intervals.push(last_depreciation_date);
|
||||
asset_values.push(flt(frm.doc.gross_purchase_amount) -
|
||||
flt(frm.doc.opening_accumulated_depreciation));
|
||||
}
|
||||
|
||||
$.each(frm.doc.schedules || [], function(i, v) {
|
||||
x_intervals.push(v.schedule_date);
|
||||
asset_value = flt(frm.doc.gross_purchase_amount) - flt(v.accumulated_depreciation_amount);
|
||||
if(v.journal_entry) {
|
||||
last_depreciation_date = v.schedule_date;
|
||||
asset_values.push(asset_value)
|
||||
} else {
|
||||
if (in_list(["Scrapped", "Sold"], frm.doc.status)) {
|
||||
asset_values.push(null)
|
||||
} else {
|
||||
asset_values.push(asset_value)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
if(in_list(["Scrapped", "Sold"], frm.doc.status)) {
|
||||
x_intervals.push(frm.doc.disposal_date);
|
||||
asset_values.push(0);
|
||||
last_depreciation_date = frm.doc.disposal_date;
|
||||
}
|
||||
|
||||
frm.dashboard.setup_chart({
|
||||
data: {
|
||||
x: 'x',
|
||||
columns: [x_intervals, asset_values],
|
||||
regions: {
|
||||
'Asset Value': [{'start': last_depreciation_date, 'style':'dashed'}]
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
show: false
|
||||
},
|
||||
axis: {
|
||||
x: {
|
||||
type: 'timeseries',
|
||||
tick: {
|
||||
format: "%d-%m-%Y"
|
||||
}
|
||||
},
|
||||
y: {
|
||||
min: 0,
|
||||
padding: {bottom: 10}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
item_code: function(frm) {
|
||||
if(frm.doc.item_code) {
|
||||
frappe.call({
|
||||
method: "erpnext.accounts.doctype.asset.asset.get_item_details",
|
||||
args: {
|
||||
item_code: frm.doc.item_code
|
||||
},
|
||||
callback: function(r, rt) {
|
||||
if(r.message) {
|
||||
$.each(r.message, function(field, value) {
|
||||
frm.set_value(field, value);
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
is_existing_asset: function(frm) {
|
||||
frm.toggle_enable("supplier", frm.doc.is_existing_asset);
|
||||
frm.toggle_reqd("next_depreciation_date", !frm.doc.is_existing_asset);
|
||||
},
|
||||
});
|
||||
|
||||
frappe.ui.form.on('Depreciation Schedule', {
|
||||
make_depreciation_entry: function(frm, cdt, cdn) {
|
||||
var row = locals[cdt][cdn];
|
||||
if (!row.journal_entry) {
|
||||
frappe.call({
|
||||
method: "erpnext.accounts.doctype.asset.depreciation.make_depreciation_entry",
|
||||
args: {
|
||||
"asset_name": frm.doc.name,
|
||||
"date": row.schedule_date
|
||||
},
|
||||
callback: function(r) {
|
||||
frappe.model.sync(r.message);
|
||||
frm.refresh();
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
erpnext.asset.make_purchase_invoice = function(frm) {
|
||||
frappe.call({
|
||||
args: {
|
||||
"asset": frm.doc.name,
|
||||
"item_code": frm.doc.item_code,
|
||||
"gross_purchase_amount": frm.doc.gross_purchase_amount,
|
||||
"company": frm.doc.company,
|
||||
"posting_date": frm.doc.purchase_date
|
||||
},
|
||||
method: "erpnext.accounts.doctype.asset.asset.make_purchase_invoice",
|
||||
callback: function(r) {
|
||||
var doclist = frappe.model.sync(r.message);
|
||||
frappe.set_route("Form", doclist[0].doctype, doclist[0].name);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
erpnext.asset.make_sales_invoice = function(frm) {
|
||||
frappe.call({
|
||||
args: {
|
||||
"asset": frm.doc.name,
|
||||
"item_code": frm.doc.item_code,
|
||||
"company": frm.doc.company
|
||||
},
|
||||
method: "erpnext.accounts.doctype.asset.asset.make_sales_invoice",
|
||||
callback: function(r) {
|
||||
var doclist = frappe.model.sync(r.message);
|
||||
frappe.set_route("Form", doclist[0].doctype, doclist[0].name);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
erpnext.asset.scrap_asset = function(frm) {
|
||||
frappe.confirm(__("Do you really want to scrap this asset?"), function () {
|
||||
frappe.call({
|
||||
args: {
|
||||
"asset_name": frm.doc.name
|
||||
},
|
||||
method: "erpnext.accounts.doctype.asset.depreciation.scrap_asset",
|
||||
callback: function(r) {
|
||||
cur_frm.reload_doc();
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
erpnext.asset.restore_asset = function(frm) {
|
||||
frappe.confirm(__("Do you really want to restore this scrapped asset?"), function () {
|
||||
frappe.call({
|
||||
args: {
|
||||
"asset_name": frm.doc.name
|
||||
},
|
||||
method: "erpnext.accounts.doctype.asset.depreciation.restore_asset",
|
||||
callback: function(r) {
|
||||
cur_frm.reload_doc();
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
erpnext.asset.transfer_asset = function(frm) {
|
||||
var dialog = new frappe.ui.Dialog({
|
||||
title: __("Transfer Asset"),
|
||||
fields: [
|
||||
{
|
||||
"label": __("Target Warehouse"),
|
||||
"fieldname": "target_warehouse",
|
||||
"fieldtype": "Link",
|
||||
"options": "Warehouse",
|
||||
"get_query": function () {
|
||||
return {
|
||||
filters: [["Warehouse", "company", "in", ["", cstr(frm.doc.company)]]]
|
||||
}
|
||||
},
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"label": __("Date"),
|
||||
"fieldname": "transfer_date",
|
||||
"fieldtype": "Datetime",
|
||||
"reqd": 1,
|
||||
"default": frappe.datetime.now_datetime()
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
dialog.set_primary_action(__("Transfer"), function() {
|
||||
args = dialog.get_values();
|
||||
if(!args) return;
|
||||
dialog.hide();
|
||||
return frappe.call({
|
||||
type: "GET",
|
||||
method: "erpnext.accounts.doctype.asset.asset.transfer_asset",
|
||||
args: {
|
||||
args: {
|
||||
"asset": frm.doc.name,
|
||||
"transaction_date": args.transfer_date,
|
||||
"source_warehouse": frm.doc.warehouse,
|
||||
"target_warehouse": args.target_warehouse,
|
||||
"company": frm.doc.company
|
||||
}
|
||||
},
|
||||
freeze: true,
|
||||
callback: function(r) {
|
||||
cur_frm.reload_doc();
|
||||
}
|
||||
})
|
||||
});
|
||||
dialog.show();
|
||||
}
|
File diff suppressed because it is too large
Load Diff
241
erpnext/accounts/doctype/asset/asset.py
Normal file
241
erpnext/accounts/doctype/asset/asset.py
Normal file
@ -0,0 +1,241 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import flt, add_months, cint, nowdate, getdate
|
||||
from frappe.model.document import Document
|
||||
from erpnext.accounts.doctype.purchase_invoice.purchase_invoice import get_fixed_asset_account
|
||||
from erpnext.accounts.doctype.asset.depreciation \
|
||||
import get_disposal_account_and_cost_center, get_depreciation_accounts
|
||||
|
||||
class Asset(Document):
|
||||
def validate(self):
|
||||
self.status = self.get_status()
|
||||
self.validate_item()
|
||||
self.set_missing_values()
|
||||
self.validate_asset_values()
|
||||
self.make_depreciation_schedule()
|
||||
self.validate_expected_value_after_useful_life()
|
||||
# Validate depreciation related accounts
|
||||
get_depreciation_accounts(self)
|
||||
|
||||
def on_submit(self):
|
||||
self.set_status()
|
||||
|
||||
def on_cancel(self):
|
||||
self.validate_cancellation()
|
||||
self.delete_depreciation_entries()
|
||||
self.set_status()
|
||||
|
||||
def validate_item(self):
|
||||
item = frappe.db.get_value("Item", self.item_code,
|
||||
["is_fixed_asset", "is_stock_item", "disabled"], as_dict=1)
|
||||
if not item:
|
||||
frappe.throw(_("Item {0} does not exist").format(self.item_code))
|
||||
elif item.disabled:
|
||||
frappe.throw(_("Item {0} has been disabled").format(self.item_code))
|
||||
elif not item.is_fixed_asset:
|
||||
frappe.throw(_("Item {0} must be a Fixed Asset Item").format(self.item_code))
|
||||
elif item.is_stock_item:
|
||||
frappe.throw(_("Item {0} must be a non-stock item").format(self.item_code))
|
||||
|
||||
def set_missing_values(self):
|
||||
if self.item_code:
|
||||
item_details = get_item_details(self.item_code)
|
||||
for field, value in item_details.items():
|
||||
if not self.get(field):
|
||||
self.set(field, value)
|
||||
|
||||
self.value_after_depreciation = (flt(self.gross_purchase_amount) -
|
||||
flt(self.opening_accumulated_depreciation))
|
||||
|
||||
def validate_asset_values(self):
|
||||
if flt(self.expected_value_after_useful_life) >= flt(self.gross_purchase_amount):
|
||||
frappe.throw(_("Expected Value After Useful Life must be less than Gross Purchase Amount"))
|
||||
|
||||
if not flt(self.gross_purchase_amount):
|
||||
frappe.throw(_("Gross Purchase Amount is mandatory"), frappe.MandatoryError)
|
||||
|
||||
if not self.is_existing_asset:
|
||||
self.opening_accumulated_depreciation = 0
|
||||
self.number_of_depreciations_booked = 0
|
||||
if not self.next_depreciation_date:
|
||||
frappe.throw(_("Next Depreciation Date is mandatory for new asset"))
|
||||
else:
|
||||
depreciable_amount = flt(self.gross_purchase_amount) - flt(self.expected_value_after_useful_life)
|
||||
if flt(self.opening_accumulated_depreciation) > depreciable_amount:
|
||||
frappe.throw(_("Opening Accumulated Depreciation must be less than equal to {0}")
|
||||
.format(depreciable_amount))
|
||||
|
||||
if self.opening_accumulated_depreciation:
|
||||
if not self.number_of_depreciations_booked:
|
||||
frappe.throw(_("Please set Number of Depreciations Booked"))
|
||||
else:
|
||||
self.number_of_depreciations_booked = 0
|
||||
|
||||
if cint(self.number_of_depreciations_booked) > cint(self.total_number_of_depreciations):
|
||||
frappe.throw(_("Number of Depreciations Booked cannot be greater than Total Number of Depreciations"))
|
||||
|
||||
if self.next_depreciation_date and getdate(self.next_depreciation_date) < getdate(nowdate()):
|
||||
frappe.throw(_("Next Depreciation Date must be on or after today"))
|
||||
|
||||
if (flt(self.value_after_depreciation) > flt(self.expected_value_after_useful_life)
|
||||
and not self.next_depreciation_date):
|
||||
frappe.throw(_("Please set Next Depreciation Date"))
|
||||
|
||||
def make_depreciation_schedule(self):
|
||||
self.schedules = []
|
||||
if not self.get("schedules") and self.next_depreciation_date:
|
||||
accumulated_depreciation = flt(self.opening_accumulated_depreciation)
|
||||
value_after_depreciation = flt(self.value_after_depreciation)
|
||||
|
||||
number_of_pending_depreciations = cint(self.total_number_of_depreciations) - \
|
||||
cint(self.number_of_depreciations_booked)
|
||||
if number_of_pending_depreciations:
|
||||
for n in xrange(number_of_pending_depreciations):
|
||||
schedule_date = add_months(self.next_depreciation_date,
|
||||
n * cint(self.frequency_of_depreciation))
|
||||
|
||||
depreciation_amount = self.get_depreciation_amount(value_after_depreciation)
|
||||
|
||||
accumulated_depreciation += flt(depreciation_amount)
|
||||
value_after_depreciation -= flt(depreciation_amount)
|
||||
|
||||
self.append("schedules", {
|
||||
"schedule_date": schedule_date,
|
||||
"depreciation_amount": depreciation_amount,
|
||||
"accumulated_depreciation_amount": accumulated_depreciation
|
||||
})
|
||||
|
||||
def get_depreciation_amount(self, depreciable_value):
|
||||
if self.depreciation_method == "Straight Line":
|
||||
depreciation_amount = (flt(self.value_after_depreciation) -
|
||||
flt(self.expected_value_after_useful_life)) / (cint(self.total_number_of_depreciations) -
|
||||
cint(self.number_of_depreciations_booked))
|
||||
else:
|
||||
factor = 200.0 / self.total_number_of_depreciations
|
||||
depreciation_amount = flt(depreciable_value * factor / 100, 0)
|
||||
|
||||
value_after_depreciation = flt(depreciable_value) - depreciation_amount
|
||||
if value_after_depreciation < flt(self.expected_value_after_useful_life):
|
||||
depreciation_amount = flt(depreciable_value) - flt(self.expected_value_after_useful_life)
|
||||
|
||||
return depreciation_amount
|
||||
|
||||
def validate_expected_value_after_useful_life(self):
|
||||
if self.depreciation_method == "Double Declining Balance":
|
||||
accumulated_depreciation_after_full_schedule = \
|
||||
max([d.accumulated_depreciation_amount for d in self.get("schedules")])
|
||||
|
||||
asset_value_after_full_schedule = (flt(self.gross_purchase_amount) -
|
||||
flt(accumulated_depreciation_after_full_schedule))
|
||||
|
||||
if self.expected_value_after_useful_life < asset_value_after_full_schedule:
|
||||
frappe.throw(_("Expected value after useful life must be greater than or equal to {0}")
|
||||
.format(asset_value_after_full_schedule))
|
||||
|
||||
def validate_cancellation(self):
|
||||
if self.status not in ("Submitted", "Partially Depreciated", "Fully Depreciated"):
|
||||
frappe.throw(_("Asset cannot be cancelled, as it is already {0}").format(self.status))
|
||||
|
||||
if self.purchase_invoice:
|
||||
frappe.throw(_("Please cancel Purchase Invoice {0} first").format(self.purchase_invoice))
|
||||
|
||||
def delete_depreciation_entries(self):
|
||||
for d in self.get("schedules"):
|
||||
if d.journal_entry:
|
||||
frappe.get_doc("Journal Entry", d.journal_entry).cancel()
|
||||
d.db_set("journal_entry", None)
|
||||
|
||||
self.db_set("value_after_depreciation",
|
||||
(flt(self.gross_purchase_amount) - flt(self.opening_accumulated_depreciation)))
|
||||
|
||||
def set_status(self, status=None):
|
||||
'''Get and update status'''
|
||||
if not status:
|
||||
status = self.get_status()
|
||||
self.db_set("status", status)
|
||||
|
||||
def get_status(self):
|
||||
'''Returns status based on whether it is draft, submitted, scrapped or depreciated'''
|
||||
if self.docstatus == 0:
|
||||
status = "Draft"
|
||||
elif self.docstatus == 1:
|
||||
status = "Submitted"
|
||||
if self.journal_entry_for_scrap:
|
||||
status = "Scrapped"
|
||||
elif flt(self.value_after_depreciation) <= flt(self.expected_value_after_useful_life):
|
||||
status = "Fully Depreciated"
|
||||
elif flt(self.value_after_depreciation) < flt(self.gross_purchase_amount):
|
||||
status = 'Partially Depreciated'
|
||||
elif self.docstatus == 2:
|
||||
status = "Cancelled"
|
||||
|
||||
return status
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_purchase_invoice(asset, item_code, gross_purchase_amount, company, posting_date):
|
||||
pi = frappe.new_doc("Purchase Invoice")
|
||||
pi.company = company
|
||||
pi.currency = frappe.db.get_value("Company", company, "default_currency")
|
||||
pi.posting_date = posting_date
|
||||
pi.append("items", {
|
||||
"item_code": item_code,
|
||||
"is_fixed_asset": 1,
|
||||
"asset": asset,
|
||||
"expense_account": get_fixed_asset_account(asset),
|
||||
"qty": 1,
|
||||
"price_list_rate": gross_purchase_amount,
|
||||
"rate": gross_purchase_amount
|
||||
})
|
||||
pi.set_missing_values()
|
||||
return pi
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_sales_invoice(asset, item_code, company):
|
||||
si = frappe.new_doc("Sales Invoice")
|
||||
si.company = company
|
||||
si.currency = frappe.db.get_value("Company", company, "default_currency")
|
||||
disposal_account, depreciation_cost_center = get_disposal_account_and_cost_center(company)
|
||||
si.append("items", {
|
||||
"item_code": item_code,
|
||||
"is_fixed_asset": 1,
|
||||
"asset": asset,
|
||||
"income_account": disposal_account,
|
||||
"cost_center": depreciation_cost_center,
|
||||
"qty": 1
|
||||
})
|
||||
si.set_missing_values()
|
||||
return si
|
||||
|
||||
@frappe.whitelist()
|
||||
def transfer_asset(args):
|
||||
import json
|
||||
args = json.loads(args)
|
||||
movement_entry = frappe.new_doc("Asset Movement")
|
||||
movement_entry.update(args)
|
||||
movement_entry.insert()
|
||||
movement_entry.submit()
|
||||
|
||||
frappe.db.commit()
|
||||
|
||||
frappe.msgprint(_("Asset Movement record {0} created").format("<a href='#Form/Asset Movement/{0}'>{0}</a>".format(movement_entry.name)))
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_item_details(item_code):
|
||||
asset_category = frappe.db.get_value("Item", item_code, "asset_category")
|
||||
|
||||
if not asset_category:
|
||||
frappe.throw(_("Please enter Asset Category in Item {0}").format(item_code))
|
||||
|
||||
ret = frappe.db.get_value("Asset Category", asset_category,
|
||||
["depreciation_method", "total_number_of_depreciations", "frequency_of_depreciation"], as_dict=1)
|
||||
|
||||
ret.update({
|
||||
"asset_category": asset_category
|
||||
})
|
||||
|
||||
return ret
|
184
erpnext/accounts/doctype/asset/depreciation.py
Normal file
184
erpnext/accounts/doctype/asset/depreciation.py
Normal file
@ -0,0 +1,184 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import flt, today, getdate
|
||||
|
||||
def post_depreciation_entries(date=None):
|
||||
if not date:
|
||||
date = today()
|
||||
for asset in get_depreciable_assets(date):
|
||||
make_depreciation_entry(asset, date)
|
||||
frappe.db.commit()
|
||||
|
||||
def get_depreciable_assets(date):
|
||||
return frappe.db.sql_list("""select a.name
|
||||
from tabAsset a, `tabDepreciation Schedule` ds
|
||||
where a.name = ds.parent and a.docstatus=1 and ds.schedule_date<=%s
|
||||
and a.status in ('Submitted', 'Partially Depreciated')
|
||||
and ifnull(ds.journal_entry, '')=''""", date)
|
||||
|
||||
@frappe.whitelist()
|
||||
def make_depreciation_entry(asset_name, date=None):
|
||||
frappe.has_permission('Journal Entry', throw=True)
|
||||
|
||||
if not date:
|
||||
date = today()
|
||||
|
||||
asset = frappe.get_doc("Asset", asset_name)
|
||||
fixed_asset_account, accumulated_depreciation_account, depreciation_expense_account = \
|
||||
get_depreciation_accounts(asset)
|
||||
|
||||
depreciation_cost_center = frappe.db.get_value("Company", asset.company, "depreciation_cost_center")
|
||||
|
||||
for d in asset.get("schedules"):
|
||||
if not d.journal_entry and getdate(d.schedule_date) <= getdate(date):
|
||||
je = frappe.new_doc("Journal Entry")
|
||||
je.voucher_type = "Depreciation Entry"
|
||||
je.posting_date = d.schedule_date
|
||||
je.company = asset.company
|
||||
je.remark = "Depreciation Entry against {0} worth {1}".format(asset_name, d.depreciation_amount)
|
||||
|
||||
je.append("accounts", {
|
||||
"account": accumulated_depreciation_account,
|
||||
"credit_in_account_currency": d.depreciation_amount,
|
||||
"reference_type": "Asset",
|
||||
"reference_name": asset.name
|
||||
})
|
||||
|
||||
je.append("accounts", {
|
||||
"account": depreciation_expense_account,
|
||||
"debit_in_account_currency": d.depreciation_amount,
|
||||
"reference_type": "Asset",
|
||||
"reference_name": asset.name,
|
||||
"cost_center": depreciation_cost_center
|
||||
})
|
||||
|
||||
je.flags.ignore_permissions = True
|
||||
je.submit()
|
||||
|
||||
d.db_set("journal_entry", je.name)
|
||||
asset.value_after_depreciation -= d.depreciation_amount
|
||||
|
||||
asset.db_set("value_after_depreciation", asset.value_after_depreciation)
|
||||
asset.set_status()
|
||||
|
||||
return asset
|
||||
|
||||
def get_depreciation_accounts(asset):
|
||||
fixed_asset_account = accumulated_depreciation_account = depreciation_expense_account = None
|
||||
|
||||
accounts = frappe.db.get_value("Asset Category Account",
|
||||
filters={'parent': asset.asset_category, 'company_name': asset.company},
|
||||
fieldname = ['fixed_asset_account', 'accumulated_depreciation_account',
|
||||
'depreciation_expense_account'], as_dict=1)
|
||||
|
||||
if accounts:
|
||||
fixed_asset_account = accounts.fixed_asset_account
|
||||
accumulated_depreciation_account = accounts.accumulated_depreciation_account
|
||||
depreciation_expense_account = accounts.depreciation_expense_account
|
||||
|
||||
if not accumulated_depreciation_account or not depreciation_expense_account:
|
||||
accounts = frappe.db.get_value("Company", asset.company,
|
||||
["accumulated_depreciation_account", "depreciation_expense_account"])
|
||||
|
||||
if not accumulated_depreciation_account:
|
||||
accumulated_depreciation_account = accounts[0]
|
||||
if not depreciation_expense_account:
|
||||
depreciation_expense_account = accounts[1]
|
||||
|
||||
if not fixed_asset_account or not accumulated_depreciation_account or not depreciation_expense_account:
|
||||
frappe.throw(_("Please set Depreciation related Accounts in Asset Category {0} or Company {1}")
|
||||
.format(asset.asset_category, asset.company))
|
||||
|
||||
return fixed_asset_account, accumulated_depreciation_account, depreciation_expense_account
|
||||
|
||||
@frappe.whitelist()
|
||||
def scrap_asset(asset_name):
|
||||
asset = frappe.get_doc("Asset", asset_name)
|
||||
|
||||
if asset.docstatus != 1:
|
||||
frappe.throw(_("Asset {0} must be submitted").format(asset.name))
|
||||
elif asset.status in ("Cancelled", "Sold", "Scrapped"):
|
||||
frappe.throw(_("Asset {0} cannot be scrapped, as it is already {1}").format(asset.name, asset.status))
|
||||
|
||||
je = frappe.new_doc("Journal Entry")
|
||||
je.voucher_type = "Journal Entry"
|
||||
je.posting_date = today()
|
||||
je.company = asset.company
|
||||
je.remark = "Scrap Entry for asset {0}".format(asset_name)
|
||||
|
||||
for entry in get_gl_entries_on_asset_disposal(asset):
|
||||
entry.update({
|
||||
"reference_type": "Asset",
|
||||
"reference_name": asset_name
|
||||
})
|
||||
je.append("accounts", entry)
|
||||
|
||||
je.flags.ignore_permissions = True
|
||||
je.submit()
|
||||
|
||||
frappe.db.set_value("Asset", asset_name, "disposal_date", today())
|
||||
frappe.db.set_value("Asset", asset_name, "journal_entry_for_scrap", je.name)
|
||||
asset.set_status("Scrapped")
|
||||
|
||||
frappe.msgprint(_("Asset scrapped via Journal Entry {0}").format(je.name))
|
||||
|
||||
@frappe.whitelist()
|
||||
def restore_asset(asset_name):
|
||||
asset = frappe.get_doc("Asset", asset_name)
|
||||
|
||||
je = asset.journal_entry_for_scrap
|
||||
|
||||
asset.db_set("disposal_date", None)
|
||||
asset.db_set("journal_entry_for_scrap", None)
|
||||
|
||||
frappe.get_doc("Journal Entry", je).cancel()
|
||||
|
||||
asset.set_status()
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_gl_entries_on_asset_disposal(asset, selling_amount=0):
|
||||
fixed_asset_account, accumulated_depr_account, depr_expense_account = get_depreciation_accounts(asset)
|
||||
disposal_account, depreciation_cost_center = get_disposal_account_and_cost_center(asset.company)
|
||||
accumulated_depr_amount = flt(asset.gross_purchase_amount) - flt(asset.value_after_depreciation)
|
||||
|
||||
gl_entries = [
|
||||
{
|
||||
"account": fixed_asset_account,
|
||||
"credit_in_account_currency": asset.gross_purchase_amount,
|
||||
"credit": asset.gross_purchase_amount
|
||||
},
|
||||
{
|
||||
"account": accumulated_depr_account,
|
||||
"debit_in_account_currency": accumulated_depr_amount,
|
||||
"debit": accumulated_depr_amount
|
||||
}
|
||||
]
|
||||
|
||||
profit_amount = flt(selling_amount) - flt(asset.value_after_depreciation)
|
||||
if flt(asset.value_after_depreciation) and profit_amount:
|
||||
debit_or_credit = "debit" if profit_amount < 0 else "credit"
|
||||
gl_entries.append({
|
||||
"account": disposal_account,
|
||||
"cost_center": depreciation_cost_center,
|
||||
debit_or_credit: abs(profit_amount),
|
||||
debit_or_credit + "_in_account_currency": abs(profit_amount)
|
||||
})
|
||||
|
||||
return gl_entries
|
||||
|
||||
@frappe.whitelist()
|
||||
def get_disposal_account_and_cost_center(company):
|
||||
disposal_account, depreciation_cost_center = frappe.db.get_value("Company", company,
|
||||
["disposal_account", "depreciation_cost_center"])
|
||||
|
||||
if not disposal_account:
|
||||
frappe.throw(_("Please set 'Gain/Loss Account on Asset Disposal' in Company {0}").format(company))
|
||||
if not depreciation_cost_center:
|
||||
frappe.throw(_("Please set 'Asset Depreciation Cost Center' in Company {0}").format(company))
|
||||
|
||||
return disposal_account, depreciation_cost_center
|
276
erpnext/accounts/doctype/asset/test_asset.py
Normal file
276
erpnext/accounts/doctype/asset/test_asset.py
Normal file
@ -0,0 +1,276 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
from frappe.utils import cstr, nowdate, getdate
|
||||
from erpnext.accounts.doctype.asset.depreciation import post_depreciation_entries, scrap_asset, restore_asset
|
||||
from erpnext.accounts.doctype.asset.asset import make_sales_invoice, make_purchase_invoice
|
||||
|
||||
class TestAsset(unittest.TestCase):
|
||||
def setUp(self):
|
||||
set_depreciation_settings_in_company()
|
||||
create_asset()
|
||||
|
||||
def test_purchase_asset(self):
|
||||
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
||||
asset.submit()
|
||||
|
||||
pi = make_purchase_invoice(asset.name, asset.item_code, asset.gross_purchase_amount,
|
||||
asset.company, asset.purchase_date)
|
||||
pi.supplier = "_Test Supplier"
|
||||
pi.insert()
|
||||
pi.submit()
|
||||
|
||||
asset.load_from_db()
|
||||
self.assertEqual(asset.supplier, "_Test Supplier")
|
||||
self.assertEqual(asset.purchase_date, getdate("2015-01-01"))
|
||||
self.assertEqual(asset.purchase_invoice, pi.name)
|
||||
|
||||
expected_gle = (
|
||||
("_Test Fixed Asset - _TC", 100000.0, 0.0),
|
||||
("Creditors - _TC", 0.0, 100000.0)
|
||||
)
|
||||
|
||||
gle = frappe.db.sql("""select account, debit, credit from `tabGL Entry`
|
||||
where voucher_type='Purchase Invoice' and voucher_no = %s
|
||||
order by account""", pi.name)
|
||||
|
||||
self.assertEqual(gle, expected_gle)
|
||||
|
||||
pi.cancel()
|
||||
|
||||
asset.load_from_db()
|
||||
self.assertEqual(asset.supplier, None)
|
||||
self.assertEqual(asset.purchase_invoice, None)
|
||||
|
||||
self.assertFalse(frappe.db.get_value("GL Entry",
|
||||
{"voucher_type": "Purchase Invoice", "voucher_no": pi.name}))
|
||||
|
||||
|
||||
def test_schedule_for_straight_line_method(self):
|
||||
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
||||
|
||||
self.assertEqual(asset.status, "Draft")
|
||||
|
||||
expected_schedules = [
|
||||
["2020-12-31", 30000, 30000],
|
||||
["2021-03-31", 30000, 60000],
|
||||
["2021-06-30", 30000, 90000]
|
||||
]
|
||||
|
||||
schedules = [[cstr(d.schedule_date), d.depreciation_amount, d.accumulated_depreciation_amount]
|
||||
for d in asset.get("schedules")]
|
||||
|
||||
self.assertEqual(schedules, expected_schedules)
|
||||
|
||||
def test_schedule_for_straight_line_method_for_existing_asset(self):
|
||||
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
||||
asset.is_existing_asset = 1
|
||||
asset.number_of_depreciations_booked = 1
|
||||
asset.opening_accumulated_depreciation = 40000
|
||||
asset.save()
|
||||
|
||||
self.assertEqual(asset.status, "Draft")
|
||||
|
||||
expected_schedules = [
|
||||
["2020-12-31", 25000, 65000],
|
||||
["2021-03-31", 25000, 90000]
|
||||
]
|
||||
|
||||
schedules = [[cstr(d.schedule_date), d.depreciation_amount, d.accumulated_depreciation_amount]
|
||||
for d in asset.get("schedules")]
|
||||
|
||||
self.assertEqual(schedules, expected_schedules)
|
||||
|
||||
|
||||
def test_schedule_for_double_declining_method(self):
|
||||
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
||||
asset.depreciation_method = "Double Declining Balance"
|
||||
asset.save()
|
||||
|
||||
expected_schedules = [
|
||||
["2020-12-31", 66667, 66667],
|
||||
["2021-03-31", 22222, 88889],
|
||||
["2021-06-30", 1111, 90000]
|
||||
]
|
||||
|
||||
schedules = [[cstr(d.schedule_date), d.depreciation_amount, d.accumulated_depreciation_amount]
|
||||
for d in asset.get("schedules")]
|
||||
|
||||
self.assertEqual(schedules, expected_schedules)
|
||||
|
||||
def test_schedule_for_double_declining_method_for_existing_asset(self):
|
||||
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
||||
asset.depreciation_method = "Double Declining Balance"
|
||||
asset.is_existing_asset = 1
|
||||
asset.number_of_depreciations_booked = 1
|
||||
asset.opening_accumulated_depreciation = 50000
|
||||
asset.save()
|
||||
|
||||
expected_schedules = [
|
||||
["2020-12-31", 33333, 83333],
|
||||
["2021-03-31", 6667, 90000]
|
||||
]
|
||||
|
||||
schedules = [[cstr(d.schedule_date), d.depreciation_amount, d.accumulated_depreciation_amount]
|
||||
for d in asset.get("schedules")]
|
||||
|
||||
self.assertEqual(schedules, expected_schedules)
|
||||
|
||||
def test_depreciation(self):
|
||||
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
||||
asset.submit()
|
||||
asset.load_from_db()
|
||||
self.assertEqual(asset.status, "Submitted")
|
||||
|
||||
post_depreciation_entries(date="2021-01-01")
|
||||
asset.load_from_db()
|
||||
|
||||
self.assertEqual(asset.status, "Partially Depreciated")
|
||||
|
||||
expected_gle = (
|
||||
("_Test Accumulated Depreciations - _TC", 0.0, 30000.0),
|
||||
("_Test Depreciations - _TC", 30000.0, 0.0)
|
||||
)
|
||||
|
||||
gle = frappe.db.sql("""select account, debit, credit from `tabGL Entry`
|
||||
where against_voucher_type='Asset' and against_voucher = %s
|
||||
order by account""", asset.name)
|
||||
|
||||
self.assertEqual(gle, expected_gle)
|
||||
self.assertEqual(asset.get("value_after_depreciation"), 70000)
|
||||
|
||||
def test_scrap_asset(self):
|
||||
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
||||
asset.submit()
|
||||
post_depreciation_entries(date="2021-01-01")
|
||||
|
||||
scrap_asset("Macbook Pro 1")
|
||||
|
||||
asset.load_from_db()
|
||||
self.assertEqual(asset.status, "Scrapped")
|
||||
self.assertTrue(asset.journal_entry_for_scrap)
|
||||
|
||||
expected_gle = (
|
||||
("_Test Accumulated Depreciations - _TC", 30000.0, 0.0),
|
||||
("_Test Fixed Asset - _TC", 0.0, 100000.0),
|
||||
("_Test Gain/Loss on Asset Disposal - _TC", 70000.0, 0.0)
|
||||
)
|
||||
|
||||
gle = frappe.db.sql("""select account, debit, credit from `tabGL Entry`
|
||||
where voucher_type='Journal Entry' and voucher_no = %s
|
||||
order by account""", asset.journal_entry_for_scrap)
|
||||
|
||||
self.assertEqual(gle, expected_gle)
|
||||
|
||||
restore_asset("Macbook Pro 1")
|
||||
|
||||
asset.load_from_db()
|
||||
self.assertFalse(asset.journal_entry_for_scrap)
|
||||
self.assertEqual(asset.status, "Partially Depreciated")
|
||||
|
||||
def test_asset_sale(self):
|
||||
frappe.get_doc("Asset", "Macbook Pro 1").submit()
|
||||
post_depreciation_entries(date="2021-01-01")
|
||||
|
||||
si = make_sales_invoice(asset="Macbook Pro 1", item_code="Macbook Pro", company="_Test Company")
|
||||
si.customer = "_Test Customer"
|
||||
si.due_date = nowdate()
|
||||
si.get("items")[0].rate = 25000
|
||||
si.insert()
|
||||
si.submit()
|
||||
|
||||
self.assertEqual(frappe.db.get_value("Asset", "Macbook Pro 1", "status"), "Sold")
|
||||
|
||||
expected_gle = (
|
||||
("_Test Accumulated Depreciations - _TC", 30000.0, 0.0),
|
||||
("_Test Fixed Asset - _TC", 0.0, 100000.0),
|
||||
("_Test Gain/Loss on Asset Disposal - _TC", 45000.0, 0.0),
|
||||
("Debtors - _TC", 25000.0, 0.0)
|
||||
)
|
||||
|
||||
gle = frappe.db.sql("""select account, debit, credit from `tabGL Entry`
|
||||
where voucher_type='Sales Invoice' and voucher_no = %s
|
||||
order by account""", si.name)
|
||||
|
||||
self.assertEqual(gle, expected_gle)
|
||||
|
||||
si.cancel()
|
||||
|
||||
self.assertEqual(frappe.db.get_value("Asset", "Macbook Pro 1", "status"), "Partially Depreciated")
|
||||
|
||||
def tearDown(self):
|
||||
asset = frappe.get_doc("Asset", "Macbook Pro 1")
|
||||
|
||||
if asset.docstatus == 1 and asset.status not in ("Scrapped", "Sold", "Draft", "Cancelled"):
|
||||
asset.cancel()
|
||||
|
||||
self.assertEqual(frappe.db.get_value("Asset", "Macbook Pro 1", "status"), "Cancelled")
|
||||
|
||||
frappe.delete_doc("Asset", "Macbook Pro 1")
|
||||
|
||||
def create_asset():
|
||||
if not frappe.db.exists("Asset Category", "Computers"):
|
||||
create_asset_category()
|
||||
|
||||
if not frappe.db.exists("Item", "Macbook Pro"):
|
||||
create_fixed_asset_item()
|
||||
|
||||
asset = frappe.get_doc({
|
||||
"doctype": "Asset",
|
||||
"asset_name": "Macbook Pro 1",
|
||||
"asset_category": "Computers",
|
||||
"item_code": "Macbook Pro",
|
||||
"company": "_Test Company",
|
||||
"purchase_date": "2015-01-01",
|
||||
"next_depreciation_date": "2020-12-31",
|
||||
"gross_purchase_amount": 100000,
|
||||
"expected_value_after_useful_life": 10000,
|
||||
"warehouse": "_Test Warehouse - _TC"
|
||||
})
|
||||
try:
|
||||
asset.save()
|
||||
except frappe.DuplicateEntryError:
|
||||
pass
|
||||
|
||||
return asset
|
||||
|
||||
def create_asset_category():
|
||||
asset_category = frappe.new_doc("Asset Category")
|
||||
asset_category.asset_category_name = "Computers"
|
||||
asset_category.total_number_of_depreciations = 3
|
||||
asset_category.frequency_of_depreciation = 3
|
||||
asset_category.append("accounts", {
|
||||
"company_name": "_Test Company",
|
||||
"fixed_asset_account": "_Test Fixed Asset - _TC",
|
||||
"accumulated_depreciation_account": "_Test Accumulated Depreciations - _TC",
|
||||
"depreciation_expense_account": "_Test Depreciations - _TC"
|
||||
})
|
||||
asset_category.insert()
|
||||
|
||||
def create_fixed_asset_item():
|
||||
try:
|
||||
frappe.get_doc({
|
||||
"doctype": "Item",
|
||||
"item_code": "Macbook Pro",
|
||||
"item_name": "Macbook Pro",
|
||||
"description": "Macbook Pro Retina Display",
|
||||
"asset_category": "Computers",
|
||||
"item_group": "All Item Groups",
|
||||
"stock_uom": "Nos",
|
||||
"is_stock_item": 0,
|
||||
"is_fixed_asset": 1
|
||||
}).insert()
|
||||
except frappe.DuplicateEntryError:
|
||||
pass
|
||||
|
||||
def set_depreciation_settings_in_company():
|
||||
company = frappe.get_doc("Company", "_Test Company")
|
||||
company.accumulated_depreciation_account = "_Test Accumulated Depreciations - _TC"
|
||||
company.depreciation_expense_account = "_Test Depreciations - _TC"
|
||||
company.disposal_account = "_Test Gain/Loss on Asset Disposal - _TC"
|
||||
company.depreciation_cost_center = "_Test Cost Center - _TC"
|
||||
company.save()
|
53
erpnext/accounts/doctype/asset_category/asset_category.js
Normal file
53
erpnext/accounts/doctype/asset_category/asset_category.js
Normal file
@ -0,0 +1,53 @@
|
||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Asset Category', {
|
||||
setup: function(frm) {
|
||||
frm.get_field('accounts').grid.editable_fields = [
|
||||
{fieldname: 'company_name', columns: 3},
|
||||
{fieldname: 'fixed_asset_account', columns: 3},
|
||||
{fieldname: 'accumulated_depreciation_account', columns: 2},
|
||||
{fieldname: 'depreciation_expense_account', columns: 2}
|
||||
];
|
||||
},
|
||||
|
||||
onload: function(frm) {
|
||||
frm.add_fetch('company_name', 'accumulated_depreciation_account', 'accumulated_depreciation_account');
|
||||
frm.add_fetch('company_name', 'depreciation_expense_account', 'accumulated_depreciation_account');
|
||||
|
||||
frm.set_query('fixed_asset_account', 'accounts', function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
return {
|
||||
"filters": {
|
||||
"account_type": "Fixed Asset",
|
||||
"root_type": "Asset",
|
||||
"is_group": 0,
|
||||
"company": d.company_name
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
frm.set_query('accumulated_depreciation_account', 'accounts', function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
return {
|
||||
"filters": {
|
||||
"root_type": "Asset",
|
||||
"is_group": 0,
|
||||
"company": d.company_name
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
frm.set_query('depreciation_expense_account', 'accounts', function(doc, cdt, cdn) {
|
||||
var d = locals[cdt][cdn];
|
||||
return {
|
||||
"filters": {
|
||||
"root_type": "Expense",
|
||||
"is_group": 0,
|
||||
"company": d.company_name
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
}
|
||||
});
|
253
erpnext/accounts/doctype/asset_category/asset_category.json
Normal file
253
erpnext/accounts/doctype/asset_category/asset_category.json
Normal file
@ -0,0 +1,253 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 1,
|
||||
"autoname": "field:asset_category_name",
|
||||
"creation": "2016-03-01 17:41:39.778765",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "Document",
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "asset_category_name",
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Asset Category Name",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"default": "Straight Line",
|
||||
"fieldname": "depreciation_method",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Depreciation Method",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "\nStraight Line\nDouble Declining Balance",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "column_break_3",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "total_number_of_depreciations",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Total Number of Depreciations",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "frequency_of_depreciation",
|
||||
"fieldtype": "Int",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Frequency of Depreciation (Months)",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "section_break_2",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Accounts",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "accounts",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Accounts",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Asset Category Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-04-20 13:23:09.890324",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Asset Category",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 1,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts User",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 1,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_seen": 0
|
||||
}
|
15
erpnext/accounts/doctype/asset_category/asset_category.py
Normal file
15
erpnext/accounts/doctype/asset_category/asset_category.py
Normal file
@ -0,0 +1,15 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import cint
|
||||
from frappe.model.document import Document
|
||||
|
||||
class AssetCategory(Document):
|
||||
def validate(self):
|
||||
for field in ("total_number_of_depreciations", "frequency_of_depreciation"):
|
||||
if cint(self.get(field))<1:
|
||||
frappe.throw(_("{0} must be greater than 0").format(self.meta.get_label(field)), frappe.MandatoryError)
|
@ -0,0 +1,29 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
|
||||
class TestAssetCategory(unittest.TestCase):
|
||||
def test_mandatory_fields(self):
|
||||
asset_category = frappe.new_doc("Asset Category")
|
||||
asset_category.asset_category_name = "Computers"
|
||||
|
||||
self.assertRaises(frappe.MandatoryError, asset_category.insert)
|
||||
|
||||
asset_category.total_number_of_depreciations = 3
|
||||
asset_category.frequency_of_depreciation = 3
|
||||
asset_category.append("accounts", {
|
||||
"company_name": "_Test Company",
|
||||
"fixed_asset_account": "_Test Fixed Asset - _TC",
|
||||
"accumulated_depreciation_account": "_Test Accumulated Depreciations - _TC",
|
||||
"depreciation_expense_account": "_Test Depreciations - _TC"
|
||||
})
|
||||
|
||||
try:
|
||||
asset_category.insert()
|
||||
except frappe.DuplicateEntryError:
|
||||
pass
|
||||
|
@ -0,0 +1,141 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
"creation": "2016-03-07 15:55:18.806409",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "company_name",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Company",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Company",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "fixed_asset_account",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Fixed Asset Account",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "accumulated_depreciation_account",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Accumulated Depreciation Account",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "depreciation_expense_account",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Depreciation Expense Account",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-07-11 03:27:58.048060",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Asset Category Account",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_seen": 0
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class AssetCategoryAccount(Document):
|
||||
pass
|
15
erpnext/accounts/doctype/asset_movement/asset_movement.js
Normal file
15
erpnext/accounts/doctype/asset_movement/asset_movement.js
Normal file
@ -0,0 +1,15 @@
|
||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Asset Movement', {
|
||||
onload: function(frm) {
|
||||
frm.add_fetch("asset", "warehouse", "source_warehouse");
|
||||
|
||||
frm.set_query("target_warehouse", function() {
|
||||
return {
|
||||
filters: [["Warehouse", "company", "in", ["", cstr(frm.doc.company)]]]
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
});
|
274
erpnext/accounts/doctype/asset_movement/asset_movement.json
Normal file
274
erpnext/accounts/doctype/asset_movement/asset_movement.json
Normal file
@ -0,0 +1,274 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 0,
|
||||
"autoname": "AM-.#####",
|
||||
"creation": "2016-04-25 18:00:23.559973",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "asset",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Asset",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Asset",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "transaction_date",
|
||||
"fieldtype": "Datetime",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Transaction Date",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Company",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Company",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "column_break_4",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "source_warehouse",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Source Warehouse",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Warehouse",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "target_warehouse",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Target Warehouse",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Warehouse",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Amended From",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"options": "Asset Movement",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-04-25 19:14:08.853429",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Asset Movement",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "System Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 0,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Stock Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_seen": 0
|
||||
}
|
48
erpnext/accounts/doctype/asset_movement/asset_movement.py
Normal file
48
erpnext/accounts/doctype/asset_movement/asset_movement.py
Normal file
@ -0,0 +1,48 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.model.document import Document
|
||||
|
||||
class AssetMovement(Document):
|
||||
def validate(self):
|
||||
self.validate_asset()
|
||||
self.validate_warehouses()
|
||||
|
||||
def validate_asset(self):
|
||||
status, company = frappe.db.get_value("Asset", self.asset, ["status", "company"])
|
||||
if status in ("Draft", "Scrapped", "Sold"):
|
||||
frappe.throw(_("{0} asset cannot be transferred").format(status))
|
||||
|
||||
if company != self.company:
|
||||
frappe.throw(_("Asset {0} does not belong to company {1}").format(self.asset, self.company))
|
||||
|
||||
def validate_warehouses(self):
|
||||
if not self.source_warehouse:
|
||||
self.source_warehouse = frappe.db.get_value("Asset", self.asset, "warehouse")
|
||||
|
||||
if self.source_warehouse == self.target_warehouse:
|
||||
frappe.throw(_("Source and Target Warehouse cannot be same"))
|
||||
|
||||
def on_submit(self):
|
||||
self.set_latest_warehouse_in_asset()
|
||||
|
||||
def on_cancel(self):
|
||||
self.set_latest_warehouse_in_asset()
|
||||
|
||||
def set_latest_warehouse_in_asset(self):
|
||||
latest_movement_entry = frappe.db.sql("""select target_warehouse from `tabAsset Movement`
|
||||
where asset=%s and docstatus=1 and company=%s
|
||||
order by transaction_date desc limit 1""", (self.asset, self.company))
|
||||
|
||||
if latest_movement_entry:
|
||||
warehouse = latest_movement_entry[0][0]
|
||||
else:
|
||||
warehouse = frappe.db.sql("""select source_warehouse from `tabAsset Movement`
|
||||
where asset=%s and docstatus=2 and company=%s
|
||||
order by transaction_date asc limit 1""", (self.asset, self.company))[0][0]
|
||||
|
||||
frappe.db.set_value("Asset", self.asset, "warehouse", warehouse)
|
@ -0,0 +1,51 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
from frappe.utils import now
|
||||
import unittest
|
||||
from erpnext.accounts.doctype.asset.test_asset import create_asset
|
||||
|
||||
|
||||
class TestAssetMovement(unittest.TestCase):
|
||||
def test_movement(self):
|
||||
asset = create_asset()
|
||||
|
||||
if asset.docstatus == 0:
|
||||
asset.submit()
|
||||
|
||||
movement1 = create_asset_movement(asset, target_warehouse="_Test Warehouse 1 - _TC")
|
||||
self.assertEqual(frappe.db.get_value("Asset", asset.name, "warehouse"), "_Test Warehouse 1 - _TC")
|
||||
|
||||
movement2 = create_asset_movement(asset, target_warehouse="_Test Warehouse 2 - _TC")
|
||||
self.assertEqual(frappe.db.get_value("Asset", asset.name, "warehouse"), "_Test Warehouse 2 - _TC")
|
||||
|
||||
movement1.cancel()
|
||||
self.assertEqual(frappe.db.get_value("Asset", asset.name, "warehouse"), "_Test Warehouse 2 - _TC")
|
||||
|
||||
movement2.cancel()
|
||||
self.assertEqual(frappe.db.get_value("Asset", asset.name, "warehouse"), "_Test Warehouse - _TC")
|
||||
|
||||
asset.load_from_db()
|
||||
asset.cancel()
|
||||
frappe.delete_doc("Asset", asset.name)
|
||||
|
||||
|
||||
def create_asset_movement(asset, target_warehouse, transaction_date=None):
|
||||
if not transaction_date:
|
||||
transaction_date = now()
|
||||
|
||||
movement = frappe.new_doc("Asset Movement")
|
||||
movement.update({
|
||||
"asset": asset.name,
|
||||
"transaction_date": transaction_date,
|
||||
"target_warehouse": target_warehouse,
|
||||
"company": asset.company
|
||||
})
|
||||
|
||||
movement.insert()
|
||||
movement.submit()
|
||||
|
||||
return movement
|
@ -3,11 +3,22 @@
|
||||
|
||||
frappe.ui.form.on("Bank Reconciliation", {
|
||||
setup: function(frm) {
|
||||
frm.get_docfield("journal_entries").allow_bulk_edit = 1;
|
||||
frm.get_docfield("payment_entries").allow_bulk_edit = 1;
|
||||
frm.add_fetch("bank_account", "account_currency", "account_currency");
|
||||
|
||||
frm.get_field('payment_entries').grid.editable_fields = [
|
||||
{fieldname: 'against_account', columns: 3},
|
||||
{fieldname: 'amount', columns: 2},
|
||||
{fieldname: 'cheque_number', columns: 3},
|
||||
{fieldname: 'clearance_date', columns: 2}
|
||||
];
|
||||
},
|
||||
|
||||
onload: function(frm) {
|
||||
var default_bank_account = locals[":Company"][frappe.defaults.get_user_default("Company")]["default_bank_account"];
|
||||
|
||||
frm.set_value("bank_account", default_bank_account);
|
||||
|
||||
frm.set_query("bank_account", function() {
|
||||
return {
|
||||
"filters": {
|
||||
@ -27,16 +38,21 @@ frappe.ui.form.on("Bank Reconciliation", {
|
||||
|
||||
update_clearance_date: function(frm) {
|
||||
return frappe.call({
|
||||
method: "update_details",
|
||||
doc: frm.doc
|
||||
});
|
||||
},
|
||||
get_relevant_entries: function(frm) {
|
||||
return frappe.call({
|
||||
method: "get_details",
|
||||
method: "update_clearance_date",
|
||||
doc: frm.doc,
|
||||
callback: function(r, rt) {
|
||||
frm.refresh()
|
||||
frm.refresh_field("payment_entries");
|
||||
frm.refresh_fields();
|
||||
}
|
||||
});
|
||||
},
|
||||
get_payment_entries: function(frm) {
|
||||
return frappe.call({
|
||||
method: "get_payment_entries",
|
||||
doc: frm.doc,
|
||||
callback: function(r, rt) {
|
||||
frm.refresh_field("payment_entries");
|
||||
frm.refresh_fields();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -2,6 +2,7 @@
|
||||
"allow_copy": 1,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
"creation": "2013-01-10 16:34:05",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
@ -16,6 +17,7 @@
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Bank Account",
|
||||
@ -40,6 +42,7 @@
|
||||
"fieldtype": "Link",
|
||||
"hidden": 1,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Account Currency",
|
||||
@ -64,6 +67,7 @@
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "From Date",
|
||||
@ -87,6 +91,7 @@
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "To Date",
|
||||
@ -110,6 +115,7 @@
|
||||
"fieldtype": "Check",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Include Reconciled Entries",
|
||||
@ -129,13 +135,14 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "get_relevant_entries",
|
||||
"fieldname": "get_payment_entries",
|
||||
"fieldtype": "Button",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Get Relevant Entries",
|
||||
"label": "Get Payment Entries",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "",
|
||||
@ -153,13 +160,14 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "journal_entries",
|
||||
"fieldname": "payment_entries",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Journal Entries",
|
||||
"label": "Payment Entries",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Bank Reconciliation Detail",
|
||||
@ -181,6 +189,7 @@
|
||||
"fieldtype": "Button",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Update Clearance Date",
|
||||
@ -205,6 +214,7 @@
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Total Amount",
|
||||
@ -226,6 +236,7 @@
|
||||
"hide_toolbar": 1,
|
||||
"icon": "icon-check",
|
||||
"idx": 1,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
@ -233,7 +244,7 @@
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2015-11-30 12:44:45.105451",
|
||||
"modified": "2016-06-28 13:11:09.396353",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Bank Reconciliation",
|
||||
@ -260,7 +271,10 @@
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 1,
|
||||
"read_only": 1,
|
||||
"read_only_onload": 0,
|
||||
"sort_order": "ASC",
|
||||
"track_seen": 0,
|
||||
"version": 0
|
||||
}
|
@ -12,7 +12,7 @@ form_grid_templates = {
|
||||
}
|
||||
|
||||
class BankReconciliation(Document):
|
||||
def get_details(self):
|
||||
def get_payment_entries(self):
|
||||
if not (self.bank_account and self.from_date and self.to_date):
|
||||
msgprint("Bank Account, From Date and To Date are Mandatory")
|
||||
return
|
||||
@ -22,48 +22,68 @@ class BankReconciliation(Document):
|
||||
condition = "and (clearance_date is null or clearance_date='0000-00-00')"
|
||||
|
||||
|
||||
dl = frappe.db.sql("""select t1.name, t1.cheque_no, t1.cheque_date, t2.debit_in_account_currency,
|
||||
t2.credit_in_account_currency, t1.posting_date, t2.against_account, t1.clearance_date
|
||||
journal_entries = frappe.db.sql("""
|
||||
select
|
||||
"Journal Entry" as payment_document, t1.name as payment_entry,
|
||||
t1.cheque_no as cheque_number, t1.cheque_date,
|
||||
abs(t2.debit_in_account_currency - t2.credit_in_account_currency) as amount,
|
||||
t1.posting_date, t2.against_account, t1.clearance_date
|
||||
from
|
||||
`tabJournal Entry` t1, `tabJournal Entry Account` t2
|
||||
where
|
||||
t2.parent = t1.name and t2.account = %s
|
||||
and t1.posting_date >= %s and t1.posting_date <= %s and t1.docstatus=1
|
||||
and ifnull(t1.is_opening, 'No') = 'No' %s
|
||||
order by t1.posting_date DESC, t1.name DESC""" %
|
||||
('%s', '%s', '%s', condition), (self.bank_account, self.from_date, self.to_date), as_dict=1)
|
||||
|
||||
self.set('journal_entries', [])
|
||||
t2.parent = t1.name and t2.account = %s and t1.docstatus=1
|
||||
and t1.posting_date >= %s and t1.posting_date <= %s
|
||||
and ifnull(t1.is_opening, 'No') = 'No' {0}
|
||||
order by t1.posting_date ASC, t1.name DESC
|
||||
""".format(condition), (self.bank_account, self.from_date, self.to_date), as_dict=1)
|
||||
|
||||
payment_entries = frappe.db.sql("""
|
||||
select
|
||||
"Payment Entry" as payment_document, name as payment_entry,
|
||||
reference_no as cheque_number, reference_date as cheque_date,
|
||||
if(paid_from=%s, paid_amount, received_amount) as amount,
|
||||
posting_date, party as against_account, clearance_date
|
||||
from `tabPayment Entry`
|
||||
where
|
||||
(paid_from=%s or paid_to=%s) and docstatus=1
|
||||
and posting_date >= %s and posting_date <= %s {0}
|
||||
order by
|
||||
posting_date ASC, name DESC
|
||||
""".format(condition),
|
||||
(self.bank_account, self.bank_account, self.bank_account, self.from_date, self.to_date), as_dict=1)
|
||||
|
||||
entries = sorted(list(payment_entries)+list(journal_entries),
|
||||
key=lambda k: k['posting_date'] or getdate(nowdate()))
|
||||
|
||||
self.set('payment_entries', [])
|
||||
self.total_amount = 0.0
|
||||
|
||||
for d in dl:
|
||||
nl = self.append('journal_entries', {})
|
||||
nl.posting_date = d.posting_date
|
||||
nl.voucher_id = d.name
|
||||
nl.cheque_number = d.cheque_no
|
||||
nl.cheque_date = d.cheque_date
|
||||
nl.debit = d.debit_in_account_currency
|
||||
nl.credit = d.credit_in_account_currency
|
||||
nl.against_account = d.against_account
|
||||
nl.clearance_date = d.clearance_date
|
||||
self.total_amount += flt(d.debit_in_account_currency) - flt(d.credit_in_account_currency)
|
||||
for d in entries:
|
||||
row = self.append('payment_entries', {})
|
||||
row.update(d)
|
||||
self.total_amount += flt(d.amount)
|
||||
|
||||
def update_details(self):
|
||||
vouchers = []
|
||||
for d in self.get('journal_entries'):
|
||||
def update_clearance_date(self):
|
||||
clearance_date_updated = False
|
||||
for d in self.get('payment_entries'):
|
||||
if d.clearance_date:
|
||||
if d.cheque_date and getdate(d.clearance_date) < getdate(d.cheque_date):
|
||||
frappe.throw(_("Clearance date cannot be before check date in row {0}").format(d.idx))
|
||||
frappe.throw(_("Row #{0}: Clearance date {1} cannot be before Cheque Date {2}")
|
||||
.format(d.idx, d.clearance_date, d.cheque_date))
|
||||
|
||||
if d.clearance_date or self.include_reconciled_entries:
|
||||
if not d.clearance_date:
|
||||
d.clearance_date = None
|
||||
frappe.db.set_value("Journal Entry", d.voucher_id, "clearance_date", d.clearance_date)
|
||||
frappe.db.sql("""update `tabJournal Entry` set clearance_date = %s, modified = %s
|
||||
where name=%s""", (d.clearance_date, nowdate(), d.voucher_id))
|
||||
vouchers.append(d.voucher_id)
|
||||
|
||||
if vouchers:
|
||||
msgprint("Clearance Date updated in: {0}".format(", ".join(vouchers)))
|
||||
frappe.db.set_value(d.payment_document, d.payment_entry, "clearance_date", d.clearance_date)
|
||||
frappe.db.sql("""update `tab{0}` set clearance_date = %s, modified = %s
|
||||
where name=%s""".format(d.payment_document),
|
||||
(d.clearance_date, nowdate(), d.payment_entry))
|
||||
|
||||
clearance_date_updated = True
|
||||
|
||||
if clearance_date_updated:
|
||||
self.get_payment_entries()
|
||||
msgprint(_("Clearance Date updated"))
|
||||
else:
|
||||
msgprint(_("Clearance Date not mentioned"))
|
||||
|
@ -2,27 +2,56 @@
|
||||
"allow_copy": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
"creation": "2013-02-22 01:27:37",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "voucher_id",
|
||||
"fieldname": "payment_document",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Payment Document",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "DocType",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "payment_entry",
|
||||
"fieldtype": "Dynamic Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Voucher ID",
|
||||
"label": "Payment Entry",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "voucher_id",
|
||||
"oldfieldtype": "Link",
|
||||
"options": "Journal Entry",
|
||||
"options": "payment_document",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
@ -42,6 +71,7 @@
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Against Account",
|
||||
@ -64,13 +94,14 @@
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "debit",
|
||||
"fieldname": "amount",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Debit",
|
||||
"in_list_view": 1,
|
||||
"label": "Amount",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "debit",
|
||||
@ -86,32 +117,6 @@
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "credit",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Credit",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"oldfieldname": "credit",
|
||||
"oldfieldtype": "Currency",
|
||||
"options": "account_currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
@ -120,6 +125,7 @@
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"length": 0,
|
||||
@ -144,8 +150,9 @@
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"in_list_view": 0,
|
||||
"label": "Posting Date",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
@ -169,6 +176,7 @@
|
||||
"fieldtype": "Data",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Cheque Number",
|
||||
@ -194,6 +202,7 @@
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Cheque Date",
|
||||
@ -219,6 +228,7 @@
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Clearance Date",
|
||||
@ -240,6 +250,7 @@
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 1,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
@ -247,12 +258,15 @@
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"menu_index": 0,
|
||||
"modified": "2016-02-17 06:50:40.074578",
|
||||
"modified": "2016-07-11 03:27:58.139117",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Bank Reconciliation Detail",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0
|
||||
"read_only_onload": 0,
|
||||
"sort_order": "ASC",
|
||||
"track_seen": 0
|
||||
}
|
32
erpnext/accounts/doctype/budget/budget.js
Normal file
32
erpnext/accounts/doctype/budget/budget.js
Normal file
@ -0,0 +1,32 @@
|
||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Budget', {
|
||||
onload: function(frm) {
|
||||
frm.set_query("cost_center", function() {
|
||||
return {
|
||||
filters: {
|
||||
company: frm.doc.company
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
frm.set_query("account", "accounts", function() {
|
||||
return {
|
||||
filters: {
|
||||
company: frm.doc.company,
|
||||
report_type: "Profit and Loss",
|
||||
is_group: 0
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
frm.set_query("monthly_distribution", function() {
|
||||
return {
|
||||
filters: {
|
||||
fiscal_year: frm.doc.fiscal_year
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
314
erpnext/accounts/doctype/budget/budget.json
Normal file
314
erpnext/accounts/doctype/budget/budget.json
Normal file
@ -0,0 +1,314 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_import": 1,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
"creation": "2016-05-16 11:42:29.632528",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "cost_center",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Cost Center",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Cost Center",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "fiscal_year",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Fiscal Year",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Fiscal Year",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "monthly_distribution",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Monthly Distribution",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Monthly Distribution",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "column_break_3",
|
||||
"fieldtype": "Column Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 1,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"default": "Stop",
|
||||
"fieldname": "action_if_annual_budget_exceeded",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Action if Annual Budget Exceeded",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "\nStop\nWarn\nIgnore",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 1,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"default": "Warn",
|
||||
"description": "",
|
||||
"fieldname": "action_if_accumulated_monthly_budget_exceeded",
|
||||
"fieldtype": "Select",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Action if Accumulated Monthly Budget Exceeded",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "\nStop\nWarn\nIgnore",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "company",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Company",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Company",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "amended_from",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Amended From",
|
||||
"length": 0,
|
||||
"no_copy": 1,
|
||||
"options": "Budget",
|
||||
"permlevel": 0,
|
||||
"print_hide": 1,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "section_break_6",
|
||||
"fieldtype": "Section Break",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 0,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "accounts",
|
||||
"fieldtype": "Table",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 0,
|
||||
"label": "Budget Accounts",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Budget Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 1,
|
||||
"issingle": 0,
|
||||
"istable": 0,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-05-16 15:00:40.233685",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Budget",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [
|
||||
{
|
||||
"amend": 1,
|
||||
"apply_user_permissions": 0,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"delete": 1,
|
||||
"email": 1,
|
||||
"export": 1,
|
||||
"if_owner": 0,
|
||||
"import": 1,
|
||||
"permlevel": 0,
|
||||
"print": 1,
|
||||
"read": 1,
|
||||
"report": 1,
|
||||
"role": "Accounts Manager",
|
||||
"set_user_permissions": 0,
|
||||
"share": 1,
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
}
|
||||
],
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_seen": 0
|
||||
}
|
133
erpnext/accounts/doctype/budget/budget.py
Normal file
133
erpnext/accounts/doctype/budget/budget.py
Normal file
@ -0,0 +1,133 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe import _
|
||||
from frappe.utils import flt, getdate, add_months, get_last_day
|
||||
from frappe.model.naming import make_autoname
|
||||
from frappe.model.document import Document
|
||||
|
||||
class BudgetError(frappe.ValidationError): pass
|
||||
class DuplicateBudgetError(frappe.ValidationError): pass
|
||||
|
||||
class Budget(Document):
|
||||
def autoname(self):
|
||||
self.name = make_autoname(self.cost_center + "/" + self.fiscal_year + "/.###")
|
||||
|
||||
def validate(self):
|
||||
self.validate_duplicate()
|
||||
self.validate_accounts()
|
||||
|
||||
def validate_duplicate(self):
|
||||
existing_budget = frappe.db.get_value("Budget", {"cost_center": self.cost_center,
|
||||
"fiscal_year": self.fiscal_year, "company": self.company,
|
||||
"name": ["!=", self.name], "docstatus": ["!=", 2]})
|
||||
if existing_budget:
|
||||
frappe.throw(_("Another Budget record {0} already exists against {1} for fiscal year {2}")
|
||||
.format(existing_budget, self.cost_center, self.fiscal_year), DuplicateBudgetError)
|
||||
|
||||
def validate_accounts(self):
|
||||
account_list = []
|
||||
for d in self.get('accounts'):
|
||||
if d.account:
|
||||
account_details = frappe.db.get_value("Account", d.account,
|
||||
["is_group", "company", "report_type"], as_dict=1)
|
||||
|
||||
if account_details.is_group:
|
||||
frappe.throw(_("Budget cannot be assigned against Group Account {0}").format(d.account))
|
||||
elif account_details.company != self.company:
|
||||
frappe.throw(_("Account {0} does not belongs to company {1}")
|
||||
.format(d.account, self.company))
|
||||
elif account_details.report_type != "Profit and Loss":
|
||||
frappe.throw(_("Budget cannot be assigned against {0}, as it's not an Income or Expense account")
|
||||
.format(d.account))
|
||||
|
||||
if d.account in account_list:
|
||||
frappe.throw(_("Account {0} has been entered multiple times").format(d.account))
|
||||
else:
|
||||
account_list.append(d.account)
|
||||
|
||||
def validate_expense_against_budget(args):
|
||||
args = frappe._dict(args)
|
||||
if frappe.db.get_value("Account", {"name": args.account, "root_type": "Expense"}):
|
||||
cc_lft, cc_rgt = frappe.db.get_value("Cost Center", args.cost_center, ["lft", "rgt"])
|
||||
|
||||
budget_records = frappe.db.sql("""
|
||||
select ba.budget_amount, b.monthly_distribution, b.cost_center,
|
||||
b.action_if_annual_budget_exceeded, b.action_if_accumulated_monthly_budget_exceeded
|
||||
from `tabBudget` b, `tabBudget Account` ba
|
||||
where
|
||||
b.name=ba.parent and b.fiscal_year=%s and ba.account=%s and b.docstatus=1
|
||||
and exists(select name from `tabCost Center` where lft<=%s and rgt>=%s and name=b.cost_center)
|
||||
""", (args.fiscal_year, args.account, cc_lft, cc_rgt), as_dict=True)
|
||||
|
||||
for budget in budget_records:
|
||||
if budget.budget_amount:
|
||||
yearly_action = budget.action_if_annual_budget_exceeded
|
||||
monthly_action = budget.action_if_accumulated_monthly_budget_exceeded
|
||||
|
||||
if monthly_action in ["Stop", "Warn"]:
|
||||
budget_amount = get_accumulated_monthly_budget(budget.monthly_distribution,
|
||||
args.posting_date, args.fiscal_year, budget.budget_amount)
|
||||
|
||||
args["month_end_date"] = get_last_day(args.posting_date)
|
||||
|
||||
compare_expense_with_budget(args, budget.cost_center,
|
||||
budget_amount, _("Accumulated Monthly"), monthly_action)
|
||||
|
||||
elif yearly_action in ["Stop", "Warn"]:
|
||||
compare_expense_with_budget(args, budget.cost_center,
|
||||
flt(budget.budget_amount), _("Annual"), yearly_action)
|
||||
|
||||
def compare_expense_with_budget(args, cost_center, budget_amount, action_for, action):
|
||||
actual_expense = get_actual_expense(args, cost_center)
|
||||
if actual_expense > budget_amount:
|
||||
diff = actual_expense - budget_amount
|
||||
|
||||
msg = _("{0} Budget for Account {1} against Cost Center {2} is {3}. It will exceed by {4}").format(_(action_for), args.account, cost_center, budget_amount, diff)
|
||||
|
||||
if action=="Stop":
|
||||
frappe.throw(msg, BudgetError)
|
||||
else:
|
||||
frappe.msgprint(msg)
|
||||
|
||||
def get_accumulated_monthly_budget(monthly_distribution, posting_date, fiscal_year, annual_budget):
|
||||
distribution = {}
|
||||
if monthly_distribution:
|
||||
for d in frappe.db.sql("""select mdp.month, mdp.percentage_allocation
|
||||
from `tabMonthly Distribution Percentage` mdp, `tabMonthly Distribution` md
|
||||
where mdp.parent=md.name and md.fiscal_year=%s""", fiscal_year, as_dict=1):
|
||||
distribution.setdefault(d.month, d.percentage_allocation)
|
||||
|
||||
dt = frappe.db.get_value("Fiscal Year", fiscal_year, "year_start_date")
|
||||
accumulated_percentage = 0.0
|
||||
|
||||
while(dt <= getdate(posting_date)):
|
||||
if monthly_distribution:
|
||||
accumulated_percentage += distribution.get(getdate(dt).strftime("%B"), 0)
|
||||
else:
|
||||
accumulated_percentage += 100.0/12
|
||||
|
||||
dt = add_months(dt, 1)
|
||||
|
||||
return annual_budget * accumulated_percentage / 100
|
||||
|
||||
def get_actual_expense(args, cost_center):
|
||||
lft_rgt = frappe.db.get_value("Cost Center", cost_center, ["lft", "rgt"], as_dict=1)
|
||||
args.update(lft_rgt)
|
||||
|
||||
condition = " and gle.posting_date <= %(month_end_date)s" if args.get("month_end_date") else ""
|
||||
|
||||
return flt(frappe.db.sql("""
|
||||
select sum(gle.debit) - sum(gle.credit)
|
||||
from `tabGL Entry` gle
|
||||
where gle.account=%(account)s
|
||||
and exists(select name from `tabCost Center`
|
||||
where lft>=%(lft)s and rgt<=%(rgt)s and name=gle.cost_center)
|
||||
and gle.fiscal_year=%(fiscal_year)s
|
||||
and gle.company=%(company)s
|
||||
and gle.docstatus=1
|
||||
{condition}
|
||||
""".format(condition=condition), (args))[0][0])
|
120
erpnext/accounts/doctype/budget/test_budget.py
Normal file
120
erpnext/accounts/doctype/budget/test_budget.py
Normal file
@ -0,0 +1,120 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# See license.txt
|
||||
from __future__ import unicode_literals
|
||||
|
||||
import frappe
|
||||
import unittest
|
||||
from erpnext.accounts.doctype.budget.budget import get_actual_expense, BudgetError
|
||||
from erpnext.accounts.doctype.journal_entry.test_journal_entry import make_journal_entry
|
||||
|
||||
class TestBudget(unittest.TestCase):
|
||||
def test_monthly_budget_crossed_ignore(self):
|
||||
set_total_expense_zero("2013-02-28")
|
||||
|
||||
budget = make_budget()
|
||||
|
||||
jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
|
||||
"_Test Bank - _TC", 40000, "_Test Cost Center - _TC", submit=True)
|
||||
|
||||
self.assertTrue(frappe.db.get_value("GL Entry",
|
||||
{"voucher_type": "Journal Entry", "voucher_no": jv.name}))
|
||||
|
||||
budget.cancel()
|
||||
|
||||
def test_monthly_budget_crossed_stop(self):
|
||||
set_total_expense_zero("2013-02-28")
|
||||
|
||||
budget = make_budget()
|
||||
|
||||
frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
|
||||
|
||||
jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
|
||||
"_Test Bank - _TC", 40000, "_Test Cost Center - _TC")
|
||||
|
||||
self.assertRaises(BudgetError, jv.submit)
|
||||
|
||||
budget.load_from_db()
|
||||
budget.cancel()
|
||||
|
||||
def test_yearly_budget_crossed_stop(self):
|
||||
set_total_expense_zero("2013-02-28")
|
||||
|
||||
budget = make_budget()
|
||||
|
||||
jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
|
||||
"_Test Bank - _TC", 150000, "_Test Cost Center - _TC")
|
||||
|
||||
self.assertRaises(BudgetError, jv.submit)
|
||||
|
||||
budget.cancel()
|
||||
|
||||
def test_monthly_budget_on_cancellation(self):
|
||||
set_total_expense_zero("2013-02-28")
|
||||
|
||||
budget = make_budget()
|
||||
|
||||
jv1 = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
|
||||
"_Test Bank - _TC", 20000, "_Test Cost Center - _TC", submit=True)
|
||||
|
||||
self.assertTrue(frappe.db.get_value("GL Entry",
|
||||
{"voucher_type": "Journal Entry", "voucher_no": jv1.name}))
|
||||
|
||||
jv2 = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
|
||||
"_Test Bank - _TC", 20000, "_Test Cost Center - _TC", submit=True)
|
||||
|
||||
self.assertTrue(frappe.db.get_value("GL Entry",
|
||||
{"voucher_type": "Journal Entry", "voucher_no": jv2.name}))
|
||||
|
||||
frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
|
||||
|
||||
self.assertRaises(BudgetError, jv1.cancel)
|
||||
|
||||
budget.load_from_db()
|
||||
budget.cancel()
|
||||
|
||||
def test_monthly_budget_against_group_cost_center(self):
|
||||
set_total_expense_zero("2013-02-28")
|
||||
set_total_expense_zero("2013-02-28", "_Test Cost Center 2 - _TC")
|
||||
|
||||
budget = make_budget("_Test Company - _TC")
|
||||
frappe.db.set_value("Budget", budget.name, "action_if_accumulated_monthly_budget_exceeded", "Stop")
|
||||
|
||||
jv = make_journal_entry("_Test Account Cost for Goods Sold - _TC",
|
||||
"_Test Bank - _TC", 40000, "_Test Cost Center 2 - _TC")
|
||||
|
||||
self.assertRaises(BudgetError, jv.submit)
|
||||
|
||||
budget.load_from_db()
|
||||
budget.cancel()
|
||||
|
||||
def set_total_expense_zero(posting_date, cost_center=None):
|
||||
existing_expense = get_actual_expense({
|
||||
"account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"cost_center": cost_center or "_Test Cost Center - _TC",
|
||||
"monthly_end_date": posting_date,
|
||||
"company": "_Test Company",
|
||||
"fiscal_year": "_Test Fiscal Year 2013"
|
||||
}, cost_center or "_Test Cost Center - _TC")
|
||||
|
||||
make_journal_entry("_Test Account Cost for Goods Sold - _TC",
|
||||
"_Test Bank - _TC", -existing_expense, "_Test Cost Center - _TC", submit=True)
|
||||
|
||||
def make_budget(cost_center=None):
|
||||
budget = frappe.new_doc("Budget")
|
||||
budget.cost_center = cost_center or "_Test Cost Center - _TC"
|
||||
budget.fiscal_year = "_Test Fiscal Year 2013"
|
||||
budget.monthly_distribution = "_Test Distribution"
|
||||
budget.company = "_Test Company"
|
||||
budget.action_if_annual_budget_exceeded = "Stop"
|
||||
budget.action_if_accumulated_monthly_budget_exceeded = "Ignore"
|
||||
|
||||
budget.append("accounts", {
|
||||
"account": "_Test Account Cost for Goods Sold - _TC",
|
||||
"budget_amount": 100000
|
||||
})
|
||||
|
||||
budget.insert()
|
||||
budget.submit()
|
||||
|
||||
return budget
|
88
erpnext/accounts/doctype/budget_account/budget_account.json
Normal file
88
erpnext/accounts/doctype/budget_account/budget_account.json
Normal file
@ -0,0 +1,88 @@
|
||||
{
|
||||
"allow_copy": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
"creation": "2016-05-16 11:54:09.286135",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"document_type": "",
|
||||
"editable_grid": 1,
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "account",
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Account",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"options": "Account",
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"bold": 0,
|
||||
"collapsible": 0,
|
||||
"fieldname": "budget_amount",
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Budget Amount",
|
||||
"length": 0,
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"precision": "",
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
"reqd": 1,
|
||||
"search_index": 0,
|
||||
"set_only_once": 0,
|
||||
"unique": 0
|
||||
}
|
||||
],
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 0,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2016-07-11 03:27:58.705376",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "Budget Account",
|
||||
"name_case": "",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 1,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0,
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_seen": 0
|
||||
}
|
10
erpnext/accounts/doctype/budget_account/budget_account.py
Normal file
10
erpnext/accounts/doctype/budget_account/budget_account.py
Normal file
@ -0,0 +1,10 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class BudgetAccount(Document):
|
||||
pass
|
@ -1 +0,0 @@
|
||||
Budget amounts for year and distribution for parent Cost Center.
|
@ -1 +0,0 @@
|
||||
from __future__ import unicode_literals
|
@ -1,9 +0,0 @@
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
|
||||
# License: GNU General Public License v3. See license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class BudgetDetail(Document):
|
||||
pass
|
@ -3,12 +3,12 @@
|
||||
|
||||
//c-form js file
|
||||
// -----------------------------
|
||||
frappe.require("assets/erpnext/js/utils.js");
|
||||
|
||||
|
||||
cur_frm.fields_dict.invoices.grid.get_field("invoice_no").get_query = function(doc) {
|
||||
return {
|
||||
filters: {
|
||||
"docstatus": 1,
|
||||
"docstatus": 1,
|
||||
"customer": doc.customer,
|
||||
"company": doc.company,
|
||||
"c_form_applicable": 'Yes',
|
||||
|
@ -18,17 +18,17 @@ class CForm(Document):
|
||||
`tabSales Invoice` where name = %s and docstatus = 1""", d.invoice_no)
|
||||
|
||||
if inv and inv[0][0] != 'Yes':
|
||||
frappe.throw("C-form is not applicable for Invoice: {0}".format(d.invoice_no))
|
||||
frappe.throw(_("C-form is not applicable for Invoice: {0}".format(d.invoice_no)))
|
||||
|
||||
elif inv and inv[0][1] and inv[0][1] != self.name:
|
||||
frappe.throw("""Invoice {0} is tagged in another C-form: {1}.
|
||||
frappe.throw(_("""Invoice {0} is tagged in another C-form: {1}.
|
||||
If you want to change C-form no for this invoice,
|
||||
please remove invoice no from the previous c-form and then try again"""\
|
||||
.format(d.invoice_no, inv[0][1]))
|
||||
.format(d.invoice_no, inv[0][1])))
|
||||
|
||||
elif not inv:
|
||||
frappe.throw("Row {0}: Invoice {1} is invalid, it might be cancelled / does not exist. \
|
||||
Please enter a valid Invoice".format(d.idx, d.invoice_no))
|
||||
frappe.throw(_("Row {0}: Invoice {1} is invalid, it might be cancelled / does not exist. \
|
||||
Please enter a valid Invoice".format(d.idx, d.invoice_no)))
|
||||
|
||||
def on_update(self):
|
||||
""" Update C-Form No on invoices"""
|
||||
|
@ -2,10 +2,12 @@
|
||||
"allow_copy": 0,
|
||||
"allow_import": 0,
|
||||
"allow_rename": 0,
|
||||
"beta": 0,
|
||||
"creation": "2013-02-22 01:27:38",
|
||||
"custom": 0,
|
||||
"docstatus": 0,
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"fields": [
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
@ -15,6 +17,7 @@
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Invoice No",
|
||||
@ -23,6 +26,7 @@
|
||||
"options": "Sales Invoice",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": "160px",
|
||||
"read_only": 0,
|
||||
"report_hide": 0,
|
||||
@ -40,6 +44,7 @@
|
||||
"fieldtype": "Date",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Invoice Date",
|
||||
@ -47,6 +52,7 @@
|
||||
"no_copy": 0,
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": "120px",
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
@ -65,6 +71,7 @@
|
||||
"fieldtype": "Link",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Territory",
|
||||
@ -73,6 +80,7 @@
|
||||
"options": "Territory",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": "120px",
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
@ -90,6 +98,7 @@
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Net Total",
|
||||
@ -98,6 +107,7 @@
|
||||
"options": "Company:company:default_currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": "120px",
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
@ -115,6 +125,7 @@
|
||||
"fieldtype": "Currency",
|
||||
"hidden": 0,
|
||||
"ignore_user_permissions": 0,
|
||||
"ignore_xss_filter": 0,
|
||||
"in_filter": 0,
|
||||
"in_list_view": 1,
|
||||
"label": "Grand Total",
|
||||
@ -123,6 +134,7 @@
|
||||
"options": "Company:company:default_currency",
|
||||
"permlevel": 0,
|
||||
"print_hide": 0,
|
||||
"print_hide_if_no_value": 0,
|
||||
"print_width": "120px",
|
||||
"read_only": 1,
|
||||
"report_hide": 0,
|
||||
@ -136,18 +148,21 @@
|
||||
"hide_heading": 0,
|
||||
"hide_toolbar": 0,
|
||||
"idx": 1,
|
||||
"image_view": 0,
|
||||
"in_create": 0,
|
||||
"in_dialog": 0,
|
||||
"is_submittable": 0,
|
||||
"issingle": 0,
|
||||
"istable": 1,
|
||||
"max_attachments": 0,
|
||||
"modified": "2015-11-16 06:29:43.221484",
|
||||
"modified": "2016-07-11 03:27:58.768719",
|
||||
"modified_by": "Administrator",
|
||||
"module": "Accounts",
|
||||
"name": "C-Form Invoice Detail",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"quick_entry": 0,
|
||||
"read_only": 0,
|
||||
"read_only_onload": 0
|
||||
"read_only_onload": 0,
|
||||
"track_seen": 0
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
// Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and contributors
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.provide("erpnext.cheque_print");
|
||||
|
||||
frappe.ui.form.on('Cheque Print Template', {
|
||||
refresh: function(frm) {
|
||||
if(!frm.doc.__islocal) {
|
||||
frm.add_custom_button(frm.doc.has_print_format?__("Update Print Format"):__("Create Print Format"),
|
||||
function() {
|
||||
erpnext.cheque_print.view_cheque_print(frm);
|
||||
}).addClass("btn-primary");
|
||||
|
||||
$(frm.fields_dict.cheque_print_preview.wrapper).empty()
|
||||
|
||||
|
||||
var template = '<div style="position: relative; overflow-x: scroll;">\
|
||||
<div id="cheque_preview" style="width: {{ cheque_width }}cm; \
|
||||
height: {{ cheque_height }}cm;\
|
||||
background-repeat: no-repeat;\
|
||||
background-size: cover;">\
|
||||
<span style="top: {{ acc_pay_dist_from_top_edge }}cm;\
|
||||
left: {{ acc_pay_dist_from_left_edge }}cm;\
|
||||
border-bottom: solid 1px;border-top:solid 1px;\
|
||||
position: absolute;"> {{ message_to_show || __("Account Pay Only") }} </span>\
|
||||
<span style="top: {{ date_dist_from_top_edge }}cm;\
|
||||
left: {{ date_dist_from_left_edge }}cm;\
|
||||
position: absolute;"> {{ frappe.datetime.obj_to_user() }} </span>\
|
||||
<span style="top: {{ acc_no_dist_from_top_edge }}cm;\
|
||||
left: {{ acc_no_dist_from_left_edge }}cm;\
|
||||
position: absolute;"> Acc. No. </span>\
|
||||
<span style="top: {{ payer_name_from_top_edge }}cm;\
|
||||
left: {{ payer_name_from_left_edge }}cm;\
|
||||
position: absolute;"> Payer Name </span>\
|
||||
<span style="top:{{ amt_in_words_from_top_edge }}cm;\
|
||||
left: {{ amt_in_words_from_left_edge }}cm;\
|
||||
position: absolute;\
|
||||
display: block;\
|
||||
width: {{ amt_in_word_width }}cm;\
|
||||
line-height: {{ amt_in_words_line_spacing }}cm;\
|
||||
word-wrap: break-word;"> Amount in Words </span>\
|
||||
<span style="top: {{ amt_in_figures_from_top_edge }}cm;\
|
||||
left: {{ amt_in_figures_from_left_edge }}cm;\
|
||||
position: absolute;"> 1000 </span>\
|
||||
<span style="top: {{ signatory_from_top_edge }}cm;\
|
||||
left: {{ signatory_from_left_edge }}cm;\
|
||||
position: absolute;"> Signatory Name </span>\
|
||||
</div>\
|
||||
</div>';
|
||||
|
||||
$(frappe.render(template, frm.doc)).appendTo(frm.fields_dict.cheque_print_preview.wrapper)
|
||||
|
||||
if (frm.doc.scanned_cheque) {
|
||||
$(frm.fields_dict.cheque_print_preview.wrapper).find("#cheque_preview").css('background-image', 'url(' + frm.doc.scanned_cheque + ')');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
erpnext.cheque_print.view_cheque_print = function(frm) {
|
||||
frappe.call({
|
||||
method: "erpnext.accounts.doctype.cheque_print_template.cheque_print_template.create_or_update_cheque_print_format",
|
||||
args:{
|
||||
"template_name": frm.doc.name
|
||||
},
|
||||
callback: function(r) {
|
||||
if (!r.exe && !frm.doc.has_print_format) {
|
||||
var doc = frappe.model.sync(r.message);
|
||||
frappe.set_route("Form", r.message.doctype, r.message.name);
|
||||
}
|
||||
else {
|
||||
frappe.msgprint(__("Print settings updated in respective print format"))
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,89 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
from frappe import _
|
||||
|
||||
class ChequePrintTemplate(Document):
|
||||
pass
|
||||
|
||||
@frappe.whitelist()
|
||||
def create_or_update_cheque_print_format(template_name):
|
||||
if not frappe.db.exists("Print Format", template_name):
|
||||
cheque_print = frappe.new_doc("Print Format")
|
||||
cheque_print.update({
|
||||
"doc_type": "Payment Entry",
|
||||
"standard": "No",
|
||||
"custom_format": 1,
|
||||
"print_format_type": "Server",
|
||||
"name": template_name
|
||||
})
|
||||
else:
|
||||
cheque_print = frappe.get_doc("Print Format", template_name)
|
||||
|
||||
doc = frappe.get_doc("Cheque Print Template", template_name)
|
||||
|
||||
cheque_print.html = """
|
||||
<div style="position: relative; top:%(starting_position_from_top_edge)scm">
|
||||
<div style="width:%(cheque_width)scm;height:%(cheque_height)scm;">
|
||||
<span style="top: {{ %(acc_pay_dist_from_top_edge)s }}cm; left: {{ %(acc_pay_dist_from_left_edge)s }}cm;
|
||||
border-bottom: solid 1px;border-top:solid 1px; position: absolute;">
|
||||
%(message_to_show)s
|
||||
</span>
|
||||
<span style="top:%(date_dist_from_top_edge)s cm; left:%(date_dist_from_left_edge)scm;
|
||||
position: absolute;">
|
||||
{{doc.reference_date or '' }}
|
||||
</span>
|
||||
<span style="top:%(acc_no_dist_from_top_edge)scm;left:%(acc_no_dist_from_left_edge)scm;
|
||||
position: absolute;">
|
||||
{{ doc.account_no or '' }}
|
||||
</span>
|
||||
<span style="top:%(payer_name_from_top_edge)scm;left: %(payer_name_from_left_edge)scm;
|
||||
position: absolute;">
|
||||
{{doc.party}}
|
||||
</span>
|
||||
<span style="top:%(amt_in_words_from_top_edge)scm; left:%(amt_in_words_from_left_edge)scm;
|
||||
position: absolute; display: block; width: %(amt_in_word_width)scm;
|
||||
line-height:%(amt_in_words_line_spacing)scm; word-wrap: break-word;">
|
||||
{{frappe.utils.money_in_words(doc.base_paid_amount or doc.base_received_amount)}}
|
||||
</span>
|
||||
<span style="top:%(amt_in_figures_from_top_edge)scm;left: %(amt_in_figures_from_left_edge)scm;
|
||||
position: absolute;">
|
||||
{{doc.get_formatted("base_paid_amount") or doc.get_formatted("base_received_amount")}}
|
||||
</span>
|
||||
<span style="top:%(signatory_from_top_edge)scm;left: %(signatory_from_left_edge)scm;
|
||||
position: absolute;">
|
||||
{{doc.company}}
|
||||
</span>
|
||||
</div>
|
||||
</div>"""%{
|
||||
"starting_position_from_top_edge": doc.starting_position_from_top_edge \
|
||||
if doc.cheque_size == "A4" else 0.0,
|
||||
"cheque_width": doc.cheque_width, "cheque_height": doc.cheque_height,
|
||||
"acc_pay_dist_from_top_edge": doc.acc_pay_dist_from_top_edge,
|
||||
"acc_pay_dist_from_left_edge": doc.acc_pay_dist_from_left_edge,
|
||||
"message_to_show": doc.message_to_show if doc.message_to_show else _("Account Pay Only"),
|
||||
"date_dist_from_top_edge": doc.date_dist_from_top_edge,
|
||||
"date_dist_from_left_edge": doc.date_dist_from_left_edge,
|
||||
"acc_no_dist_from_top_edge": doc.acc_no_dist_from_top_edge,
|
||||
"acc_no_dist_from_left_edge": doc.acc_no_dist_from_left_edge,
|
||||
"payer_name_from_top_edge": doc.payer_name_from_top_edge,
|
||||
"payer_name_from_left_edge": doc.payer_name_from_left_edge,
|
||||
"amt_in_words_from_top_edge": doc.amt_in_words_from_top_edge,
|
||||
"amt_in_words_from_left_edge": doc.amt_in_words_from_left_edge,
|
||||
"amt_in_word_width": doc.amt_in_word_width,
|
||||
"amt_in_words_line_spacing": doc.amt_in_words_line_spacing,
|
||||
"amt_in_figures_from_top_edge": doc.amt_in_figures_from_top_edge,
|
||||
"amt_in_figures_from_left_edge": doc.amt_in_figures_from_left_edge,
|
||||
"signatory_from_top_edge": doc.signatory_from_top_edge,
|
||||
"signatory_from_left_edge": doc.signatory_from_left_edge
|
||||
}
|
||||
|
||||
cheque_print.save(ignore_permissions=True)
|
||||
|
||||
frappe.db.set_value("Cheque Print Template", template_name, "has_print_format", 1)
|
||||
|
||||
return cheque_print
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user