Merge branch 'develop' into payment-reconc-party-validation-fix

This commit is contained in:
Afshan 2021-08-18 16:03:47 +05:30 committed by GitHub
commit 2416b3a1ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
167 changed files with 6623 additions and 3923 deletions

View File

@ -154,7 +154,8 @@
"before": true,
"beforeEach": true,
"onScan": true,
"html2canvas": true,
"extend_cscript": true,
"localforage": true,
"localforage": true
}
}

View File

@ -32,11 +32,15 @@ if __name__ == "__main__":
if response.ok:
payload = response.json()
title = payload.get("title", "").lower()
head_sha = payload.get("head", {}).get("sha")
body = payload.get("body", "").lower()
title = (payload.get("title") or "").lower().strip()
head_sha = (payload.get("head") or {}).get("sha")
body = (payload.get("body") or "").lower()
if title.startswith("feat") and head_sha and "no-docs" not in body:
if (title.startswith("feat")
and head_sha
and "no-docs" not in body
and "backport" not in body
):
if docs_link_exists(body):
print("Documentation Link Found. You're Awesome! 🎉")

View File

@ -1,6 +1,12 @@
name: Patch
on: [pull_request, workflow_dispatch]
on:
pull_request:
paths-ignore:
- '**.js'
- '**.md'
workflow_dispatch:
jobs:
test:

View File

@ -2,9 +2,15 @@ name: Server
on:
pull_request:
paths-ignore:
- '**.js'
- '**.md'
workflow_dispatch:
push:
branches: [ develop ]
paths-ignore:
- '**.js'
- '**.md'
jobs:
test:

View File

@ -2,6 +2,8 @@ name: UI
on:
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:
jobs:
@ -102,7 +104,7 @@ jobs:
- name: UI Tests
run: cd ~/frappe-bench/ && bench --site test_site run-ui-tests erpnext --headless
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
CYPRESS_RECORD_KEY: 60a8e3bf-08f5-45b1-9269-2b207d7d30cd
- name: Show bench console if tests failed
if: ${{ failure() }}

View File

@ -0,0 +1,113 @@
context('Organizational Chart', () => {
before(() => {
cy.login();
cy.visit('/app/website');
cy.awesomebar('Organizational Chart');
cy.wait(500);
cy.url().should('include', '/organizational-chart');
cy.window().its('frappe.csrf_token').then(csrf_token => {
return cy.request({
url: `/api/method/erpnext.tests.ui_test_helpers.create_employee_records`,
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
'X-Frappe-CSRF-Token': csrf_token
},
timeout: 60000
}).then(res => {
expect(res.status).eq(200);
cy.get('.frappe-control[data-fieldname=company] input').focus().as('input');
cy.get('@input')
.clear({ force: true })
.type('Test Org Chart{enter}', { force: true })
.blur({ force: true });
});
});
});
it('renders root nodes and loads children for the first expandable node', () => {
// check rendered root nodes and the node name, title, connections
cy.get('.hierarchy').find('.root-level ul.node-children').children()
.should('have.length', 2)
.first()
.as('first-child');
cy.get('@first-child').get('.node-name').contains('Test Employee 1');
cy.get('@first-child').get('.node-info').find('.node-title').contains('CEO');
cy.get('@first-child').get('.node-info').find('.node-connections').contains('· 2 Connections');
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
// children of 1st root visible
cy.get(`div[data-parent="${employee_records.message[0]}"]`).as('child-node');
cy.get('@child-node')
.should('have.length', 1)
.should('be.visible');
cy.get('@child-node').get('.node-name').contains('Test Employee 3');
// connectors between first root node and immediate child
cy.get(`path[data-parent="${employee_records.message[0]}"]`)
.should('be.visible')
.invoke('attr', 'data-child')
.should('equal', employee_records.message[2]);
});
});
it('hides active nodes children and connectors on expanding sibling node', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
// click sibling
cy.get(`#${employee_records.message[1]}`)
.click()
.should('have.class', 'active');
// child nodes and connectors hidden
cy.get(`[data-parent="${employee_records.message[0]}"]`).should('not.be.visible');
cy.get(`path[data-parent="${employee_records.message[0]}"]`).should('not.be.visible');
});
});
it('collapses previous level nodes and refreshes connectors on expanding child node', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
// click child node
cy.get(`#${employee_records.message[3]}`)
.click()
.should('have.class', 'active');
// previous level nodes: parent should be on active-path; other nodes should be collapsed
cy.get(`#${employee_records.message[0]}`).should('have.class', 'collapsed');
cy.get(`#${employee_records.message[1]}`).should('have.class', 'active-path');
// previous level connectors refreshed
cy.get(`path[data-parent="${employee_records.message[1]}"]`)
.should('have.class', 'collapsed-connector');
// child node's children and connectors rendered
cy.get(`[data-parent="${employee_records.message[3]}"]`).should('be.visible');
cy.get(`path[data-parent="${employee_records.message[3]}"]`).should('be.visible');
});
});
it('expands previous level nodes', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
cy.get(`#${employee_records.message[0]}`)
.click()
.should('have.class', 'active');
cy.get(`[data-parent="${employee_records.message[0]}"]`)
.should('be.visible');
cy.get('ul.hierarchy').children().should('have.length', 2);
cy.get(`#connectors`).children().should('have.length', 1);
});
});
it('edit node navigates to employee master', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
cy.get(`#${employee_records.message[0]}`).find('.btn-edit-node')
.click();
cy.url().should('include', `/employee/${employee_records.message[0]}`);
});
});
});

View File

@ -0,0 +1,190 @@
context('Organizational Chart Mobile', () => {
before(() => {
cy.login();
cy.viewport(375, 667);
cy.visit('/app/website');
cy.awesomebar('Organizational Chart');
cy.window().its('frappe.csrf_token').then(csrf_token => {
return cy.request({
url: `/api/method/erpnext.tests.ui_test_helpers.create_employee_records`,
method: 'POST',
headers: {
Accept: 'application/json',
'Content-Type': 'application/json',
'X-Frappe-CSRF-Token': csrf_token
},
timeout: 60000
}).then(res => {
expect(res.status).eq(200);
cy.get('.frappe-control[data-fieldname=company] input').focus().as('input');
cy.get('@input')
.clear({ force: true })
.type('Test Org Chart{enter}', { force: true })
.blur({ force: true });
});
});
});
it('renders root nodes', () => {
// check rendered root nodes and the node name, title, connections
cy.get('.hierarchy-mobile').find('.root-level').children()
.should('have.length', 2)
.first()
.as('first-child');
cy.get('@first-child').get('.node-name').contains('Test Employee 1');
cy.get('@first-child').get('.node-info').find('.node-title').contains('CEO');
cy.get('@first-child').get('.node-info').find('.node-connections').contains('· 2');
});
it('expands root node', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
cy.get(`#${employee_records.message[1]}`)
.click()
.should('have.class', 'active');
// other root node removed
cy.get(`#${employee_records.message[0]}`).should('not.exist');
// children of active root node
cy.get('.hierarchy-mobile').find('.level').first().find('ul.node-children').children()
.should('have.length', 2);
cy.get(`div[data-parent="${employee_records.message[1]}"]`).first().as('child-node');
cy.get('@child-node').should('be.visible');
cy.get('@child-node')
.get('.node-name')
.contains('Test Employee 4');
// connectors between root node and immediate children
cy.get(`path[data-parent="${employee_records.message[1]}"]`).as('connectors');
cy.get('@connectors')
.should('have.length', 2)
.should('be.visible');
cy.get('@connectors')
.first()
.invoke('attr', 'data-child')
.should('eq', employee_records.message[3]);
});
});
it('expands child node', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
cy.get(`#${employee_records.message[3]}`)
.click()
.should('have.class', 'active')
.as('expanded_node');
// 2 levels on screen; 1 on active path; 1 collapsed
cy.get('.hierarchy-mobile').children().should('have.length', 2);
cy.get(`#${employee_records.message[1]}`).should('have.class', 'active-path');
// children of expanded node visible
cy.get('@expanded_node')
.next()
.should('have.class', 'node-children')
.as('node-children');
cy.get('@node-children').children().should('have.length', 1);
cy.get('@node-children')
.first()
.get('.node-card')
.should('have.class', 'active-child')
.contains('Test Employee 7');
// orphan connectors removed
cy.get(`#connectors`).children().should('have.length', 2);
});
});
it('renders sibling group', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
// sibling group visible for parent
cy.get(`#${employee_records.message[1]}`)
.next()
.as('sibling_group');
cy.get('@sibling_group')
.should('have.attr', 'data-parent', 'undefined')
.should('have.class', 'node-group')
.and('have.class', 'collapsed');
cy.get('@sibling_group').get('.avatar-group').children().as('siblings');
cy.get('@siblings').should('have.length', 1);
cy.get('@siblings')
.first()
.should('have.attr', 'title', 'Test Employee 1');
});
});
it('expands previous level nodes', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
cy.get(`#${employee_records.message[6]}`)
.click()
.should('have.class', 'active');
// clicking on previous level node should remove all the nodes ahead
// and expand that node
cy.get(`#${employee_records.message[3]}`).click();
cy.get(`#${employee_records.message[3]}`)
.should('have.class', 'active')
.should('not.have.class', 'active-path');
cy.get(`#${employee_records.message[6]}`).should('have.class', 'active-child');
cy.get('.hierarchy-mobile').children().should('have.length', 2);
cy.get(`#connectors`).children().should('have.length', 2);
});
});
it('expands sibling group', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
// sibling group visible for parent
cy.get(`#${employee_records.message[6]}`).click();
cy.get(`#${employee_records.message[3]}`)
.next()
.click();
// siblings of parent should be visible
cy.get('.hierarchy-mobile').prev().as('sibling_group');
cy.get('@sibling_group')
.should('exist')
.should('have.class', 'sibling-group')
.should('not.have.class', 'collapsed');
cy.get(`#${employee_records.message[1]}`)
.should('be.visible')
.should('have.class', 'active');
cy.get(`[data-parent="${employee_records.message[1]}"]`)
.should('be.visible')
.should('have.length', 2)
.should('have.class', 'active-child');
});
});
it('goes to the respective level after clicking on non-collapsed sibling group', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(() => {
// click on non-collapsed sibling group
cy.get('.hierarchy-mobile')
.prev()
.click();
// should take you to that level
cy.get('.hierarchy-mobile').find('li.level .node-card').should('have.length', 2);
});
});
it('edit node navigates to employee master', () => {
cy.call('erpnext.tests.ui_test_helpers.get_employee_records').then(employee_records => {
cy.get(`#${employee_records.message[0]}`).find('.btn-edit-node')
.click();
cy.url().should('include', `/employee/${employee_records.message[0]}`);
});
});
});

View File

@ -5,7 +5,7 @@ import frappe
from erpnext.hooks import regional_overrides
from frappe.utils import getdate
__version__ = '13.8.0'
__version__ = '13.9.0'
def get_default_company(user=None):
'''Get default company for user'''

View File

@ -20,6 +20,7 @@
"book_asset_depreciation_entry_automatically",
"unlink_advance_payment_on_cancelation_of_order",
"post_change_gl_entries",
"enable_discount_accounting",
"tax_settings_section",
"determine_address_tax_category_from",
"column_break_19",
@ -260,6 +261,13 @@
"fieldname": "post_change_gl_entries",
"fieldtype": "Check",
"label": "Create Ledger Entries for Change Amount"
},
{
"default": "0",
"description": "If enabled, additional ledger entries will be made for discounts in a separate Discount Account",
"fieldname": "enable_discount_accounting",
"fieldtype": "Check",
"label": "Enable Discount Accounting"
}
],
"icon": "icon-cog",
@ -267,7 +275,7 @@
"index_web_pages_for_search": 1,
"issingle": 1,
"links": [],
"modified": "2021-08-09 13:08:01.335416",
"modified": "2021-08-09 13:08:04.335416",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Accounts Settings",

View File

@ -21,6 +21,7 @@ class AccountsSettings(Document):
self.validate_stale_days()
self.enable_payment_schedule_in_print()
self.toggle_discount_accounting_fields()
def validate_stale_days(self):
if not self.allow_stale and cint(self.stale_days) <= 0:
@ -33,3 +34,22 @@ class AccountsSettings(Document):
for doctype in ("Sales Order", "Sales Invoice", "Purchase Order", "Purchase Invoice"):
make_property_setter(doctype, "due_date", "print_hide", show_in_print, "Check", validate_fields_for_doctype=False)
make_property_setter(doctype, "payment_schedule", "print_hide", 0 if show_in_print else 1, "Check", validate_fields_for_doctype=False)
def toggle_discount_accounting_fields(self):
enable_discount_accounting = cint(self.enable_discount_accounting)
for doctype in ["Sales Invoice Item", "Purchase Invoice Item"]:
make_property_setter(doctype, "discount_account", "hidden", not(enable_discount_accounting), "Check", validate_fields_for_doctype=False)
if enable_discount_accounting:
make_property_setter(doctype, "discount_account", "mandatory_depends_on", "eval: doc.discount_amount", "Code", validate_fields_for_doctype=False)
else:
make_property_setter(doctype, "discount_account", "mandatory_depends_on", "", "Code", validate_fields_for_doctype=False)
for doctype in ["Sales Invoice", "Purchase Invoice"]:
make_property_setter(doctype, "additional_discount_account", "hidden", not(enable_discount_accounting), "Check", validate_fields_for_doctype=False)
if enable_discount_accounting:
make_property_setter(doctype, "additional_discount_account", "mandatory_depends_on", "eval: doc.discount_amount", "Code", validate_fields_for_doctype=False)
else:
make_property_setter(doctype, "additional_discount_account", "mandatory_depends_on", "", "Code", validate_fields_for_doctype=False)
make_property_setter("Item", "default_discount_account", "hidden", not(enable_discount_accounting), "Check", validate_fields_for_doctype=False)

View File

