Merge branch 'develop' into company_ui/ux_fix

This commit is contained in:
Mangesh-Khairnar 2019-06-17 15:36:45 +05:30 committed by GitHub
commit 57f4e817f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 62 additions and 34 deletions

View File

@ -128,7 +128,8 @@ def get_gl_entries(filters):
order_by_statement = "order by posting_date, voucher_type, voucher_no" order_by_statement = "order by posting_date, voucher_type, voucher_no"
if filters.get("group_by") == _("Group by Voucher (Consolidated)"): 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, select_fields = """, sum(debit) as debit, sum(credit) as credit,
sum(debit_in_account_currency) as debit_in_account_currency, sum(debit_in_account_currency) as debit_in_account_currency,
sum(credit_in_account_currency) as credit_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", "link": "Tree/Item Group",
"description": _("Tree of Item Groups."), "description": _("Tree of Item Groups."),
}, },
{
"type": "doctype",
"name": "Promotional Scheme",
"description": _("Rules for applying different promotional schemes.")
},
{ {
"type": "doctype", "type": "doctype",
"name": "Pricing Rule", "name": "Pricing Rule",
"description": _("Rules for applying pricing and discount.") "description": _("Rules for applying pricing and discount.")
}, }
] ]
}, },
{ {

View File

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

View File

@ -2,16 +2,13 @@
// MIT License. See license.txt // MIT License. See license.txt
frappe.ui.form.on('Website Theme', { frappe.ui.form.on('Website Theme', {
apply_custom_theme(frm) { validate(frm) {
let custom_theme = frm.doc.custom_theme; let theme_scss = frm.doc.theme_scss;
custom_theme = custom_theme.split('\n'); if (theme_scss.includes('frappe/public/scss/website')
if ( && !theme_scss.includes('erpnext/public/scss/website')
frm.doc.apply_custom_theme
&& custom_theme.length === 2
&& custom_theme[1].includes('frappe/public/scss/website')
) { ) {
frm.set_value('custom_theme', frm.set_value('theme_scss',
`$primary: #7575ff;\n@import "frappe/public/scss/website";\n@import "erpnext/public/scss/website";`); `${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") outward_supply_tax_amounts = self.get_tax_amounts("Sales Invoice")
inward_supply_tax_amounts = self.get_tax_amounts("Purchase Invoice", reverse_charge="Y") inward_supply_tax_amounts = self.get_tax_amounts("Purchase Invoice", reverse_charge="Y")
itc_details = self.get_itc_details() 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_det", ["Registered Regular"])
self.prepare_data("Sales Invoice", outward_supply_tax_amounts, "sup_details", "osup_zero", ["SEZ", "Deemed Export", "Overseas"]) 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.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.report_dict["sup_details"]["osup_nil_exmp"]["txval"] = flt(self.get_nil_rated_supply_value(), 2)
self.set_itc_details(itc_details) 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_inter_state_supply(inter_state_supplies)
self.set_inward_nil_exempt(inward_nil_exempt) self.set_inward_nil_exempt(inward_nil_exempt)
@ -221,7 +222,7 @@ class GSTR3BReport(Document):
for k, v in iteritems(account_map): for k, v in iteritems(account_map):
txval -= self.report_dict.get(supply_type, {}).get(supply_category, {}).get(v, 0) 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): 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""", 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 (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 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, `tabSales Taxes and Charges` t, `tabAddress` a from `tabSales Invoice` s where s.docstatus = 1 and month(s.posting_date) = %s and year(s.posting_date) = %s
where t.parent = s.name and s.customer_address = a.name and and s.company = %s and s.company_gstin = %s and s.gst_category in ('Unregistered', 'Registered Composition', 'UIN Holders')
s.docstatus = 1 and month(s.posting_date) = %s and year(s.posting_date) = %s and group by s.gst_category, s.place_of_supply""", (self.month_no, self.year, self.company, self.gst_details.get("gstin")), as_dict=1)
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_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 = {} 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( inter_state_supply_details.setdefault(
d.gst_category, [] d.gst_category, []
) )
inter_state_supply_details[d.gst_category].append({ if state_number != d.place_of_supply.split("-")[0]:
"pos": get_state_code(d.gst_state), inter_state_supply_details[d.gst_category].append({
"txval": d.total - d.tax_amount, "pos": d.place_of_supply,
"iamt": d.tax_amount "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 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): def get_product_info_for_website(item_code):
"""get product price / stock info for website""" """get product price / stock info for website"""
cart_quotation = _get_cart_quotation()
cart_settings = get_shopping_cart_settings() cart_settings = get_shopping_cart_settings()
if not cart_settings.enabled:
return frappe._dict()
cart_quotation = _get_cart_quotation()
price = get_price( price = get_price(
item_code, item_code,

View File

@ -9,7 +9,13 @@
</p> </p>
<!-- description --> <!-- description -->
<div itemprop="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> </div>
{% if has_variants %} {% if has_variants %}

View File

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

View File

@ -33,7 +33,7 @@
{% for item in homepage.products %} {% for item in homepage.products %}
<div class="col-md-4 mb-4"> <div class="col-md-4 mb-4">
<div class="card h-100 justify-content-between"> <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"> <div class="card-body flex-grow-0">
<h5 class="card-title">{{ item.item_name }}</h5> <h5 class="card-title">{{ item.item_name }}</h5>
<a href="{{ item.route }}" class="card-link">{{ _('More details') }}</a> <a href="{{ item.route }}" class="card-link">{{ _('More details') }}</a>

View File

@ -42,7 +42,7 @@
</div> </div>
<div class="col-12 order-1 col-md-4 order-md-2"> <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> <a class="mb-3 d-inline-block" href="/all-products">{{ _('Clear filters') }}</a>
{% endif %} {% endif %}