diff --git a/erpnext/__init__.py b/erpnext/__init__.py index c1ec5715e6..d8122088b6 100644 --- a/erpnext/__init__.py +++ b/erpnext/__init__.py @@ -5,7 +5,7 @@ import frappe from erpnext.hooks import regional_overrides from frappe.utils import getdate -__version__ = '10.0.8' +__version__ = '10.0.9' def get_default_company(user=None): '''Get default company for user''' diff --git a/erpnext/accounts/utils.py b/erpnext/accounts/utils.py index e5809fec58..0e35768a6a 100644 --- a/erpnext/accounts/utils.py +++ b/erpnext/accounts/utils.py @@ -252,7 +252,7 @@ def add_ac(args=None): if not ac.parent_account: ac.parent_account = args.get("parent") - if ac.is_root: + if getattr(ac, 'is_root', None): ac.parent_account='' ac.old_parent = "" diff --git a/erpnext/controllers/accounts_controller.py b/erpnext/controllers/accounts_controller.py index e1764720a0..81d2786c10 100644 --- a/erpnext/controllers/accounts_controller.py +++ b/erpnext/controllers/accounts_controller.py @@ -54,6 +54,7 @@ class AccountsController(TransactionBase): if self.meta.get_field("taxes_and_charges"): self.validate_enabled_taxes_and_charges() + self.validate_tax_account_company() self.validate_party() self.validate_currency() @@ -255,6 +256,14 @@ class AccountsController(TransactionBase): if frappe.db.get_value(taxes_and_charges_doctype, self.taxes_and_charges, "disabled"): frappe.throw(_("{0} '{1}' is disabled").format(taxes_and_charges_doctype, self.taxes_and_charges)) + def validate_tax_account_company(self): + for d in self.get("taxes"): + if d.account_head: + tax_account_company = frappe.db.get_value("Account", d.account_head, "company") + if tax_account_company != self.company: + frappe.throw(_("Row #{0}: Account {1} does not belong to company {2}") + .format(d.idx, d.account_head, self.company)) + def get_gl_dict(self, args, account_currency=None): """this method populates the common properties of a gl entry record""" @@ -722,11 +731,15 @@ def get_tax_rate(account_head): return frappe.db.get_value("Account", account_head, ["tax_rate", "account_name"], as_dict=True) @frappe.whitelist() -def get_default_taxes_and_charges(master_doctype, company=None): +def get_default_taxes_and_charges(master_doctype, tax_template=None, company=None): if not company: return {} - default_tax = frappe.db.get_value(master_doctype, - {"is_default": 1, "company": company}) + if tax_template and company: + tax_template_company = frappe.db.get_value(master_doctype, tax_template, "company") + if tax_template_company == company: + return + + default_tax = frappe.db.get_value(master_doctype, {"is_default": 1, "company": company}) return { 'taxes_and_charges': default_tax, diff --git a/erpnext/crm/doctype/opportunity/opportunity.py b/erpnext/crm/doctype/opportunity/opportunity.py index 9b5d6a6335..75f9deac22 100644 --- a/erpnext/crm/doctype/opportunity/opportunity.py +++ b/erpnext/crm/doctype/opportunity/opportunity.py @@ -232,7 +232,7 @@ def make_quotation(source_name, target_doc=None): quotation.conversion_rate = exchange_rate # get default taxes - taxes = get_default_taxes_and_charges("Sales Taxes and Charges Template", quotation.company) + taxes = get_default_taxes_and_charges("Sales Taxes and Charges Template", company=quotation.company) if taxes.get('taxes'): quotation.update(taxes) diff --git a/erpnext/non_profit/doctype/chapter/chapter.py b/erpnext/non_profit/doctype/chapter/chapter.py index d484882519..33206904d6 100644 --- a/erpnext/non_profit/doctype/chapter/chapter.py +++ b/erpnext/non_profit/doctype/chapter/chapter.py @@ -35,4 +35,16 @@ def get_list_context(context): context.title = 'All Chapters' context.no_breadcrumbs = True context.order_by = 'creation desc' - context.introduction = '

All Chapters

' \ No newline at end of file + context.introduction = '

All Chapters

' + + +@frappe.whitelist() +def leave(title, user_id, leave_reason): + chapter = frappe.get_doc("Chapter", title) + for member in chapter.members: + if member.user == user_id: + member.enabled = 0 + member.leave_reason = leave_reason + chapter.save(ignore_permissions=1) + frappe.db.commit() + return "Thank you for Feedback" \ No newline at end of file diff --git a/erpnext/non_profit/doctype/chapter/templates/chapter.html b/erpnext/non_profit/doctype/chapter/templates/chapter.html index 8953481196..671a13a951 100644 --- a/erpnext/non_profit/doctype/chapter/templates/chapter.html +++ b/erpnext/non_profit/doctype/chapter/templates/chapter.html @@ -5,34 +5,39 @@

Details

{{ introduction }}

{% if meetup_embed_html %} -{{ meetup_embed_html }} + {{ meetup_embed_html }} {% endif %}

List of Members

-{% if members %} + +{% if members %} + {% set index = [1] %} {% for user in members %} - - - + + - + + + {% set __ = index.append(1) %} + {% endif %} {% endfor %}
Member Details
{{ loop.index }} -
-
{{ frappe.db.get_value('User', user.user, 'full_name') }}
-
- {% if user.website_url %} - {{ user.website_url or '' }} + {% if user.enabled == 1 %} +
{{ index|length }} +
+
{{ frappe.db.get_value('User', user.user, 'full_name') }}
+
+ {% if user.website_url %} + {{ user.website_url or '' }} + {% endif %} +
+
+ {% if user.introduction %} + {{ user.introduction }} {% endif %} +
-
- {% if user.introduction %} - {{ user.introduction }} - {% endif %} -
- -
{% else %} diff --git a/erpnext/non_profit/doctype/chapter/templates/chapter_row.html b/erpnext/non_profit/doctype/chapter/templates/chapter_row.html index 67fb0c5631..12176ca177 100644 --- a/erpnext/non_profit/doctype/chapter/templates/chapter_row.html +++ b/erpnext/non_profit/doctype/chapter/templates/chapter_row.html @@ -1,21 +1,30 @@ {% if doc.published %}
- +

{{ doc.name }}

- {{ frappe.db.get_value('User', chapter_head, 'full_name') }} + Chapter Head : {{ frappe.db.get_value('User', chapter_head, 'full_name') }} {% if members %} - Members: {{ members|length }} + {% set index = [] %} + {% for user in members %} + {% if user.enabled == 1 %} + {% set __ = index.append(1) %} + {% endif %} + {% endfor %} + Members: {{ index|length }} {% else %} Members: 0 {% endif %} - + +

{{ html2text(doc.introduction[:200]) }}{% if introduction|len > 200 %}...{% endif %}

{% endif %} + +