@ -0,0 +1,31 @@
{
"actions": [],
"creation": "2021-05-06 16:18:25.410476",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"campaign"
],
"fields": [
{
"fieldname": "campaign",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Campaign",
"options": "Campaign"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-05-07 10:43:49.717633",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Campaign Item",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -0,0 +1,8 @@
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class CampaignItem(Document):
pass

View File

@ -57,7 +57,7 @@ def test_create_test_data():
})
item_price.insert()
# create test item pricing rule
if not frappe.db.exists("Pricing Rule","_Test Pricing Rule for _Test Item"):
if not frappe.db.exists("Pricing Rule", {"title": "_Test Pricing Rule for _Test Item"}):
item_pricing_rule = frappe.get_doc({
"doctype": "Pricing Rule",
"title": "_Test Pricing Rule for _Test Item",
@ -86,14 +86,15 @@ def test_create_test_data():
sales_partner.insert()
# create test item coupon code
if not frappe.db.exists("Coupon Code", "SAVE30"):
pricing_rule = frappe.db.get_value("Pricing Rule", {"title": "_Test Pricing Rule for _Test Item"}, ['name'])
coupon_code = frappe.get_doc({
"doctype": "Coupon Code",
"coupon_name":"SAVE30",
"coupon_code":"SAVE30",
"pricing_rule": "_Test Pricing Rule for _Test Item",
"valid_from": "2014-01-01",
"maximum_use":1,
"used":0
"doctype": "Coupon Code",
"coupon_name":"SAVE30",
"coupon_code":"SAVE30",
"pricing_rule": pricing_rule,
"valid_from": "2014-01-01",
"maximum_use":1,
"used":0
})
coupon_code.insert()
@ -102,7 +103,7 @@ class TestCouponCode(unittest.TestCase):
test_create_test_data()
def tearDown(self):
frappe.set_user("Administrator")
frappe.set_user("Administrator")
def test_sales_order_with_coupon_code(self):
frappe.db.set_value("Coupon Code", "SAVE30", "used", 0)

View File

@ -0,0 +1,31 @@
{
"actions": [],
"creation": "2021-05-06 16:12:42.558878",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"customer_group"
],
"fields": [
{
"fieldname": "customer_group",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Customer Group",
"options": "Customer Group"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-05-07 10:39:21.563506",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Customer Group Item",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -0,0 +1,8 @@
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class CustomerGroupItem(Document):
pass

View File

@ -0,0 +1,31 @@
{
"actions": [],
"creation": "2021-05-05 14:04:54.266353",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"customer"
],
"fields": [
{
"fieldname": "customer",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Customer ",
"options": "Customer"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-05-06 10:02:32.967841",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Customer Item",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -0,0 +1,8 @@
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class CustomerItem(Document):
pass

View File

@ -529,7 +529,7 @@ class PaymentEntry(AccountsController):
if self.payment_type == "Receive" \
and self.base_total_allocated_amount < self.base_received_amount + total_deductions \
and self.total_allocated_amount < self.paid_amount + (total_deductions / self.source_exchange_rate):
self.unallocated_amount = (self.received_amount + total_deductions -
self.unallocated_amount = (self.base_received_amount + total_deductions -
self.base_total_allocated_amount) / self.source_exchange_rate
self.unallocated_amount -= included_taxes
elif self.payment_type == "Pay" \

View File

@ -295,6 +295,34 @@ class TestPaymentEntry(unittest.TestCase):
outstanding_amount = flt(frappe.db.get_value("Sales Invoice", si.name, "outstanding_amount"))
self.assertEqual(outstanding_amount, 80)
def test_payment_entry_against_si_usd_to_usd_with_deduction_in_base_currency (self):
si = create_sales_invoice(customer="_Test Customer USD", debit_to="_Test Receivable USD - _TC",
currency="USD", conversion_rate=50, do_not_save=1)
si.plc_conversion_rate = 50
si.save()
si.submit()
pe = get_payment_entry("Sales Invoice", si.name, party_amount=20,
bank_account="_Test Bank USD - _TC", bank_amount=900)
pe.source_exchange_rate = 45.263
pe.target_exchange_rate = 45.263
pe.reference_no = "1"
pe.reference_date = "2016-01-01"
pe.append("deductions", {
"account": "_Test Exchange Gain/Loss - _TC",
"cost_center": "_Test Cost Center - _TC",
"amount": 94.80
})
pe.save()
self.assertEqual(flt(pe.difference_amount, 2), 0.0)
self.assertEqual(flt(pe.unallocated_amount, 2), 0.0)
def test_payment_entry_retrieves_last_exchange_rate(self):
from erpnext.setup.doctype.currency_exchange.test_currency_exchange import test_records, save_new_records

View File

@ -2,12 +2,13 @@
"actions": [],
"allow_import": 1,
"allow_rename": 1,
"autoname": "field:title",
"autoname": "naming_series:",
"creation": "2014-02-21 15:02:51",
"doctype": "DocType",
"engine": "InnoDB",
"field_order": [
"applicability_section",
"naming_series",
"title",
"disable",
"apply_on",
@ -95,8 +96,7 @@
"fieldtype": "Data",
"label": "Title",
"no_copy": 1,
"reqd": 1,
"unique": 1
"reqd": 1
},
{
"default": "0",
@ -571,6 +571,13 @@
"fieldname": "is_recursive",
"fieldtype": "Check",
"label": "Is Recursive"
},
{
"default": "PRLE-.####",
"fieldname": "naming_series",
"fieldtype": "Select",
"label": "Naming Series",
"options": "PRLE-.####"
}
],
"icon": "fa fa-gift",
@ -634,5 +641,6 @@
],
"show_name_in_global_search": 1,
"sort_field": "modified",
"sort_order": "DESC"
}
"sort_order": "DESC",
"title_field": "title"
}

View File

@ -25,22 +25,31 @@ product_discount_fields = ['free_item', 'free_qty', 'free_item_uom',
class PromotionalScheme(Document):
def validate(self):
if not self.selling and not self.buying:
frappe.throw(_("Either 'Selling' or 'Buying' must be selected"), title=_("Mandatory"))
if not (self.price_discount_slabs
or self.product_discount_slabs):
frappe.throw(_("Price or product discount slabs are required"))
def on_update(self):
data = frappe.get_all('Pricing Rule', fields = ["promotional_scheme_id", "name"],
filters = {'promotional_scheme': self.name}) or {}
pricing_rules = frappe.get_all(
'Pricing Rule',
fields = ["promotional_scheme_id", "name", "creation"],
filters = {
'promotional_scheme': self.name,
'applicable_for': self.applicable_for
},
order_by = 'creation asc',
) or {}
self.update_pricing_rules(pricing_rules)
self.update_pricing_rules(data)
def update_pricing_rules(self, data):
def update_pricing_rules(self, pricing_rules):
rules = {}
count = 0
for d in data:
rules[d.get('promotional_scheme_id')] = d.get('name')
names = []
for rule in pricing_rules:
names.append(rule.name)
rules[rule.get('promotional_scheme_id')] = names
docs = get_pricing_rules(self, rules)
@ -57,9 +66,9 @@ class PromotionalScheme(Document):
frappe.msgprint(_("New {0} pricing rules are created").format(count))
def on_trash(self):
for d in frappe.get_all('Pricing Rule',
for rule in frappe.get_all('Pricing Rule',
{'promotional_scheme': self.name}):
frappe.delete_doc('Pricing Rule', d.name)
frappe.delete_doc('Pricing Rule', rule.name)
def get_pricing_rules(doc, rules = {}):
new_doc = []
@ -73,42 +82,80 @@ def get_pricing_rules(doc, rules = {}):
def _get_pricing_rules(doc, child_doc, discount_fields, rules = {}):
new_doc = []
args = get_args_for_pricing_rule(doc)
for d in doc.get(child_doc):
applicable_for = frappe.scrub(doc.get('applicable_for'))
for idx, d in enumerate(doc.get(child_doc)):
if d.name in rules:
pr = frappe.get_doc('Pricing Rule', rules.get(d.name))
for applicable_for_value in args.get(applicable_for):
temp_args = args.copy()
docname = frappe.get_all(
'Pricing Rule',
fields = ["promotional_scheme_id", "name", applicable_for],
filters = {
'promotional_scheme_id': d.name,
applicable_for: applicable_for_value
}
)
if docname:
pr = frappe.get_doc('Pricing Rule', docname[0].get('name'))
temp_args[applicable_for] = applicable_for_value
pr = set_args(temp_args, pr, doc, child_doc, discount_fields, d)
else:
pr = frappe.new_doc("Pricing Rule")
pr.title = doc.name
temp_args[applicable_for] = applicable_for_value
pr = set_args(temp_args, pr, doc, child_doc, discount_fields, d)
new_doc.append(pr)
else:
pr = frappe.new_doc("Pricing Rule")
pr.title = make_autoname("{0}/.####".format(doc.name))
pr.update(args)
for field in (other_fields + discount_fields):
pr.set(field, d.get(field))
pr.promotional_scheme_id = d.name
pr.promotional_scheme = doc.name
pr.disable = d.disable if d.disable else doc.disable
pr.price_or_product_discount = ('Price'
if child_doc == 'price_discount_slabs' else 'Product')
for field in ['items', 'item_groups', 'brands']:
if doc.get(field):
pr.set(field, [])
apply_on = frappe.scrub(doc.get('apply_on'))
for d in doc.get(field):
pr.append(field, {
apply_on: d.get(apply_on),
'uom': d.uom
})
new_doc.append(pr)
applicable_for_values = args.get(applicable_for) or []
for applicable_for_value in applicable_for_values:
pr = frappe.new_doc("Pricing Rule")
pr.title = doc.name
temp_args = args.copy()
temp_args[applicable_for] = applicable_for_value
pr = set_args(temp_args, pr, doc, child_doc, discount_fields, d)
new_doc.append(pr)
return new_doc
def set_args(args, pr, doc, child_doc, discount_fields, child_doc_fields):
pr.update(args)
for field in (other_fields + discount_fields):
pr.set(field, child_doc_fields.get(field))
pr.promotional_scheme_id = child_doc_fields.name
pr.promotional_scheme = doc.name
pr.disable = child_doc_fields.disable if child_doc_fields.disable else doc.disable
pr.price_or_product_discount = ('Price'
if child_doc == 'price_discount_slabs' else 'Product')
for field in ['items', 'item_groups', 'brands']:
if doc.get(field):
pr.set(field, [])
apply_on = frappe.scrub(doc.get('apply_on'))
for d in doc.get(field):
pr.append(field, {
apply_on: d.get(apply_on),
'uom': d.uom
})
return pr
def get_args_for_pricing_rule(doc):
args = { 'promotional_scheme': doc.name }
applicable_for = frappe.scrub(doc.get('applicable_for'))
for d in pricing_rule_fields:
args[d] = doc.get(d)
if d == applicable_for:
items = []
for applicable_for_values in doc.get(applicable_for):
items.append(applicable_for_values.get(applicable_for))
args[d] = items
else:
args[d] = doc.get(d)
return args

View File

@ -7,4 +7,54 @@ import frappe
import unittest
class TestPromotionalScheme(unittest.TestCase):
pass
def test_promotional_scheme(self):
ps = make_promotional_scheme()
price_rules = frappe.get_all('Pricing Rule', fields = ["promotional_scheme_id", "name", "creation"],
filters = {'promotional_scheme': ps.name})
self.assertTrue(len(price_rules),1)
price_doc_details = frappe.db.get_value('Pricing Rule', price_rules[0].name, ['customer', 'min_qty', 'discount_percentage'], as_dict = 1)
self.assertTrue(price_doc_details.customer, '_Test Customer')
self.assertTrue(price_doc_details.min_qty, 4)
self.assertTrue(price_doc_details.discount_percentage, 20)
ps.price_discount_slabs[0].min_qty = 6
ps.append('customer', {
'customer': "_Test Customer 2"})
ps.save()
price_rules = frappe.get_all('Pricing Rule', fields = ["promotional_scheme_id", "name"],
filters = {'promotional_scheme': ps.name})
self.assertTrue(len(price_rules), 2)
price_doc_details = frappe.db.get_value('Pricing Rule', price_rules[1].name, ['customer', 'min_qty', 'discount_percentage'], as_dict = 1)
self.assertTrue(price_doc_details.customer, '_Test Customer 2')
self.assertTrue(price_doc_details.min_qty, 6)
self.assertTrue(price_doc_details.discount_percentage, 20)
price_doc_details = frappe.db.get_value('Pricing Rule', price_rules[0].name, ['customer', 'min_qty', 'discount_percentage'], as_dict = 1)
self.assertTrue(price_doc_details.customer, '_Test Customer')
self.assertTrue(price_doc_details.min_qty, 6)
frappe.delete_doc('Promotional Scheme', ps.name)
price_rules = frappe.get_all('Pricing Rule', fields = ["promotional_scheme_id", "name"],
filters = {'promotional_scheme': ps.name})
self.assertEqual(price_rules, [])
def make_promotional_scheme():
ps = frappe.new_doc('Promotional Scheme')
ps.name = '_Test Scheme'
ps.append('items',{
'item_code': '_Test Item'
})
ps.selling = 1
ps.append('price_discount_slabs',{
'min_qty': 4,
'discount_percentage': 20,
'rule_description': 'Test'
})
ps.applicable_for = 'Customer'
ps.append('customer',{
'customer': "_Test Customer"
})
ps.save()
return ps

View File

@ -283,7 +283,8 @@ erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying.
party: this.frm.doc.supplier,
party_type: "Supplier",
account: this.frm.doc.credit_to,
price_list: this.frm.doc.buying_price_list
price_list: this.frm.doc.buying_price_list,
fetch_payment_terms_template: cint(!this.frm.doc.ignore_default_payment_terms_template)
}, function() {
me.apply_pricing_rule();
me.frm.doc.apply_tds = me.frm.supplier_tds ? 1 : 0;
@ -365,7 +366,7 @@ erpnext.accounts.PurchaseInvoice = class PurchaseInvoice extends erpnext.buying.
items_add(doc, cdt, cdn) {
var row = frappe.get_doc(cdt, cdn);
this.frm.script_manager.copy_from_first_row("items", row,
["expense_account", "cost_center", "project"]);
["expense_account", "discount_account", "cost_center", "project"]);
}
on_submit() {
@ -499,6 +500,16 @@ frappe.ui.form.on("Purchase Invoice", {
'Payment Entry': 'Payment'
}
frm.set_query("additional_discount_account", function() {
return {
filters: {
company: frm.doc.company,
is_group: 0,
report_type: "Profit and Loss",
}
};
});
frm.fields_dict['items'].grid.get_field('deferred_expense_account').get_query = function(doc) {
return {
filters: {
@ -508,6 +519,16 @@ frappe.ui.form.on("Purchase Invoice", {
}
}
}
frm.fields_dict['items'].grid.get_field('discount_account').get_query = function(doc) {
return {
filters: {
'report_type': 'Profit and Loss',
'company': doc.company,
"is_group": 0
}
}
}
},
refresh: function(frm) {
@ -570,4 +591,4 @@ frappe.ui.form.on("Purchase Invoice", {
company: function(frm) {
erpnext.accounts.dimensions.update_dimension(frm, frm.doctype);
},
})
})

View File

@ -448,6 +448,7 @@ class PurchaseInvoice(BuyingController):
self.make_supplier_gl_entry(gl_entries)
self.make_item_gl_entries(gl_entries)
self.make_discount_gl_entries(gl_entries)
if self.check_asset_cwip_enabled():
self.get_asset_gl_entry(gl_entries)
@ -522,6 +523,8 @@ class PurchaseInvoice(BuyingController):
exchange_rate_map, net_rate_map = get_purchase_document_details(self)
enable_discount_accounting = cint(frappe.db.get_single_value('Accounts Settings', 'enable_discount_accounting'))
for item in self.get("items"):
if flt(item.base_net_amount):
account_currency = get_account_currency(item.expense_account)
@ -612,7 +615,7 @@ class PurchaseInvoice(BuyingController):
if (not item.enable_deferred_expense or self.is_return) else item.deferred_expense_account)
if not item.is_fixed_asset:
amount = flt(item.base_net_amount, item.precision("base_net_amount"))
dummy, amount = self.get_amount_and_base_amount(item, enable_discount_accounting)
else:
amount = flt(item.base_net_amount + item.item_tax_amount, item.precision("base_net_amount"))
@ -854,8 +857,11 @@ class PurchaseInvoice(BuyingController):
def make_tax_gl_entries(self, gl_entries):
# tax table gl entries
valuation_tax = {}
enable_discount_accounting = cint(frappe.db.get_single_value('Accounts Settings', 'enable_discount_accounting'))
for tax in self.get("taxes"):
if tax.category in ("Total", "Valuation and Total") and flt(tax.base_tax_amount_after_discount_amount):
amount, base_amount = self.get_tax_amounts(tax, enable_discount_accounting)
if tax.category in ("Total", "Valuation and Total") and flt(base_amount):
account_currency = get_account_currency(tax.account_head)
dr_or_cr = "debit" if tax.add_deduct_tax == "Add" else "credit"
@ -864,21 +870,21 @@ class PurchaseInvoice(BuyingController):
self.get_gl_dict({
"account": tax.account_head,
"against": self.supplier,
dr_or_cr: tax.base_tax_amount_after_discount_amount,
dr_or_cr + "_in_account_currency": tax.base_tax_amount_after_discount_amount \
if account_currency==self.company_currency \
else tax.tax_amount_after_discount_amount,
dr_or_cr: base_amount,
dr_or_cr + "_in_account_currency": base_amount
if account_currency==self.company_currency
else amount,
"cost_center": tax.cost_center
}, account_currency, item=tax)
)
# accumulate valuation tax
if self.is_opening == "No" and tax.category in ("Valuation", "Valuation and Total") and flt(tax.base_tax_amount_after_discount_amount) \
if self.is_opening == "No" and tax.category in ("Valuation", "Valuation and Total") and flt(base_amount) \
and not self.is_internal_transfer():
if self.auto_accounting_for_stock and not tax.cost_center:
frappe.throw(_("Cost Center is required in row {0} in Taxes table for type {1}").format(tax.idx, _(tax.category)))
valuation_tax.setdefault(tax.name, 0)
valuation_tax[tax.name] += \
(tax.add_deduct_tax == "Add" and 1 or -1) * flt(tax.base_tax_amount_after_discount_amount)
(tax.add_deduct_tax == "Add" and 1 or -1) * flt(base_amount)
if self.is_opening == "No" and self.negative_expense_to_be_booked and valuation_tax:
# credit valuation tax amount in "Expenses Included In Valuation"
@ -919,6 +925,13 @@ class PurchaseInvoice(BuyingController):
"remarks": self.remarks or "Accounting Entry for Stock"
}, item=tax))
@property
def enable_discount_accounting(self):
if not hasattr(self, "_enable_discount_accounting"):
self._enable_discount_accounting = cint(frappe.db.get_single_value('Accounts Settings', 'enable_discount_accounting'))
return self._enable_discount_accounting
def make_internal_transfer_gl_entries(self, gl_entries):
if self.is_internal_transfer() and flt(self.base_total_taxes_and_charges):
account_currency = get_account_currency(self.unrealized_profit_loss_account)

View File

@ -251,6 +251,50 @@ class TestPurchaseInvoice(unittest.TestCase):
self.assertEqual(discrepancy_caused_by_exchange_rate_diff, amount)
def test_purchase_invoice_with_discount_accounting_enabled(self):
enable_discount_accounting()
discount_account = create_account(account_name="Discount Account",
parent_account="Indirect Expenses - _TC", company="_Test Company")
pi = make_purchase_invoice(discount_account=discount_account, rate=45)
expected_gle = [
["_Test Account Cost for Goods Sold - _TC", 250.0, 0.0, nowdate()],
["Creditors - _TC", 0.0, 225.0, nowdate()],
["Discount Account - _TC", 0.0, 25.0, nowdate()]
]
check_gl_entries(self, pi.name, expected_gle, nowdate())
enable_discount_accounting(enable=0)
def test_additional_discount_for_purchase_invoice_with_discount_accounting_enabled(self):
enable_discount_accounting()
additional_discount_account = create_account(account_name="Discount Account",
parent_account="Indirect Expenses - _TC", company="_Test Company")
pi = make_purchase_invoice(do_not_save=1, parent_cost_center="Main - _TC")
pi.apply_discount_on = "Grand Total"
pi.additional_discount_account = additional_discount_account
pi.additional_discount_percentage = 10
pi.disable_rounded_total = 1
pi.append("taxes", {
"charge_type": "On Net Total",
"account_head": "_Test Account VAT - _TC",
"cost_center": "Main - _TC",
"description": "Test",
"rate": 10
})
pi.submit()
expected_gle = [
["_Test Account Cost for Goods Sold - _TC", 250.0, 0.0, nowdate()],
["_Test Account VAT - _TC", 25.0, 0.0, nowdate()],
["Creditors - _TC", 0.0, 247.5, nowdate()],
["Discount Account - _TC", 0.0, 27.5, nowdate()]
]
check_gl_entries(self, pi.name, expected_gle, nowdate())
def test_purchase_invoice_change_naming_series(self):
pi = frappe.copy_doc(test_records[1])
pi.insert()
@ -1161,6 +1205,18 @@ class TestPurchaseInvoice(unittest.TestCase):
self.assertEqual(expected_gle[i][0], gle.account)
self.assertEqual(expected_gle[i][1], gle.amount)
def check_gl_entries(doc, voucher_no, expected_gle, posting_date):
gl_entries = frappe.db.sql("""select account, debit, credit, posting_date
from `tabGL Entry`
where voucher_type='Purchase Invoice' and voucher_no=%s and posting_date >= %s
order by posting_date asc, account asc""", (voucher_no, posting_date), as_dict=1)
for i, gle in enumerate(gl_entries):
doc.assertEqual(expected_gle[i][0], gle.account)
doc.assertEqual(expected_gle[i][1], gle.debit)
doc.assertEqual(expected_gle[i][2], gle.credit)
doc.assertEqual(getdate(expected_gle[i][3]), gle.posting_date)
def update_tax_witholding_category(company, account, date):
from erpnext.accounts.utils import get_fiscal_year
@ -1191,6 +1247,11 @@ def unlink_payment_on_cancel_of_invoice(enable=1):
accounts_settings.unlink_payment_on_cancellation_of_invoice = enable
accounts_settings.save()
def enable_discount_accounting(enable=1):
accounts_settings = frappe.get_doc("Accounts Settings")
accounts_settings.enable_discount_accounting = enable
accounts_settings.save()
def make_purchase_invoice(**args):
pi = frappe.new_doc("Purchase Invoice")
args = frappe._dict(args)
@ -1213,6 +1274,7 @@ def make_purchase_invoice(**args):
pi.return_against = args.return_against
pi.is_subcontracted = args.is_subcontracted or "No"
pi.supplier_warehouse = args.supplier_warehouse or "_Test Warehouse 1 - _TC"
pi.cost_center = args.parent_cost_center
pi.append("items", {
"item_code": args.item or args.item_code or "_Test Item",
@ -1221,7 +1283,10 @@ def make_purchase_invoice(**args):
"received_qty": args.received_qty or 0,
"rejected_qty": args.rejected_qty or 0,
"rate": args.rate or 50,
'expense_account': args.expense_account or '_Test Account Cost for Goods Sold - _TC',
"price_list_rate": args.price_list_rate or 50,
"expense_account": args.expense_account or '_Test Account Cost for Goods Sold - _TC',
"discount_account": args.discount_account or None,
"discount_amount": args.discount_amount or 0,
"conversion_factor": 1.0,
"serial_no": args.serial_no,
"stock_uom": args.uom or "_Test UOM",

View File

@ -73,6 +73,7 @@
"manufacturer_part_no",
"accounting",
"expense_account",
"discount_account",
"col_break5",
"is_fixed_asset",
"asset_location",
@ -501,6 +502,7 @@
},
{
"collapsible": 1,
"collapsible_depends_on": "enable_deferred_expense",
"fieldname": "deferred_expense_section",
"fieldtype": "Section Break",
"label": "Deferred Expense"
@ -849,12 +851,18 @@
"options": "Company:company:default_currency",
"print_hide": 1,
"read_only": 1
},
{
"fieldname": "discount_account",
"fieldtype": "Link",
"label": "Discount Account",
"options": "Account"
}
],
"idx": 1,
"istable": 1,
"links": [],
"modified": "2021-06-16 19:43:51.099386",
"modified": "2021-08-12 20:14:48.506639",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Invoice Item",

View File

@ -22,7 +22,7 @@
"cost_center",
"dimension_col_break",
"section_break_9",
"currency",
"account_currency",
"tax_amount",
"tax_amount_after_discount_amount",
"total",
@ -208,14 +208,6 @@
"fieldname": "dimension_col_break",
"fieldtype": "Column Break"
},
{
"fetch_from": "account_head.account_currency",
"fieldname": "currency",
"fieldtype": "Link",
"label": "Account Currency",
"options": "Currency",
"read_only": 1
},
{
"default": "0",
"depends_on": "eval:['Purchase Taxes and Charges Template', 'Payment Entry'].includes(parent.doctype)",
@ -223,12 +215,20 @@
"fieldname": "included_in_paid_amount",
"fieldtype": "Check",
"label": "Considered In Paid Amount"
},
{
"fetch_from": "account_head.account_currency",
"fieldname": "account_currency",
"fieldtype": "Link",
"label": "Account Currency",
"options": "Currency",
"read_only": 1
}
],
"idx": 1,
"istable": 1,
"links": [],
"modified": "2021-06-14 01:43:50.750455",
"modified": "2021-08-05 20:04:36.618240",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Purchase Taxes and Charges",

View File

