Merge branch 'develop' of https://github.com/frappe/erpnext into dimension-fixes

This commit is contained in:
deepeshgarg007 2019-06-17 15:26:05 +05:30
commit dfe006be19
33 changed files with 322 additions and 70 deletions

View File

@ -128,7 +128,8 @@ def get_gl_entries(filters):
order_by_statement = "order by posting_date, voucher_type, voucher_no"
if filters.get("group_by") == _("Group by Voucher (Consolidated)"):
group_by_statement = "group by voucher_type, voucher_no, account, cost_center, against_voucher"
group_by_statement = "group by voucher_type, voucher_no, account, cost_center"
select_fields = """, sum(debit) as debit, sum(credit) as credit,
sum(debit_in_account_currency) as debit_in_account_currency,
sum(credit_in_account_currency) as credit_in_account_currency"""

View File

@ -70,11 +70,16 @@ def get_data():
"link": "Tree/Item Group",
"description": _("Tree of Item Groups."),
},
{
"type": "doctype",
"name": "Promotional Scheme",
"description": _("Rules for applying different promotional schemes.")
},
{
"type": "doctype",
"name": "Pricing Rule",
"description": _("Rules for applying pricing and discount.")
},
}
]
},
{

View File

@ -111,6 +111,11 @@ def get_data():
"description": _("Bundle items at time of sale."),
"dependencies": ["Item"],
},
{
"type": "doctype",
"name": "Promotional Scheme",
"description": _("Rules for applying different promotional schemes.")
},
{
"type": "doctype",
"name": "Pricing Rule",

View File

@ -152,9 +152,6 @@ def tax_account_query(doctype, txt, searchfield, start, page_len, filters):
def item_query(doctype, txt, searchfield, start, page_len, filters, as_dict=False):
conditions = []
if not filters["item_group"]:
filters.pop("item_group", None)
description_cond = ''
if frappe.db.count('Item', cache=True) < 50000:
# scan description only if items are less than 50000

View File

@ -0,0 +1,12 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'kra_template',
'transactions': [
{
'items': ['Appraisal']
},
],
}

View File

@ -12,24 +12,32 @@ def get_data():
'items': ['Attendance', 'Attendance Request', 'Leave Application', 'Leave Allocation']
},
{
'label': _('Payroll'),
'items': ['Salary Structure Assignment', 'Salary Slip', 'Timesheet']
'label': _('Lifecycle'),
'items': ['Employee Transfer', 'Employee Promotion', 'Employee Separation']
},
{
'label': _('Shift'),
'items': ['Shift Request', 'Shift Assignment']
},
{
'label': _('Expense'),
'items': ['Expense Claim']
'items': ['Expense Claim', 'Travel Request']
},
{
'label': _('Benefit'),
'items': ['Employee Benefit Application', 'Employee Benefit Claim']
},
{
'label': _('Evaluation'),
'items': ['Appraisal']
},
{
'label': _('Training'),
'items': ['Training Event', 'Training Result']
'label': _('Payroll'),
'items': ['Salary Structure Assignment', 'Salary Slip', 'Additional Salary', 'Timesheet','Employee Incentive', 'Retention Bonus']
},
{
'label': _('Lifecycle'),
'items': ['Employee Transfer', 'Employee Promotion', 'Employee Separation']
}
'label': _('Training'),
'items': ['Training Event', 'Training Result', 'Training Feedback', 'Employee Skill Map']
},
]
}

View File

@ -0,0 +1,12 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'employee_onboarding_template',
'transactions': [
{
'items': ['Employee Onboarding']
},
],
}

View File

@ -0,0 +1,12 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'employee_separation_template',
'transactions': [
{
'items': ['Employee Separation']
},
],
}

View File

@ -13,6 +13,9 @@ def get_data():
},
{
'items': ['Leave Period', 'Shift Type']
},
{
'items': ['Service Level', 'Service Level Agreement']
}
]
}

View File

