From 3986badd06ab17060c5849d7d23914caec1eda11 Mon Sep 17 00:00:00 2001 From: Nabin Hait Date: Fri, 26 Jul 2013 11:01:17 +0530 Subject: [PATCH 1/2] [feature] If customer/supplier account freezed do not allow to make any transaction --- controllers/accounts_controller.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/controllers/accounts_controller.py b/controllers/accounts_controller.py index abefb9bc3d..27bb2a5155 100644 --- a/controllers/accounts_controller.py +++ b/controllers/accounts_controller.py @@ -34,6 +34,8 @@ class AccountsController(TransactionBase): self.validate_value("grand_total", ">=", 0) self.set_total_in_words() + self.validate_for_freezed_account() + def set_missing_values(self, for_validate=False): for fieldname in ["posting_date", "transaction_date"]: if not self.doc.fields.get(fieldname) and self.meta.get_field(fieldname): @@ -52,6 +54,18 @@ class AccountsController(TransactionBase): if date_field and self.doc.fields[date_field]: validate_fiscal_year(self.doc.fields[date_field], self.doc.fiscal_year, label=self.meta.get_label(date_field)) + + def validate_for_freezed_account(self): + for fld in ["customer", "supplier"]: + if self.meta.get_field(fld): + accounts = webnotes.conn.get_values("Account", {"master_type": fld.upper(), + "master_name": self.doc.fields[fld], "company": self.doc.company}, + "freeze_account", as_dict=1) + + if accounts: + if not filter(lambda x: cstr(x.freeze_account) in ["", "No"], accounts): + msgprint(_("Account for this ") + fld + _(" has been freezed. ") + + self.doc.doctype + _(" can not be made."), raise_exception=1) def set_price_list_currency(self, buying_or_selling): # TODO - change this, since price list now has only one currency allowed From c4f5e4fd3f4ff6f0b1f20024c748627a8e3161e7 Mon Sep 17 00:00:00 2001 From: Rushabh Mehta Date: Fri, 26 Jul 2013 11:21:45 +0530 Subject: [PATCH 2/2] [docs] remove attributions from page and added to docs --- .../purchase_order/test_purchase_order.py | 8 +- config.json | 3 - home/page/attributions/README.md | 1 - home/page/attributions/__init__.py | 1 - home/page/attributions/attributions.css | 3 - home/page/attributions/attributions.html | 143 ----------------- home/page/attributions/attributions.js | 4 - home/page/attributions/attributions.py | 2 - home/page/attributions/attributions.txt | 22 --- setup/doctype/uom/test_uom.py | 7 +- utilities/page/__init__.py | 1 - utilities/page/markdown_reference/README.md | 1 - utilities/page/markdown_reference/__init__.py | 1 - .../markdown_reference/markdown_reference.css | 0 .../markdown_reference.html | 150 ------------------ .../markdown_reference/markdown_reference.js | 1 - .../markdown_reference/markdown_reference.py | 2 - .../markdown_reference/markdown_reference.txt | 22 --- utilities/transaction_base.py | 4 +- website/templates/html/footer.html | 2 +- website/templates/pages/attributions.html | 140 ---------------- 21 files changed, 17 insertions(+), 501 deletions(-) delete mode 100644 home/page/attributions/README.md delete mode 100644 home/page/attributions/__init__.py delete mode 100644 home/page/attributions/attributions.css delete mode 100644 home/page/attributions/attributions.html delete mode 100644 home/page/attributions/attributions.js delete mode 100644 home/page/attributions/attributions.py delete mode 100644 home/page/attributions/attributions.txt delete mode 100644 utilities/page/__init__.py delete mode 100644 utilities/page/markdown_reference/README.md delete mode 100644 utilities/page/markdown_reference/__init__.py delete mode 100644 utilities/page/markdown_reference/markdown_reference.css delete mode 100644 utilities/page/markdown_reference/markdown_reference.html delete mode 100644 utilities/page/markdown_reference/markdown_reference.js delete mode 100644 utilities/page/markdown_reference/markdown_reference.py delete mode 100644 utilities/page/markdown_reference/markdown_reference.txt delete mode 100644 website/templates/pages/attributions.html diff --git a/buying/doctype/purchase_order/test_purchase_order.py b/buying/doctype/purchase_order/test_purchase_order.py index 2c354b52b1..75eac9478f 100644 --- a/buying/doctype/purchase_order/test_purchase_order.py +++ b/buying/doctype/purchase_order/test_purchase_order.py @@ -70,6 +70,12 @@ class TestPurchaseOrder(unittest.TestCase): po.doc.conversion_rate = 0.0167 self.assertRaises(WrongWarehouseCompany, po.insert) + def test_uom_integer_validation(self): + from utilities.transaction_base import UOMMustBeIntegerError + po = webnotes.bean(copy=test_records[0]) + po.doclist[1].qty = 3.4 + self.assertRaises(UOMMustBeIntegerError, po.insert) + test_dependencies = ["BOM"] @@ -101,7 +107,7 @@ test_records = [ "import_rate": 500.0, "amount": 5000.0, "warehouse": "_Test Warehouse - _TC", - "stock_uom": "Nos", + "stock_uom": "_Test UOM", "uom": "_Test UOM", "schedule_date": "2013-03-01" } diff --git a/config.json b/config.json index 29d24fe982..c9d1aa71f8 100644 --- a/config.json +++ b/config.json @@ -87,9 +87,6 @@ "no_cache": true, "template": "app/website/templates/pages/account" }, - "attributions": { - "template": "app/website/templates/pages/attributions" - }, "blog": { "template": "app/website/templates/pages/blog", "args_method": "website.helpers.blog.get_blog_template_args" diff --git a/home/page/attributions/README.md b/home/page/attributions/README.md deleted file mode 100644 index a5237bb8ce..0000000000 --- a/home/page/attributions/README.md +++ /dev/null @@ -1 +0,0 @@ -Attributions for software libraries / images used in ERPNext. \ No newline at end of file diff --git a/home/page/attributions/__init__.py b/home/page/attributions/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/home/page/attributions/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/home/page/attributions/attributions.css b/home/page/attributions/attributions.css deleted file mode 100644 index 1de05eec8e..0000000000 --- a/home/page/attributions/attributions.css +++ /dev/null @@ -1,3 +0,0 @@ -.layout-attributions td:first-child { - width: 30%; -} \ No newline at end of file diff --git a/home/page/attributions/attributions.html b/home/page/attributions/attributions.html deleted file mode 100644 index 00f6342837..0000000000 --- a/home/page/attributions/attributions.html +++ /dev/null @@ -1,143 +0,0 @@ -
-
-
-

