{{ _("Loading") }}...
- {{ _("Rate") + ': ' + d.get_formatted("rate") }} -
- - {{ d.get_formatted("amount") }} -{{ _("Cart is Empty") }}
{% endif %}diff --git a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py index 030fddbb997..885e7bd1603 100644 --- a/erpnext/accounts/doctype/sales_invoice/sales_invoice.py +++ b/erpnext/accounts/doctype/sales_invoice/sales_invoice.py @@ -35,6 +35,15 @@ class SalesInvoice(SellingController): 'overflow_type': 'billing' }] + def set_indicator(self): + """Set indicator for portal""" + if self.outstanding_amount > 0: + self.indicator_color = "orange" + self.indicator_title = _("Unpaid") + else: + self.indicator_color = "green" + self.indicator_title = _("Paid") + def validate(self): super(SalesInvoice, self).validate() self.validate_posting_time() @@ -90,7 +99,7 @@ class SalesInvoice(SellingController): # this sequence because outstanding may get -ve self.make_gl_entries() - + if not self.is_return: self.update_billing_status_for_zero_amount_refdoc("Sales Order") self.check_credit_limit() @@ -161,10 +170,10 @@ class SalesInvoice(SellingController): 'extra_cond': """ and exists (select name from `tabSales Invoice` where name=`tabSales Invoice Item`.parent and update_stock=1 and is_return=1)""" } ]) - + def check_credit_limit(self): from erpnext.selling.doctype.customer.customer import check_credit_limit - + validate_against_credit_limit = False for d in self.get("items"): if not (d.sales_order or d.delivery_note): @@ -282,7 +291,7 @@ class SalesInvoice(SellingController): reconcile_against_document(lst) def validate_debit_to_acc(self): - account = frappe.db.get_value("Account", self.debit_to, + account = frappe.db.get_value("Account", self.debit_to, ["account_type", "report_type", "account_currency"], as_dict=True) if account.report_type != "Balance Sheet": @@ -290,7 +299,7 @@ class SalesInvoice(SellingController): if self.customer and account.account_type != "Receivable": frappe.throw(_("Debit To account must be a Receivable account")) - + self.party_account_currency = account.account_currency def validate_fixed_asset_account(self): @@ -437,18 +446,18 @@ class SalesInvoice(SellingController): if cint(self.is_pos) == 1: if flt(self.paid_amount) == 0: if self.cash_bank_account: - frappe.db.set(self, 'paid_amount', - flt(flt(self.grand_total) - flt(self.write_off_amount), self.precision("paid_amount"))) + frappe.db.set(self, 'paid_amount', + flt(flt(self.grand_total) - flt(self.write_off_amount), self.precision("paid_amount"))) else: # show message that the amount is not paid frappe.db.set(self,'paid_amount',0) frappe.msgprint(_("Note: Payment Entry will not be created since 'Cash or Bank Account' was not specified")) else: frappe.db.set(self,'paid_amount',0) - - frappe.db.set(self, 'base_paid_amount', + + frappe.db.set(self, 'base_paid_amount', flt(self.paid_amount*self.conversion_rate, self.precision("base_paid_amount"))) - + def check_prev_docstatus(self): for d in self.get('items'): if d.sales_order and frappe.db.get_value("Sales Order", d.sales_order, "docstatus") != 1: @@ -487,7 +496,7 @@ class SalesInvoice(SellingController): from erpnext.accounts.general_ledger import merge_similar_entries gl_entries = [] - + self.make_customer_gl_entry(gl_entries) self.make_tax_gl_entries(gl_entries) @@ -586,7 +595,7 @@ class SalesInvoice(SellingController): # write off entries, applicable if only pos if self.write_off_account and self.write_off_amount: write_off_account_currency = frappe.db.get_value("Account", self.write_off_account, "account_currency") - + gl_entries.append( self.get_gl_dict({ "account": self.debit_to, diff --git a/erpnext/controllers/website_list_for_contact.py b/erpnext/controllers/website_list_for_contact.py index 9ec94eb3f84..51fb0a58892 100644 --- a/erpnext/controllers/website_list_for_contact.py +++ b/erpnext/controllers/website_list_for_contact.py @@ -66,6 +66,9 @@ def post_process(doctype, data): doc.status_percent += flt(doc.per_delivered) doc.status_display.append(_("Delivered") if doc.per_delivered==100 else _("{0}% Delivered").format(doc.per_delivered)) + if hasattr(doc, "set_indicator"): + doc.set_indicator() + doc.status_display = ", ".join(doc.status_display) doc.items_preview = ", ".join([d.item_name for d in doc.items]) result.append(doc) diff --git a/erpnext/shopping_cart/cart.py b/erpnext/shopping_cart/cart.py index e219d8ed5fc..6ff164b2295 100644 --- a/erpnext/shopping_cart/cart.py +++ b/erpnext/shopping_cart/cart.py @@ -122,7 +122,8 @@ def update_cart_address(address_fieldname, address_name): quotation.flags.ignore_permissions = True quotation.save() - return get_cart_quotation(quotation) + return frappe.render_template("templates/includes/cart/cart_address.html", + get_cart_quotation(quotation)) def guess_territory(): territory = None diff --git a/erpnext/templates/includes/cart.css b/erpnext/templates/includes/cart.css index ed98846a8d4..7a18530286f 100644 --- a/erpnext/templates/includes/cart.css +++ b/erpnext/templates/includes/cart.css @@ -1,7 +1,25 @@ .cart-content { min-height: 400px; + margin-top: 60px; } .cart-header, .cart-footer { - margin-bottom: 40px; + margin-bottom: 60px; +} + +.cart-item-header { + padding-bottom: 10px; + margin-bottom: 10px; + border-bottom: 1px solid #d1d8dd; +} + +.tax-grand-total-row { + font-size: 14px; + margin-top: 30px; + font-weight: bold; +} + +.cart-addresses { + margin-top: 80px; + margin-bottom: 60px; } diff --git a/erpnext/templates/includes/cart.js b/erpnext/templates/includes/cart.js index 349e2f5ed82..e0706f7fcec 100644 --- a/erpnext/templates/includes/cart.js +++ b/erpnext/templates/includes/cart.js @@ -13,6 +13,8 @@ $.extend(shopping_cart, { }, bind_events: function() { + shopping_cart.bind_address_select(); + // bind update button $(document).on("click", ".item-update-cart button", function() { var item_code = $(this).attr("data-item-code"); @@ -31,19 +33,36 @@ $.extend(shopping_cart, { }); }); - $("#cart-add-shipping-address").on("click", function() { - window.location.href = "addresses"; - }); - - $("#cart-add-billing-address").on("click", function() { - window.location.href = "address"; - }); - $(".btn-place-order").on("click", function() { shopping_cart.place_order(this); }); }, + bind_address_select: function() { + $(".cart-addresses").find('input[data-address-name]').on("click", function() { + if($(this).prop("checked")) { + var me = this; + + return frappe.call({ + type: "POST", + method: "erpnext.shopping_cart.cart.update_cart_address", + args: { + address_fieldname: $(this).attr("data-fieldname"), + address_name: $(this).attr("data-address-name") + }, + callback: function(r) { + if(!r.exc) { + $('.cart-addresses').html(r.message); + } + } + }); + } else { + return false; + } + }); + + }, + render: function(out) { var doc = out.doc; var addresses = out.addresses; @@ -209,32 +228,6 @@ $.extend(shopping_cart, { +$(this).attr("data-address-name")+'"]').collapse("toggle"); }); - $address_wrapper.find('input[type="checkbox"]').on("click", function() { - if($(this).prop("checked")) { - var me = this; - $address_wrapper.find('input[type="checkbox"]').each(function(i, chk) { - if($(chk).attr("data-address-name")!=$(me).attr("data-address-name")) { - $(chk).prop("checked", false); - } - }); - - return frappe.call({ - type: "POST", - method: "erpnext.shopping_cart.cart.update_cart_address", - args: { - address_fieldname: $address_wrapper.attr("data-fieldname"), - address_name: $(this).attr("data-address-name") - }, - callback: function(r) { - if(!r.exc) { - shopping_cart.render(r.message); - } - } - }); - } else { - return false; - } - }); $address_wrapper.find('input[type="checkbox"][data-address-name="'+ address_name +'"]') .prop("checked", true); diff --git a/erpnext/templates/includes/cart/cart_address.html b/erpnext/templates/includes/cart/cart_address.html new file mode 100644 index 00000000000..44964da47c5 --- /dev/null +++ b/erpnext/templates/includes/cart/cart_address.html @@ -0,0 +1,24 @@ +{% from "erpnext/templates/includes/cart/cart_macros.html" + import show_address %} +
+ {{ _("Rate") + ': ' + d.get_formatted("rate") }} +
+{{ d.description }}
-{{ d.description }}
+{{ _("Loading") }}...
- {{ _("Rate") + ': ' + d.get_formatted("rate") }} -
- - {{ d.get_formatted("amount") }} -{{ _("Cart is Empty") }}
{% endif %}