@ -0,0 +1,15 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'job_applicant',
'transactions': [
{
'items': ['Employee', 'Employee Onboarding']
},
{
'items': ['Job Offer']
},
],
}

View File

@ -0,0 +1,12 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'job_title',
'transactions': [
{
'items': ['Job Applicant']
}
],
}

View File

@ -0,0 +1,15 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'leave_allocation',
'transactions': [
{
'items': ['Compensatory Leave Request']
},
{
'items': ['Leave Encashment']
}
],
}

View File

@ -0,0 +1,12 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'loan_application',
'transactions': [
{
'items': ['Loan']
},
],
}

View File

@ -0,0 +1,12 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'loan_type',
'transactions': [
{
'items': ['Loan Application']
},
],
}

View File

@ -0,0 +1,12 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'payroll_period',
'transactions': [
{
'items': ['Employee Tax Exemption Proof Submission', 'Employee Tax Exemption Declaration']
},
],
}

View File

@ -4,9 +4,15 @@ from frappe import _
def get_data():
return {
'fieldname': 'salary_structure',
'non_standard_fieldnames': {
'Employee Grade': 'default_salary_structure'
},
'transactions': [
{
'items': ['Salary Structure Assignment']
}
'items': ['Salary Structure Assignment', 'Salary Slip']
},
{
'items': ['Employee Grade']
},
]
}

View File

@ -0,0 +1,12 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'shift_request',
'transactions': [
{
'items': ['Shift Assignment']
},
],
}

View File

@ -0,0 +1,12 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'shift_type',
'transactions': [
{
'items': ['Shift Request', 'Shift Assignment']
}
],
}

View File

@ -0,0 +1,12 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'staffing_plan',
'transactions': [
{
'items': ['Job Opening']
}
],
}

View File

@ -0,0 +1,12 @@
from __future__ import unicode_literals
from frappe import _
def get_data():
return {
'fieldname': 'training_event',
'transactions': [
{
'items': ['Training Result', 'Training Feedback']
},
],
}

View File

@ -1,14 +1,20 @@
from __future__ import unicode_literals
from frappe import _
data = {
'heatmap': True,
'heatmap_message': _('This is based on logs against this Vehicle. See timeline below for details'),
'fieldname': 'license_plate',
'transactions': [
{
'label': _('Logs'),
'items': ['Vehicle Log']
}
]
}
def get_data():
return {
'heatmap': True,
'heatmap_message': _('This is based on logs against this Vehicle. See timeline below for details'),
'fieldname': 'license_plate',
'non_standard_fieldnames':{
'Delivery Trip': 'vehicle'
},
'transactions': [
{
'items': ['Vehicle Log']
},
{
'items': ['Delivery Trip']
}
]
}

View File