ERPNext is made using these Awesome Open Source Projects

-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
ERPNextWeb based, Open Source ERP.
- Get top class hosting and support at ERPNext.com
wnframeworkThe full stack Python + Javascript web application framework on which ERPNext is built.
Linux Operating SystemThe operating system that brought a revolution in Open Source software.
MySQL DatabaseThe world's most popular Open Source Database.
Apache HTTPD web serverThe Number One HTTP Server On The Internet.
MemcachedFree & open source, high-performance, distributed memory object caching system.
Python Programming LanguageThe "batteries included" language that lets you write elegant code, quickly.

Python Libraries: -
    -
  • MySQLdb -
  • pytz -
  • jinja2 -
  • markdown2 -
  • dateutil -
  • termcolor -
  • python-memcached -
  • requests -
  • chardet -
  • pygeoip -
  • dropbox -
  • google-api-python-client -
-
Git - Source Code ManagementGit is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.

- Kindly hosted on the web by GitHub: The service that makes it easier for individuals and teams to write better code, faster.
JQuery Javascript LibaryThe write less, do more Javascript Library.
JQuery UI - User Interface LibraryA curated set of user interface interactions, effects, widgets, and themes built on top of the jQuery JavaScript Library.
Bootstrap CSS FrameworkSleek, intuitive, and powerful front-end framework for faster and easier web development.
Font Awesome - IconsThe iconic font designed for use with Twitter Bootstrap.
TinyMCE Rich Text EditorTinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under LGPL by Moxiecode Systems AB.
SlickGridA lightning fast JavaScript grid/spreadsheet.
FullCalendarFullCalendar is a jQuery plugin that provides a full-sized, drag and drop calendar.
Flot Charting LibraryAttractive JavaScript plotting for jQuery.
Ace Code EditorHigh Performance Code Editor for the web.
JQuery.Gantt - Gantt ChartsDraw Gantt charts with the famous jQuery ease of development.
JQuery Tag-itSimple and configurable tag editing widget with autocomplete support.
JSColor - Color PickerHTML/Javascript Color Picker.
QUnitA JavaScript Unit Testing framework.
Downloadify - Flash Download WidgetA tiny javascript + Flash library that enables the creation and download of text files without server interaction.
GeoLite data by MaxMindGeoLite data created by MaxMind, available from - https://www.maxmind.com
- -
-