@ -347,7 +347,7 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends e
items_add(doc, cdt, cdn) {
var row = frappe.get_doc(cdt, cdn);
this.frm.script_manager.copy_from_first_row("items", row, ["income_account", "cost_center"]);
this.frm.script_manager.copy_from_first_row("items", row, ["income_account", "discount_account", "cost_center"]);
}
set_dynamic_labels() {
@ -448,6 +448,15 @@ erpnext.accounts.SalesInvoiceController = class SalesInvoiceController extends e
this.frm.refresh_field("paid_amount");
this.frm.refresh_field("base_paid_amount");
}
currency() {
super.currency();
$.each(cur_frm.doc.timesheets, function(i, d) {
let row = frappe.get_doc(d.doctype, d.name)
set_timesheet_detail_rate(row.doctype, row.name, cur_frm.doc.currency, row.timesheet_detail)
});
calculate_total_billing_amount(cur_frm)
}
};
// for backward compatibility: combine new and previous states
@ -510,7 +519,6 @@ cur_frm.set_query("income_account", "items", function(doc) {
}
});
// Cost Center in Details Table
// -----------------------------
cur_frm.fields_dict["items"].grid.get_field("cost_center").get_query = function(doc) {
@ -592,6 +600,16 @@ frappe.ui.form.on('Sales Invoice', {
};
});
frm.set_query("additional_discount_account", function() {
return {
filters: {
company: frm.doc.company,
is_group: 0,
report_type: "Profit and Loss",
}
};
});
frm.custom_make_buttons = {
'Delivery Note': 'Delivery',
'Sales Invoice': 'Return / Credit Note',
@ -618,6 +636,17 @@ frappe.ui.form.on('Sales Invoice', {
}
}
// discount account
frm.fields_dict['items'].grid.get_field('discount_account').get_query = function(doc) {
return {
filters: {
'report_type': 'Profit and Loss',
'company': doc.company,
"is_group": 0
}
}
}
frm.fields_dict['items'].grid.get_field('deferred_revenue_account').get_query = function(doc) {
return {
filters: {
@ -826,7 +855,8 @@ frappe.ui.form.on('Sales Invoice', {
'time_sheet': row.parent,
'billing_hours': row.billing_hours,
'billing_amount': flt(row.billing_amount) * flt(exchange_rate),
'timesheet_detail': row.name
'timesheet_detail': row.name,
'project_name': row.project_name
});
frm.refresh_field('timesheets');
calculate_total_billing_amount(frm);
@ -945,43 +975,34 @@ frappe.ui.form.on('Sales Invoice', {
}
})
frappe.ui.form.on('Sales Invoice Timesheet', {
time_sheet: function(frm, cdt, cdn){
var d = locals[cdt][cdn];
if(d.time_sheet) {
frappe.call({
method: "erpnext.projects.doctype.timesheet.timesheet.get_timesheet_data",
args: {
'name': d.time_sheet,
'project': frm.doc.project || null
},
callback: function(r, rt) {
if(r.message){
let data = r.message;
frappe.model.set_value(cdt, cdn, "billing_hours", data.billing_hours);
frappe.model.set_value(cdt, cdn, "billing_amount", data.billing_amount);
frappe.model.set_value(cdt, cdn, "timesheet_detail", data.timesheet_detail);
calculate_total_billing_amount(frm)
}
}
})
}
}
})
var calculate_total_billing_amount = function(frm) {
var doc = frm.doc;
doc.total_billing_amount = 0.0
if(doc.timesheets) {
if (doc.timesheets) {
$.each(doc.timesheets, function(index, data){
doc.total_billing_amount += data.billing_amount
doc.total_billing_amount += flt(data.billing_amount)
})
}
refresh_field('total_billing_amount')
}
var set_timesheet_detail_rate = function(cdt, cdn, currency, timelog) {
frappe.call({
method: "erpnext.projects.doctype.timesheet.timesheet.get_timesheet_detail_rate",
args: {
timelog: timelog,
currency: currency
},
callback: function(r) {
if (!r.exc && r.message) {
frappe.model.set_value(cdt, cdn, 'billing_amount', r.message);
}
}
});
}
var select_loyalty_program = function(frm, loyalty_programs) {
var dialog = new frappe.ui.Dialog({
title: __("Select Loyalty Program"),

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe, erpnext
import frappe.defaults
from frappe.utils import cint, flt, getdate, add_days, cstr, nowdate, get_link_to_form, formatdate
from frappe.utils import cint, flt, getdate, add_days, add_months, cstr, nowdate, get_link_to_form, formatdate
from frappe import _, msgprint, throw
from erpnext.accounts.party import get_party_account, get_due_date, get_party_details
from frappe.model.mapper import get_mapped_doc
@ -13,7 +13,7 @@ from erpnext.accounts.utils import get_account_currency
from erpnext.stock.doctype.delivery_note.delivery_note import update_billed_amount_based_on_so
from erpnext.projects.doctype.timesheet.timesheet import get_projectwise_timesheet_data
from erpnext.assets.doctype.asset.depreciation \
import get_disposal_account_and_cost_center, get_gl_entries_on_asset_disposal, get_gl_entries_on_asset_regain
import get_disposal_account_and_cost_center, get_gl_entries_on_asset_disposal, get_gl_entries_on_asset_regain, post_depreciation_entries
from erpnext.stock.doctype.batch.batch import set_batch_nos
from erpnext.stock.doctype.serial_no.serial_no import get_serial_nos, get_delivery_note_serial_no
from erpnext.setup.doctype.company.company import update_company_current_month_sales
@ -478,6 +478,9 @@ class SalesInvoice(SellingController):
if cint(self.is_pos) != 1:
return
if not self.account_for_change_amount:
self.account_for_change_amount = frappe.get_cached_value('Company', self.company, 'default_cash_account')
from erpnext.stock.get_item_details import get_pos_profile_item_details, get_pos_profile
if not self.pos_profile:
pos_profile = get_pos_profile(self.company) or {}
@ -492,9 +495,6 @@ class SalesInvoice(SellingController):
if not self.get('payments') and not for_validate:
update_multi_mode_option(self, pos)
if not self.account_for_change_amount:
self.account_for_change_amount = frappe.get_cached_value('Company', self.company, 'default_cash_account')
if pos:
if not for_validate:
self.tax_category = pos.get("tax_category")
@ -848,6 +848,7 @@ class SalesInvoice(SellingController):
self.allocate_advance_taxes(gl_entries)
self.make_item_gl_entries(gl_entries)
self.make_discount_gl_entries(gl_entries)
# merge gl entries before adding pos entries
gl_entries = merge_similar_entries(gl_entries)
@ -887,18 +888,22 @@ class SalesInvoice(SellingController):
)
def make_tax_gl_entries(self, gl_entries):
enable_discount_accounting = cint(frappe.db.get_single_value('Accounts Settings', 'enable_discount_accounting'))
for tax in self.get("taxes"):
amount, base_amount = self.get_tax_amounts(tax, enable_discount_accounting)
if flt(tax.base_tax_amount_after_discount_amount):
account_currency = get_account_currency(tax.account_head)
gl_entries.append(
self.get_gl_dict({
"account": tax.account_head,
"against": self.customer,
"credit": flt(tax.base_tax_amount_after_discount_amount,
"credit": flt(base_amount,
tax.precision("tax_amount_after_discount_amount")),
"credit_in_account_currency": (flt(tax.base_tax_amount_after_discount_amount,
"credit_in_account_currency": (flt(base_amount,
tax.precision("base_tax_amount_after_discount_amount")) if account_currency==self.company_currency else
flt(tax.tax_amount_after_discount_amount, tax.precision("tax_amount_after_discount_amount"))),
flt(amount, tax.precision("tax_amount_after_discount_amount"))),
"cost_center": tax.cost_center
}, account_currency, item=tax)
)
@ -917,30 +922,29 @@ class SalesInvoice(SellingController):
def make_item_gl_entries(self, gl_entries):
# income account gl entries
enable_discount_accounting = cint(frappe.db.get_single_value('Accounts Settings', 'enable_discount_accounting'))
for item in self.get("items"):
if flt(item.base_net_amount, item.precision("base_net_amount")):
if item.is_fixed_asset:
if item.get('asset'):
asset = frappe.get_doc("Asset", item.asset)
else:
frappe.throw(_(
"Row #{0}: You must select an Asset for Item {1}.").format(item.idx, item.item_name),
title=_("Missing Asset")
)
if (len(asset.finance_books) > 1 and not item.finance_book
and asset.finance_books[0].finance_book):
frappe.throw(_("Select finance book for the item {0} at row {1}")
.format(item.item_code, item.idx))
asset = self.get_asset(item)
if self.is_return:
fixed_asset_gl_entries = get_gl_entries_on_asset_regain(asset,
item.base_net_amount, item.finance_book)
asset.db_set("disposal_date", None)
if asset.calculate_depreciation:
self.reset_depreciation_schedule(asset)
else:
fixed_asset_gl_entries = get_gl_entries_on_asset_disposal(asset,
item.base_net_amount, item.finance_book)
asset.db_set("disposal_date", self.posting_date)
if asset.calculate_depreciation:
self.depreciate_asset(asset)
for gle in fixed_asset_gl_entries:
gle["against"] = self.customer
gl_entries.append(self.get_gl_dict(gle, item=item))
@ -953,15 +957,17 @@ class SalesInvoice(SellingController):
income_account = (item.income_account
if (not item.enable_deferred_revenue or self.is_return) else item.deferred_revenue_account)
amount, base_amount = self.get_amount_and_base_amount(item, enable_discount_accounting)
account_currency = get_account_currency(income_account)
gl_entries.append(
self.get_gl_dict({
"account": income_account,
"against": self.customer,
"credit": flt(item.base_net_amount, item.precision("base_net_amount")),
"credit_in_account_currency": (flt(item.base_net_amount, item.precision("base_net_amount"))
"credit": flt(base_amount, item.precision("base_net_amount")),
"credit_in_account_currency": (flt(base_amount, item.precision("base_net_amount"))
if account_currency==self.company_currency
else flt(item.net_amount, item.precision("net_amount"))),
else flt(amount, item.precision("net_amount"))),
"cost_center": item.cost_center,
"project": item.project or self.project
}, account_currency, item=item)
@ -972,6 +978,96 @@ class SalesInvoice(SellingController):
erpnext.is_perpetual_inventory_enabled(self.company):
gl_entries += super(SalesInvoice, self).get_gl_entries()
def get_asset(self, item):
if item.get('asset'):
asset = frappe.get_doc("Asset", item.asset)
else:
frappe.throw(_(
"Row #{0}: You must select an Asset for Item {1}.").format(item.idx, item.item_name),
title=_("Missing Asset")
)
self.check_finance_books(item, asset)
return asset
def check_finance_books(self, item, asset):
if (len(asset.finance_books) > 1 and not item.finance_book
and asset.finance_books[0].finance_book):
frappe.throw(_("Select finance book for the item {0} at row {1}")
.format(item.item_code, item.idx))
def depreciate_asset(self, asset):
asset.flags.ignore_validate_update_after_submit = True
asset.prepare_depreciation_data(self.posting_date)
asset.save()
post_depreciation_entries(self.posting_date)
def reset_depreciation_schedule(self, asset):
asset.flags.ignore_validate_update_after_submit = True
# recreate original depreciation schedule of the asset
asset.prepare_depreciation_data()
self.modify_depreciation_schedule_for_asset_repairs(asset)
asset.save()
self.delete_depreciation_entry_made_after_sale(asset)
def modify_depreciation_schedule_for_asset_repairs(self, asset):
asset_repairs = frappe.get_all(
'Asset Repair',
filters = {'asset': asset.name},
fields = ['name', 'increase_in_asset_life']
)
for repair in asset_repairs:
if repair.increase_in_asset_life:
asset_repair = frappe.get_doc('Asset Repair', repair.name)
asset_repair.modify_depreciation_schedule()
asset.prepare_depreciation_data()
def delete_depreciation_entry_made_after_sale(self, asset):
from erpnext.accounts.doctype.journal_entry.journal_entry import make_reverse_journal_entry
posting_date_of_original_invoice = self.get_posting_date_of_sales_invoice()
row = -1
finance_book = asset.get('schedules')[0].get('finance_book')
for schedule in asset.get('schedules'):
if schedule.finance_book != finance_book:
row = 0
finance_book = schedule.finance_book
else:
row += 1
if schedule.schedule_date == posting_date_of_original_invoice:
if not self.sale_was_made_on_original_schedule_date(asset, schedule, row, posting_date_of_original_invoice):
reverse_journal_entry = make_reverse_journal_entry(schedule.journal_entry)
reverse_journal_entry.posting_date = nowdate()
reverse_journal_entry.submit()
def get_posting_date_of_sales_invoice(self):
return frappe.db.get_value('Sales Invoice', self.return_against, 'posting_date')
# if the invoice had been posted on the date the depreciation was initially supposed to happen, the depreciation shouldn't be undone
def sale_was_made_on_original_schedule_date(self, asset, schedule, row, posting_date_of_original_invoice):
for finance_book in asset.get('finance_books'):
if schedule.finance_book == finance_book.finance_book:
orginal_schedule_date = add_months(finance_book.depreciation_start_date,
row * cint(finance_book.frequency_of_depreciation))
if orginal_schedule_date == posting_date_of_original_invoice:
return True
return False
@property
def enable_discount_accounting(self):
if not hasattr(self, "_enable_discount_accounting"):
self._enable_discount_accounting = cint(frappe.db.get_single_value('Accounts Settings', 'enable_discount_accounting'))
return self._enable_discount_accounting
def set_asset_status(self, asset):
if self.is_return:
asset.set_status()
@ -1367,7 +1463,7 @@ class SalesInvoice(SellingController):
discounting_status = None
if self.is_discounted:
discountng_status = get_discounting_status(self.name)
discounting_status = get_discounting_status(self.name)
if not status:
if self.docstatus == 2:
@ -1375,11 +1471,11 @@ class SalesInvoice(SellingController):
elif self.docstatus == 1:
if self.is_internal_transfer():
self.status = 'Internal Transfer'
elif outstanding_amount > 0 and due_date < nowdate and self.is_discounted and discountng_status=='Disbursed':
elif outstanding_amount > 0 and due_date < nowdate and self.is_discounted and discounting_status=='Disbursed':
self.status = "Overdue and Discounted"
elif outstanding_amount > 0 and due_date < nowdate:
self.status = "Overdue"
elif outstanding_amount > 0 and due_date >= nowdate and self.is_discounted and discountng_status=='Disbursed':
elif outstanding_amount > 0 and due_date >= nowdate and self.is_discounted and discounting_status=='Disbursed':
self.status = "Unpaid and Discounted"
elif outstanding_amount > 0 and due_date >= nowdate:
self.status = "Unpaid"

View File

@ -12,6 +12,7 @@ from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import unli
from erpnext.accounts.doctype.purchase_invoice.purchase_invoice import WarehouseMissingError
from erpnext.accounts.doctype.pos_profile.test_pos_profile import make_pos_profile
from erpnext.assets.doctype.asset.test_asset import create_asset, create_asset_data
from erpnext.assets.doctype.asset.depreciation import post_depreciation_entries
from erpnext.exceptions import InvalidAccountCurrency, InvalidCurrency
from erpnext.stock.doctype.serial_no.serial_no import SerialNoWarehouseError
from frappe.model.naming import make_autoname
@ -2101,6 +2102,78 @@ class TestSalesInvoice(unittest.TestCase):
sales_invoice.save()
self.assertEqual(sales_invoice.items[0].item_tax_template, "_Test Account Excise Duty @ 10 - _TC")
def test_sales_invoice_with_discount_accounting_enabled(self):
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import enable_discount_accounting
enable_discount_accounting()
discount_account = create_account(account_name="Discount Account",
parent_account="Indirect Expenses - _TC", company="_Test Company")
si = create_sales_invoice(discount_account=discount_account, discount_percentage=10, rate=90)
expected_gle = [
["Debtors - _TC", 90.0, 0.0, nowdate()],
["Discount Account - _TC", 10.0, 0.0, nowdate()],
["Sales - _TC", 0.0, 100.0, nowdate()]
]
check_gl_entries(self, si.name, expected_gle, add_days(nowdate(), -1))
enable_discount_accounting(enable=0)
def test_additional_discount_for_sales_invoice_with_discount_accounting_enabled(self):
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import enable_discount_accounting
enable_discount_accounting()
additional_discount_account = create_account(account_name="Discount Account",
parent_account="Indirect Expenses - _TC", company="_Test Company")
si = create_sales_invoice(parent_cost_center='Main - _TC', do_not_save=1)
si.apply_discount_on = "Grand Total"
si.additional_discount_account = additional_discount_account
si.additional_discount_percentage = 20
si.append("taxes", {
"charge_type": "On Net Total",
"account_head": "_Test Account VAT - _TC",
"cost_center": "Main - _TC",
"description": "Test",
"rate": 10
})
si.submit()
expected_gle = [
["_Test Account VAT - _TC", 0.0, 10.0, nowdate()],
["Debtors - _TC", 88, 0.0, nowdate()],
["Discount Account - _TC", 22.0, 0.0, nowdate()],
["Sales - _TC", 0.0, 100.0, nowdate()]
]
check_gl_entries(self, si.name, expected_gle, add_days(nowdate(), -1))
enable_discount_accounting(enable=0)
def test_asset_depreciation_on_sale(self):
"""
Tests if an Asset set to depreciate yearly on June 30, that gets sold on Sept 30, creates an additional depreciation entry on Sept 30.
"""
create_asset_data()
asset = create_asset(item_code="Macbook Pro", calculate_depreciation=1, submit=1)
post_depreciation_entries(getdate("2021-09-30"))
create_sales_invoice(item_code="Macbook Pro", asset=asset.name, qty=1, rate=90000, posting_date=getdate("2021-09-30"))
asset.load_from_db()
expected_values = [
["2020-06-30", 1311.48, 1311.48],
["2021-06-30", 20000.0, 21311.48],
["2021-09-30", 3966.76, 25278.24]
]
for i, schedule in enumerate(asset.schedules):
self.assertEqual(getdate(expected_values[i][0]), schedule.schedule_date)
self.assertEqual(expected_values[i][1], schedule.depreciation_amount)
self.assertEqual(expected_values[i][2], schedule.accumulated_depreciation_amount)
self.assertTrue(schedule.journal_entry)
def get_sales_invoice_for_e_invoice():
si = make_sales_invoice_for_ewaybill()
si.naming_series = 'INV-2020-.#####'
@ -2293,6 +2366,7 @@ def create_sales_invoice(**args):
si.currency=args.currency or "INR"
si.conversion_rate = args.conversion_rate or 1
si.naming_series = args.naming_series or "T-SINV-"
si.cost_center = args.parent_cost_center
si.append("items", {
"item_code": args.item or args.item_code or "_Test Item",
@ -2304,8 +2378,11 @@ def create_sales_invoice(**args):
"uom": args.uom or "Nos",
"stock_uom": args.uom or "Nos",
"rate": args.rate if args.get("rate") is not None else 100,
"price_list_rate": args.price_list_rate if args.get("price_list_rate") is not None else 100,
"income_account": args.income_account or "Sales - _TC",
"expense_account": args.expense_account or "Cost of Goods Sold - _TC",
"discount_account": args.discount_account or None,
"discount_amount": args.discount_amount or 0,
"asset": args.asset or None,
"cost_center": args.cost_center or "_Test Cost Center - _TC",
"serial_no": args.serial_no,

View File

@ -63,6 +63,7 @@
"finance_book",
"col_break4",
"expense_account",
"discount_account",
"deferred_revenue",
"deferred_revenue_account",
"service_stop_date",
@ -473,6 +474,7 @@
},
{
"collapsible": 1,
"collapsible_depends_on": "enable_deferred_revenue",
"fieldname": "deferred_revenue",
"fieldtype": "Section Break",
"label": "Deferred Revenue"
@ -820,12 +822,18 @@
"no_copy": 1,
"options": "currency",
"read_only": 1
},
{
"fieldname": "discount_account",
"fieldtype": "Link",
"label": "Discount Account",
"options": "Account"
}
],
"idx": 1,
"istable": 1,
"links": [],
"modified": "2021-06-21 23:03:11.599901",
"modified": "2021-08-12 20:15:47.668399",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Item",

View File

@ -9,7 +9,9 @@
"description",
"billing_hours",
"billing_amount",
"column_break_5",
"time_sheet",
"project_name",
"timesheet_detail"
],
"fields": [
@ -61,11 +63,21 @@
"in_list_view": 1,
"label": "Description",
"read_only": 1
},
{
"fieldname": "column_break_5",
"fieldtype": "Column Break"
},
{
"fieldname": "project_name",
"fieldtype": "Data",
"label": "Project Name",
"read_only": 1
}
],
"istable": 1,
"links": [],
"modified": "2021-05-20 22:33:57.234846",
"modified": "2021-06-08 14:43:02.748981",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Invoice Timesheet",

View File

@ -0,0 +1,31 @@
{
"actions": [],
"creation": "2021-05-06 16:17:44.329943",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"sales_partner"
],
"fields": [
{
"fieldname": "sales_partner",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Sales Partner ",
"options": "Sales Partner"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-05-07 10:43:37.532095",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Partner Item",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -0,0 +1,8 @@
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class SalesPartnerItem(Document):
pass

View File

@ -19,7 +19,7 @@
"section_break_8",
"rate",
"section_break_9",
"currency",
"account_currency",
"tax_amount",
"total",
"tax_amount_after_discount_amount",
@ -186,14 +186,6 @@
"fieldname": "dimension_col_break",
"fieldtype": "Column Break"
},
{
"fetch_from": "account_head.account_currency",
"fieldname": "currency",
"fieldtype": "Link",
"label": "Account Currency",
"options": "Currency",
"read_only": 1
},
{
"default": "0",
"depends_on": "eval:['Sales Taxes and Charges Template', 'Payment Entry'].includes(parent.doctype)",
@ -210,13 +202,21 @@
"label": "Dont Recompute tax",
"print_hide": 1,
"read_only": 1
},
{
"fetch_from": "account_head.account_currency",
"fieldname": "account_currency",
"fieldtype": "Link",
"label": "Account Currency",
"options": "Currency",
"read_only": 1
}
],
"idx": 1,
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-07-27 12:40:59.051803",
"modified": "2021-08-05 20:04:01.726867",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Sales Taxes and Charges",

View File

@ -0,0 +1,31 @@
{
"actions": [],
"creation": "2021-05-06 16:19:22.040795",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"supplier_group"
],
"fields": [
{
"fieldname": "supplier_group",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Supplier Group",
"options": "Supplier Group"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-05-07 10:43:59.877938",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Supplier Group Item",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -0,0 +1,8 @@
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class SupplierGroupItem(Document):
pass

View File

@ -0,0 +1,31 @@
{
"actions": [],
"creation": "2021-05-06 16:18:54.758468",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"supplier"
],
"fields": [
{
"fieldname": "supplier",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Supplier",
"options": "Supplier"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-05-07 10:44:09.707778",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Supplier Item",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -0,0 +1,8 @@
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class SupplierItem(Document):
pass

View File

@ -0,0 +1,31 @@
{
"actions": [],
"creation": "2021-05-06 16:16:51.885441",
"doctype": "DocType",
"editable_grid": 1,
"engine": "InnoDB",
"field_order": [
"territory"
],
"fields": [
{
"fieldname": "territory",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Territory",
"options": "Territory"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-05-07 10:43:26.641030",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Territory Item",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -0,0 +1,8 @@
# Copyright (c) 2021, Frappe Technologies Pvt. Ltd. and contributors
# For license information, please see license.txt
# import frappe
from frappe.model.document import Document
class TerritoryItem(Document):
pass

View File

@ -8,7 +8,7 @@ from frappe import _, msgprint, scrub
from frappe.core.doctype.user_permission.user_permission import get_permitted_documents
from frappe.model.utils import get_fetch_values
from frappe.utils import (add_days, getdate, formatdate, date_diff,
add_years, get_timestamp, nowdate, flt, cstr, add_months, get_last_day)
add_years, get_timestamp, nowdate, flt, cstr, add_months, get_last_day, cint)
from frappe.contacts.doctype.address.address import (get_address_display,
get_default_address, get_company_address)
from frappe.contacts.doctype.contact.contact import get_contact_details
@ -58,7 +58,7 @@ def _get_party_details(party=None, account=None, party_type="Customer", company=
customer_group=party_details.customer_group, supplier_group=party_details.supplier_group, tax_category=party_details.tax_category,
billing_address=party_address, shipping_address=shipping_address)
if fetch_payment_terms_template:
if cint(fetch_payment_terms_template):
party_details["payment_terms_template"] = get_payment_terms_template(party.name, party_type, company)
if not party_details.get("currency"):

View File

@ -16,7 +16,7 @@
"name": "Bank and Cash Payment Voucher",
"owner": "Administrator",
"print_format_builder": 0,
"print_format_type": "Server",
"print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}

View File

@ -10,6 +10,6 @@
"modified_by": "Administrator",
"name": "Cheque Printing Format",
"owner": "Administrator",
"print_format_type": "Server",
"print_format_type": "Jinja",
"standard": "Yes"
}

View File

@ -17,7 +17,7 @@
"owner": "Administrator",
"parentfield": "__print_formats",
"print_format_builder": 0,
"print_format_type": "Server",
"print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}

View File

@ -16,7 +16,7 @@
"name": "GST Purchase Invoice",
"owner": "Administrator",
"print_format_builder": 1,
"print_format_type": "Server",
"print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}

View File

@ -16,7 +16,7 @@
"name": "Journal Auditing Voucher",
"owner": "Administrator",
"print_format_builder": 0,
"print_format_type": "Server",
"print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}

View File

@ -12,6 +12,6 @@
"name": "Payment Receipt Voucher",
"owner": "Administrator",
"print_format_builder": 0,
"print_format_type": "Server",
"print_format_type": "Jinja",
"standard": "Yes"
}

View File

@ -16,7 +16,7 @@
"name": "Purchase Auditing Voucher",
"owner": "Administrator",
"print_format_builder": 0,
"print_format_type": "Server",
"print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}

View File

@ -16,7 +16,7 @@
"name": "Sales Auditing Voucher",
"owner": "Administrator",
"print_format_builder": 0,
"print_format_type": "Server",
"print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}

View File

@ -38,8 +38,8 @@ def execute(filters=None):
GROUP BY parent''',{'dimension':[dimension]})
if DCC_allocation:
filters['budget_against_filter'] = [DCC_allocation[0][0]]
cam_map = get_dimension_account_month_map(filters)
dimension_items = cam_map.get(DCC_allocation[0][0])
ddc_cam_map = get_dimension_account_month_map(filters)
dimension_items = ddc_cam_map.get(DCC_allocation[0][0])
if dimension_items:
data = get_final_data(dimension, dimension_items, filters, period_month_ranges, data, DCC_allocation[0][1])
@ -48,7 +48,6 @@ def execute(filters=None):
return columns, data, None, chart
def get_final_data(dimension, dimension_items, filters, period_month_ranges, data, DCC_allocation):
for account, monthwise_data in iteritems(dimension_items):
row = [dimension, account]
totals = [0, 0, 0]

View File

@ -1,28 +1,32 @@
{
"category": "Modules",
"category": "",
"charts": [
{
"chart_name": "Profit and Loss",
"label": "Profit and Loss"
}
],
"content": "[{\"type\": \"onboarding\", \"data\": {\"onboarding_name\":\"Accounts\", \"col\": 12}}, {\"type\": \"chart\", \"data\": {\"chart_name\": \"Profit and Loss\", \"col\": 12}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Chart of Accounts\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Sales Invoice\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Purchase Invoice\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Journal Entry\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Payment Entry\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Accounts Receivable\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"General Ledger\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Trial Balance\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Accounting Masters\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"General Ledger\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Accounts Receivable\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Accounts Payable\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Reports\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Financial Statements\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Multi Currency\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Settings\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Bank Statement\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Subscription Management\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Goods and Services Tax (GST India)\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Share Management\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Cost Center and Budgeting\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Opening and Closing\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Taxes\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Profitability\", \"col\": 4}}]",
"creation": "2020-03-02 15:41:59.515192",
"developer_mode_only": 0,
"disable_user_customization": 0,
"docstatus": 0,
"doctype": "Workspace",
"extends": "",
"extends_another_page": 0,
"for_user": "",
"hide_custom": 0,
"icon": "accounting",
"idx": 0,
"is_default": 0,
"is_standard": 1,
"is_standard": 0,
"label": "Accounting",
"links": [
{
"hidden": 0,
"is_query_report": 0,
"label": "Accounting Masters",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -31,6 +35,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Company",
"link_count": 0,
"link_to": "Company",
"link_type": "DocType",
"onboard": 1,
@ -41,6 +46,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Chart of Accounts",
"link_count": 0,
"link_to": "Account",
"link_type": "DocType",
"onboard": 1,
@ -51,6 +57,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Accounts Settings",
"link_count": 0,
"link_to": "Accounts Settings",
"link_type": "DocType",
"onboard": 0,
@ -61,6 +68,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Fiscal Year",
"link_count": 0,
"link_to": "Fiscal Year",
"link_type": "DocType",
"onboard": 0,
@ -71,6 +79,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Accounting Dimension",
"link_count": 0,
"link_to": "Accounting Dimension",
"link_type": "DocType",
"onboard": 0,
@ -81,6 +90,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Finance Book",
"link_count": 0,
"link_to": "Finance Book",
"link_type": "DocType",
"onboard": 0,
@ -91,6 +101,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Accounting Period",
"link_count": 0,
"link_to": "Accounting Period",
"link_type": "DocType",
"onboard": 0,
@ -101,6 +112,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Payment Term",
"link_count": 0,
"link_to": "Payment Term",
"link_type": "DocType",
"onboard": 0,
@ -110,6 +122,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "General Ledger",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -118,6 +131,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Journal Entry",
"link_count": 0,
"link_to": "Journal Entry",
"link_type": "DocType",
"onboard": 0,
@ -128,6 +142,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Journal Entry Template",
"link_count": 0,
"link_to": "Journal Entry Template",
"link_type": "DocType",
"onboard": 0,
@ -138,6 +153,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "General Ledger",
"link_count": 0,
"link_to": "General Ledger",
"link_type": "Report",
"onboard": 0,
@ -148,6 +164,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Customer Ledger Summary",
"link_count": 0,
"link_to": "Customer Ledger Summary",
"link_type": "Report",
"onboard": 0,
@ -158,6 +175,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Supplier Ledger Summary",
"link_count": 0,
"link_to": "Supplier Ledger Summary",
"link_type": "Report",
"onboard": 0,
@ -167,6 +185,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Accounts Receivable",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -175,6 +194,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Sales Invoice",
"link_count": 0,
"link_to": "Sales Invoice",
"link_type": "DocType",
"onboard": 1,
@ -185,6 +205,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Customer",
"link_count": 0,
"link_to": "Customer",
"link_type": "DocType",
"onboard": 1,
@ -195,6 +216,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Payment Entry",
"link_count": 0,
"link_to": "Payment Entry",
"link_type": "DocType",
"onboard": 0,
@ -205,6 +227,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Payment Request",
"link_count": 0,
"link_to": "Payment Request",
"link_type": "DocType",
"onboard": 0,
@ -215,6 +238,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Accounts Receivable",
"link_count": 0,
"link_to": "Accounts Receivable",
"link_type": "Report",
"onboard": 0,
@ -225,6 +249,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Accounts Receivable Summary",
"link_count": 0,
"link_to": "Accounts Receivable Summary",
"link_type": "Report",
"onboard": 0,
@ -235,6 +260,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Sales Register",
"link_count": 0,
"link_to": "Sales Register",
"link_type": "Report",
"onboard": 0,
@ -245,6 +271,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Item-wise Sales Register",
"link_count": 0,
"link_to": "Item-wise Sales Register",
"link_type": "Report",
"onboard": 0,
@ -255,6 +282,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Sales Order Analysis",
"link_count": 0,
"link_to": "Sales Order Analysis",
"link_type": "Report",
"onboard": 0,
@ -265,6 +293,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Delivered Items To Be Billed",
"link_count": 0,
"link_to": "Delivered Items To Be Billed",
"link_type": "Report",
"onboard": 0,
@ -274,6 +303,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Accounts Payable",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -282,6 +312,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Purchase Invoice",
"link_count": 0,
"link_to": "Purchase Invoice",
"link_type": "DocType",
"onboard": 1,
@ -292,6 +323,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Supplier",
"link_count": 0,
"link_to": "Supplier",
"link_type": "DocType",
"onboard": 1,
@ -302,6 +334,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Payment Entry",
"link_count": 0,
"link_to": "Payment Entry",
"link_type": "DocType",
"onboard": 0,
@ -312,6 +345,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Accounts Payable",
"link_count": 0,
"link_to": "Accounts Payable",
"link_type": "Report",
"onboard": 0,
@ -322,6 +356,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Accounts Payable Summary",
"link_count": 0,
"link_to": "Accounts Payable Summary",
"link_type": "Report",
"onboard": 0,
@ -332,6 +367,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Purchase Register",
"link_count": 0,
"link_to": "Purchase Register",
"link_type": "Report",
"onboard": 0,
@ -342,6 +378,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Item-wise Purchase Register",
"link_count": 0,
"link_to": "Item-wise Purchase Register",
"link_type": "Report",
"onboard": 0,
@ -352,6 +389,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Purchase Order Analysis",
"link_count": 0,
"link_to": "Purchase Order Analysis",
"link_type": "Report",
"onboard": 0,
@ -362,6 +400,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Received Items To Be Billed",
"link_count": 0,
"link_to": "Received Items To Be Billed",
"link_type": "Report",
"onboard": 0,
@ -371,6 +410,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Reports",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -379,6 +419,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Trial Balance for Party",
"link_count": 0,
"link_to": "Trial Balance for Party",
"link_type": "Report",
"onboard": 0,
@ -389,6 +430,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Payment Period Based On Invoice Date",
"link_count": 0,
"link_to": "Payment Period Based On Invoice Date",
"link_type": "Report",
"onboard": 0,
@ -399,6 +441,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Sales Partners Commission",
"link_count": 0,
"link_to": "Sales Partners Commission",
"link_type": "Report",
"onboard": 0,
@ -409,6 +452,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Customer Credit Balance",
"link_count": 0,
"link_to": "Customer Credit Balance",
"link_type": "Report",
"onboard": 0,
@ -419,6 +463,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Sales Payment Summary",
"link_count": 0,
"link_to": "Sales Payment Summary",
"link_type": "Report",
"onboard": 0,
@ -429,6 +474,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Address And Contacts",
"link_count": 0,
"link_to": "Address And Contacts",
"link_type": "Report",
"onboard": 0,
@ -439,6 +485,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Tax Detail",
"link_count": 0,
"link_to": "Tax Detail",
"link_type": "Report",
"onboard": 0,
@ -449,6 +496,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "DATEV Export",
"link_count": 0,
"link_to": "DATEV",
"link_type": "Report",
"onboard": 0,
@ -460,6 +508,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "UAE VAT 201",
"link_count": 0,
"link_to": "UAE VAT 201",
"link_type": "Report",
"onboard": 0,
@ -470,6 +519,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Financial Statements",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -478,6 +528,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Trial Balance",
"link_count": 0,
"link_to": "Trial Balance",
"link_type": "Report",
"onboard": 0,
@ -488,6 +539,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Profit and Loss Statement",
"link_count": 0,
"link_to": "Profit and Loss Statement",
"link_type": "Report",
"onboard": 0,
@ -498,6 +550,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Balance Sheet",
"link_count": 0,
"link_to": "Balance Sheet",
"link_type": "Report",
"onboard": 0,
@ -508,6 +561,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Cash Flow",
"link_count": 0,
"link_to": "Cash Flow",
"link_type": "Report",
"onboard": 0,
@ -518,6 +572,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Consolidated Financial Statement",
"link_count": 0,
"link_to": "Consolidated Financial Statement",
"link_type": "Report",
"onboard": 0,
@ -527,6 +582,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Multi Currency",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -535,6 +591,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Currency",
"link_count": 0,
"link_to": "Currency",
"link_type": "DocType",
"onboard": 0,
@ -545,6 +602,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Currency Exchange",
"link_count": 0,
"link_to": "Currency Exchange",
"link_type": "DocType",
"onboard": 0,
@ -555,6 +613,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Exchange Rate Revaluation",
"link_count": 0,
"link_to": "Exchange Rate Revaluation",
"link_type": "DocType",
"onboard": 0,
@ -564,6 +623,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Settings",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -572,6 +632,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Payment Gateway Account",
"link_count": 0,
"link_to": "Payment Gateway Account",
"link_type": "DocType",
"onboard": 0,
@ -582,6 +643,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Terms and Conditions Template",
"link_count": 0,
"link_to": "Terms and Conditions",
"link_type": "DocType",
"onboard": 0,
@ -592,6 +654,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Mode of Payment",
"link_count": 0,
"link_to": "Mode of Payment",
"link_type": "DocType",
"onboard": 0,
@ -601,6 +664,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Bank Statement",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -609,6 +673,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Bank",
"link_count": 0,
"link_to": "Bank",
"link_type": "DocType",
"onboard": 0,
@ -619,6 +684,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Bank Account",
"link_count": 0,
"link_to": "Bank Account",
"link_type": "DocType",
"onboard": 0,
@ -629,6 +695,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Bank Clearance",
"link_count": 0,
"link_to": "Bank Clearance",
"link_type": "DocType",
"onboard": 0,
@ -639,6 +706,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Bank Reconciliation Tool",
"link_count": 0,
"link_to": "Bank Reconciliation Tool",
"link_type": "DocType",
"onboard": 0,
@ -649,6 +717,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Bank Reconciliation Statement",
"link_count": 0,
"link_to": "Bank Reconciliation Statement",
"link_type": "Report",
"onboard": 0,
@ -658,6 +727,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Subscription Management",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -666,6 +736,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Subscription Plan",
"link_count": 0,
"link_to": "Subscription Plan",
"link_type": "DocType",
"onboard": 0,
@ -676,6 +747,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Subscription",
"link_count": 0,
"link_to": "Subscription",
"link_type": "DocType",
"onboard": 0,
@ -686,6 +758,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Subscription Settings",
"link_count": 0,
"link_to": "Subscription Settings",
"link_type": "DocType",
"onboard": 0,
@ -695,6 +768,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Goods and Services Tax (GST India)",
"link_count": 0,
"onboard": 0,
"only_for": "India",
"type": "Card Break"
@ -704,6 +778,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "GST Settings",
"link_count": 0,
"link_to": "GST Settings",
"link_type": "DocType",
"onboard": 0,
@ -715,6 +790,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "GST HSN Code",
"link_count": 0,
"link_to": "GST HSN Code",
"link_type": "DocType",
"onboard": 0,
@ -726,6 +802,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "GSTR-1",
"link_count": 0,
"link_to": "GSTR-1",
"link_type": "Report",
"onboard": 0,
@ -737,6 +814,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "GSTR-2",
"link_count": 0,
"link_to": "GSTR-2",
"link_type": "Report",
"onboard": 0,
@ -748,6 +826,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "GSTR 3B Report",
"link_count": 0,
"link_to": "GSTR 3B Report",
"link_type": "DocType",
"onboard": 0,
@ -759,6 +838,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "GST Sales Register",
"link_count": 0,
"link_to": "GST Sales Register",
"link_type": "Report",
"onboard": 0,
@ -770,6 +850,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "GST Purchase Register",
"link_count": 0,
"link_to": "GST Purchase Register",
"link_type": "Report",
"onboard": 0,
@ -781,6 +862,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "GST Itemised Sales Register",
"link_count": 0,
"link_to": "GST Itemised Sales Register",
"link_type": "Report",
"onboard": 0,
@ -792,6 +874,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "GST Itemised Purchase Register",
"link_count": 0,
"link_to": "GST Itemised Purchase Register",
"link_type": "Report",
"onboard": 0,
@ -803,6 +886,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "C-Form",
"link_count": 0,
"link_to": "C-Form",
"link_type": "DocType",
"onboard": 0,
@ -814,6 +898,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Lower Deduction Certificate",
"link_count": 0,
"link_to": "Lower Deduction Certificate",
"link_type": "DocType",
"onboard": 0,
@ -824,6 +909,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Share Management",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -832,6 +918,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Shareholder",
"link_count": 0,
"link_to": "Shareholder",
"link_type": "DocType",
"onboard": 0,
@ -842,6 +929,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Share Transfer",
"link_count": 0,
"link_to": "Share Transfer",
"link_type": "DocType",
"onboard": 0,
@ -852,6 +940,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Share Ledger",
"link_count": 0,
"link_to": "Share Ledger",
"link_type": "Report",
"onboard": 0,
@ -862,6 +951,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Share Balance",
"link_count": 0,
"link_to": "Share Balance",
"link_type": "Report",
"onboard": 0,
@ -871,6 +961,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Cost Center and Budgeting",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -879,6 +970,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Chart of Cost Centers",
"link_count": 0,
"link_to": "Cost Center",
"link_type": "DocType",
"onboard": 0,
@ -889,6 +981,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Budget",
"link_count": 0,
"link_to": "Budget",
"link_type": "DocType",
"onboard": 0,
@ -899,6 +992,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Accounting Dimension",
"link_count": 0,
"link_to": "Accounting Dimension",
"link_type": "DocType",
"onboard": 0,
@ -909,6 +1003,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Budget Variance Report",
"link_count": 0,
"link_to": "Budget Variance Report",
"link_type": "Report",
"onboard": 0,
@ -919,6 +1014,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Monthly Distribution",
"link_count": 0,
"link_to": "Monthly Distribution",
"link_type": "DocType",
"onboard": 0,
@ -928,6 +1024,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Opening and Closing",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -936,6 +1033,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Opening Invoice Creation Tool",
"link_count": 0,
"link_to": "Opening Invoice Creation Tool",
"link_type": "DocType",
"onboard": 0,
@ -946,6 +1044,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Chart of Accounts Importer",
"link_count": 0,
"link_to": "Chart of Accounts Importer",
"link_type": "DocType",
"onboard": 0,
@ -956,6 +1055,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Period Closing Voucher",
"link_count": 0,
"link_to": "Period Closing Voucher",
"link_type": "DocType",
"onboard": 0,
@ -965,6 +1065,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Taxes",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -973,6 +1074,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Sales Taxes and Charges Template",
"link_count": 0,
"link_to": "Sales Taxes and Charges Template",
"link_type": "DocType",
"onboard": 0,
@ -983,6 +1085,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Purchase Taxes and Charges Template",
"link_count": 0,
"link_to": "Purchase Taxes and Charges Template",
"link_type": "DocType",
"onboard": 0,
@ -993,6 +1096,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Item Tax Template",
"link_count": 0,
"link_to": "Item Tax Template",
"link_type": "DocType",
"onboard": 0,
@ -1003,6 +1107,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Tax Category",
"link_count": 0,
"link_to": "Tax Category",
"link_type": "DocType",
"onboard": 0,
@ -1013,6 +1118,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Tax Rule",
"link_count": 0,
"link_to": "Tax Rule",
"link_type": "DocType",
"onboard": 0,
@ -1023,6 +1129,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Tax Withholding Category",
"link_count": 0,
"link_to": "Tax Withholding Category",
"link_type": "DocType",
"onboard": 0,
@ -1032,6 +1139,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Profitability",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -1040,6 +1148,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Gross Profit",
"link_count": 0,
"link_to": "Gross Profit",
"link_type": "Report",
"onboard": 0,
@ -1050,6 +1159,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Profitability Analysis",
"link_count": 0,
"link_to": "Profitability Analysis",
"link_type": "Report",
"onboard": 0,
@ -1060,6 +1170,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Sales Invoice Trends",
"link_count": 0,
"link_to": "Sales Invoice Trends",
"link_type": "Report",
"onboard": 0,
@ -1070,20 +1181,26 @@
"hidden": 0,
"is_query_report": 1,
"label": "Purchase Invoice Trends",
"link_count": 0,
"link_to": "Purchase Invoice Trends",
"link_type": "Report",
"onboard": 0,
"type": "Link"
}
],
"modified": "2021-06-10 03:17:31.427945",
"modified": "2021-08-05 12:15:52.872470",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Accounting",
"onboarding": "Accounts",
"owner": "Administrator",
"parent_page": "",
"pin_to_bottom": 0,
"pin_to_top": 0,
"public": 1,
"restrict_to_domain": "",
"roles": [],
"sequence_id": 2,
"shortcuts": [
{
"label": "Chart of Accounts",
@ -1130,5 +1247,6 @@
"link_to": "Accounts",
"type": "Dashboard"
}
]
],
"title": "Accounting"
}

View File

@ -1,22 +1,27 @@
{
"category": "Domains",
"category": "",
"charts": [],
"content": "[{\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Crops & Lands\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Analytics\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Diseases & Fertilizers\", \"col\": 4}}]",
"creation": "2020-03-02 17:23:34.339274",
"developer_mode_only": 0,
"disable_user_customization": 0,
"docstatus": 0,
"doctype": "Workspace",
"extends": "",
"extends_another_page": 0,
"for_user": "",
"hide_custom": 0,
"icon": "agriculture",
"idx": 0,
"is_standard": 1,
"is_default": 0,
"is_standard": 0,
"label": "Agriculture",
"links": [
{
"hidden": 0,
"is_query_report": 0,
"label": "Crops & Lands",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -25,6 +30,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Crop",
"link_count": 0,
"link_to": "Crop",
"link_type": "DocType",
"onboard": 1,
@ -35,6 +41,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Crop Cycle",
"link_count": 0,
"link_to": "Crop Cycle",
"link_type": "DocType",
"onboard": 1,
@ -45,6 +52,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Location",
"link_count": 0,
"link_to": "Location",
"link_type": "DocType",
"onboard": 1,
@ -54,6 +62,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Analytics",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -62,6 +71,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Plant Analysis",
"link_count": 0,
"link_to": "Plant Analysis",
"link_type": "DocType",
"onboard": 0,
@ -72,6 +82,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Soil Analysis",
"link_count": 0,
"link_to": "Soil Analysis",
"link_type": "DocType",
"onboard": 0,
@ -82,6 +93,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Water Analysis",
"link_count": 0,
"link_to": "Water Analysis",
"link_type": "DocType",
"onboard": 0,
@ -92,6 +104,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Soil Texture",
"link_count": 0,
"link_to": "Soil Texture",
"link_type": "DocType",
"onboard": 0,
@ -102,6 +115,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Weather",
"link_count": 0,
"link_to": "Weather",
"link_type": "DocType",
"onboard": 0,
@ -112,6 +126,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Agriculture Analysis Criteria",
"link_count": 0,
"link_to": "Agriculture Analysis Criteria",
"link_type": "DocType",
"onboard": 0,
@ -121,6 +136,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Diseases & Fertilizers",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -129,6 +145,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Disease",
"link_count": 0,
"link_to": "Disease",
"link_type": "DocType",
"onboard": 1,
@ -139,19 +156,26 @@
"hidden": 0,
"is_query_report": 0,
"label": "Fertilizer",
"link_count": 0,
"link_to": "Fertilizer",
"link_type": "DocType",
"onboard": 1,
"type": "Link"
}
],
"modified": "2020-12-01 13:38:38.477493",
"modified": "2021-08-05 12:15:54.595197",
"modified_by": "Administrator",
"module": "Agriculture",
"name": "Agriculture",
"onboarding": "",
"owner": "Administrator",
"parent_page": "",
"pin_to_bottom": 0,
"pin_to_top": 0,
"public": 1,
"restrict_to_domain": "Agriculture",
"shortcuts": []
"roles": [],
"sequence_id": 3,
"shortcuts": [],
"title": "Agriculture"
}

View File

@ -56,12 +56,12 @@ class Asset(AccountsController):
if self.is_existing_asset and self.purchase_invoice:
frappe.throw(_("Purchase Invoice cannot be made against an existing asset {0}").format(self.name))
def prepare_depreciation_data(self):
def prepare_depreciation_data(self, date_of_sale=None):
if self.calculate_depreciation:
self.value_after_depreciation = 0
self.set_depreciation_rate()
self.make_depreciation_schedule()
self.set_accumulated_depreciation()
self.make_depreciation_schedule(date_of_sale)
self.set_accumulated_depreciation(date_of_sale)
else:
self.finance_books = []
self.value_after_depreciation = (flt(self.gross_purchase_amount) -
@ -167,7 +167,7 @@ class Asset(AccountsController):
d.rate_of_depreciation = flt(self.get_depreciation_rate(d, on_validate=True),
d.precision("rate_of_depreciation"))
def make_depreciation_schedule(self):
def make_depreciation_schedule(self, date_of_sale):
if 'Manual' not in [d.depreciation_method for d in self.finance_books] and not self.schedules:
self.schedules = []
@ -176,16 +176,16 @@ class Asset(AccountsController):
for d in self.get('finance_books'):
self.validate_asset_finance_books(d)
start = self.clear_depreciation_schedule()
# value_after_depreciation - current Asset value
if d.value_after_depreciation:
value_after_depreciation = (flt(d.value_after_depreciation) -
flt(self.opening_accumulated_depreciation))
flt(self.opening_accumulated_depreciation))
else:
value_after_depreciation = (flt(self.gross_purchase_amount) -
flt(self.opening_accumulated_depreciation))
flt(self.opening_accumulated_depreciation))
d.value_after_depreciation = value_after_depreciation
@ -212,6 +212,21 @@ class Asset(AccountsController):
# so monthly schedule date is calculated by removing 11 months from it
monthly_schedule_date = add_months(schedule_date, - d.frequency_of_depreciation + 1)
# if asset is being sold
if date_of_sale:
from_date = self.get_from_date(d.finance_book)
depreciation_amount, days, months = self.get_pro_rata_amt(d, depreciation_amount,
from_date, date_of_sale)
self.append("schedules", {
"schedule_date": date_of_sale,
"depreciation_amount": depreciation_amount,
"depreciation_method": d.depreciation_method,
"finance_book": d.finance_book,
"finance_book_id": d.idx
})
break
# For first row
if has_pro_rata and n==0:
depreciation_amount, days, months = self.get_pro_rata_amt(d, depreciation_amount,
@ -303,6 +318,21 @@ class Asset(AccountsController):
break
return start
def get_from_date(self, finance_book):
if not self.get('schedules'):
return self.available_for_use_date
if len(self.finance_books) == 1:
return self.schedules[-1].schedule_date
from_date = ""
for schedule in self.get('schedules'):
if schedule.finance_book == finance_book:
from_date = schedule.schedule_date
if from_date:
return from_date
return self.available_for_use_date
# if it returns True, depreciation_amount will not be equal for the first and last rows
def check_is_pro_rata(self, row):
@ -357,7 +387,7 @@ class Asset(AccountsController):
frappe.throw(_("Depreciation Row {0}: Next Depreciation Date cannot be before Available-for-use Date")
.format(row.idx))
def set_accumulated_depreciation(self, ignore_booked_entry = False):
def set_accumulated_depreciation(self, date_of_sale=None, ignore_booked_entry = False):
straight_line_idx = [d.idx for d in self.get("schedules") if d.depreciation_method == 'Straight Line']
finance_books = []
@ -365,7 +395,7 @@ class Asset(AccountsController):
if ignore_booked_entry and d.journal_entry:
continue
if d.finance_book_id not in finance_books:
if int(d.finance_book_id) not in finance_books:
accumulated_depreciation = flt(self.opening_accumulated_depreciation)
value_after_depreciation = flt(self.get_value_after_depreciation(d.finance_book_id))
finance_books.append(int(d.finance_book_id))
@ -374,7 +404,7 @@ class Asset(AccountsController):
value_after_depreciation -= flt(depreciation_amount)
# for the last row, if depreciation method = Straight Line
if straight_line_idx and i == max(straight_line_idx) - 1:
if straight_line_idx and i == max(straight_line_idx) - 1 and not date_of_sale:
book = self.get('finance_books')[cint(d.finance_book_id) - 1]
depreciation_amount += flt(value_after_depreciation -
flt(book.expected_value_after_useful_life), d.precision("depreciation_amount"))
@ -801,4 +831,4 @@ def get_depreciation_amount(asset, depreciable_value, row):
else:
depreciation_amount = flt(depreciable_value * (flt(row.rate_of_depreciation) / 100))
return depreciation_amount
return depreciation_amount

View File

@ -15,6 +15,7 @@ from erpnext.stock.doctype.purchase_receipt.test_purchase_receipt import make_pu
class TestAssetMovement(unittest.TestCase):
def setUp(self):
frappe.db.set_value("Company", "_Test Company", "capital_work_in_progress_account", "CWIP Account - _TC")
create_asset_data()
make_location()
@ -45,12 +46,12 @@ class TestAssetMovement(unittest.TestCase):
'location_name': 'Test Location 2'
}).insert()
movement1 = create_asset_movement(purpose = 'Transfer', company = asset.company,
movement1 = create_asset_movement(purpose = 'Transfer', company = asset.company,
assets = [{ 'asset': asset.name , 'source_location': 'Test Location', 'target_location': 'Test Location 2'}],
reference_doctype = 'Purchase Receipt', reference_name = pr.name)
self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location 2")
movement2 = create_asset_movement(purpose = 'Transfer', company = asset.company,
create_asset_movement(purpose = 'Transfer', company = asset.company,
assets = [{ 'asset': asset.name , 'source_location': 'Test Location 2', 'target_location': 'Test Location'}],
reference_doctype = 'Purchase Receipt', reference_name = pr.name)
self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location")
@ -59,18 +60,18 @@ class TestAssetMovement(unittest.TestCase):
self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location")
employee = make_employee("testassetmovemp@example.com", company="_Test Company")
movement3 = create_asset_movement(purpose = 'Issue', company = asset.company,
create_asset_movement(purpose = 'Issue', company = asset.company,
assets = [{ 'asset': asset.name , 'source_location': 'Test Location', 'to_employee': employee}],
reference_doctype = 'Purchase Receipt', reference_name = pr.name)
# after issuing asset should belong to an employee not at a location
self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), None)
self.assertEqual(frappe.db.get_value("Asset", asset.name, "custodian"), employee)
def test_last_movement_cancellation(self):
pr = make_purchase_receipt(item_code="Macbook Pro",
qty=1, rate=100000.0, location="Test Location")
asset_name = frappe.db.get_value("Asset", {"purchase_receipt": pr.name}, 'name')
asset = frappe.get_doc('Asset', asset_name)
asset.calculate_depreciation = 1
@ -85,17 +86,17 @@ class TestAssetMovement(unittest.TestCase):
})
if asset.docstatus == 0:
asset.submit()
if not frappe.db.exists("Location", "Test Location 2"):
frappe.get_doc({
'doctype': 'Location',
'location_name': 'Test Location 2'
}).insert()
movement = frappe.get_doc({'doctype': 'Asset Movement', 'reference_name': pr.name })
self.assertRaises(frappe.ValidationError, movement.cancel)
movement1 = create_asset_movement(purpose = 'Transfer', company = asset.company,
movement1 = create_asset_movement(purpose = 'Transfer', company = asset.company,
assets = [{ 'asset': asset.name , 'source_location': 'Test Location', 'target_location': 'Test Location 2'}],
reference_doctype = 'Purchase Receipt', reference_name = pr.name)
self.assertEqual(frappe.db.get_value("Asset", asset.name, "location"), "Test Location 2")

View File

@ -1,27 +1,32 @@
{
"category": "Modules",
"category": "",
"charts": [
{
"chart_name": "Asset Value Analytics",
"label": "Asset Value Analytics"
}
],
"content": "[{\"type\": \"onboarding\", \"data\": {\"onboarding_name\":\"Assets\", \"col\": 12}}, {\"type\": \"chart\", \"data\": {\"chart_name\": \"Asset Value Analytics\", \"col\": 12}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Asset\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Asset Category\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Fixed Asset Register\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Assets\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Maintenance\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Reports\", \"col\": 4}}]",
"creation": "2020-03-02 15:43:27.634865",
"developer_mode_only": 0,
"disable_user_customization": 0,
"docstatus": 0,
"doctype": "Workspace",
"extends": "",
"extends_another_page": 0,
"for_user": "",
"hide_custom": 0,
"icon": "assets",
"idx": 0,
"is_standard": 1,
"is_default": 0,
"is_standard": 0,
"label": "Assets",
"links": [
{
"hidden": 0,
"is_query_report": 0,
"label": "Assets",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -30,6 +35,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Asset",
"link_count": 0,
"link_to": "Asset",
"link_type": "DocType",
"onboard": 1,
@ -40,6 +46,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Location",
"link_count": 0,
"link_to": "Location",
"link_type": "DocType",
"onboard": 1,
@ -50,6 +57,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Asset Category",
"link_count": 0,
"link_to": "Asset Category",
"link_type": "DocType",
"onboard": 1,
@ -60,6 +68,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Asset Movement",
"link_count": 0,
"link_to": "Asset Movement",
"link_type": "DocType",
"onboard": 0,
@ -69,6 +78,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Maintenance",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -77,6 +87,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Asset Maintenance Team",
"link_count": 0,
"link_to": "Asset Maintenance Team",
"link_type": "DocType",
"onboard": 1,
@ -87,6 +98,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Asset Maintenance",
"link_count": 0,
"link_to": "Asset Maintenance",
"link_type": "DocType",
"onboard": 1,
@ -97,6 +109,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Asset Maintenance Log",
"link_count": 0,
"link_to": "Asset Maintenance Log",
"link_type": "DocType",
"onboard": 0,
@ -107,6 +120,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Asset Value Adjustment",
"link_count": 0,
"link_to": "Asset Value Adjustment",
"link_type": "DocType",
"onboard": 0,
@ -117,6 +131,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Asset Repair",
"link_count": 0,
"link_to": "Asset Repair",
"link_type": "DocType",
"onboard": 0,
@ -126,6 +141,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Reports",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -134,6 +150,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Asset Depreciation Ledger",
"link_count": 0,
"link_to": "Asset Depreciation Ledger",
"link_type": "Report",
"onboard": 0,
@ -144,6 +161,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Asset Depreciations and Balances",
"link_count": 0,
"link_to": "Asset Depreciations and Balances",
"link_type": "Report",
"onboard": 0,
@ -154,20 +172,26 @@
"hidden": 0,
"is_query_report": 0,
"label": "Asset Maintenance",
"link_count": 0,
"link_to": "Asset Maintenance",
"link_type": "Report",
"onboard": 0,
"type": "Link"
}
],
"modified": "2020-12-01 13:38:37.977119",
"modified": "2021-08-05 12:15:54.839452",
"modified_by": "Administrator",
"module": "Assets",
"name": "Assets",
"onboarding": "Assets",
"owner": "Administrator",
"parent_page": "",
"pin_to_bottom": 0,
"pin_to_top": 0,
"public": 1,
"restrict_to_domain": "",
"roles": [],
"sequence_id": 4,
"shortcuts": [
{
"label": "Asset",
@ -189,5 +213,6 @@
"link_to": "Asset",
"type": "Dashboard"
}
]
],
"title": "Assets"
}

View File

@ -447,10 +447,11 @@ def get_mapped_purchase_invoice(source_name, target_doc=None, ignore_permissions
target.flags.ignore_permissions = ignore_permissions
set_missing_values(source, target)
#Get the advance paid Journal Entries in Purchase Invoice Advance
if target.get("allocate_advances_automatically"):
target.set_advances()
target.set_payment_schedule()
def update_item(obj, target, source_parent):
target.amount = flt(obj.amount) - flt(obj.billed_amt)
target.base_amount = target.amount * flt(source_parent.conversion_rate)
@ -470,6 +471,7 @@ def get_mapped_purchase_invoice(source_name, target_doc=None, ignore_permissions
"party_account_currency": "party_account_currency",
"supplier_warehouse":"supplier_warehouse"
},
"field_no_map" : ["payment_terms_template"],
"validation": {
"docstatus": ["=", 1],
}
@ -489,12 +491,6 @@ def get_mapped_purchase_invoice(source_name, target_doc=None, ignore_permissions
},
}
if frappe.get_single("Accounts Settings").automatically_fetch_payment_terms == 1:
fields["Payment Schedule"] = {
"doctype": "Payment Schedule",
"add_if_empty": True
}
doc = get_mapped_doc("Purchase Order", source_name, fields,
target_doc, postprocess, ignore_permissions=ignore_permissions)

View File

@ -484,6 +484,9 @@ class TestPurchaseOrder(unittest.TestCase):
def test_make_purchase_invoice_with_terms(self):
from erpnext.selling.doctype.sales_order.test_sales_order import automatically_fetch_payment_terms, compare_payment_schedules
automatically_fetch_payment_terms()
po = create_purchase_order(do_not_save=True)
self.assertRaises(frappe.ValidationError, make_pi_from_po, po.name)
@ -509,6 +512,7 @@ class TestPurchaseOrder(unittest.TestCase):
self.assertEqual(getdate(pi.payment_schedule[0].due_date), getdate(po.transaction_date))
self.assertEqual(pi.payment_schedule[1].payment_amount, 2500.0)
self.assertEqual(getdate(pi.payment_schedule[1].due_date), add_days(getdate(po.transaction_date), 30))
automatically_fetch_payment_terms(enable=0)
def test_subcontracting(self):
po = create_purchase_order(item_code="_Test FG Item", is_subcontracted="Yes")
@ -632,14 +636,18 @@ class TestPurchaseOrder(unittest.TestCase):
else:
raise Exception
def test_terms_does_not_copy(self):
po = create_purchase_order()
self.assertTrue(po.get('payment_schedule'))
def test_terms_are_not_copied_if_automatically_fetch_payment_terms_is_unchecked(self):
po = create_purchase_order(do_not_save=1)
po.payment_terms_template = '_Test Payment Term Template'
po.save()
po.submit()
frappe.db.set_value('Company', '_Test Company', 'payment_terms', '_Test Payment Term Template 1')
pi = make_pi_from_po(po.name)
pi.save()
self.assertFalse(pi.get('payment_schedule'))
self.assertEqual(pi.get('payment_terms_template'), '_Test Payment Term Template 1')
frappe.db.set_value('Company', '_Test Company', 'payment_terms', '')
def test_terms_copied(self):
po = create_purchase_order(do_not_save=1)
@ -968,8 +976,27 @@ class TestPurchaseOrder(unittest.TestCase):
# To test if the PO does NOT have a Blanket Order
self.assertEqual(po_doc.items[0].blanket_order, None)
def test_payment_terms_are_fetched_when_creating_purchase_invoice(self):
from erpnext.accounts.doctype.payment_entry.test_payment_entry import create_payment_terms_template
from erpnext.accounts.doctype.purchase_invoice.test_purchase_invoice import make_purchase_invoice
from erpnext.selling.doctype.sales_order.test_sales_order import automatically_fetch_payment_terms, compare_payment_schedules
automatically_fetch_payment_terms()
po = create_purchase_order(qty=10, rate=100, do_not_save=1)
create_payment_terms_template()
po.payment_terms_template = 'Test Receivable Template'
po.submit()
pi = make_purchase_invoice(qty=10, rate=100, do_not_save=1)
pi.items[0].purchase_order = po.name
pi.items[0].po_detail = po.items[0].name
pi.insert()
# self.assertEqual(po.payment_terms_template, pi.payment_terms_template)
compare_payment_schedules(self, po, pi)
automatically_fetch_payment_terms(enable=0)
def make_pr_against_po(po, received_qty=0):
pr = make_purchase_receipt(po)

View File

@ -13,6 +13,6 @@
"name": "Drop Shipping Format",
"owner": "Administrator",
"print_format_builder": 0,
"print_format_type": "Server",
"print_format_type": "Jinja",
"standard": "Yes"
}

View File

@ -1,6 +1,6 @@
{
"cards_label": "",
"category": "Modules",
"category": "",
"charts": [
{
"chart_name": "Purchase Order Trends",
@ -8,22 +8,27 @@
}
],
"charts_label": "",
"content": "[{\"type\": \"onboarding\", \"data\": {\"onboarding_name\":\"Buying\", \"col\": 12}}, {\"type\": \"chart\", \"data\": {\"chart_name\": \"Purchase Order Trends\", \"col\": 12}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Item\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Material Request\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Purchase Order\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Purchase Analytics\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Purchase Order Analysis\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Buying\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Items & Pricing\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Settings\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Supplier\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Supplier Scorecard\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Key Reports\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Other Reports\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Regional\", \"col\": 4}}]",
"creation": "2020-01-28 11:50:26.195467",
"developer_mode_only": 0,
"disable_user_customization": 0,
"docstatus": 0,
"doctype": "Workspace",
"extends": "",
"extends_another_page": 0,
"for_user": "",
"hide_custom": 0,
"icon": "buying",
"idx": 0,
"is_standard": 1,
"is_default": 0,
"is_standard": 0,
"label": "Buying",
"links": [
{
"hidden": 0,
"is_query_report": 0,
"label": "Buying",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -32,6 +37,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Material Request",
"link_count": 0,
"link_to": "Material Request",
"link_type": "DocType",
"onboard": 1,
@ -42,6 +48,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Purchase Order",
"link_count": 0,
"link_to": "Purchase Order",
"link_type": "DocType",
"onboard": 1,
@ -52,6 +59,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Purchase Invoice",
"link_count": 0,
"link_to": "Purchase Invoice",
"link_type": "DocType",
"onboard": 1,
@ -62,6 +70,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Request for Quotation",
"link_count": 0,
"link_to": "Request for Quotation",
"link_type": "DocType",
"onboard": 1,
@ -72,6 +81,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Supplier Quotation",
"link_count": 0,
"link_to": "Supplier Quotation",
"link_type": "DocType",
"onboard": 0,
@ -81,6 +91,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Items & Pricing",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -89,6 +100,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Item",
"link_count": 0,
"link_to": "Item",
"link_type": "DocType",
"onboard": 1,
@ -99,6 +111,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Item Price",
"link_count": 0,
"link_to": "Item Price",
"link_type": "DocType",
"onboard": 1,
@ -109,6 +122,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Price List",
"link_count": 0,
"link_to": "Price List",
"link_type": "DocType",
"onboard": 1,
@ -119,6 +133,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Product Bundle",
"link_count": 0,
"link_to": "Product Bundle",
"link_type": "DocType",
"onboard": 0,
@ -129,6 +144,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Item Group",
"link_count": 0,
"link_to": "Item Group",
"link_type": "DocType",
"onboard": 0,
@ -139,6 +155,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Promotional Scheme",
"link_count": 0,
"link_to": "Promotional Scheme",
"link_type": "DocType",
"onboard": 0,
@ -149,6 +166,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Pricing Rule",
"link_count": 0,
"link_to": "Pricing Rule",
"link_type": "DocType",
"onboard": 0,
@ -158,6 +176,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Settings",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -166,6 +185,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Buying Settings",
"link_count": 0,
"link_to": "Buying Settings",
"link_type": "DocType",
"onboard": 0,
@ -176,6 +196,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Purchase Taxes and Charges Template",
"link_count": 0,
"link_to": "Purchase Taxes and Charges Template",
"link_type": "DocType",
"onboard": 0,
@ -186,6 +207,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Terms and Conditions Template",
"link_count": 0,
"link_to": "Terms and Conditions",
"link_type": "DocType",
"onboard": 0,
@ -195,6 +217,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Supplier",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -203,6 +226,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Supplier",
"link_count": 0,
"link_to": "Supplier",
"link_type": "DocType",
"onboard": 1,
@ -213,6 +237,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Supplier Group",
"link_count": 0,
"link_to": "Supplier Group",
"link_type": "DocType",
"onboard": 0,
@ -223,6 +248,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Contact",
"link_count": 0,
"link_to": "Contact",
"link_type": "DocType",
"onboard": 0,
@ -233,6 +259,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Address",
"link_count": 0,
"link_to": "Address",
"link_type": "DocType",
"onboard": 0,
@ -242,6 +269,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Supplier Scorecard",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -250,6 +278,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Supplier Scorecard",
"link_count": 0,
"link_to": "Supplier Scorecard",
"link_type": "DocType",
"onboard": 0,
@ -260,6 +289,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Supplier Scorecard Variable",
"link_count": 0,
"link_to": "Supplier Scorecard Variable",
"link_type": "DocType",
"onboard": 0,
@ -270,6 +300,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Supplier Scorecard Criteria",
"link_count": 0,
"link_to": "Supplier Scorecard Criteria",
"link_type": "DocType",
"onboard": 0,
@ -280,6 +311,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Supplier Scorecard Standing",
"link_count": 0,
"link_to": "Supplier Scorecard Standing",
"link_type": "DocType",
"onboard": 0,
@ -289,6 +321,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Key Reports",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -297,6 +330,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Purchase Analytics",
"link_count": 0,
"link_to": "Purchase Analytics",
"link_type": "Report",
"onboard": 1,
@ -307,6 +341,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Purchase Order Analysis",
"link_count": 0,
"link_to": "Purchase Order Analysis",
"link_type": "Report",
"onboard": 1,
@ -317,6 +352,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Supplier-Wise Sales Analytics",
"link_count": 0,
"link_to": "Supplier-Wise Sales Analytics",
"link_type": "Report",
"onboard": 1,
@ -327,6 +363,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Items to Order and Receive",
"link_count": 0,
"link_to": "Requested Items to Order and Receive",
"link_type": "Report",
"onboard": 1,
@ -337,6 +374,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Purchase Order Trends",
"link_count": 0,
"link_to": "Purchase Order Trends",
"link_type": "Report",
"onboard": 1,
@ -347,6 +385,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Procurement Tracker",
"link_count": 0,
"link_to": "Procurement Tracker",
"link_type": "Report",
"onboard": 1,
@ -356,6 +395,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Other Reports",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -364,6 +404,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Items To Be Requested",
"link_count": 0,
"link_to": "Items To Be Requested",
"link_type": "Report",
"onboard": 1,
@ -374,6 +415,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Item-wise Purchase History",
"link_count": 0,
"link_to": "Item-wise Purchase History",
"link_type": "Report",
"onboard": 1,
@ -384,6 +426,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Purchase Receipt Trends",
"link_count": 0,
"link_to": "Purchase Receipt Trends",
"link_type": "Report",
"onboard": 0,
@ -394,6 +437,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Purchase Invoice Trends",
"link_count": 0,
"link_to": "Purchase Invoice Trends",
"link_type": "Report",
"onboard": 0,
@ -404,6 +448,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Subcontracted Raw Materials To Be Transferred",
"link_count": 0,
"link_to": "Subcontracted Raw Materials To Be Transferred",
"link_type": "Report",
"onboard": 0,
@ -414,6 +459,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Subcontracted Item To Be Received",
"link_count": 0,
"link_to": "Subcontracted Item To Be Received",
"link_type": "Report",
"onboard": 0,
@ -424,6 +470,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Supplier Quotation Comparison",
"link_count": 0,
"link_to": "Supplier Quotation Comparison",
"link_type": "Report",
"onboard": 1,
@ -434,6 +481,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Material Requests for which Supplier Quotations are not created",
"link_count": 0,
"link_to": "Material Requests for which Supplier Quotations are not created",
"link_type": "Report",
"onboard": 0,
@ -444,6 +492,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Supplier Addresses And Contacts",
"link_count": 0,
"link_to": "Address And Contacts",
"link_type": "Report",
"onboard": 0,
@ -453,6 +502,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Regional",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -461,20 +511,26 @@
"hidden": 0,
"is_query_report": 0,
"label": "Import Supplier Invoice",
"link_count": 0,
"link_to": "Import Supplier Invoice",
"link_type": "DocType",
"onboard": 0,
"type": "Link"
}
],
"modified": "2020-12-01 13:38:38.615167",
"modified": "2021-08-05 12:15:56.218427",
"modified_by": "Administrator",
"module": "Buying",
"name": "Buying",
"onboarding": "Buying",
"owner": "Administrator",
"parent_page": "",
"pin_to_bottom": 0,
"pin_to_top": 0,
"public": 1,
"restrict_to_domain": "",
"roles": [],
"sequence_id": 6,
"shortcuts": [
{
"color": "Green",
@ -516,5 +572,6 @@
"type": "Dashboard"
}
],
"shortcuts_label": ""
"shortcuts_label": "",
"title": "Buying"
}

View File

@ -0,0 +1,46 @@
# Version 13.9.0 Release Notes
### Features & Enhancements
- Organizational Chart ([#26261](https://github.com/frappe/erpnext/pull/26261))
- Enable discount accounting ([#26579](https://github.com/frappe/erpnext/pull/26579))
- Added multi-select fields in promotional scheme to create multiple pricing rules ([#25622](https://github.com/frappe/erpnext/pull/25622))
- Over transfer allowance for material transfers ([#26814](https://github.com/frappe/erpnext/pull/26814))
- Enhancements in Tax Withholding Category ([#26661](https://github.com/frappe/erpnext/pull/26661))
### Fixes
- Sales Return cancellation if linked with Payment Entry ([#26883](https://github.com/frappe/erpnext/pull/26883))
- Production plan not fetching sales order of a variant ([#25845](https://github.com/frappe/erpnext/pull/25845))
- Stock Analytics Report must consider warehouse during calculation ([#26908](https://github.com/frappe/erpnext/pull/26908))
- Incorrect date difference calculation ([#26805](https://github.com/frappe/erpnext/pull/26805))
- Tax calculation for Recurring additional salary ([#24206](https://github.com/frappe/erpnext/pull/24206))
- Cannot cancel payment entry if linked with invoices ([#26703](https://github.com/frappe/erpnext/pull/26703))
- Included company in link document type filters for contact ([#26576](https://github.com/frappe/erpnext/pull/26576))
- Fetch Payment Terms from linked Sales/Purchase Order ([#26723](https://github.com/frappe/erpnext/pull/26723))
- Let all System Managers be able to delete Company transactions ([#26819](https://github.com/frappe/erpnext/pull/26819))
- Bank remittance report issue ([#26398](https://github.com/frappe/erpnext/pull/26398))
- Faulty Gl Entry for Asset LCVs ([#26803](https://github.com/frappe/erpnext/pull/26803))
- Clean Serial No input on Server Side ([#26878](https://github.com/frappe/erpnext/pull/26878))
- Supplier invoice importer fix v13 ([#26633](https://github.com/frappe/erpnext/pull/26633))
- POS payment modes displayed wrong total ([#26808](https://github.com/frappe/erpnext/pull/26808))
- Fetching of item tax from hsn code ([#26736](https://github.com/frappe/erpnext/pull/26736))
- Cannot cancel invoice if IRN cancelled on portal ([#26879](https://github.com/frappe/erpnext/pull/26879))
- Validate python expressions ([#26856](https://github.com/frappe/erpnext/pull/26856))
- POS Item Cart non-stop scroll issue ([#26693](https://github.com/frappe/erpnext/pull/26693))
- Add mandatory depends on condition for export type field ([#26958](https://github.com/frappe/erpnext/pull/26958))
- Cannot generate IRNs for standalone credit notes ([#26824](https://github.com/frappe/erpnext/pull/26824))
- Added progress bar in Repost Item Valuation to check the status of reposting ([#26630](https://github.com/frappe/erpnext/pull/26630))
- TDS calculation for first threshold breach for TDS category 194Q ([#26710](https://github.com/frappe/erpnext/pull/26710))
- Student category mapping from the program enrollment tool ([#26739](https://github.com/frappe/erpnext/pull/26739))
- Cost center & account validation in Sales/Purchase Taxes and Charges ([#26881](https://github.com/frappe/erpnext/pull/26881))
- Reset weight_per_unit on replacing Item ([#26791](https://github.com/frappe/erpnext/pull/26791))
- Do not fetch fully return issued purchase receipts ([#26825](https://github.com/frappe/erpnext/pull/26825))
- Incorrect amount in work order required items table. ([#26585](https://github.com/frappe/erpnext/pull/26585))
- Additional discount calculations in Invoices ([#26553](https://github.com/frappe/erpnext/pull/26553))
- Refactored Asset Repair ([#26415](https://github.com/frappe/erpnext/pull/25798))
- Exchange rate revaluation posting date and precision fixes ([#26650](https://github.com/frappe/erpnext/pull/26650))
- POS Invoice consolidated Sales Invoice field set to no copy ([#26768](https://github.com/frappe/erpnext/pull/26768))
- Consider grand total for threshold check ([#26683](https://github.com/frappe/erpnext/pull/26683))
- Budget variance missing values ([#26966](https://github.com/frappe/erpnext/pull/26966))
- GL Entries for exchange gain loss ([#26728](https://github.com/frappe/erpnext/pull/26728))
- Add missing cess amount in GSTR-3B report ([#26544](https://github.com/frappe/erpnext/pull/26544))
- GST Reports timeout issue ([#26575](https://github.com/frappe/erpnext/pull/26575))

View File

@ -813,6 +813,89 @@ class AccountsController(TransactionBase):
tax_map[tax.account_head] -= allocated_amount
allocated_tax_map[tax.account_head] -= allocated_amount
def get_amount_and_base_amount(self, item, enable_discount_accounting):
amount = item.net_amount
base_amount = item.base_net_amount
if enable_discount_accounting and self.get('discount_amount') and self.get('additional_discount_account'):
amount = item.amount
base_amount = item.base_amount
return amount, base_amount
def get_tax_amounts(self, tax, enable_discount_accounting):
amount = tax.tax_amount_after_discount_amount
base_amount = tax.base_tax_amount_after_discount_amount
if enable_discount_accounting and self.get('discount_amount') and self.get('additional_discount_account') \
and self.get('apply_discount_on') == 'Grand Total':
amount = tax.tax_amount
base_amount = tax.base_tax_amount
return amount, base_amount
def make_discount_gl_entries(self, gl_entries):
enable_discount_accounting = cint(frappe.db.get_single_value('Accounts Settings', 'enable_discount_accounting'))
if enable_discount_accounting:
if self.doctype == "Purchase Invoice":
dr_or_cr = "credit"
rev_dr_cr = "debit"
supplier_or_customer = self.supplier
else:
dr_or_cr = "debit"
rev_dr_cr = "credit"
supplier_or_customer = self.customer
for item in self.get("items"):
if item.get('discount_amount') and item.get('discount_account'):
discount_amount = item.discount_amount * item.qty
if self.doctype == "Purchase Invoice":
income_or_expense_account = (item.expense_account
if (not item.enable_deferred_expense or self.is_return)
else item.deferred_expense_account)
else:
income_or_expense_account = (item.income_account
if (not item.enable_deferred_revenue or self.is_return)
else item.deferred_revenue_account)
account_currency = get_account_currency(item.discount_account)
gl_entries.append(
self.get_gl_dict({
"account": item.discount_account,
"against": supplier_or_customer,
dr_or_cr: flt(discount_amount, item.precision('discount_amount')),
dr_or_cr + "_in_account_currency": flt(discount_amount * self.get('conversion_rate'),
item.precision('discount_amount')),
"cost_center": item.cost_center,
"project": item.project
}, account_currency, item=item)
)
account_currency = get_account_currency(income_or_expense_account)
gl_entries.append(
self.get_gl_dict({
"account": income_or_expense_account,
"against": supplier_or_customer,
rev_dr_cr: flt(discount_amount, item.precision('discount_amount')),
rev_dr_cr + "_in_account_currency": flt(discount_amount * self.get('conversion_rate'),
item.precision('discount_amount')),
"cost_center": item.cost_center,
"project": item.project or self.project
}, account_currency, item=item)
)
if self.get('discount_amount') and self.get('additional_discount_account'):
gl_entries.append(
self.get_gl_dict({
"account": self.additional_discount_account,
"against": supplier_or_customer,
dr_or_cr: self.discount_amount,
"cost_center": self.cost_center
}, item=self)
)
def allocate_advance_taxes(self, gl_entries):
tax_map = self.get_tax_map()
for pe in self.get("advances"):
@ -1096,6 +1179,8 @@ class AccountsController(TransactionBase):
if self.doctype in ("Sales Invoice", "Purchase Invoice"):
base_grand_total = base_grand_total - flt(self.base_write_off_amount)
grand_total = grand_total - flt(self.write_off_amount)
po_or_so, doctype, fieldname = self.get_order_details()
automatically_fetch_payment_terms = cint(frappe.db.get_single_value('Accounts Settings', 'automatically_fetch_payment_terms'))
if self.get("total_advance"):
if party_account_currency == self.company_currency:
@ -1106,22 +1191,86 @@ class AccountsController(TransactionBase):
base_grand_total = flt(grand_total * self.get("conversion_rate"), self.precision("base_grand_total"))
if not self.get("payment_schedule"):
if self.get("payment_terms_template"):
if self.doctype in ["Sales Invoice", "Purchase Invoice"] and automatically_fetch_payment_terms \
and self.linked_order_has_payment_terms(po_or_so, fieldname, doctype):
self.fetch_payment_terms_from_order(po_or_so, doctype)
if self.get('payment_terms_template'):
self.ignore_default_payment_terms_template = 1
elif self.get("payment_terms_template"):
data = get_payment_terms(self.payment_terms_template, posting_date, grand_total, base_grand_total)
for item in data:
self.append("payment_schedule", item)
else:
elif self.doctype not in ["Purchase Receipt"]:
data = dict(due_date=due_date, invoice_portion=100, payment_amount=grand_total, base_payment_amount=base_grand_total)
self.append("payment_schedule", data)
else:
for d in self.get("payment_schedule"):
if d.invoice_portion:
d.payment_amount = flt(grand_total * flt(d.invoice_portion / 100), d.precision('payment_amount'))
d.base_payment_amount = flt(base_grand_total * flt(d.invoice_portion / 100), d.precision('base_payment_amount'))
d.outstanding = d.payment_amount
elif not d.invoice_portion:
d.base_payment_amount = flt(base_grand_total * self.get("conversion_rate"), d.precision('base_payment_amount'))
for d in self.get("payment_schedule"):
if d.invoice_portion:
d.payment_amount = flt(grand_total * flt(d.invoice_portion / 100), d.precision('payment_amount'))
d.base_payment_amount = flt(base_grand_total * flt(d.invoice_portion / 100), d.precision('base_payment_amount'))
d.outstanding = d.payment_amount
elif not d.invoice_portion:
d.base_payment_amount = flt(base_grand_total * self.get("conversion_rate"), d.precision('base_payment_amount'))
def get_order_details(self):
if self.doctype == "Sales Invoice":
po_or_so = self.get('items')[0].get('sales_order')
po_or_so_doctype = "Sales Order"
po_or_so_doctype_name = "sales_order"
else:
po_or_so = self.get('items')[0].get('purchase_order')
po_or_so_doctype = "Purchase Order"
po_or_so_doctype_name = "purchase_order"
return po_or_so, po_or_so_doctype, po_or_so_doctype_name
def linked_order_has_payment_terms(self, po_or_so, fieldname, doctype):
if po_or_so and self.all_items_have_same_po_or_so(po_or_so, fieldname):
if self.linked_order_has_payment_terms_template(po_or_so, doctype):
return True
elif self.linked_order_has_payment_schedule(po_or_so):
return True
return False
def all_items_have_same_po_or_so(self, po_or_so, fieldname):
for item in self.get('items'):
if item.get(fieldname) != po_or_so:
return False
return True
def linked_order_has_payment_terms_template(self, po_or_so, doctype):
return frappe.get_value(doctype, po_or_so, 'payment_terms_template')
def linked_order_has_payment_schedule(self, po_or_so):
return frappe.get_all('Payment Schedule', filters={'parent': po_or_so})
def fetch_payment_terms_from_order(self, po_or_so, po_or_so_doctype):
"""
Fetch Payment Terms from Purchase/Sales Order on creating a new Purchase/Sales Invoice.
"""
po_or_so = frappe.get_cached_doc(po_or_so_doctype, po_or_so)
self.payment_schedule = []
self.payment_terms_template = po_or_so.payment_terms_template
for schedule in po_or_so.payment_schedule:
payment_schedule = {
'payment_term': schedule.payment_term,
'due_date': schedule.due_date,
'invoice_portion': schedule.invoice_portion,
'mode_of_payment': schedule.mode_of_payment,
'description': schedule.description
}
if schedule.discount_type == 'Percentage':
payment_schedule['discount_type'] = schedule.discount_type
payment_schedule['discount'] = schedule.discount
self.append("payment_schedule", payment_schedule)
def set_due_date(self):
due_dates = [d.due_date for d in self.get("payment_schedule") if d.due_date]
@ -1829,4 +1978,4 @@ def validate_regional(doc):
@erpnext.allow_regional
def validate_einvoice_fields(doc):
pass
pass

View File

@ -72,7 +72,8 @@ class BuyingController(StockController, Subcontracting):
# set contact and address details for supplier, if they are not mentioned
if getattr(self, "supplier", None):
self.update_if_missing(get_party_details(self.supplier, party_type="Supplier", ignore_permissions=self.flags.ignore_permissions,
doctype=self.doctype, company=self.company, party_address=self.supplier_address, shipping_address=self.get('shipping_address')))
doctype=self.doctype, company=self.company, party_address=self.supplier_address, shipping_address=self.get('shipping_address'),
fetch_payment_terms_template= not self.get('ignore_default_payment_terms_template')))
self.set_missing_item_details(for_validate)

View File

@ -3,7 +3,7 @@
from __future__ import unicode_literals
import frappe
from frappe.utils import flt, comma_or, nowdate, getdate
from frappe.utils import flt, comma_or, nowdate, getdate, now
from frappe import _
from frappe.model.document import Document
@ -336,10 +336,14 @@ class StatusUpdater(Document):
target.notify_update()
def _update_modified(self, args, update_modified):
args['update_modified'] = ''
if update_modified:
args['update_modified'] = ', modified = now(), modified_by = {0}'\
.format(frappe.db.escape(frappe.session.user))
if not update_modified:
args['update_modified'] = ''
return
args['update_modified'] = ', modified = {0}, modified_by = {1}'.format(
frappe.db.escape(now()),
frappe.db.escape(frappe.session.user)
)
def update_billing_status_for_zero_amount_refdoc(self, ref_dt):
ref_fieldname = frappe.scrub(ref_dt)

View File

@ -1,26 +1,31 @@
{
"category": "Modules",
"category": "",
"charts": [
{
"chart_name": "Territory Wise Sales"
}
],
"content": "[{\"type\": \"onboarding\", \"data\": {\"onboarding_name\":\"CRM\", \"col\": 12}}, {\"type\": \"chart\", \"data\": {\"chart_name\": null, \"col\": 12}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Lead\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Opportunity\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Customer\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Sales Analytics\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Sales Pipeline\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Reports\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Maintenance\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Campaign\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Settings\", \"col\": 4}}]",
"creation": "2020-01-23 14:48:30.183272",
"developer_mode_only": 0,
"disable_user_customization": 0,
"docstatus": 0,
"doctype": "Workspace",
"extends": "",
"extends_another_page": 0,
"for_user": "",
"hide_custom": 0,
"icon": "crm",
"idx": 0,
"is_standard": 1,
"is_default": 0,
"is_standard": 0,
"label": "CRM",
"links": [
{
"hidden": 0,
"is_query_report": 0,
"label": "Sales Pipeline",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -29,6 +34,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Lead",
"link_count": 0,
"link_to": "Lead",
"link_type": "DocType",
"onboard": 1,
@ -39,6 +45,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Opportunity",
"link_count": 0,
"link_to": "Opportunity",
"link_type": "DocType",
"onboard": 1,
@ -49,6 +56,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Customer",
"link_count": 0,
"link_to": "Customer",
"link_type": "DocType",
"onboard": 1,
@ -59,6 +67,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Contact",
"link_count": 0,
"link_to": "Contact",
"link_type": "DocType",
"onboard": 1,
@ -69,6 +78,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Communication",
"link_count": 0,
"link_to": "Communication",
"link_type": "DocType",
"onboard": 0,
@ -79,6 +89,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Lead Source",
"link_count": 0,
"link_to": "Lead Source",
"link_type": "DocType",
"onboard": 0,
@ -89,6 +100,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Contract",
"link_count": 0,
"link_to": "Contract",
"link_type": "DocType",
"onboard": 0,
@ -99,6 +111,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Appointment",
"link_count": 0,
"link_to": "Appointment",
"link_type": "DocType",
"onboard": 0,
@ -109,6 +122,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Newsletter",
"link_count": 0,
"link_to": "Newsletter",
"link_type": "DocType",
"onboard": 0,
@ -118,6 +132,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Reports",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -126,6 +141,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Lead Details",
"link_count": 0,
"link_to": "Lead Details",
"link_type": "Report",
"onboard": 1,
@ -136,6 +152,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Sales Funnel",
"link_count": 0,
"link_to": "sales-funnel",
"link_type": "Page",
"onboard": 1,
@ -146,6 +163,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Prospects Engaged But Not Converted",
"link_count": 0,
"link_to": "Prospects Engaged But Not Converted",
"link_type": "Report",
"onboard": 1,
@ -156,6 +174,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "First Response Time for Opportunity",
"link_count": 0,
"link_to": "First Response Time for Opportunity",
"link_type": "Report",
"onboard": 0,
@ -166,6 +185,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Inactive Customers",
"link_count": 0,
"link_to": "Inactive Customers",
"link_type": "Report",
"onboard": 0,
@ -176,6 +196,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Campaign Efficiency",
"link_count": 0,
"link_to": "Campaign Efficiency",
"link_type": "Report",
"onboard": 0,
@ -186,6 +207,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Lead Owner Efficiency",
"link_count": 0,
"link_to": "Lead Owner Efficiency",
"link_type": "Report",
"onboard": 0,
@ -195,6 +217,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Maintenance",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -203,6 +226,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Maintenance Schedule",
"link_count": 0,
"link_to": "Maintenance Schedule",
"link_type": "DocType",
"onboard": 1,
@ -213,6 +237,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Maintenance Visit",
"link_count": 0,
"link_to": "Maintenance Visit",
"link_type": "DocType",
"onboard": 0,
@ -223,6 +248,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Warranty Claim",
"link_count": 0,
"link_to": "Warranty Claim",
"link_type": "DocType",
"onboard": 0,
@ -232,6 +258,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Campaign",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -240,6 +267,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Campaign",
"link_count": 0,
"link_to": "Campaign",
"link_type": "DocType",
"onboard": 0,
@ -250,6 +278,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Email Campaign",
"link_count": 0,
"link_to": "Email Campaign",
"link_type": "DocType",
"onboard": 0,
@ -260,6 +289,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Social Media Post",
"link_count": 0,
"link_to": "Social Media Post",
"link_type": "DocType",
"onboard": 0,
@ -269,6 +299,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Settings",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -277,6 +308,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Customer Group",
"link_count": 0,
"link_to": "Customer Group",
"link_type": "DocType",
"onboard": 1,
@ -287,6 +319,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Territory",
"link_count": 0,
"link_to": "Territory",
"link_type": "DocType",
"onboard": 1,
@ -297,6 +330,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Sales Person",
"link_count": 0,
"link_to": "Sales Person",
"link_type": "DocType",
"onboard": 1,
@ -307,6 +341,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "SMS Center",
"link_count": 0,
"link_to": "SMS Center",
"link_type": "DocType",
"onboard": 0,
@ -317,6 +352,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "SMS Log",
"link_count": 0,
"link_to": "SMS Log",
"link_type": "DocType",
"onboard": 0,
@ -327,6 +363,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "SMS Settings",
"link_count": 0,
"link_to": "SMS Settings",
"link_type": "DocType",
"onboard": 0,
@ -337,6 +374,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Email Group",
"link_count": 0,
"link_to": "Email Group",
"link_type": "DocType",
"onboard": 0,
@ -347,6 +385,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Twitter Settings",
"link_count": 0,
"link_to": "Twitter Settings",
"link_type": "DocType",
"onboard": 0,
@ -357,20 +396,26 @@
"hidden": 0,
"is_query_report": 0,
"label": "LinkedIn Settings",
"link_count": 0,
"link_to": "LinkedIn Settings",
"link_type": "DocType",
"onboard": 0,
"type": "Link"
}
],
"modified": "2020-12-01 13:38:36.871352",
"modified": "2021-08-05 12:15:56.913091",
"modified_by": "Administrator",
"module": "CRM",
"name": "CRM",
"onboarding": "CRM",
"owner": "Administrator",
"parent_page": "",
"pin_to_bottom": 0,
"pin_to_top": 0,
"public": 1,
"restrict_to_domain": "",
"roles": [],
"sequence_id": 7,
"shortcuts": [
{
"color": "Blue",
@ -403,5 +448,6 @@
"link_to": "CRM",
"type": "Dashboard"
}
]
],
"title": "CRM"
}

View File

@ -1,27 +1,32 @@
{
"category": "Domains",
"category": "",
"charts": [
{
"chart_name": "Program Enrollments",
"label": "Program Enrollments"
}
],
"content": "[{\"type\": \"onboarding\", \"data\": {\"onboarding_name\":\"Education\", \"col\": 12}}, {\"type\": \"chart\", \"data\": {\"chart_name\": \"Program Enrollments\", \"col\": 12}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Student\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Instructor\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Program\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Course\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Fees\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Student Monthly Attendance Sheet\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Course Scheduling Tool\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Student Attendance Tool\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Student and Instructor\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Masters\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Content Masters\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Settings\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Admission\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Fees\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Schedule\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Attendance\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"LMS Activity\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Assessment\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Assessment Reports\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Tools\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Other Reports\", \"col\": 4}}]",
"creation": "2020-03-02 17:22:57.066401",
"developer_mode_only": 0,
"disable_user_customization": 0,
"docstatus": 0,
"doctype": "Workspace",
"extends": "",
"extends_another_page": 0,
"for_user": "",
"hide_custom": 0,
"icon": "education",
"idx": 0,
"is_standard": 1,
"is_default": 0,
"is_standard": 0,
"label": "Education",
"links": [
{
"hidden": 0,
"is_query_report": 0,
"label": "Student and Instructor",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -30,6 +35,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Student",
"link_count": 0,
"link_to": "Student",
"link_type": "DocType",
"onboard": 1,
@ -40,6 +46,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Instructor",
"link_count": 0,
"link_to": "Instructor",
"link_type": "DocType",
"onboard": 1,
@ -50,6 +57,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Guardian",
"link_count": 0,
"link_to": "Guardian",
"link_type": "DocType",
"onboard": 0,
@ -60,6 +68,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Student Group",
"link_count": 0,
"link_to": "Student Group",
"link_type": "DocType",
"onboard": 0,
@ -70,6 +79,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Student Log",
"link_count": 0,
"link_to": "Student Log",
"link_type": "DocType",
"onboard": 0,
@ -79,6 +89,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Masters",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -87,6 +98,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Program",
"link_count": 0,
"link_to": "Program",
"link_type": "DocType",
"onboard": 0,
@ -97,6 +109,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Course",
"link_count": 0,
"link_to": "Course",
"link_type": "DocType",
"onboard": 1,
@ -107,6 +120,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Topic",
"link_count": 0,
"link_to": "Topic",
"link_type": "DocType",
"onboard": 0,
@ -117,6 +131,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Room",
"link_count": 0,
"link_to": "Room",
"link_type": "DocType",
"onboard": 1,
@ -126,6 +141,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Content Masters",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -134,6 +150,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Article",
"link_count": 0,
"link_to": "Article",
"link_type": "DocType",
"onboard": 0,
@ -144,6 +161,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Video",
"link_count": 0,
"link_to": "Video",
"link_type": "DocType",
"onboard": 0,
@ -154,6 +172,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Quiz",
"link_count": 0,
"link_to": "Quiz",
"link_type": "DocType",
"onboard": 0,
@ -163,6 +182,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Settings",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -171,6 +191,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Education Settings",
"link_count": 0,
"link_to": "Education Settings",
"link_type": "DocType",
"onboard": 0,
@ -181,6 +202,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Student Category",
"link_count": 0,
"link_to": "Student Category",
"link_type": "DocType",
"onboard": 0,
@ -191,6 +213,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Student Batch Name",
"link_count": 0,
"link_to": "Student Batch Name",
"link_type": "DocType",
"onboard": 0,
@ -201,6 +224,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Grading Scale",
"link_count": 0,
"link_to": "Grading Scale",
"link_type": "DocType",
"onboard": 1,
@ -211,6 +235,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Academic Term",
"link_count": 0,
"link_to": "Academic Term",
"link_type": "DocType",
"onboard": 0,
@ -221,6 +246,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Academic Year",
"link_count": 0,
"link_to": "Academic Year",
"link_type": "DocType",
"onboard": 0,
@ -230,6 +256,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Admission",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -238,6 +265,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Student Applicant",
"link_count": 0,
"link_to": "Student Applicant",
"link_type": "DocType",
"onboard": 0,
@ -248,6 +276,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Student Admission",
"link_count": 0,
"link_to": "Student Admission",
"link_type": "DocType",
"onboard": 0,
@ -258,6 +287,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Program Enrollment",
"link_count": 0,
"link_to": "Program Enrollment",
"link_type": "DocType",
"onboard": 0,
@ -268,6 +298,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Course Enrollment",
"link_count": 0,
"link_to": "Course Enrollment",
"link_type": "DocType",
"onboard": 0,
@ -277,6 +308,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Fees",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -285,6 +317,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Fee Structure",
"link_count": 0,
"link_to": "Fee Structure",
"link_type": "DocType",
"onboard": 0,
@ -295,6 +328,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Fee Category",
"link_count": 0,
"link_to": "Fee Category",
"link_type": "DocType",
"onboard": 0,
@ -305,6 +339,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Fee Schedule",
"link_count": 0,
"link_to": "Fee Schedule",
"link_type": "DocType",
"onboard": 0,
@ -315,6 +350,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Fees",
"link_count": 0,
"link_to": "Fees",
"link_type": "DocType",
"onboard": 0,
@ -325,6 +361,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Student Fee Collection Report",
"link_count": 0,
"link_to": "Student Fee Collection",
"link_type": "Report",
"onboard": 0,
@ -335,6 +372,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Program wise Fee Collection Report",
"link_count": 0,
"link_to": "Program wise Fee Collection",
"link_type": "Report",
"onboard": 0,
@ -344,6 +382,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Schedule",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -352,6 +391,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Course Schedule",
"link_count": 0,
"link_to": "Course Schedule",
"link_type": "DocType",
"onboard": 0,
@ -362,6 +402,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Course Scheduling Tool",
"link_count": 0,
"link_to": "Course Scheduling Tool",
"link_type": "DocType",
"onboard": 0,
@ -371,6 +412,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Attendance",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -379,6 +421,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Student Attendance",
"link_count": 0,
"link_to": "Student Attendance",
"link_type": "DocType",
"onboard": 0,
@ -389,6 +432,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Student Leave Application",
"link_count": 0,
"link_to": "Student Leave Application",
"link_type": "DocType",
"onboard": 0,
@ -399,6 +443,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Student Monthly Attendance Sheet",
"link_count": 0,
"link_to": "Student Monthly Attendance Sheet",
"link_type": "Report",
"onboard": 0,
@ -409,6 +454,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Absent Student Report",
"link_count": 0,
"link_to": "Absent Student Report",
"link_type": "Report",
"onboard": 0,
@ -419,6 +465,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Student Batch-Wise Attendance",
"link_count": 0,
"link_to": "Student Batch-Wise Attendance",
"link_type": "Report",
"onboard": 0,
@ -428,6 +475,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "LMS Activity",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -436,6 +484,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Course Enrollment",
"link_count": 0,
"link_to": "Course Enrollment",
"link_type": "DocType",
"onboard": 0,
@ -446,6 +495,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Course Activity",
"link_count": 0,
"link_to": "Course Activity",
"link_type": "DocType",
"onboard": 0,
@ -456,6 +506,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Quiz Activity",
"link_count": 0,
"link_to": "Quiz Activity",
"link_type": "DocType",
"onboard": 0,
@ -465,6 +516,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Assessment",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -473,6 +525,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Assessment Plan",
"link_count": 0,
"link_to": "Assessment Plan",
"link_type": "DocType",
"onboard": 0,
@ -483,6 +536,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Assessment Group",
"link_count": 0,
"link_to": "Assessment Group",
"link_type": "DocType",
"onboard": 0,
@ -493,6 +547,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Assessment Result",
"link_count": 0,
"link_to": "Assessment Result",
"link_type": "DocType",
"onboard": 0,
@ -503,6 +558,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Assessment Criteria",
"link_count": 0,
"link_to": "Assessment Criteria",
"link_type": "DocType",
"onboard": 0,
@ -512,6 +568,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Assessment Reports",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -520,6 +577,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Course wise Assessment Report",
"link_count": 0,
"link_to": "Course wise Assessment Report",
"link_type": "Report",
"onboard": 0,
@ -530,6 +588,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Final Assessment Grades",
"link_count": 0,
"link_to": "Final Assessment Grades",
"link_type": "Report",
"onboard": 0,
@ -540,6 +599,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Assessment Plan Status",
"link_count": 0,
"link_to": "Assessment Plan Status",
"link_type": "Report",
"onboard": 0,
@ -550,6 +610,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Student Report Generation Tool",
"link_count": 0,
"link_to": "Student Report Generation Tool",
"link_type": "DocType",
"onboard": 0,
@ -559,6 +620,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Tools",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -567,6 +629,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Student Attendance Tool",
"link_count": 0,
"link_to": "Student Attendance Tool",
"link_type": "DocType",
"onboard": 0,
@ -577,6 +640,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Assessment Result Tool",
"link_count": 0,
"link_to": "Assessment Result Tool",
"link_type": "DocType",
"onboard": 0,
@ -587,6 +651,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Student Group Creation Tool",
"link_count": 0,
"link_to": "Student Group Creation Tool",
"link_type": "DocType",
"onboard": 0,
@ -597,6 +662,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Program Enrollment Tool",
"link_count": 0,
"link_to": "Program Enrollment Tool",
"link_type": "DocType",
"onboard": 0,
@ -607,6 +673,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Course Scheduling Tool",
"link_count": 0,
"link_to": "Course Scheduling Tool",
"link_type": "DocType",
"onboard": 0,
@ -616,6 +683,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Other Reports",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -624,21 +692,26 @@
"hidden": 0,
"is_query_report": 1,
"label": "Student and Guardian Contact Details",
"link_count": 0,
"link_to": "Student and Guardian Contact Details",
"link_type": "Report",
"onboard": 0,
"type": "Link"
}
],
"modified": "2020-12-01 13:38:37.448989",
"modified": "2021-08-05 12:15:57.929275",
"modified_by": "Administrator",
"module": "Education",
"name": "Education",
"onboarding": "Education",
"owner": "Administrator",
"parent_page": "",
"pin_to_bottom": 0,
"pin_to_top": 0,
"public": 1,
"restrict_to_domain": "Education",
"roles": [],
"sequence_id": 9,
"shortcuts": [
{
"color": "Grey",
@ -697,5 +770,6 @@
"link_to": "Education",
"type": "Dashboard"
}
]
],
"title": "Education"
}

View File

@ -1,22 +1,27 @@
{
"category": "Modules",
"category": "",
"charts": [],
"content": "[{\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Marketplace\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Payments\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Settings\", \"col\": 4}}]",
"creation": "2020-08-20 19:30:48.138801",
"developer_mode_only": 0,
"disable_user_customization": 0,
"docstatus": 0,
"doctype": "Workspace",
"extends": "Integrations",
"extends_another_page": 1,
"hide_custom": 1,
"extends": "",
"extends_another_page": 0,
"for_user": "",
"hide_custom": 0,
"icon": "integration",
"idx": 0,
"is_standard": 1,
"is_default": 0,
"is_standard": 0,
"label": "ERPNext Integrations",
"links": [
{
"hidden": 0,
"is_query_report": 0,
"label": "Marketplace",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -25,6 +30,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Woocommerce Settings",
"link_count": 0,
"link_to": "Woocommerce Settings",
"link_type": "DocType",
"onboard": 0,
@ -35,15 +41,28 @@
"hidden": 0,
"is_query_report": 0,
"label": "Amazon MWS Settings",
"link_count": 0,
"link_to": "Amazon MWS Settings",
"link_type": "DocType",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
"label": "Shopify Settings",
"link_count": 0,
"link_to": "Shopify Settings",
"link_type": "DocType",
"onboard": 0,
"type": "Link"
},
{
"hidden": 0,
"is_query_report": 0,
"label": "Payments",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -52,6 +71,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "GoCardless Settings",
"link_count": 0,
"link_to": "GoCardless Settings",
"link_type": "DocType",
"onboard": 0,
@ -62,6 +82,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "M-Pesa Settings",
"link_count": 0,
"link_to": "Mpesa Settings",
"link_type": "DocType",
"onboard": 0,
@ -71,6 +92,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Settings",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -79,6 +101,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Plaid Settings",
"link_count": 0,
"link_to": "Plaid Settings",
"link_type": "DocType",
"onboard": 0,
@ -89,18 +112,26 @@
"hidden": 0,
"is_query_report": 0,
"label": "Exotel Settings",
"link_count": 0,
"link_to": "Exotel Settings",
"link_type": "DocType",
"onboard": 0,
"type": "Link"
}
],
"modified": "2020-12-01 13:38:35.846528",
"modified": "2021-08-05 12:15:58.740246",
"modified_by": "Administrator",
"module": "ERPNext Integrations",
"name": "ERPNext Integrations",
"onboarding": "",
"owner": "Administrator",
"parent_page": "",
"pin_to_bottom": 0,
"pin_to_top": 0,
"shortcuts": []
"public": 1,
"restrict_to_domain": "",
"roles": [],
"sequence_id": 10,
"shortcuts": [],
"title": "ERPNext Integrations"
}

View File

@ -1,22 +1,27 @@
{
"category": "Modules",
"category": "",
"charts": [],
"content": "[{\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Integrations Settings\", \"col\": 4}}]",
"creation": "2020-07-31 10:38:54.021237",
"developer_mode_only": 0,
"disable_user_customization": 0,
"docstatus": 0,
"doctype": "Workspace",
"extends": "Settings",
"extends_another_page": 1,
"extends": "",
"extends_another_page": 0,
"for_user": "",
"hide_custom": 0,
"icon": "setting",
"idx": 0,
"is_standard": 1,
"is_default": 0,
"is_standard": 0,
"label": "ERPNext Integrations Settings",
"links": [
{
"hidden": 0,
"is_query_report": 0,
"label": "Integrations Settings",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -25,16 +30,29 @@
"hidden": 0,
"is_query_report": 0,
"label": "Woocommerce Settings",
"link_count": 0,
"link_to": "Woocommerce Settings",
"link_type": "DocType",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
"label": "Shopify Settings",
"link_count": 0,
"link_to": "Shopify Settings",
"link_type": "DocType",
"onboard": 0,
"type": "Link"
},
{
"dependencies": "",
"hidden": 0,
"is_query_report": 0,
"label": "Amazon MWS Settings",
"link_count": 0,
"link_to": "Amazon MWS Settings",
"link_type": "DocType",
"onboard": 0,
@ -45,6 +63,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Plaid Settings",
"link_count": 0,
"link_to": "Plaid Settings",
"link_type": "DocType",
"onboard": 0,
@ -55,18 +74,26 @@
"hidden": 0,
"is_query_report": 0,
"label": "Exotel Settings",
"link_count": 0,
"link_to": "Exotel Settings",
"link_type": "DocType",
"onboard": 0,
"type": "Link"
}
],
"modified": "2020-12-01 13:38:34.732552",
"modified": "2021-08-05 12:15:58.951704",
"modified_by": "Administrator",
"module": "ERPNext Integrations",
"name": "ERPNext Integrations Settings",
"onboarding": "",
"owner": "Administrator",
"parent_page": "",
"pin_to_bottom": 0,
"pin_to_top": 0,
"shortcuts": []
"public": 1,
"restrict_to_domain": "",
"roles": [],
"sequence_id": 11,
"shortcuts": [],
"title": "ERPNext Integrations Settings"
}

View File

@ -48,13 +48,13 @@
"fieldname": "inpatient_visit_charge",
"fieldtype": "Currency",
"in_list_view": 1,
"label": "Inpatient Visit Charge Item"
"label": "Inpatient Visit Charge"
}
],
"index_web_pages_for_search": 1,
"istable": 1,
"links": [],
"modified": "2021-01-22 09:35:26.503443",
"modified": "2021-08-17 06:05:02.240812",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Appointment Type Service Item",

View File

@ -16,7 +16,7 @@
"name": "Encounter Print",
"owner": "Administrator",
"print_format_builder": 0,
"print_format_type": "Server",
"print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}

View File

@ -16,7 +16,7 @@
"name": "Sample ID Print",
"owner": "Administrator",
"print_format_builder": 0,
"print_format_type": "Server",
"print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}

View File

@ -1,5 +1,5 @@
{
"category": "Domains",
"category": "",
"charts": [
{
"chart_name": "Patient Appointments",
@ -7,22 +7,27 @@
}
],
"charts_label": "",
"content": "[{\"type\": \"onboarding\", \"data\": {\"onboarding_name\":\"Healthcare\", \"col\": 12}}, {\"type\": \"chart\", \"data\": {\"chart_name\": \"Patient Appointments\", \"col\": 12}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Patient Appointment\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Patient\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Healthcare Service Unit\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Healthcare Practitioner\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Patient History\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Masters\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Consultation Setup\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Consultation\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Settings\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Laboratory Setup\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Laboratory\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Rehabilitation and Physiotherapy\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Records and History\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Reports\", \"col\": 4}}]",
"creation": "2020-03-02 17:23:17.919682",
"developer_mode_only": 0,
"disable_user_customization": 0,
"docstatus": 0,
"doctype": "Workspace",
"extends": "",
"extends_another_page": 0,
"for_user": "",
"hide_custom": 0,
"icon": "healthcare",
"idx": 0,
"is_standard": 1,
"is_default": 0,
"is_standard": 0,
"label": "Healthcare",
"links": [
{
"hidden": 0,
"is_query_report": 0,
"label": "Masters",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -31,6 +36,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Patient",
"link_count": 0,
"link_to": "Patient",
"link_type": "DocType",
"onboard": 1,
@ -41,6 +47,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Healthcare Practitioner",
"link_count": 0,
"link_to": "Healthcare Practitioner",
"link_type": "DocType",
"onboard": 1,
@ -51,6 +58,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Practitioner Schedule",
"link_count": 0,
"link_to": "Practitioner Schedule",
"link_type": "DocType",
"onboard": 1,
@ -61,6 +69,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Medical Department",
"link_count": 0,
"link_to": "Medical Department",
"link_type": "DocType",
"onboard": 0,
@ -71,6 +80,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Healthcare Service Unit Type",
"link_count": 0,
"link_to": "Healthcare Service Unit Type",
"link_type": "DocType",
"onboard": 0,
@ -81,6 +91,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Healthcare Service Unit",
"link_count": 0,
"link_to": "Healthcare Service Unit",
"link_type": "DocType",
"onboard": 0,
@ -91,6 +102,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Medical Code Standard",
"link_count": 0,
"link_to": "Medical Code Standard",
"link_type": "DocType",
"onboard": 0,
@ -101,6 +113,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Medical Code",
"link_count": 0,
"link_to": "Medical Code",
"link_type": "DocType",
"onboard": 0,
@ -110,6 +123,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Consultation Setup",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -118,6 +132,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Appointment Type",
"link_count": 0,
"link_to": "Appointment Type",
"link_type": "DocType",
"onboard": 0,
@ -128,6 +143,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Clinical Procedure Template",
"link_count": 0,
"link_to": "Clinical Procedure Template",
"link_type": "DocType",
"onboard": 0,
@ -138,6 +154,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Prescription Dosage",
"link_count": 0,
"link_to": "Prescription Dosage",
"link_type": "DocType",
"onboard": 0,
@ -148,6 +165,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Prescription Duration",
"link_count": 0,
"link_to": "Prescription Duration",
"link_type": "DocType",
"onboard": 0,
@ -158,6 +176,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Antibiotic",
"link_count": 0,
"link_to": "Antibiotic",
"link_type": "DocType",
"onboard": 0,
@ -167,6 +186,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Consultation",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -175,6 +195,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Patient Appointment",
"link_count": 0,
"link_to": "Patient Appointment",
"link_type": "DocType",
"onboard": 0,
@ -185,6 +206,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Clinical Procedure",
"link_count": 0,
"link_to": "Clinical Procedure",
"link_type": "DocType",
"onboard": 0,
@ -195,6 +217,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Patient Encounter",
"link_count": 0,
"link_to": "Patient Encounter",
"link_type": "DocType",
"onboard": 0,
@ -205,6 +228,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Vital Signs",
"link_count": 0,
"link_to": "Vital Signs",
"link_type": "DocType",
"onboard": 0,
@ -215,6 +239,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Complaint",
"link_count": 0,
"link_to": "Complaint",
"link_type": "DocType",
"onboard": 0,
@ -225,6 +250,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Diagnosis",
"link_count": 0,
"link_to": "Diagnosis",
"link_type": "DocType",
"onboard": 0,
@ -235,6 +261,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Fee Validity",
"link_count": 0,
"link_to": "Fee Validity",
"link_type": "DocType",
"onboard": 0,
@ -244,6 +271,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Settings",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -252,6 +280,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Healthcare Settings",
"link_count": 0,
"link_to": "Healthcare Settings",
"link_type": "DocType",
"onboard": 1,
@ -261,6 +290,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Laboratory Setup",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -269,6 +299,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Lab Test Template",
"link_count": 0,
"link_to": "Lab Test Template",
"link_type": "DocType",
"onboard": 0,
@ -279,6 +310,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Lab Test Sample",
"link_count": 0,
"link_to": "Lab Test Sample",
"link_type": "DocType",
"onboard": 0,
@ -289,6 +321,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Lab Test UOM",
"link_count": 0,
"link_to": "Lab Test UOM",
"link_type": "DocType",
"onboard": 0,
@ -299,6 +332,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Sensitivity",
"link_count": 0,
"link_to": "Sensitivity",
"link_type": "DocType",
"onboard": 0,
@ -308,6 +342,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Laboratory",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -316,6 +351,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Lab Test",
"link_count": 0,
"link_to": "Lab Test",
"link_type": "DocType",
"onboard": 0,
@ -326,6 +362,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Sample Collection",
"link_count": 0,
"link_to": "Sample Collection",
"link_type": "DocType",
"onboard": 0,
@ -336,6 +373,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Dosage Form",
"link_count": 0,
"link_to": "Dosage Form",
"link_type": "DocType",
"onboard": 0,
@ -345,6 +383,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Rehabilitation and Physiotherapy",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -353,6 +392,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Exercise Type",
"link_count": 0,
"link_to": "Exercise Type",
"link_type": "DocType",
"onboard": 1,
@ -363,6 +403,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Therapy Type",
"link_count": 0,
"link_to": "Therapy Type",
"link_type": "DocType",
"onboard": 1,
@ -373,6 +414,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Therapy Plan",
"link_count": 0,
"link_to": "Therapy Plan",
"link_type": "DocType",
"onboard": 0,
@ -383,6 +425,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Therapy Session",
"link_count": 0,
"link_to": "Therapy Session",
"link_type": "DocType",
"onboard": 0,
@ -393,6 +436,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Patient Assessment Template",
"link_count": 0,
"link_to": "Patient Assessment Template",
"link_type": "DocType",
"onboard": 0,
@ -403,6 +447,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Patient Assessment",
"link_count": 0,
"link_to": "Patient Assessment",
"link_type": "DocType",
"onboard": 0,
@ -412,6 +457,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Records and History",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -420,6 +466,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Patient History",
"link_count": 0,
"link_to": "patient_history",
"link_type": "Page",
"onboard": 0,
@ -430,6 +477,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Patient Progress",
"link_count": 0,
"link_to": "patient-progress",
"link_type": "Page",
"onboard": 0,
@ -440,6 +488,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Patient Medical Record",
"link_count": 0,
"link_to": "Patient Medical Record",
"link_type": "DocType",
"onboard": 0,
@ -450,6 +499,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Inpatient Record",
"link_count": 0,
"link_to": "Inpatient Record",
"link_type": "DocType",
"onboard": 0,
@ -459,6 +509,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Reports",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -467,6 +518,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Patient Appointment Analytics",
"link_count": 0,
"link_to": "Patient Appointment Analytics",
"link_type": "Report",
"onboard": 0,
@ -477,21 +529,26 @@
"hidden": 0,
"is_query_report": 1,
"label": "Lab Test Report",
"link_count": 0,
"link_to": "Lab Test Report",
"link_type": "Report",
"onboard": 0,
"type": "Link"
}
],
"modified": "2020-12-01 13:38:34.841396",
"modified": "2021-08-05 12:15:59.434612",
"modified_by": "Administrator",
"module": "Healthcare",
"name": "Healthcare",
"onboarding": "Healthcare",
"owner": "Administrator",
"parent_page": "",
"pin_to_bottom": 0,
"pin_to_top": 0,
"public": 1,
"restrict_to_domain": "Healthcare",
"roles": [],
"sequence_id": 13,
"shortcuts": [
{
"color": "Orange",
@ -532,5 +589,6 @@
"link_to": "Healthcare",
"type": "Dashboard"
}
]
],
"title": "Healthcare"
}

View File

@ -135,7 +135,7 @@ def mark_attendance(employee, attendance_date, status, shift=None, leave_type=No
def mark_bulk_attendance(data):
import json
from pprint import pprint
if isinstance(data, frappe.string_types):
if isinstance(data, str):
data = json.loads(data)
data = frappe._dict(data)
company = frappe.get_value('Employee', data.employee, 'company')

View File

@ -15,7 +15,11 @@ class TestAttendanceRequest(unittest.TestCase):
for doctype in ["Attendance Request", "Attendance"]:
frappe.db.sql("delete from `tab{doctype}`".format(doctype=doctype))
def tearDown(self):
frappe.db.rollback()
def test_on_duty_attendance_request(self):
"Test creation/updation of Attendace from Attendance Request, on duty."
today = nowdate()
employee = get_employee()
attendance_request = frappe.new_doc("Attendance Request")
@ -26,17 +30,36 @@ class TestAttendanceRequest(unittest.TestCase):
attendance_request.company = "_Test Company"
attendance_request.insert()
attendance_request.submit()
attendance = frappe.get_doc('Attendance', {
'employee': employee.name,
'attendance_date': date(date.today().year, 1, 1),
'docstatus': 1
})
self.assertEqual(attendance.status, 'Present')
attendance = frappe.db.get_value(
"Attendance",
filters={
"attendance_request": attendance_request.name,
"attendance_date": date(date.today().year, 1, 1)
},
fieldname=["status", "docstatus"],
as_dict=True
)
self.assertEqual(attendance.status, "Present")
self.assertEqual(attendance.docstatus, 1)
# cancelling attendance request cancels linked attendances
attendance_request.cancel()
attendance.reload()
self.assertEqual(attendance.docstatus, 2)
# cancellation alters docname
# fetch attendance value again to avoid stale docname
attendance_docstatus = frappe.db.get_value(
"Attendance",
filters={
"attendance_request": attendance_request.name,
"attendance_date": date(date.today().year, 1, 1)
},
fieldname="docstatus"
)
self.assertEqual(attendance_docstatus, 2)
def test_work_from_home_attendance_request(self):
"Test creation/updation of Attendace from Attendance Request, work from home."
today = nowdate()
employee = get_employee()
attendance_request = frappe.new_doc("Attendance Request")
@ -47,15 +70,30 @@ class TestAttendanceRequest(unittest.TestCase):
attendance_request.company = "_Test Company"
attendance_request.insert()
attendance_request.submit()
attendance = frappe.get_doc('Attendance', {
'employee': employee.name,
'attendance_date': date(date.today().year, 1, 1),
'docstatus': 1
})
self.assertEqual(attendance.status, 'Work From Home')
attendance_status = frappe.db.get_value(
"Attendance",
filters={
"attendance_request": attendance_request.name,
"attendance_date": date(date.today().year, 1, 1)
},
fieldname="status"
)
self.assertEqual(attendance_status, 'Work From Home')
attendance_request.cancel()
attendance.reload()
self.assertEqual(attendance.docstatus, 2)
# cancellation alters docname
# fetch attendance value again to avoid stale docname
attendance_docstatus = frappe.db.get_value(
"Attendance",
filters={
"attendance_request": attendance_request.name,
"attendance_date": date(date.today().year, 1, 1)
},
fieldname="docstatus"
)
self.assertEqual(attendance_docstatus, 2)
def get_employee():
return frappe.get_doc("Employee", "_T-Employee-00001")

View File

@ -214,7 +214,7 @@
"icon": "fa fa-flag",
"idx": 1,
"links": [],
"modified": "2021-03-02 11:22:33.776320",
"modified": "2021-08-12 16:10:36.464690",
"modified_by": "Administrator",
"module": "HR",
"name": "Leave Type",
@ -248,5 +248,6 @@
}
],
"sort_field": "modified",
"sort_order": "DESC"
"sort_order": "DESC",
"track_changes": 1
}

View File

@ -15,24 +15,35 @@ class TestShiftRequest(unittest.TestCase):
for doctype in ["Shift Request", "Shift Assignment"]:
frappe.db.sql("delete from `tab{doctype}`".format(doctype=doctype))
def tearDown(self):
frappe.db.rollback()
def test_make_shift_request(self):
"Test creation/updation of Shift Assignment from Shift Request."
department = frappe.get_value("Employee", "_T-Employee-00001", 'department')
set_shift_approver(department)
approver = frappe.db.sql("""select approver from `tabDepartment Approver` where parent= %s and parentfield = 'shift_request_approver'""", (department))[0][0]
shift_request = make_shift_request(approver)
shift_assignments = frappe.db.sql('''
SELECT shift_request, employee
FROM `tabShift Assignment`
WHERE shift_request = '{0}'
'''.format(shift_request.name), as_dict=1)
for d in shift_assignments:
employee = d.get('employee')
self.assertEqual(shift_request.employee, employee)
shift_request.cancel()
shift_assignment_doc = frappe.get_doc("Shift Assignment", {"shift_request": d.get('shift_request')})
self.assertEqual(shift_assignment_doc.docstatus, 2)
# Only one shift assignment is created against a shift request
shift_assignment = frappe.db.get_value(
"Shift Assignment",
filters={"shift_request": shift_request.name},
fieldname=["employee", "docstatus"],
as_dict=True
)
self.assertEqual(shift_request.employee, shift_assignment.employee)
self.assertEqual(shift_assignment.docstatus, 1)
shift_request.cancel()
shift_assignment_docstatus = frappe.db.get_value(
"Shift Assignment",
filters={"shift_request": shift_request.name},
fieldname="docstatus"
)
self.assertEqual(shift_assignment_docstatus, 2)
def test_shift_request_approver_perms(self):
employee = frappe.get_doc("Employee", "_T-Employee-00001")

View File

@ -11,21 +11,34 @@ from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_
class TestTrainingEvent(unittest.TestCase):
def setUp(self):
create_training_program("Basic Training")
self.employee = make_employee("robert_loan@trainig.com")
self.employee2 = make_employee("suzie.tan@trainig.com")
employee = make_employee("robert_loan@trainig.com")
employee2 = make_employee("suzie.tan@trainig.com")
self.attendees = [
{"employee": employee},
{"employee": employee2}
]
def test_training_event_status_update(self):
training_event = create_training_event(self.attendees)
training_event.submit()
training_event.event_status = "Completed"
training_event.save()
training_event.reload()
for entry in training_event.employees:
self.assertEqual(entry.status, "Completed")
training_event.event_status = "Scheduled"
training_event.save()
training_event.reload()
for entry in training_event.employees:
self.assertEqual(entry.status, "Open")
def tearDown(self):
frappe.db.rollback()
def test_create_training_event(self):
if not frappe.db.get_value("Training Event", "Basic Training Event"):
frappe.get_doc({
"doctype": "Training Event",
"event_name": "Basic Training Event",
"training_program": "Basic Training",
"location": "Union Square",
"start_time": add_days(today(), 5),
"end_time": add_days(today(), 6),
"introduction": "Welcome to the Basic Training Event",
"employees": get_attendees(self.employee, self.employee2)
}).insert()
def create_training_program(training_program):
if not frappe.db.get_value("Training Program", training_program):
@ -35,8 +48,14 @@ def create_training_program(training_program):
"description": training_program
}).insert()
def get_attendees(employee, employee2):
return [
{"employee": employee},
{"employee": employee2}
]
def create_training_event(attendees):
return frappe.get_doc({
"doctype": "Training Event",
"event_name": "Basic Training Event",
"training_program": "Basic Training",
"location": "Union Square",
"start_time": add_days(today(), 5),
"end_time": add_days(today(), 6),
"introduction": "Welcome to the Basic Training Event",
"employees": attendees
}).insert()

View File

@ -14,10 +14,25 @@ class TrainingEvent(Document):
self.set_employee_emails()
self.validate_period()
def on_update_after_submit(self):
self.set_status_for_attendees()
def set_employee_emails(self):
self.employee_emails = ', '.join(get_employee_emails([d.employee
for d in self.employees]))
def validate_period(self):
if time_diff_in_seconds(self.end_time, self.start_time) <= 0:
frappe.throw(_('End time cannot be before start time'))
frappe.throw(_('End time cannot be before start time'))
def set_status_for_attendees(self):
if self.event_status == 'Completed':
for employee in self.employees:
if employee.attendance == 'Present' and employee.status != 'Feedback Submitted':
employee.status = 'Completed'
elif self.event_status == 'Scheduled':
for employee in self.employees:
employee.status = 'Open'
self.db_update_all()

View File

@ -5,8 +5,63 @@ from __future__ import unicode_literals
import frappe
import unittest
# test_records = frappe.get_test_records('Training Feedback')
from erpnext.payroll.doctype.salary_structure.test_salary_structure import make_employee
from erpnext.hr.doctype.training_event.test_training_event import create_training_program, create_training_event
class TestTrainingFeedback(unittest.TestCase):
pass
def setUp(self):
create_training_program("Basic Training")
self.employee = make_employee("robert_loan@trainig.com")
self.employee2 = make_employee("suzie.tan@trainig.com")
self.attendees = [{"employee": self.employee}]
def test_employee_validations_for_feedback(self):
training_event = create_training_event(self.attendees)
training_event.submit()
training_event.event_status = "Completed"
training_event.save()
training_event.reload()
# should not allow creating feedback since employee2 was not part of the event
feedback = create_training_feedback(training_event.name, self.employee2)
self.assertRaises(frappe.ValidationError, feedback.save)
# cannot record feedback for absent employee
employee = frappe.db.get_value("Training Event Employee", {
"parent": training_event.name,
"employee": self.employee
}, "name")
frappe.db.set_value("Training Event Employee", employee, "attendance", "Absent")
feedback = create_training_feedback(training_event.name, self.employee)
self.assertRaises(frappe.ValidationError, feedback.save)
def test_training_feedback_status(self):
training_event = create_training_event(self.attendees)
training_event.submit()
training_event.event_status = "Completed"
training_event.save()
training_event.reload()
feedback = create_training_feedback(training_event.name, self.employee)
feedback.submit()
status = frappe.db.get_value("Training Event Employee", {
"parent": training_event.name,
"employee": self.employee
}, "status")
self.assertEqual(status, "Feedback Submitted")
def tearDown(self):
frappe.db.rollback()
def create_training_feedback(event, employee):
return frappe.get_doc({
"doctype": "Training Feedback",
"training_event": event,
"employee": employee,
"feedback": "Test"
})

View File

@ -11,15 +11,35 @@ class TrainingFeedback(Document):
def validate(self):
training_event = frappe.get_doc("Training Event", self.training_event)
if training_event.docstatus != 1:
frappe.throw(_('{0} must be submitted').format(_('Training Event')))
frappe.throw(_("{0} must be submitted").format(_("Training Event")))
emp_event_details = frappe.db.get_value("Training Event Employee", {
"parent": self.training_event,
"employee": self.employee
}, ["name", "attendance"], as_dict=True)
if not emp_event_details:
frappe.throw(_("Employee {0} not found in Training Event Participants.").format(
frappe.bold(self.employee_name)))
if emp_event_details.attendance == "Absent":
frappe.throw(_("Feedback cannot be recorded for an absent Employee."))
def on_submit(self):
training_event = frappe.get_doc("Training Event", self.training_event)
event_status = None
for e in training_event.employees:
if e.employee == self.employee:
event_status = 'Feedback Submitted'
break
employee = frappe.db.get_value("Training Event Employee", {
"parent": self.training_event,
"employee": self.employee
})
if employee:
frappe.db.set_value("Training Event Employee", employee, "status", "Feedback Submitted")
def on_cancel(self):
employee = frappe.db.get_value("Training Event Employee", {
"parent": self.training_event,
"employee": self.employee
})
if employee:
frappe.db.set_value("Training Event Employee", employee, "status", "Completed")
if event_status:
frappe.db.set_value("Training Event", self.training_event, "event_status", event_status)

View File

@ -0,0 +1,21 @@
frappe.pages['organizational-chart'].on_page_load = function(wrapper) {
frappe.ui.make_app_page({
parent: wrapper,
title: __('Organizational Chart'),
single_column: true
});
$(wrapper).bind('show', () => {
frappe.require('hierarchy-chart.bundle.js', () => {
let organizational_chart = undefined;
let method = 'erpnext.hr.page.organizational_chart.organizational_chart.get_children';
if (frappe.is_mobile()) {
organizational_chart = new erpnext.HierarchyChartMobile('Employee', wrapper, method);
} else {
organizational_chart = new erpnext.HierarchyChart('Employee', wrapper, method);
}
organizational_chart.show();
});
});
};

View File

@ -0,0 +1,26 @@
{
"content": null,
"creation": "2021-05-25 10:53:10.107241",
"docstatus": 0,
"doctype": "Page",
"idx": 0,
"modified": "2021-05-25 10:53:18.201931",
"modified_by": "Administrator",
"module": "HR",
"name": "organizational-chart",
"owner": "Administrator",
"page_name": "Organizational Chart",
"roles": [
{
"role": "HR User"
},
{
"role": "HR Manager"
}
],
"script": null,
"standard": "Yes",
"style": null,
"system_page": 0,
"title": "Organizational Chart"
}

View File

@ -0,0 +1,48 @@
from __future__ import unicode_literals
import frappe
@frappe.whitelist()
def get_children(parent=None, company=None, exclude_node=None):
filters = [['status', '!=', 'Left']]
if company and company != 'All Companies':
filters.append(['company', '=', company])
if parent and company and parent != company:
filters.append(['reports_to', '=', parent])
else:
filters.append(['reports_to', '=', ''])
if exclude_node:
filters.append(['name', '!=', exclude_node])
employees = frappe.get_list('Employee',
fields=['employee_name as name', 'name as id', 'reports_to', 'image', 'designation as title'],
filters=filters,
order_by='name'
)
for employee in employees:
is_expandable = frappe.db.count('Employee', filters={'reports_to': employee.get('id')})
employee.connections = get_connections(employee.id)
employee.expandable = 1 if is_expandable else 0
return employees
def get_connections(employee):
num_connections = 0
nodes_to_expand = frappe.get_list('Employee', filters=[
['reports_to', '=', employee]
])
num_connections += len(nodes_to_expand)
while nodes_to_expand:
parent = nodes_to_expand.pop(0)
descendants = frappe.get_list('Employee', filters=[
['reports_to', '=', parent.name]
])
num_connections += len(descendants)
nodes_to_expand.extend(descendants)
return num_connections

View File

@ -15,7 +15,7 @@
"name": "Job Offer",
"owner": "Administrator",
"print_format_builder": 0,
"print_format_type": "Server",
"print_format_type": "Jinja",
"show_section_headings": 0,
"standard": "Yes"
}

View File

@ -1,28 +1,32 @@
{
"category": "Modules",
"category": "",
"charts": [
{
"chart_name": "Outgoing Salary",
"label": "Outgoing Salary"
}
],
"content": "[{\"type\": \"onboarding\", \"data\": {\"onboarding_name\":\"Human Resource\", \"col\": 12}}, {\"type\": \"chart\", \"data\": {\"chart_name\": \"Outgoing Salary\", \"col\": 12}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Employee\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Leave Application\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Attendance\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Job Applicant\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Monthly Attendance Sheet\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Employee\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Employee Lifecycle\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Shift Management\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Leaves\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Attendance\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Expense Claims\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Settings\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Fleet Management\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Recruitment\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Loans\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Training\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Performance\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Key Reports\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Other Reports\", \"col\": 4}}]",
"creation": "2020-03-02 15:48:58.322521",
"developer_mode_only": 0,
"disable_user_customization": 0,
"docstatus": 0,
"doctype": "Workspace",
"extends": "",
"extends_another_page": 0,
"for_user": "",
"hide_custom": 0,
"icon": "hr",
"idx": 0,
"is_default": 0,
"is_standard": 1,
"is_standard": 0,
"label": "HR",
"links": [
{
"hidden": 0,
"is_query_report": 0,
"label": "Employee",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -31,6 +35,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Employee",
"link_count": 0,
"link_to": "Employee",
"link_type": "DocType",
"onboard": 1,
@ -41,6 +46,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Employment Type",
"link_count": 0,
"link_to": "Employment Type",
"link_type": "DocType",
"onboard": 0,
@ -51,6 +57,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Branch",
"link_count": 0,
"link_to": "Branch",
"link_type": "DocType",
"onboard": 0,
@ -61,6 +68,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Department",
"link_count": 0,
"link_to": "Department",
"link_type": "DocType",
"onboard": 0,
@ -71,6 +79,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Designation",
"link_count": 0,
"link_to": "Designation",
"link_type": "DocType",
"onboard": 0,
@ -81,6 +90,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Employee Grade",
"link_count": 0,
"link_to": "Employee Grade",
"link_type": "DocType",
"onboard": 0,
@ -91,6 +101,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Employee Group",
"link_count": 0,
"link_to": "Employee Group",
"link_type": "DocType",
"onboard": 0,
@ -101,6 +112,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Employee Health Insurance",
"link_count": 0,
"link_to": "Employee Health Insurance",
"link_type": "DocType",
"onboard": 0,
@ -110,6 +122,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Employee Lifecycle",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -118,6 +131,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Employee Onboarding",
"link_count": 0,
"link_to": "Employee Onboarding",
"link_type": "DocType",
"onboard": 0,
@ -128,6 +142,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Employee Skill Map",
"link_count": 0,
"link_to": "Employee Skill Map",
"link_type": "DocType",
"onboard": 0,
@ -138,6 +153,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Employee Promotion",
"link_count": 0,
"link_to": "Employee Promotion",
"link_type": "DocType",
"onboard": 0,
@ -148,6 +164,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Employee Transfer",
"link_count": 0,
"link_to": "Employee Transfer",
"link_type": "DocType",
"onboard": 0,
@ -157,6 +174,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Grievance Type",
"link_count": 0,
"link_to": "Grievance Type",
"link_type": "DocType",
"onboard": 0,
@ -166,6 +184,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Employee Grievance",
"link_count": 0,
"link_to": "Employee Grievance",
"link_type": "DocType",
"onboard": 0,
@ -176,6 +195,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Employee Separation",
"link_count": 0,
"link_to": "Employee Separation",
"link_type": "DocType",
"onboard": 0,
@ -186,6 +206,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Employee Onboarding Template",
"link_count": 0,
"link_to": "Employee Onboarding Template",
"link_type": "DocType",
"onboard": 0,
@ -196,6 +217,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Employee Separation Template",
"link_count": 0,
"link_to": "Employee Separation Template",
"link_type": "DocType",
"onboard": 0,
@ -205,6 +227,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Shift Management",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -213,6 +236,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Shift Type",
"link_count": 0,
"link_to": "Shift Type",
"link_type": "DocType",
"onboard": 0,
@ -223,6 +247,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Shift Request",
"link_count": 0,
"link_to": "Shift Request",
"link_type": "DocType",
"onboard": 0,
@ -233,6 +258,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Shift Assignment",
"link_count": 0,
"link_to": "Shift Assignment",
"link_type": "DocType",
"onboard": 0,
@ -242,6 +268,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Leaves",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -250,6 +277,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Holiday List",
"link_count": 0,
"link_to": "Holiday List",
"link_type": "DocType",
"onboard": 0,
@ -260,6 +288,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Leave Type",
"link_count": 0,
"link_to": "Leave Type",
"link_type": "DocType",
"onboard": 0,
@ -270,6 +299,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Leave Period",
"link_count": 0,
"link_to": "Leave Period",
"link_type": "DocType",
"onboard": 0,
@ -280,6 +310,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Leave Policy",
"link_count": 0,
"link_to": "Leave Policy",
"link_type": "DocType",
"onboard": 0,
@ -290,6 +321,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Leave Policy Assignment",
"link_count": 0,
"link_to": "Leave Policy Assignment",
"link_type": "DocType",
"onboard": 0,
@ -300,6 +332,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Leave Application",
"link_count": 0,
"link_to": "Leave Application",
"link_type": "DocType",
"onboard": 0,
@ -310,6 +343,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Leave Allocation",
"link_count": 0,
"link_to": "Leave Allocation",
"link_type": "DocType",
"onboard": 0,
@ -320,6 +354,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Leave Encashment",
"link_count": 0,
"link_to": "Leave Encashment",
"link_type": "DocType",
"onboard": 0,
@ -330,6 +365,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Leave Block List",
"link_count": 0,
"link_to": "Leave Block List",
"link_type": "DocType",
"onboard": 0,
@ -340,6 +376,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Compensatory Leave Request",
"link_count": 0,
"link_to": "Compensatory Leave Request",
"link_type": "DocType",
"onboard": 0,
@ -349,6 +386,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Attendance",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -357,6 +395,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Employee Attendance Tool",
"link_count": 0,
"link_to": "Employee Attendance Tool",
"link_type": "DocType",
"onboard": 1,
@ -367,6 +406,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Attendance",
"link_count": 0,
"link_to": "Attendance",
"link_type": "DocType",
"onboard": 1,
@ -377,6 +417,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Attendance Request",
"link_count": 0,
"link_to": "Attendance Request",
"link_type": "DocType",
"onboard": 0,
@ -387,6 +428,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Upload Attendance",
"link_count": 0,
"link_to": "Upload Attendance",
"link_type": "DocType",
"onboard": 0,
@ -397,6 +439,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Employee Checkin",
"link_count": 0,
"link_to": "Employee Checkin",
"link_type": "DocType",
"onboard": 0,
@ -406,6 +449,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Expense Claims",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -414,6 +458,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Expense Claim",
"link_count": 0,
"link_to": "Expense Claim",
"link_type": "DocType",
"onboard": 0,
@ -424,6 +469,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Employee Advance",
"link_count": 0,
"link_to": "Employee Advance",
"link_type": "DocType",
"onboard": 0,
@ -433,6 +479,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Travel Request",
"link_count": 0,
"link_to": "Travel Request",
"link_type": "DocType",
"onboard": 0,
@ -442,6 +489,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Settings",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -450,6 +498,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "HR Settings",
"link_count": 0,
"link_to": "HR Settings",
"link_type": "DocType",
"onboard": 0,
@ -460,6 +509,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Daily Work Summary Group",
"link_count": 0,
"link_to": "Daily Work Summary Group",
"link_type": "DocType",
"onboard": 0,
@ -470,6 +520,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Team Updates",
"link_count": 0,
"link_to": "team-updates",
"link_type": "Page",
"onboard": 0,
@ -479,6 +530,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Fleet Management",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -486,6 +538,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Driver",
"link_count": 0,
"link_to": "Driver",
"link_type": "DocType",
"onboard": 0,
@ -496,6 +549,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Vehicle",
"link_count": 0,
"link_to": "Vehicle",
"link_type": "DocType",
"onboard": 0,
@ -506,6 +560,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Vehicle Log",
"link_count": 0,
"link_to": "Vehicle Log",
"link_type": "DocType",
"onboard": 0,
@ -516,6 +571,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Vehicle Expenses",
"link_count": 0,
"link_to": "Vehicle Expenses",
"link_type": "Report",
"onboard": 0,
@ -525,6 +581,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Recruitment",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -533,6 +590,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Job Opening",
"link_count": 0,
"link_to": "Job Opening",
"link_type": "DocType",
"onboard": 1,
@ -542,6 +600,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Employee Referral",
"link_count": 0,
"link_to": "Employee Referral",
"link_type": "DocType",
"onboard": 0,
@ -552,6 +611,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Job Applicant",
"link_count": 0,
"link_to": "Job Applicant",
"link_type": "DocType",
"onboard": 1,
@ -562,6 +622,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Job Offer",
"link_count": 0,
"link_to": "Job Offer",
"link_type": "DocType",
"onboard": 1,
@ -572,6 +633,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Staffing Plan",
"link_count": 0,
"link_to": "Staffing Plan",
"link_type": "DocType",
"onboard": 0,
@ -581,6 +643,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Appointment Letter",
"link_count": 0,
"link_to": "Appointment Letter",
"link_type": "DocType",
"onboard": 0,
@ -590,6 +653,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Appointment Letter Template",
"link_count": 0,
"link_to": "Appointment Letter Template",
"link_type": "DocType",
"onboard": 0,
@ -599,6 +663,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Loans",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -607,6 +672,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Loan Application",
"link_count": 0,
"link_to": "Loan Application",
"link_type": "DocType",
"onboard": 0,
@ -617,6 +683,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Loan",
"link_count": 0,
"link_to": "Loan",
"link_type": "DocType",
"onboard": 0,
@ -627,6 +694,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Loan Type",
"link_count": 0,
"link_to": "Loan Type",
"link_type": "DocType",
"onboard": 0,
@ -636,6 +704,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Training",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -644,6 +713,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Training Program",
"link_count": 0,
"link_to": "Training Program",
"link_type": "DocType",
"onboard": 0,
@ -654,6 +724,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Training Event",
"link_count": 0,
"link_to": "Training Event",
"link_type": "DocType",
"onboard": 0,
@ -664,6 +735,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Training Result",
"link_count": 0,
"link_to": "Training Result",
"link_type": "DocType",
"onboard": 0,
@ -674,6 +746,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Training Feedback",
"link_count": 0,
"link_to": "Training Feedback",
"link_type": "DocType",
"onboard": 0,
@ -683,6 +756,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Performance",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -691,6 +765,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Appraisal",
"link_count": 0,
"link_to": "Appraisal",
"link_type": "DocType",
"onboard": 0,
@ -701,6 +776,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Appraisal Template",
"link_count": 0,
"link_to": "Appraisal Template",
"link_type": "DocType",
"onboard": 0,
@ -711,6 +787,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Energy Point Rule",
"link_count": 0,
"link_to": "Energy Point Rule",
"link_type": "DocType",
"onboard": 0,
@ -721,6 +798,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Energy Point Log",
"link_count": 0,
"link_to": "Energy Point Log",
"link_type": "DocType",
"onboard": 0,
@ -730,6 +808,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Key Reports",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -738,6 +817,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Monthly Attendance Sheet",
"link_count": 0,
"link_to": "Monthly Attendance Sheet",
"link_type": "Report",
"onboard": 0,
@ -748,6 +828,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Recruitment Analytics",
"link_count": 0,
"link_to": "Recruitment Analytics",
"link_type": "Report",
"onboard": 0,
@ -758,6 +839,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Employee Analytics",
"link_count": 0,
"link_to": "Employee Analytics",
"link_type": "Report",
"onboard": 0,
@ -768,6 +850,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Employee Leave Balance",
"link_count": 0,
"link_to": "Employee Leave Balance",
"link_type": "Report",
"onboard": 0,
@ -778,6 +861,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Employee Leave Balance Summary",
"link_count": 0,
"link_to": "Employee Leave Balance Summary",
"link_type": "Report",
"onboard": 0,
@ -788,6 +872,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Employee Advance Summary",
"link_count": 0,
"link_to": "Employee Advance Summary",
"link_type": "Report",
"onboard": 0,
@ -797,6 +882,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Other Reports",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -805,6 +891,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Employee Information",
"link_count": 0,
"link_to": "Employee Information",
"link_type": "Report",
"onboard": 0,
@ -815,6 +902,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Employee Birthday",
"link_count": 0,
"link_to": "Employee Birthday",
"link_type": "Report",
"onboard": 0,
@ -825,6 +913,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Employees Working on a Holiday",
"link_count": 0,
"link_to": "Employees working on a holiday",
"link_type": "Report",
"onboard": 0,
@ -835,20 +924,26 @@
"hidden": 0,
"is_query_report": 1,
"label": "Daily Work Summary Replies",
"link_count": 0,
"link_to": "Daily Work Summary Replies",
"link_type": "Report",
"onboard": 0,
"type": "Link"
}
],
"modified": "2021-05-13 17:19:40.524444",
"modified": "2021-08-05 12:15:59.842918",
"modified_by": "Administrator",
"module": "HR",
"name": "HR",
"onboarding": "Human Resource",
"owner": "Administrator",
"parent_page": "",
"pin_to_bottom": 0,
"pin_to_top": 0,
"public": 1,
"restrict_to_domain": "",
"roles": [],
"sequence_id": 14,
"shortcuts": [
{
"color": "Green",
@ -889,5 +984,6 @@
"stats_filter": "{\n \"status\": \"Open\"\n}",
"type": "Dashboard"
}
]
],
"title": "HR"
}

View File

@ -1,23 +1,27 @@
{
"category": "Modules",
"category": "",
"charts": [],
"content": "[{\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Loan Application\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Loan\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Loan\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Loan Processes\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Disbursement and Repayment\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Loan Security\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Reports\", \"col\": 4}}]",
"creation": "2020-03-12 16:35:55.299820",
"developer_mode_only": 0,
"disable_user_customization": 0,
"docstatus": 0,
"doctype": "Workspace",
"extends": "",
"extends_another_page": 0,
"for_user": "",
"hide_custom": 0,
"icon": "loan",
"idx": 0,
"is_default": 0,
"is_standard": 1,
"is_standard": 0,
"label": "Loans",
"links": [
{
"hidden": 0,
"is_query_report": 0,
"label": "Loan",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -26,6 +30,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Loan Type",
"link_count": 0,
"link_to": "Loan Type",
"link_type": "DocType",
"onboard": 0,
@ -36,6 +41,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Loan Application",
"link_count": 0,
"link_to": "Loan Application",
"link_type": "DocType",
"onboard": 0,
@ -46,6 +52,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Loan",
"link_count": 0,
"link_to": "Loan",
"link_type": "DocType",
"onboard": 0,
@ -55,6 +62,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Loan Processes",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -63,6 +71,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Process Loan Security Shortfall",
"link_count": 0,
"link_to": "Process Loan Security Shortfall",
"link_type": "DocType",
"onboard": 0,
@ -73,6 +82,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Process Loan Interest Accrual",
"link_count": 0,
"link_to": "Process Loan Interest Accrual",
"link_type": "DocType",
"onboard": 0,
@ -82,6 +92,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Disbursement and Repayment",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -90,6 +101,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Loan Disbursement",
"link_count": 0,
"link_to": "Loan Disbursement",
"link_type": "DocType",
"onboard": 0,
@ -100,6 +112,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Loan Repayment",
"link_count": 0,
"link_to": "Loan Repayment",
"link_type": "DocType",
"onboard": 0,
@ -110,6 +123,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Loan Write Off",
"link_count": 0,
"link_to": "Loan Write Off",
"link_type": "DocType",
"onboard": 0,
@ -120,6 +134,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Loan Interest Accrual",
"link_count": 0,
"link_to": "Loan Interest Accrual",
"link_type": "DocType",
"onboard": 0,
@ -129,6 +144,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Loan Security",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -137,6 +153,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Loan Security Type",
"link_count": 0,
"link_to": "Loan Security Type",
"link_type": "DocType",
"onboard": 0,
@ -147,6 +164,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Loan Security Price",
"link_count": 0,
"link_to": "Loan Security Price",
"link_type": "DocType",
"onboard": 0,
@ -157,6 +175,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Loan Security",
"link_count": 0,
"link_to": "Loan Security",
"link_type": "DocType",
"onboard": 0,
@ -167,6 +186,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Loan Security Pledge",
"link_count": 0,
"link_to": "Loan Security Pledge",
"link_type": "DocType",
"onboard": 0,
@ -177,6 +197,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Loan Security Unpledge",
"link_count": 0,
"link_to": "Loan Security Unpledge",
"link_type": "DocType",
"onboard": 0,
@ -187,6 +208,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Loan Security Shortfall",
"link_count": 0,
"link_to": "Loan Security Shortfall",
"link_type": "DocType",
"onboard": 0,
@ -196,6 +218,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Reports",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -204,6 +227,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Loan Repayment and Closure",
"link_count": 0,
"link_to": "Loan Repayment and Closure",
"link_type": "Report",
"onboard": 0,
@ -214,19 +238,26 @@
"hidden": 0,
"is_query_report": 1,
"label": "Loan Security Status",
"link_count": 0,
"link_to": "Loan Security Status",
"link_type": "Report",
"onboard": 0,
"type": "Link"
}
],
"modified": "2021-05-25 17:31:53.586508",
"modified": "2021-08-05 12:18:13.350904",
"modified_by": "Administrator",
"module": "Loan Management",
"name": "Loans",
"onboarding": "",
"owner": "Administrator",
"parent_page": "",
"pin_to_bottom": 0,
"pin_to_top": 0,
"public": 1,
"restrict_to_domain": "",
"roles": [],
"sequence_id": 16,
"shortcuts": [
{
"color": "Green",
@ -247,5 +278,6 @@
"link_to": "Loan Dashboard",
"type": "Dashboard"
}
]
],
"title": "Loans"
}

View File

@ -109,6 +109,15 @@ class ProductionPlan(Document):
so_mr_list = [d.get(field) for d in self.get(table) if d.get(field)]
return so_mr_list
def get_bom_item(self):
"""Check if Item or if its Template has a BOM."""
bom_item = None
has_bom = frappe.db.exists({'doctype': 'BOM', 'item': self.item_code, 'docstatus': 1})
if not has_bom:
template_item = frappe.db.get_value('Item', self.item_code, ['variant_of'])
bom_item = "bom.item = {0}".format(frappe.db.escape(template_item)) if template_item else bom_item
return bom_item
def get_so_items(self):
# Check for empty table or empty rows
if not self.get("sales_orders") or not self.get_so_mr_list("sales_order", "sales_orders"):
@ -117,16 +126,26 @@ class ProductionPlan(Document):
so_list = self.get_so_mr_list("sales_order", "sales_orders")
item_condition = ""
if self.item_code:
bom_item = "bom.item = so_item.item_code"
if self.item_code and frappe.db.exists('Item', self.item_code):
bom_item = self.get_bom_item() or bom_item
item_condition = ' and so_item.item_code = {0}'.format(frappe.db.escape(self.item_code))
items = frappe.db.sql("""select distinct parent, item_code, warehouse,
(qty - work_order_qty) * conversion_factor as pending_qty, description, name
from `tabSales Order Item` so_item
where parent in (%s) and docstatus = 1 and qty > work_order_qty
and exists (select name from `tabBOM` bom where bom.item=so_item.item_code
and bom.is_active = 1) %s""" % \
(", ".join(["%s"] * len(so_list)), item_condition), tuple(so_list), as_dict=1)
items = frappe.db.sql("""
select
distinct parent, item_code, warehouse,
(qty - work_order_qty) * conversion_factor as pending_qty,
description, name
from
`tabSales Order Item` so_item
where
parent in (%s) and docstatus = 1 and qty > work_order_qty
and exists (select name from `tabBOM` bom where %s
and bom.is_active = 1) %s""" %
(", ".join(["%s"] * len(so_list)),
bom_item,
item_condition),
tuple(so_list), as_dict=1)
if self.item_code:
item_condition = ' and so_item.item_code = {0}'.format(frappe.db.escape(self.item_code))
@ -683,6 +702,7 @@ def get_material_request_items(row, sales_order, company,
def get_sales_orders(self):
so_filter = item_filter = ""
bom_item = "bom.item = so_item.item_code"
if self.from_date:
so_filter += " and so.transaction_date >= %(from_date)s"
if self.to_date:
@ -694,7 +714,8 @@ def get_sales_orders(self):
if self.sales_order_status:
so_filter += "and so.status = %(sales_order_status)s"
if self.item_code:
if self.item_code and frappe.db.exists('Item', self.item_code):
bom_item = self.get_bom_item() or bom_item
item_filter += " and so_item.item_code = %(item)s"
open_so = frappe.db.sql("""
@ -704,13 +725,13 @@ def get_sales_orders(self):
and so.docstatus = 1 and so.status not in ("Stopped", "Closed")
and so.company = %(company)s
and so_item.qty > so_item.work_order_qty {0} {1}
and (exists (select name from `tabBOM` bom where bom.item=so_item.item_code
and (exists (select name from `tabBOM` bom where {2}
and bom.is_active = 1)
or exists (select name from `tabPacked Item` pi
where pi.parent = so.name and pi.parent_item = so_item.item_code
and exists (select name from `tabBOM` bom where bom.item=pi.item_code
and bom.is_active = 1)))
""".format(so_filter, item_filter), {
""".format(so_filter, item_filter, bom_item), {
"from_date": self.from_date,
"to_date": self.to_date,
"customer": self.customer,

View File

@ -11,6 +11,7 @@ from erpnext.manufacturing.doctype.production_plan.production_plan import get_sa
from erpnext.stock.doctype.stock_reconciliation.test_stock_reconciliation import create_stock_reconciliation
from erpnext.selling.doctype.sales_order.test_sales_order import make_sales_order
from erpnext.manufacturing.doctype.production_plan.production_plan import get_items_for_material_requests, get_warehouse_list
from erpnext.controllers.item_variant import create_variant
class TestProductionPlan(unittest.TestCase):
def setUp(self):
@ -271,6 +272,60 @@ class TestProductionPlan(unittest.TestCase):
self.assertEqual(warehouses, expected_warehouses)
def test_get_sales_order_with_variant(self):
if not frappe.db.exists('Item', {"item_code": 'PIV'}):
item = create_item('PIV', valuation_rate = 100)
variant_settings = {
"attributes": [
{
"attribute": "Colour"
},
],
"has_variants": 1
}
item.update(variant_settings)
item.save()
parent_bom = make_bom(item = 'PIV', raw_materials = ['PIV'])
if not frappe.db.exists('BOM', {"item": 'PIV'}):
parent_bom = make_bom(item = 'PIV', raw_materials = ['PIV'])
else:
parent_bom = frappe.get_doc('BOM', {"item": 'PIV'})
if not frappe.db.exists('Item', {"item_code": 'PIV-RED'}):
variant = create_variant("PIV", {"Colour": "Red"})
variant.save()
variant_bom = make_bom(item = variant.item_code, raw_materials = [variant.item_code])
else:
variant = frappe.get_doc('Item', 'PIV-RED')
if not frappe.db.exists('BOM', {"item": 'PIV-RED'}):
variant_bom = make_bom(item = variant.item_code, raw_materials = [variant.item_code])
"""Testing when item variant has a BOM"""
so = make_sales_order(item_code="PIV-RED", qty=5)
pln = frappe.new_doc('Production Plan')
pln.company = so.company
pln.get_items_from = 'Sales Order'
pln.item_code = 'PIV-RED'
pln.get_open_sales_orders()
self.assertEqual(pln.sales_orders[0].sales_order, so.name)
pln.get_so_items()
self.assertEqual(pln.po_items[0].item_code, 'PIV-RED')
self.assertEqual(pln.po_items[0].bom_no, variant_bom.name)
so.cancel()
frappe.delete_doc('Sales Order', so.name)
variant_bom.cancel()
frappe.delete_doc('BOM', variant_bom.name)
"""Testing when item variant doesn't have a BOM"""
so = make_sales_order(item_code="PIV-RED", qty=5)
pln.get_open_sales_orders()
self.assertEqual(pln.sales_orders[0].sales_order, so.name)
pln.po_items = []
pln.get_so_items()
self.assertEqual(pln.po_items[0].item_code, 'PIV-RED')
self.assertEqual(pln.po_items[0].bom_no, parent_bom.name)
frappe.db.rollback()
def create_production_plan(**args):
args = frappe._dict(args)

View File

@ -1,26 +1,31 @@
{
"category": "Domains",
"category": "",
"charts": [
{
"chart_name": "Produced Quantity"
}
],
"content": "[{\"type\": \"onboarding\", \"data\": {\"onboarding_name\":\"Manufacturing\", \"col\": 12}}, {\"type\": \"chart\", \"data\": {\"chart_name\": null, \"col\": 12}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Your Shortcuts\", \"level\": 4, \"col\": 12}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Item\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"BOM\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Work Order\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Production Plan\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Forecasting\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Work Order Summary\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"BOM Stock Report\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Production Planning Report\", \"col\": 4}}, {\"type\": \"shortcut\", \"data\": {\"shortcut_name\": \"Dashboard\", \"col\": 4}}, {\"type\": \"spacer\", \"data\": {\"col\": 12}}, {\"type\": \"header\", \"data\": {\"text\": \"Reports & Masters\", \"level\": 4, \"col\": 12}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Production\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Bill of Materials\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Reports\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Tools\", \"col\": 4}}, {\"type\": \"card\", \"data\": {\"card_name\": \"Settings\", \"col\": 4}}]",
"creation": "2020-03-02 17:11:37.032604",
"developer_mode_only": 0,
"disable_user_customization": 0,
"docstatus": 0,
"doctype": "Workspace",
"extends": "",
"extends_another_page": 0,
"for_user": "",
"hide_custom": 0,
"icon": "organization",
"idx": 0,
"is_standard": 1,
"is_default": 0,
"is_standard": 0,
"label": "Manufacturing",
"links": [
{
"hidden": 0,
"is_query_report": 0,
"label": "Production",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -29,6 +34,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Work Order",
"link_count": 0,
"link_to": "Work Order",
"link_type": "DocType",
"onboard": 1,
@ -39,6 +45,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Production Plan",
"link_count": 0,
"link_to": "Production Plan",
"link_type": "DocType",
"onboard": 1,
@ -49,6 +56,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Stock Entry",
"link_count": 0,
"link_to": "Stock Entry",
"link_type": "DocType",
"onboard": 1,
@ -59,6 +67,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Job Card",
"link_count": 0,
"link_to": "Job Card",
"link_type": "DocType",
"onboard": 0,
@ -69,6 +78,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Downtime Entry",
"link_count": 0,
"link_to": "Downtime Entry",
"link_type": "DocType",
"onboard": 0,
@ -78,6 +88,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Bill of Materials",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -86,6 +97,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Item",
"link_count": 0,
"link_to": "Item",
"link_type": "DocType",
"onboard": 1,
@ -96,6 +108,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Bill of Materials",
"link_count": 0,
"link_to": "BOM",
"link_type": "DocType",
"onboard": 1,
@ -106,6 +119,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Workstation",
"link_count": 0,
"link_to": "Workstation",
"link_type": "DocType",
"onboard": 0,
@ -116,6 +130,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Operation",
"link_count": 0,
"link_to": "Operation",
"link_type": "DocType",
"onboard": 0,
@ -126,6 +141,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Routing",
"link_count": 0,
"link_to": "Routing",
"link_type": "DocType",
"onboard": 0,
@ -135,6 +151,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Reports",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -143,6 +160,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Production Planning Report",
"link_count": 0,
"link_to": "Production Planning Report",
"link_type": "Report",
"onboard": 0,
@ -153,6 +171,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Work Order Summary",
"link_count": 0,
"link_to": "Work Order Summary",
"link_type": "Report",
"onboard": 0,
@ -163,6 +182,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Quality Inspection Summary",
"link_count": 0,
"link_to": "Quality Inspection Summary",
"link_type": "Report",
"onboard": 0,
@ -173,6 +193,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Downtime Analysis",
"link_count": 0,
"link_to": "Downtime Analysis",
"link_type": "Report",
"onboard": 0,
@ -183,6 +204,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Job Card Summary",
"link_count": 0,
"link_to": "Job Card Summary",
"link_type": "Report",
"onboard": 0,
@ -193,6 +215,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "BOM Search",
"link_count": 0,
"link_to": "BOM Search",
"link_type": "Report",
"onboard": 0,
@ -203,6 +226,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "BOM Stock Report",
"link_count": 0,
"link_to": "BOM Stock Report",
"link_type": "Report",
"onboard": 0,
@ -213,6 +237,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "Production Analytics",
"link_count": 0,
"link_to": "Production Analytics",
"link_type": "Report",
"onboard": 0,
@ -223,6 +248,7 @@
"hidden": 0,
"is_query_report": 1,
"label": "BOM Operations Time",
"link_count": 0,
"link_to": "BOM Operations Time",
"link_type": "Report",
"onboard": 0,
@ -232,6 +258,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Tools",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -240,6 +267,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "BOM Update Tool",
"link_count": 0,
"link_to": "BOM Update Tool",
"link_type": "DocType",
"onboard": 0,
@ -250,6 +278,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "BOM Comparison Tool",
"link_count": 0,
"link_to": "bom-comparison-tool",
"link_type": "Page",
"onboard": 0,
@ -259,6 +288,7 @@
"hidden": 0,
"is_query_report": 0,
"label": "Settings",
"link_count": 0,
"onboard": 0,
"type": "Card Break"
},
@ -267,21 +297,26 @@
"hidden": 0,
"is_query_report": 0,
"label": "Manufacturing Settings",
"link_count": 0,
"link_to": "Manufacturing Settings",
"link_type": "DocType",
"onboard": 0,
"type": "Link"
}
],
"modified": "2020-12-01 13:38:39.365928",
"modified": "2021-08-05 12:16:00.825741",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Manufacturing",
"onboarding": "Manufacturing",
"owner": "Administrator",
"parent_page": "",
"pin_to_bottom": 0,
"pin_to_top": 0,
"public": 1,
"restrict_to_domain": "Manufacturing",
"roles": [],
"sequence_id": 17,
"shortcuts": [
{
"color": "Green",
@ -346,5 +381,6 @@
"restrict_to_domain": "Manufacturing",
"type": "Dashboard"
}
]
],
"title": "Manufacturing"
}

Some files were not shown because too many files have changed in this diff Show More