@ -72,9 +72,10 @@ frappe.ui.form.on("Work Order", {
frm.set_query("production_item", function() {
return {
query: "erpnext.controllers.queries.item_query",
filters:{
'is_stock_item': 1,
}
filters:[
['is_stock_item', '=',1],
['default_bom', '!=', '']
]
}
});

View File

@ -2,16 +2,13 @@
// MIT License. See license.txt
frappe.ui.form.on('Website Theme', {
apply_custom_theme(frm) {
let custom_theme = frm.doc.custom_theme;
custom_theme = custom_theme.split('\n');
if (
frm.doc.apply_custom_theme
&& custom_theme.length === 2
&& custom_theme[1].includes('frappe/public/scss/website')
validate(frm) {
let theme_scss = frm.doc.theme_scss;
if (theme_scss.includes('frappe/public/scss/website')
&& !theme_scss.includes('erpnext/public/scss/website')
) {
frm.set_value('custom_theme',
`$primary: #7575ff;\n@import "frappe/public/scss/website";\n@import "erpnext/public/scss/website";`);
frm.set_value('theme_scss',
`${frm.doc.theme_scss}\n@import "erpnext/public/scss/website";`);
}
}
});

View File

@ -138,14 +138,15 @@ class GSTR3BReport(Document):
outward_supply_tax_amounts = self.get_tax_amounts("Sales Invoice")
inward_supply_tax_amounts = self.get_tax_amounts("Purchase Invoice", reverse_charge="Y")
itc_details = self.get_itc_details()
inter_state_supplies = self.get_inter_state_supplies(self.gst_details.get("gst_state"))
inward_nil_exempt = self.get_inward_nil_exempt(self.gst_details.get("gst_state"))
self.prepare_data("Sales Invoice", outward_supply_tax_amounts, "sup_details", "osup_det", ["Registered Regular"])
self.prepare_data("Sales Invoice", outward_supply_tax_amounts, "sup_details", "osup_zero", ["SEZ", "Deemed Export", "Overseas"])
self.prepare_data("Purchase Invoice", inward_supply_tax_amounts, "sup_details", "isup_rev", ["Registered Regular"], reverse_charge="Y")
self.report_dict["sup_details"]["osup_nil_exmp"]["txval"] = flt(self.get_nil_rated_supply_value(), 2)
self.set_itc_details(itc_details)
inter_state_supplies = self.get_inter_state_supplies(self.gst_details.get("gst_state_number"))
inward_nil_exempt = self.get_inward_nil_exempt(self.gst_details.get("gst_state"))
self.set_inter_state_supply(inter_state_supplies)
self.set_inward_nil_exempt(inward_nil_exempt)
@ -221,7 +222,7 @@ class GSTR3BReport(Document):
for k, v in iteritems(account_map):
txval -= self.report_dict.get(supply_type, {}).get(supply_category, {}).get(v, 0)
self.report_dict[supply_type][supply_category]["txval"] = flt(txval, 2)
self.report_dict[supply_type][supply_category]["txval"] += flt(txval, 2)
def set_inter_state_supply(self, inter_state_supply):
@ -283,28 +284,40 @@ class GSTR3BReport(Document):
and s.company = %s and s.company_gstin = %s""",
(self.month_no, self.year, self.company, self.gst_details.get("gstin")), as_dict=1)[0].total
def get_inter_state_supplies(self, state):
def get_inter_state_supplies(self, state_number):
inter_state_supply = frappe.db.sql(""" select sum(s.grand_total) as total, t.tax_amount, a.gst_state, s.gst_category
from `tabSales Invoice` s, `tabSales Taxes and Charges` t, `tabAddress` a
where t.parent = s.name and s.customer_address = a.name and
s.docstatus = 1 and month(s.posting_date) = %s and year(s.posting_date) = %s and
a.gst_state <> %s and s.company = %s and s.company_gstin = %s and
s.gst_category in ('Unregistered', 'Registered Composition', 'UIN Holders')
group by s.gst_category, a.state""", (self.month_no, self.year, state, self.company, self.gst_details.get("gstin")), as_dict=1)
inter_state_supply_taxable_value = frappe.db.sql(""" select sum(s.net_total) as total, s.place_of_supply, s.gst_category
from `tabSales Invoice` s where s.docstatus = 1 and month(s.posting_date) = %s and year(s.posting_date) = %s
and s.company = %s and s.company_gstin = %s and s.gst_category in ('Unregistered', 'Registered Composition', 'UIN Holders')
group by s.gst_category, s.place_of_supply""", (self.month_no, self.year, self.company, self.gst_details.get("gstin")), as_dict=1)
inter_state_supply_tax = frappe.db.sql(""" select sum(t.tax_amount) as tax_amount, s.place_of_supply, s.gst_category
from `tabSales Invoice` s, `tabSales Taxes and Charges` t
where t.parent = s.name and s.docstatus = 1 and month(s.posting_date) = %s and year(s.posting_date) = %s
and s.company = %s and s.company_gstin = %s and s.gst_category in ('Unregistered', 'Registered Composition', 'UIN Holders')
group by s.gst_category, s.place_of_supply""", (self.month_no, self.year, self.company, self.gst_details.get("gstin")), as_dict=1)
inter_state_supply_tax_mapping={}
inter_state_supply_details = {}
for d in inter_state_supply:
for d in inter_state_supply_tax:
inter_state_supply_tax_mapping.setdefault(d.place_of_supply, d.tax_amount)
for d in inter_state_supply_taxable_value:
inter_state_supply_details.setdefault(
d.gst_category, []
)
inter_state_supply_details[d.gst_category].append({
"pos": get_state_code(d.gst_state),
"txval": d.total - d.tax_amount,
"iamt": d.tax_amount
})
if state_number != d.place_of_supply.split("-")[0]:
inter_state_supply_details[d.gst_category].append({
"pos": d.place_of_supply,
"txval": flt(d.total, 2),
"iamt": flt(inter_state_supply_tax_mapping.get(d.place_of_supply), 2)
})
else:
self.report_dict["sup_details"]["osup_det"]["txval"] += flt(d.total, 2)
self.report_dict["sup_details"]["osup_det"]["camt"] += flt(inter_state_supply_tax_mapping.get(d.place_of_supply)/2, 2)
self.report_dict["sup_details"]["osup_det"]["samt"] += flt(inter_state_supply_tax_mapping.get(d.place_of_supply)/2, 2)
return inter_state_supply_details

View File

@ -13,8 +13,11 @@ from erpnext.utilities.product import get_price, get_qty_in_stock
def get_product_info_for_website(item_code):
"""get product price / stock info for website"""
cart_quotation = _get_cart_quotation()
cart_settings = get_shopping_cart_settings()
if not cart_settings.enabled:
return frappe._dict()
cart_quotation = _get_cart_quotation()
price = get_price(
item_code,

View File

@ -107,6 +107,8 @@ erpnext.stock.PurchaseReceiptController = erpnext.buying.BuyingController.extend
cur_frm.add_custom_button(__('Return'), this.make_purchase_return, __('Create'));
cur_frm.add_custom_button(__('Make Stock Entry'), cur_frm.cscript['Make Stock Entry'], __('Create'));
if(flt(this.frm.doc.per_billed) < 100) {
cur_frm.add_custom_button(__('Invoice'), this.make_purchase_invoice, __('Create'));
}
@ -249,6 +251,13 @@ frappe.ui.form.on('Purchase Receipt Item', {
},
});
cur_frm.cscript['Make Stock Entry'] = function() {
frappe.model.open_mapped_doc({
method: "erpnext.stock.doctype.purchase_receipt.purchase_receipt.make_stock_entry",
frm: cur_frm,
})
}
var validate_sample_quantity = function(frm, cdt, cdn) {
var d = locals[cdt][cdn];
if (d.sample_quantity) {

View File

@ -12,6 +12,7 @@ from frappe.utils import getdate
from erpnext.controllers.buying_controller import BuyingController
from erpnext.accounts.utils import get_account_currency
from frappe.desk.notifications import clear_doctype_notifications
from frappe.model.mapper import get_mapped_doc
from erpnext.buying.utils import check_on_hold_or_closed_status
from erpnext.assets.doctype.asset.asset import get_asset_account, is_cwip_accounting_disabled
from six import iteritems
@ -530,3 +531,24 @@ def make_purchase_return(source_name, target_doc=None):
def update_purchase_receipt_status(docname, status):
pr = frappe.get_doc("Purchase Receipt", docname)
pr.update_status(status)
@frappe.whitelist()
def make_stock_entry(source_name,target_doc=None):
def set_missing_values(source, target):
target.stock_entry_type = "Material Transfer"
target.purpose = "Material Transfer"
doclist = get_mapped_doc("Purchase Receipt", source_name,{
"Purchase Receipt": {
"doctype": "Stock Entry",
},
"Purchase Receipt Item": {
"doctype": "Stock Entry Detail",
"field_map": {
"warehouse": "s_warehouse",
"parent": "reference_purchase_receipt"
},
},
}, target_doc, set_missing_values)
return doclist

View File

@ -13,6 +13,7 @@
"t_warehouse",
"sec_break1",
"item_code",
"item_group",
"col_break2",
"item_name",
"section_break_8",
@ -59,7 +60,8 @@
"against_stock_entry",
"ste_detail",
"column_break_51",
"transferred_qty"
"transferred_qty",
"reference_purchase_receipt"
],
"fields": [
{
@ -72,7 +74,6 @@
"fieldtype": "Section Break"
},
{
"columns": 2,
"fieldname": "s_warehouse",
"fieldtype": "Link",
"in_list_view": 1,
@ -86,7 +87,6 @@
"fieldtype": "Column Break"
},
{
"columns": 2,
"fieldname": "t_warehouse",
"fieldtype": "Link",
"in_list_view": 1,
@ -101,7 +101,6 @@
},
{
"bold": 1,
"columns": 3,
"fieldname": "item_code",
"fieldtype": "Link",
"in_global_search": 1,
@ -164,7 +163,6 @@
},
{
"bold": 1,
"columns": 3,
"fieldname": "qty",
"fieldtype": "Float",
"in_list_view": 1,
@ -460,15 +458,30 @@
{
"fieldname": "dimension_col_break",
"fieldtype": "Column Break"
},
{
"fetch_from": "item_code.item_group",
"fieldname": "item_group",
"fieldtype": "Data",
"in_list_view": 1,
"label": "Item Group"
},
{
"fieldname": "reference_purchase_receipt",
"fieldtype": "Link",
"label": "Reference Purchase Receipt",
"options": "Purchase Receipt",
"read_only": 1
}
],
"idx": 1,
"istable": 1,
"modified": "2019-05-25 22:51:00.802226",
"modified": "2019-06-14 11:58:41.958144",
"modified_by": "Administrator",
"module": "Stock",
"name": "Stock Entry Detail",
"owner": "Administrator",
"permissions": [],
"sort_field": "modified",
"sort_order": "ASC"
}

View File

@ -41,9 +41,6 @@ frappe.query_reports["Stock Balance"] = {
"get_query": function() {
return {
query: "erpnext.controllers.queries.item_query",
filters: {
"item_group": frappe.query_report.get_filter_value("item_group")
}
}
}
},

View File

@ -9,7 +9,13 @@
</p>
<!-- description -->
<div itemprop="description">
{{ doc.web_long_description or doc.description or _("No description given") | safe }}
{% if frappe.utils.strip_html(doc.web_long_description) %}
{{ doc.web_long_description | safe }}
{% elif frappe.utils.strip_html(doc.description) %}
{{ doc.description | safe }}
{% else %}
{{ _("No description given") }}
{% endif %}
</div>
{% if has_variants %}

View File

@ -1,8 +1,6 @@
{% if doc.website_specifications -%}
<div class="row item-website-specification mt-5">
<div class="col-md-12">
<h6 class="text-uppercase text-muted">{{ _("Specifications") }}</h6>
<table class="table table-bordered">
{% for d in doc.website_specifications -%}
<tr>

View File

@ -33,7 +33,7 @@
{% for item in homepage.products %}
<div class="col-md-4 mb-4">
<div class="card h-100 justify-content-between">
<div class="website-image-lazy" data-class="card-img-top h-100" data-src="{{ item.image }}" data-alt="{{ item.item_name }}"></div>
<div class="website-image-lazy" data-class="card-img-top website-image-extra-large" data-src="{{ item.image }}" data-alt="{{ item.item_name }}"></div>
<div class="card-body flex-grow-0">
<h5 class="card-title">{{ item.item_name }}</h5>
<a href="{{ item.route }}" class="card-link">{{ _('More details') }}</a>

View File

@ -42,7 +42,7 @@
</div>
<div class="col-12 order-1 col-md-4 order-md-2">
{% if frappe.form_dict.start or frappe.form_dict.field_filters or frappe.form_dict.search %}
{% if frappe.form_dict.start or frappe.form_dict.field_filters or frappe.form_dict.attribute_filters or frappe.form_dict.search %}
<a class="mb-3 d-inline-block" href="/all-products">{{ _('Clear filters') }}</a>
{% endif %}