ERPNext License: GNU/General Public License

-
-

ERPNext - Open Source, web based ERP

-

Copyright © 2012, Web Notes Technologies Pvt Ltd, India

- -

This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version.

- -

This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details.

- -

For complete license see http://www.gnu.org/licenses/

-
-

Note: A link to this page must be easily accessible and all other ERPNext branding must remain as it is.

-
-

For more information please write to us at support@erpnext.com

-
-
\ No newline at end of file diff --git a/home/page/attributions/attributions.js b/home/page/attributions/attributions.js deleted file mode 100644 index 29eb72f171..0000000000 --- a/home/page/attributions/attributions.js +++ /dev/null @@ -1,4 +0,0 @@ -wn.pages['attributions'].onload = function(wrapper) { - wrapper.appframe = new wn.ui.AppFrame($(wrapper).find(".layout-appframe"), - "Attributions"); -} \ No newline at end of file diff --git a/home/page/attributions/attributions.py b/home/page/attributions/attributions.py deleted file mode 100644 index fbba0997d8..0000000000 --- a/home/page/attributions/attributions.py +++ /dev/null @@ -1,2 +0,0 @@ -from __future__ import unicode_literals -import webnotes \ No newline at end of file diff --git a/home/page/attributions/attributions.txt b/home/page/attributions/attributions.txt deleted file mode 100644 index 547d9bc59c..0000000000 --- a/home/page/attributions/attributions.txt +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "creation": "2012-03-01 12:30:42", - "docstatus": 0, - "modified": "2013-07-11 14:41:47", - "modified_by": "Administrator", - "owner": "Administrator" - }, - { - "doctype": "Page", - "icon": "icon-trophy", - "module": "Home", - "name": "__common__", - "page_name": "attributions", - "standard": "Yes", - "title": "Attributions" - }, - { - "doctype": "Page", - "name": "attributions" - } -] \ No newline at end of file diff --git a/setup/doctype/uom/test_uom.py b/setup/doctype/uom/test_uom.py index 51c2bdd92f..7dbb28c502 100644 --- a/setup/doctype/uom/test_uom.py +++ b/setup/doctype/uom/test_uom.py @@ -1,6 +1,11 @@ test_records = [ [{ "doctype": "UOM", - "uom_name": "_Test UOM" + "uom_name": "_Test UOM", + "must_be_whole_number": 1 + }], + [{ + "doctype": "UOM", + "uom_name": "_Test UOM 1" }] ] \ No newline at end of file diff --git a/utilities/page/__init__.py b/utilities/page/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/utilities/page/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/utilities/page/markdown_reference/README.md b/utilities/page/markdown_reference/README.md deleted file mode 100644 index 80f16cb4ec..0000000000 --- a/utilities/page/markdown_reference/README.md +++ /dev/null @@ -1 +0,0 @@ -Markdown reference. \ No newline at end of file diff --git a/utilities/page/markdown_reference/__init__.py b/utilities/page/markdown_reference/__init__.py deleted file mode 100644 index baffc48825..0000000000 --- a/utilities/page/markdown_reference/__init__.py +++ /dev/null @@ -1 +0,0 @@ -from __future__ import unicode_literals diff --git a/utilities/page/markdown_reference/markdown_reference.css b/utilities/page/markdown_reference/markdown_reference.css deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/utilities/page/markdown_reference/markdown_reference.html b/utilities/page/markdown_reference/markdown_reference.html deleted file mode 100644 index 767ac36e30..0000000000 --- a/utilities/page/markdown_reference/markdown_reference.html +++ /dev/null @@ -1,150 +0,0 @@ -
-
-
- Markdown Reference - × -
-
-
-
-

Phrase Emphasis

-
*italic*   **bold**
-_italic_   __bold__
-
- -

Links

- -

Inline:

- -
An [example](http://url.com/ "Title")
-
- -

Reference-style labels (titles are optional):

- -
An [example][id]. Then, anywhere
-else in the doc, define the link:
-
-   [id]: http://example.com/  "Title"
-
- -

Images

- -

Inline (titles are optional):

- -
![alt text](/path/img.jpg "Title")
-
- -

Reference-style:

- -
![alt text][id]
-
-    [id]: /url/to/img.jpg "Title"
-
- -

Headers

- -

Setext-style:

- -
Header 1
-========
-
-Header 2
---------
-
-
- -

atx-style (closing #'s are optional):

- -
# Header 1 #
-
-
-
- -

Lists

- -

Ordered, without paragraphs:

- -
1.  Foo
-2.  Bar
-
- -

Unordered, with paragraphs:

- -
*   A list item.
-
-    With multiple paragraphs.
-
-*   Bar
-
- -

You can nest them:

- -
*   Abacus
-    * ass
-*   Bastard
-    1.  bitch
-    2.  bupkis
-        * BELITTLER
-    3. burper
-*   Cunning
-
- -

Blockquotes

- -
> Email-style angle brackets
-
-> are used for blockquotes.
-
-> > And, they can be nested.
-
-> >
-> * You can quote a list.
-> * Etc.
-
- -

Code Spans

- -
`<code>` spans are delimited
-by backticks.
-
-You can include literal backticks
-like `` `this` ``.
-
- -

Preformatted Code Blocks

- -

Indent every line of a code block by at least 4 spaces or 1 tab, and use a colon at the end of the preceding paragraph.

- -
This is a normal paragraph:
-
-    This is a preformatted
-    code block.
-
-Preceded by a space, the colon
-disappears. :
-
-    This is a preformatted
-    code block.
-
- -

Horizontal Rules

- -

Three or more dashes or asterisks:

- -
---
-
-* * *
-
-- - - -
-
- -

Manual Line Breaks

- -

End a line with two or more spaces:

- -
Roses are red,
-Violets are blue.
-
-
-
-
\ No newline at end of file diff --git a/utilities/page/markdown_reference/markdown_reference.js b/utilities/page/markdown_reference/markdown_reference.js deleted file mode 100644 index 8e8fbac2c9..0000000000 --- a/utilities/page/markdown_reference/markdown_reference.js +++ /dev/null @@ -1 +0,0 @@ -wn.pages['markdown-reference'].onload = function(wrapper) { } \ No newline at end of file diff --git a/utilities/page/markdown_reference/markdown_reference.py b/utilities/page/markdown_reference/markdown_reference.py deleted file mode 100644 index fbba0997d8..0000000000 --- a/utilities/page/markdown_reference/markdown_reference.py +++ /dev/null @@ -1,2 +0,0 @@ -from __future__ import unicode_literals -import webnotes \ No newline at end of file diff --git a/utilities/page/markdown_reference/markdown_reference.txt b/utilities/page/markdown_reference/markdown_reference.txt deleted file mode 100644 index 2906644134..0000000000 --- a/utilities/page/markdown_reference/markdown_reference.txt +++ /dev/null @@ -1,22 +0,0 @@ -[ - { - "creation": "2012-08-07 12:35:30", - "docstatus": 0, - "modified": "2013-07-11 14:43:28", - "modified_by": "Administrator", - "owner": "Administrator" - }, - { - "doctype": "Page", - "icon": "icon-code", - "module": "Utilities", - "name": "__common__", - "page_name": "Markdown Reference", - "standard": "Yes", - "title": "Markdown Reference" - }, - { - "doctype": "Page", - "name": "markdown-reference" - } -] \ No newline at end of file diff --git a/utilities/transaction_base.py b/utilities/transaction_base.py index 4acfdf4e59..55421a1349 100644 --- a/utilities/transaction_base.py +++ b/utilities/transaction_base.py @@ -502,6 +502,8 @@ def delete_events(ref_type, ref_name): webnotes.delete_doc("Event", webnotes.conn.sql_list("""select name from `tabEvent` where ref_type=%s and ref_name=%s""", (ref_type, ref_name)), for_reload=True) +class UOMMustBeIntegerError(webnotes.ValidationError): pass + def validate_uom_is_integer(doclist, uom_field, qty_fields): if isinstance(qty_fields, basestring): qty_fields = [qty_fields] @@ -520,4 +522,4 @@ def validate_uom_is_integer(doclist, uom_field, qty_fields): webnotes.msgprint(_("For UOM") + " '" + d.fields[uom_field] \ + "': " + _("Quantity cannot be a fraction.") \ + " " + _("In Row") + ": " + str(d.idx), - raise_exception=True) + raise_exception=UOMMustBeIntegerError) diff --git a/website/templates/html/footer.html b/website/templates/html/footer.html index 3161987ed8..0e6cca7dc6 100644 --- a/website/templates/html/footer.html +++ b/website/templates/html/footer.html @@ -23,7 +23,7 @@ {% endif %}

- ERPNext Powered + ERPNext Powered