Fixed conflict

This commit is contained in:
Nabin Hait
2015-01-14 16:27:13 +05:30
31 changed files with 3893 additions and 3804 deletions

View File

@@ -15,6 +15,7 @@ install:
- cd ~/ && bench init frappe-bench --frappe-path https://github.com/frappe/frappe.git - cd ~/ && bench init frappe-bench --frappe-path https://github.com/frappe/frappe.git
- cp -r $TRAVIS_BUILD_DIR/test_sites/test_site ~/frappe-bench/sites/ - cp -r $TRAVIS_BUILD_DIR/test_sites/test_site ~/frappe-bench/sites/
<<<<<<< HEAD
script: script:
- cd ~/frappe-bench - cd ~/frappe-bench
- bench get-app erpnext $TRAVIS_BUILD_DIR - bench get-app erpnext $TRAVIS_BUILD_DIR
@@ -23,6 +24,13 @@ script:
- bench frappe --build_website - bench frappe --build_website
- bench frappe --serve_test & - bench frappe --serve_test &
- bench frappe --verbose --run_tests - bench frappe --verbose --run_tests
=======
- sudo apt-get install xfonts-75dpi xfonts-base -y
- wget http://downloads.sourceforge.net/project/wkhtmltopdf/0.12.2/wkhtmltox-0.12.2_linux-precise-amd64.deb
- sudo dpkg -i wkhtmltox-0.12.2_linux-precise-amd64.deb
- CFLAGS=-O0 pip install git+https://github.com/frappe/frappe.git@develop
- CFLAGS=-O0 pip install --editable .
>>>>>>> da975f5a76aacc24abb71c4a26cb204f9ec72610
before_script: before_script:
- mysql -e 'create database test_frappe' - mysql -e 'create database test_frappe'

View File

@@ -1,34 +1,31 @@
# ERPNext - Open Source ERP for small, medium sized businesses [![Build Status](https://travis-ci.org/frappe/erpnext.png)](https://travis-ci.org/frappe/erpnext) # ERPNext - Open source ERP for small and medium-size business [![Build Status](https://travis-ci.org/frappe/erpnext.png)](https://travis-ci.org/frappe/erpnext)
[https://erpnext.com](https://erpnext.com) [https://erpnext.com](https://erpnext.com)
Includes Accounting, Inventory, CRM, Sales, Purchase, Projects, HRMS. Built on Python / MariaDB. Includes: Accounting, Inventory, CRM, Sales, Purchase, Projects, HRMS. Requires MariaDB.
ERPNext is built on [frappe](https://github.com/frappe/frappe) Python Framework. ERPNext is built on the [Frappe](https://github.com/frappe/frappe) Framework, a full-stack web app framework in Python & Javascript.
- [User Guide](http://erpnext.org/user-guide.html) - [User Guide](https://erpnext.com/user-guide)
- [Getting Help](http://erpnext.org/getting-help.html) - [Getting Help](http://erpnext.org/getting-help.html)
- [Developer Forum](http://groups.google.com/group/erpnext-developer-forum) - [Discussion Forum](https://discuss.frappe.io/)
- [User Forum](http://groups.google.com/group/erpnext-user-forum)
--- ---
### Install ### Full Install
Use the bench, https://github.com/frappe/bench The Easy Way install script for bench will install all dependencies (e.g. MariaDB). See https://github.com/frappe/bench
### Admin Login New passwords will be created for the ERPNext "Administrator" user, the MariaDB root user, and the frappe user (the script displays the passwords and saves them to ~/frappe_passwords.txt).
1. go to "/login" ### Virtual Image
1. Administrator user name: "Administrator"
1. Administrator password: "admin"
### Download and Install You can download a virtual image to run ERPNext in a virtual machine on your local system.
##### Virtual Image:
- [ERPNext Download](http://erpnext.com/download) - [ERPNext Download](http://erpnext.com/download)
System and user credentials are listed on the download page.
--- ---
## License ## License

View File

@@ -422,6 +422,15 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"permlevel": 0 "permlevel": 0
}, },
{
"fieldname": "other_charges_total_export",
"fieldtype": "Currency",
"label": "Total Taxes and Charges",
"options": "currency",
"permlevel": 0,
"print_hide": 1,
"read_only": 1
},
{ {
"fieldname": "other_charges_total", "fieldname": "other_charges_total",
"fieldtype": "Currency", "fieldtype": "Currency",
@@ -438,23 +447,24 @@
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0 "permlevel": 0
}, },
{
"fieldname": "other_charges_total_export",
"fieldtype": "Currency",
"label": "Total Taxes and Charges",
"options": "currency",
"permlevel": 0,
"print_hide": 1,
"read_only": 1
},
{ {
"fieldname": "discount_amount", "fieldname": "discount_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Discount Amount", "label": "Discount Amount",
"options": "Company:company:default_currency", "options": "currency",
"permlevel": 0, "permlevel": 0,
"print_hide": 0 "print_hide": 0
}, },
{
"fieldname": "base_discount_amount",
"fieldtype": "Currency",
"label": "Discount Amount (Company Currency)",
"options": "Company:company:default_currency",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"read_only": 1
},
{ {
"fieldname": "totals", "fieldname": "totals",
"fieldtype": "Section Break", "fieldtype": "Section Break",
@@ -1192,7 +1202,7 @@
"icon": "icon-file-text", "icon": "icon-file-text",
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"modified": "2015-01-06 11:55:32.975513", "modified": "2015-01-12 17:34:36.353241",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Sales Invoice", "name": "Sales Invoice",

View File

@@ -77,7 +77,7 @@ cur_frm.pformat.taxes= function(doc){
// Discount Amount // Discount Amount
if(!print_hide('discount_amount') && doc.discount_amount) if(!print_hide('discount_amount') && doc.discount_amount)
out += make_row('Discount Amount', convert_rate(doc.discount_amount), 0); out += make_row('Discount Amount', doc.discount_amount, 0);
// grand total // grand total
if(!print_hide('grand_total_export')) if(!print_hide('grand_total_export'))

View File

@@ -3,9 +3,9 @@
"doc_type": "Journal Entry", "doc_type": "Journal Entry",
"docstatus": 0, "docstatus": 0,
"doctype": "Print Format", "doctype": "Print Format",
"html": "<div style=\"position: relative\">\n\n\t{%- from \"templates/print_formats/standard_macros.html\" import add_header -%}\n<div class=\"page-break\">\n {%- if not doc.get(\"print_heading\") and not doc.get(\"select_print_heading\") \n and doc.set(\"select_print_heading\", _(\"Payment Advice\")) -%}{%- endif -%}\n {{ add_header(0, 1, doc, letter_head, no_letterhead) }}\n\n{%- for label, value in (\n (_(\"Voucher Date\"), frappe.utils.formatdate(doc.voucher_date)),\n (_(\"Reference / Cheque No.\"), doc.cheque_no),\n (_(\"Reference / Cheque Date\"), frappe.utils.formatdate(doc.cheque_date))\n ) -%}\n <div class=\"row\">\n <div class=\"col-sm-4\"><label class=\"text-right\">{{ label }}</label></div>\n <div class=\"col-sm-8\">{{ value }}</div>\n </div>\n{%- endfor -%}\n\t<hr>\n\t<p>{{ _(\"This amount is in full / part settlement of the listed bills\") }}:</p>\n{%- for label, value in (\n (_(\"Amount\"), \"<strong>\" + doc.get_formatted(\"total_amount\") + \"</strong><br>\" + (doc.total_amount_in_words or \"\") + \"<br>\"),\n (_(\"References\"), doc.remark)\n ) -%}\n <div class=\"row\">\n <div class=\"col-sm-4\"><label class=\"text-right\">{{ label }}</label></div>\n <div class=\"col-sm-8\">{{ value }}</div>\n </div>\n {%- endfor -%}\n <hr>\n\t<div style=\"position: absolute; top: 14cm; left: 0cm;\">\n\t\tPrepared By</div>\n\t<div style=\"position: absolute; top: 14cm; left: 5.5cm;\">\n\t\tAuthorised Signatory</div>\n\t<div style=\"position: absolute; top: 14cm; left: 11cm;\">\n\t\tReceived Payment as Above</div>\n\t<div style=\"position: absolute; top: 16.4cm; left: 5.9cm;\">\n\t\t<strong>_____________</strong></div>\n\t<div style=\"position: absolute; top: 16.7cm; left: 6cm;\">\n\t\t<strong>A/C Payee</strong></div>\n\t<div style=\"position: absolute; top: 16.7cm; left: 5.9cm;\">\n\t\t<strong>_____________</strong></div>\n\t<div style=\"position: absolute; top: 16.9cm; left: 12cm;\">\n\t\t{{ frappe.utils.formatdate(doc.cheque_date) }}</div>\n\t<div style=\"position: absolute; top: 17.9cm; left: 1cm;\">\n\t\t{{ doc.pay_to_recd_from }}</div>\n\t<div style=\"position: absolute; top: 18.6cm; left: 1cm; width: 7cm;\">\n\t\t{{ doc.total_amount_in_words }}</div>\n\t<div style=\"position: absolute; top: 19.7cm; left: 12cm;\">\n\t\t{{ doc.total_amount }}</div>\n</div>", "html": "<div style=\"position: relative\">\n\n\t{%- from \"templates/print_formats/standard_macros.html\" import add_header -%}\n<div class=\"page-break\">\n {%- if not doc.get(\"print_heading\") and not doc.get(\"select_print_heading\") \n and doc.set(\"select_print_heading\", _(\"Payment Advice\")) -%}{%- endif -%}\n {{ add_header(0, 1, doc, letter_head, no_letterhead) }}\n\n{%- for label, value in (\n (_(\"Voucher Date\"), frappe.utils.formatdate(doc.voucher_date)),\n (_(\"Reference / Cheque No.\"), doc.cheque_no),\n (_(\"Reference / Cheque Date\"), frappe.utils.formatdate(doc.cheque_date))\n ) -%}\n <div class=\"row\">\n <div class=\"col-xs-4\"><label class=\"text-right\">{{ label }}</label></div>\n <div class=\"col-xs-8\">{{ value }}</div>\n </div>\n{%- endfor -%}\n\t<hr>\n\t<p>{{ _(\"This amount is in full / part settlement of the listed bills\") }}:</p>\n{%- for label, value in (\n (_(\"Amount\"), \"<strong>\" + doc.get_formatted(\"total_amount\") + \"</strong><br>\" + (doc.total_amount_in_words or \"\") + \"<br>\"),\n (_(\"References\"), doc.remark)\n ) -%}\n <div class=\"row\">\n <div class=\"col-xs-4\"><label class=\"text-right\">{{ label }}</label></div>\n <div class=\"col-xs-8\">{{ value }}</div>\n </div>\n {%- endfor -%}\n <hr>\n\t<div style=\"position: absolute; top: 14cm; left: 0cm;\">\n\t\tPrepared By</div>\n\t<div style=\"position: absolute; top: 14cm; left: 5.5cm;\">\n\t\tAuthorised Signatory</div>\n\t<div style=\"position: absolute; top: 14cm; left: 11cm;\">\n\t\tReceived Payment as Above</div>\n\t<div style=\"position: absolute; top: 16.4cm; left: 5.9cm;\">\n\t\t<strong>_____________</strong></div>\n\t<div style=\"position: absolute; top: 16.7cm; left: 6cm;\">\n\t\t<strong>A/C Payee</strong></div>\n\t<div style=\"position: absolute; top: 16.7cm; left: 5.9cm;\">\n\t\t<strong>_____________</strong></div>\n\t<div style=\"position: absolute; top: 16.9cm; left: 12cm;\">\n\t\t{{ frappe.utils.formatdate(doc.cheque_date) }}</div>\n\t<div style=\"position: absolute; top: 17.9cm; left: 1cm;\">\n\t\t{{ doc.pay_to_recd_from }}</div>\n\t<div style=\"position: absolute; top: 18.6cm; left: 1cm; width: 7cm;\">\n\t\t{{ doc.total_amount_in_words }}</div>\n\t<div style=\"position: absolute; top: 19.7cm; left: 12cm;\">\n\t\t{{ doc.total_amount }}</div>\n</div>",
"idx": 1, "idx": 1,
"modified": "2014-12-12 16:29:57.723432", "modified": "2015-01-12 11:03:17.032512",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Cheque Printing Format", "name": "Cheque Printing Format",

View File

@@ -4,9 +4,9 @@
"doc_type": "Journal Entry", "doc_type": "Journal Entry",
"docstatus": 0, "docstatus": 0,
"doctype": "Print Format", "doctype": "Print Format",
"html": "{%- from \"templates/print_formats/standard_macros.html\" import add_header -%}\n\n<div class=\"page-break\">\n {%- if not doc.get(\"print_heading\") and not doc.get(\"select_print_heading\") \n and doc.set(\"select_print_heading\", _(\"Credit Note\")) -%}{%- endif -%}\n {{ add_header(0, 1, doc, letter_head, no_letterhead) }}\n\n {%- for label, value in (\n (_(\"Credit To\"), doc.pay_to_recd_from),\n (_(\"Date\"), frappe.utils.formatdate(doc.voucher_date)),\n (_(\"Amount\"), \"<strong>\" + doc.get_formatted(\"total_amount\") + \"</strong><br>\" + (doc.total_amount_in_words or \"\") + \"<br>\"),\n (_(\"Remarks\"), doc.remark)\n ) -%}\n\n <div class=\"row\">\n <div class=\"col-sm-3\"><label class=\"text-right\">{{ label }}</label></div>\n <div class=\"col-sm-9\">{{ value }}</div>\n </div>\n\n {%- endfor -%}\n\n <hr>\n <br>\n <p class=\"strong\">\n {{ _(\"For\") }} {{ doc.company }},<br>\n <br>\n <br>\n <br>\n {{ _(\"Authorized Signatory\") }}\n </p>\n</div>\n\n\n", "html": "{%- from \"templates/print_formats/standard_macros.html\" import add_header -%}\n\n<div class=\"page-break\">\n {%- if not doc.get(\"print_heading\") and not doc.get(\"select_print_heading\") \n and doc.set(\"select_print_heading\", _(\"Credit Note\")) -%}{%- endif -%}\n {{ add_header(0, 1, doc, letter_head, no_letterhead) }}\n\n {%- for label, value in (\n (_(\"Credit To\"), doc.pay_to_recd_from),\n (_(\"Date\"), frappe.utils.formatdate(doc.voucher_date)),\n (_(\"Amount\"), \"<strong>\" + doc.get_formatted(\"total_amount\") + \"</strong><br>\" + (doc.total_amount_in_words or \"\") + \"<br>\"),\n (_(\"Remarks\"), doc.remark)\n ) -%}\n\n <div class=\"row\">\n <div class=\"col-xs-3\"><label class=\"text-right\">{{ label }}</label></div>\n <div class=\"col-xs-9\">{{ value }}</div>\n </div>\n\n {%- endfor -%}\n\n <hr>\n <br>\n <p class=\"strong\">\n {{ _(\"For\") }} {{ doc.company }},<br>\n <br>\n <br>\n <br>\n {{ _(\"Authorized Signatory\") }}\n </p>\n</div>\n\n\n",
"idx": 2, "idx": 2,
"modified": "2014-12-12 16:30:53.890457", "modified": "2015-01-12 11:02:25.716825",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Credit Note", "name": "Credit Note",

View File

@@ -3,9 +3,9 @@
"doc_type": "Journal Entry", "doc_type": "Journal Entry",
"docstatus": 0, "docstatus": 0,
"doctype": "Print Format", "doctype": "Print Format",
"html": "{%- from \"templates/print_formats/standard_macros.html\" import add_header -%}\n<div class=\"page-break\">\n {%- if not doc.get(\"print_heading\") and not doc.get(\"select_print_heading\") \n and doc.set(\"select_print_heading\", _(\"Payment Receipt Note\")) -%}{%- endif -%}\n {{ add_header(0, 1, doc, letter_head, no_letterhead) }}\n\n {%- for label, value in (\n (_(\"Received On\"), frappe.utils.formatdate(doc.voucher_date)),\n (_(\"Received From\"), doc.pay_to_recd_from),\n (_(\"Amount\"), \"<strong>\" + doc.get_formatted(\"total_amount\") + \"</strong><br>\" + (doc.total_amount_in_words or \"\") + \"<br>\"),\n (_(\"Remarks\"), doc.remark)\n ) -%}\n <div class=\"row\">\n <div class=\"col-sm-3\"><label class=\"text-right\">{{ label }}</label></div>\n <div class=\"col-sm-9\">{{ value }}</div>\n </div>\n\n {%- endfor -%}\n\n <hr>\n <br>\n <p class=\"strong\">\n {{ _(\"For\") }} {{ doc.company }},<br>\n <br>\n <br>\n <br>\n {{ _(\"Authorized Signatory\") }}\n </p>\n</div>\n\n", "html": "{%- from \"templates/print_formats/standard_macros.html\" import add_header -%}\n<div class=\"page-break\">\n {%- if not doc.get(\"print_heading\") and not doc.get(\"select_print_heading\") \n and doc.set(\"select_print_heading\", _(\"Payment Receipt Note\")) -%}{%- endif -%}\n {{ add_header(0, 1, doc, letter_head, no_letterhead) }}\n\n {%- for label, value in (\n (_(\"Received On\"), frappe.utils.formatdate(doc.voucher_date)),\n (_(\"Received From\"), doc.pay_to_recd_from),\n (_(\"Amount\"), \"<strong>\" + doc.get_formatted(\"total_amount\") + \"</strong><br>\" + (doc.total_amount_in_words or \"\") + \"<br>\"),\n (_(\"Remarks\"), doc.remark)\n ) -%}\n <div class=\"row\">\n <div class=\"col-xs-3\"><label class=\"text-right\">{{ label }}</label></div>\n <div class=\"col-xs-9\">{{ value }}</div>\n </div>\n\n {%- endfor -%}\n\n <hr>\n <br>\n <p class=\"strong\">\n {{ _(\"For\") }} {{ doc.company }},<br>\n <br>\n <br>\n <br>\n {{ _(\"Authorized Signatory\") }}\n </p>\n</div>\n\n",
"idx": 1, "idx": 1,
"modified": "2014-12-12 16:31:33.869069", "modified": "2015-01-12 11:03:22.893209",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Accounts", "module": "Accounts",
"name": "Payment Receipt Voucher", "name": "Payment Receipt Voucher",

View File

@@ -36,7 +36,7 @@ def get_fiscal_years(transaction_date=None, fiscal_year=None, label="Date", verb
}) })
if not fy: if not fy:
error_msg = _("""{0} {1} not in any Fiscal Year""").format(label, formatdate(transaction_date)) error_msg = _("""{0} {1} not in any Fiscal Year. For more details check {2}.""").format(label, formatdate(transaction_date), "https://erpnext.com/kb/accounts/fiscal-year-error")
if verbose==1: frappe.msgprint(error_msg) if verbose==1: frappe.msgprint(error_msg)
raise FiscalYearError, error_msg raise FiscalYearError, error_msg
return fy return fy

View File

@@ -208,7 +208,8 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
var tax_count = this.frm.tax_doclist.length; var tax_count = this.frm.tax_doclist.length;
this.frm.doc.grand_total = flt(tax_count ? this.frm.doc.grand_total = flt(tax_count ?
this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total); this.frm.tax_doclist[tax_count - 1].total : this.frm.doc.net_total);
this.frm.doc.grand_total_import = flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate); this.frm.doc.grand_total_import = flt(tax_count ?
flt(this.frm.doc.grand_total / this.frm.doc.conversion_rate) : this.frm.doc.net_total_import);
this.frm.doc.total_tax = flt(this.frm.doc.grand_total - this.frm.doc.net_total, this.frm.doc.total_tax = flt(this.frm.doc.grand_total - this.frm.doc.net_total,
precision("total_tax")); precision("total_tax"));

View File

@@ -291,7 +291,7 @@ class AccountsController(TransactionBase):
self.precision("tax_amount", tax)) self.precision("tax_amount", tax))
def adjust_discount_amount_loss(self, tax): def adjust_discount_amount_loss(self, tax):
discount_amount_loss = self.grand_total - flt(self.discount_amount) - tax.total discount_amount_loss = self.grand_total - flt(self.base_discount_amount) - tax.total
tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount + tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount +
discount_amount_loss, self.precision("tax_amount", tax)) discount_amount_loss, self.precision("tax_amount", tax))
tax.total = flt(tax.total + discount_amount_loss, self.precision("total", tax)) tax.total = flt(tax.total + discount_amount_loss, self.precision("total", tax))
@@ -475,7 +475,7 @@ class AccountsController(TransactionBase):
max_allowed_amt = flt(ref_amt * (100 + tolerance) / 100) max_allowed_amt = flt(ref_amt * (100 + tolerance) / 100)
if total_billed_amt - max_allowed_amt > 0.01: if total_billed_amt - max_allowed_amt > 0.01:
frappe.throw(_("Cannot overbill for Item {0} in row {0} more than {1}. To allow overbilling, please set in Stock Settings").format(item.item_code, item.idx, max_allowed_amt)) frappe.throw(_("Cannot overbill for Item {0} in row {1} more than {2}. To allow overbilling, please set in Stock Settings").format(item.item_code, item.idx, max_allowed_amt))
def get_company_default(self, fieldname): def get_company_default(self, fieldname):
from erpnext.accounts.utils import get_company_default from erpnext.accounts.utils import get_company_default

View File

@@ -115,7 +115,8 @@ class BuyingController(StockController):
def calculate_totals(self): def calculate_totals(self):
self.grand_total = flt(self.get("taxes")[-1].total if self.get("taxes") else self.net_total) self.grand_total = flt(self.get("taxes")[-1].total if self.get("taxes") else self.net_total)
self.grand_total_import = flt(self.grand_total / self.conversion_rate) self.grand_total_import = flt(self.grand_total / self.conversion_rate) \
if self.get("taxes") else self.net_total_import
self.total_tax = flt(self.grand_total - self.net_total, self.precision("total_tax")) self.total_tax = flt(self.grand_total - self.net_total, self.precision("total_tax"))

View File

@@ -232,16 +232,20 @@ class SellingController(StockController):
def apply_discount_amount(self): def apply_discount_amount(self):
if self.discount_amount: if self.discount_amount:
self.base_discount_amount = flt(self.discount_amount * self.conversion_rate, self.precision("base_discount_amount"))
grand_total_for_discount_amount = self.get_grand_total_for_discount_amount() grand_total_for_discount_amount = self.get_grand_total_for_discount_amount()
if grand_total_for_discount_amount: if grand_total_for_discount_amount:
# calculate item amount after Discount Amount # calculate item amount after Discount Amount
for item in self.get("items"): for item in self.get("items"):
distributed_amount = flt(self.discount_amount) * item.base_amount / grand_total_for_discount_amount distributed_amount = flt(self.base_discount_amount) * item.base_amount / grand_total_for_discount_amount
item.base_amount = flt(item.base_amount - distributed_amount, self.precision("base_amount", item)) item.base_amount = flt(item.base_amount - distributed_amount, self.precision("base_amount", item))
self.discount_amount_applied = True self.discount_amount_applied = True
self._calculate_taxes_and_totals() self._calculate_taxes_and_totals()
else:
self.base_discount_amount = 0
def get_grand_total_for_discount_amount(self): def get_grand_total_for_discount_amount(self):
actual_taxes_dict = {} actual_taxes_dict = {}

View File

@@ -167,7 +167,7 @@ class StockController(AccountsController):
else: else:
is_expense_account = frappe.db.get_value("Account", is_expense_account = frappe.db.get_value("Account",
item.get("expense_account"), "report_type")=="Profit and Loss" item.get("expense_account"), "report_type")=="Profit and Loss"
if self.doctype not in ("Purchase Receipt", "Stock Reconciliation") and not is_expense_account: if self.doctype not in ("Purchase Receipt", "Stock Reconciliation", "Stock Entry") and not is_expense_account:
frappe.throw(_("Expense / Difference account ({0}) must be a 'Profit or Loss' account") frappe.throw(_("Expense / Difference account ({0}) must be a 'Profit or Loss' account")
.format(item.get("expense_account"))) .format(item.get("expense_account")))
if is_expense_account and not item.get("cost_center"): if is_expense_account and not item.get("cost_center"):
@@ -245,7 +245,7 @@ def compare_existing_and_expected_gle(existing_gle, expected_gle):
for entry in expected_gle: for entry in expected_gle:
for e in existing_gle: for e in existing_gle:
if entry.account==e.account and entry.against_account==e.against_account \ if entry.account==e.account and entry.against_account==e.against_account \
and entry.cost_center==e.cost_center \ and (not entry.cost_center or not e.cost_center or entry.cost_center==e.cost_center) \
and (entry.debit != e.debit or entry.credit != e.credit): and (entry.debit != e.debit or entry.credit != e.credit):
matched = False matched = False
break break

View File

@@ -33,7 +33,7 @@ cur_frm.cscript.refresh = function(doc, dt, dn) {
cur_frm.set_intro(__("You are the Leave Approver for this record. Please Update the 'Status' and Save")); cur_frm.set_intro(__("You are the Leave Approver for this record. Please Update the 'Status' and Save"));
cur_frm.toggle_enable("status", true); cur_frm.toggle_enable("status", true);
} else { } else {
cur_frm.set_intro(__("This Leave Application is pending approval. Only the Leave Apporver can update status.")) cur_frm.set_intro(__("This Leave Application is pending approval. Only the Leave Approver can update status."))
cur_frm.toggle_enable("status", false); cur_frm.toggle_enable("status", false);
} }
} }

View File

@@ -8,6 +8,8 @@ from frappe.utils import cint, cstr, flt
from frappe import _ from frappe import _
from frappe.model.document import Document from frappe.model.document import Document
from operator import itemgetter
class BOM(Document): class BOM(Document):
def autoname(self): def autoname(self):
@@ -335,7 +337,7 @@ class BOM(Document):
"Add items to Flat BOM table" "Add items to Flat BOM table"
frappe.db.sql("""delete from `tabBOM Explosion Item` where parent=%s""", self.name) frappe.db.sql("""delete from `tabBOM Explosion Item` where parent=%s""", self.name)
self.set('exploded_items', []) self.set('exploded_items', [])
for d in self.cur_exploded_items: for d in sorted(self.cur_exploded_items, key=itemgetter(0)):
ch = self.append('exploded_items', {}) ch = self.append('exploded_items', {})
for i in self.cur_exploded_items[d].keys(): for i in self.cur_exploded_items[d].keys():
ch.set(i, self.cur_exploded_items[d][i]) ch.set(i, self.cur_exploded_items[d][i])

View File

@@ -11,7 +11,7 @@ from erpnext.stock.doctype.stock_entry import test_stock_entry
from erpnext.projects.doctype.time_log.time_log import OverProductionError from erpnext.projects.doctype.time_log.time_log import OverProductionError
class TestProductionOrder(unittest.TestCase): class TestProductionOrder(unittest.TestCase):
def test_planned_qty(self): def check_planned_qty(self):
set_perpetual_inventory(0) set_perpetual_inventory(0)
planned0 = frappe.db.get_value("Bin", {"item_code": "_Test FG Item", "warehouse": "_Test Warehouse 1 - _TC"}, "planned_qty") or 0 planned0 = frappe.db.get_value("Bin", {"item_code": "_Test FG Item", "warehouse": "_Test Warehouse 1 - _TC"}, "planned_qty") or 0
@@ -30,11 +30,15 @@ class TestProductionOrder(unittest.TestCase):
s = frappe.get_doc(make_stock_entry(pro_doc.name, "Material Transfer", 4)) s = frappe.get_doc(make_stock_entry(pro_doc.name, "Material Transfer", 4))
for d in s.get("items"): for d in s.get("items"):
d.s_warehouse = "Stores - _TC" d.s_warehouse = "Stores - _TC"
s.fiscal_year = "_Test Fiscal Year 2013"
s.posting_date = "2013-01-02"
s.insert() s.insert()
s.submit() s.submit()
# from wip to fg # from wip to fg
s = frappe.get_doc(make_stock_entry(pro_doc.name, "Manufacture", 4)) s = frappe.get_doc(make_stock_entry(pro_doc.name, "Manufacture", 4))
s.fiscal_year = "_Test Fiscal Year 2013"
s.posting_date = "2013-01-03"
s.insert() s.insert()
s.submit() s.submit()
@@ -47,7 +51,7 @@ class TestProductionOrder(unittest.TestCase):
def test_over_production(self): def test_over_production(self):
from erpnext.manufacturing.doctype.production_order.production_order import StockOverProductionError from erpnext.manufacturing.doctype.production_order.production_order import StockOverProductionError
pro_doc = self.test_planned_qty() pro_doc = self.check_planned_qty()
test_stock_entry.make_stock_entry(item_code="_Test Item", test_stock_entry.make_stock_entry(item_code="_Test Item",
target="_Test Warehouse - _TC", qty=100, incoming_rate=100) target="_Test Warehouse - _TC", qty=100, incoming_rate=100)
@@ -55,6 +59,8 @@ class TestProductionOrder(unittest.TestCase):
target="_Test Warehouse - _TC", qty=100, incoming_rate=100) target="_Test Warehouse - _TC", qty=100, incoming_rate=100)
s = frappe.get_doc(make_stock_entry(pro_doc.name, "Manufacture", 7)) s = frappe.get_doc(make_stock_entry(pro_doc.name, "Manufacture", 7))
s.fiscal_year = "_Test Fiscal Year 2013"
s.posting_date = "2013-01-04"
s.insert() s.insert()
self.assertRaises(StockOverProductionError, s.submit) self.assertRaises(StockOverProductionError, s.submit)

View File

@@ -24,6 +24,13 @@ cur_frm.cscript.item_code = function(doc,cdt,cdn) {
} }
} }
cur_frm.cscript.raise_purchase_request = function(doc, cdt, cdn) {
return frappe.call({
method: "raise_purchase_request",
doc:doc
})
}
cur_frm.cscript.download_materials_required = function(doc, cdt, cdn) { cur_frm.cscript.download_materials_required = function(doc, cdt, cdn) {
return $c_obj(doc, 'validate_data', '', function(r, rt) { return $c_obj(doc, 'validate_data', '', function(r, rt) {
if (!r['exc']) if (!r['exc'])

View File

@@ -143,7 +143,7 @@
"fieldname": "raise_purchase_request", "fieldname": "raise_purchase_request",
"fieldtype": "Button", "fieldtype": "Button",
"label": "Create Material Requests", "label": "Create Material Requests",
"options": "raise_purchase_request", "options": "",
"permlevel": 0 "permlevel": 0
}, },
{ {
@@ -158,7 +158,7 @@
"idx": 1, "idx": 1,
"in_create": 1, "in_create": 1,
"issingle": 1, "issingle": 1,
"modified": "2014-12-24 16:36:06.267344", "modified": "2015-01-11 21:53:21.253556",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Manufacturing", "module": "Manufacturing",
"name": "Production Planning Tool", "name": "Production Planning Tool",

View File

@@ -87,6 +87,7 @@ erpnext.patches.v4_2.fix_gl_entries_for_stock_transactions
erpnext.patches.v4_2.update_requested_and_ordered_qty erpnext.patches.v4_2.update_requested_and_ordered_qty
erpnext.patches.v4_4.make_email_accounts erpnext.patches.v4_4.make_email_accounts
execute:frappe.delete_doc("DocType", "Contact Control") execute:frappe.delete_doc("DocType", "Contact Control")
erpnext.patches.v4_2.discount_amount
erpnext.patches.v4_2.reset_bom_costs erpnext.patches.v4_2.reset_bom_costs
erpnext.patches.v5_0.update_frozen_accounts_permission_role erpnext.patches.v5_0.update_frozen_accounts_permission_role
erpnext.patches.v5_0.update_dn_against_doc_fields erpnext.patches.v5_0.update_dn_against_doc_fields

View File

@@ -0,0 +1,12 @@
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.modules import scrub, get_doctype_module
def execute():
for dt in ["Quotation", "Sales Order", "Delivery Note", "Sales Invoice"]:
frappe.reload_doc(get_doctype_module(dt), "doctype", scrub(dt))
frappe.db.sql("""update `tab{0}` set base_discount_amount=discount_amount,
discount_amount=discount_amount/conversion_rate""".format(dt))

View File

@@ -696,7 +696,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
}, },
adjust_discount_amount_loss: function(tax) { adjust_discount_amount_loss: function(tax) {
var discount_amount_loss = this.frm.doc.grand_total - flt(this.frm.doc.discount_amount) - tax.total; var discount_amount_loss = this.frm.doc.grand_total - flt(this.frm.doc.base_discount_amount) - tax.total;
tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount + tax.tax_amount_after_discount_amount = flt(tax.tax_amount_after_discount_amount +
discount_amount_loss, precision("tax_amount", tax)); discount_amount_loss, precision("tax_amount", tax));
tax.total = flt(tax.total + discount_amount_loss, precision("total", tax)); tax.total = flt(tax.total + discount_amount_loss, precision("total", tax));
@@ -710,8 +710,7 @@ erpnext.TransactionController = erpnext.stock.StockController.extend({
// distribute the tax amount proportionally to each item row // distribute the tax amount proportionally to each item row
var actual = flt(tax.rate, precision("tax_amount", tax)); var actual = flt(tax.rate, precision("tax_amount", tax));
current_tax_amount = this.frm.doc.net_total ? current_tax_amount = this.frm.doc.net_total ?
((item.base_amount / this.frm.doc.net_total) * actual) : ((item.base_amount / this.frm.doc.net_total) * actual) : 0.0;
0.0;
} else if(tax.charge_type == "On Net Total") { } else if(tax.charge_type == "On Net Total") {
current_tax_amount = (tax_rate / 100.0) * item.base_amount; current_tax_amount = (tax_rate / 100.0) * item.base_amount;

View File

@@ -5,6 +5,8 @@
"enquiry_from": "Lead", "enquiry_from": "Lead",
"enquiry_type": "Sales", "enquiry_type": "Sales",
"lead": "_T-Lead-00001", "lead": "_T-Lead-00001",
"transaction_date": "2013-12-12",
"fiscal_year": "_Test Fiscal Year 2013",
"items": [{ "items": [{
"item_name": "Test Item", "item_name": "Test Item",
"description": "Some description" "description": "Some description"

View File

@@ -405,6 +405,15 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"permlevel": 0 "permlevel": 0
}, },
{
"fieldname": "other_charges_total_export",
"fieldtype": "Currency",
"label": "Taxes and Charges Total",
"options": "currency",
"permlevel": 0,
"print_hide": 1,
"read_only": 1
},
{ {
"fieldname": "other_charges_total", "fieldname": "other_charges_total",
"fieldtype": "Currency", "fieldtype": "Currency",
@@ -421,22 +430,23 @@
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0 "permlevel": 0
}, },
{
"fieldname": "other_charges_total_export",
"fieldtype": "Currency",
"label": "Taxes and Charges Total",
"options": "currency",
"permlevel": 0,
"print_hide": 1,
"read_only": 1
},
{ {
"fieldname": "discount_amount", "fieldname": "discount_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Discount Amount", "label": "Discount Amount",
"options": "Company:company:default_currency", "options": "currency",
"permlevel": 0 "permlevel": 0
}, },
{
"fieldname": "base_discount_amount",
"fieldtype": "Currency",
"label": "Discount Amount (Company Currency)",
"options": "Company:company:default_currency",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"read_only": 1
},
{ {
"fieldname": "totals", "fieldname": "totals",
"fieldtype": "Section Break", "fieldtype": "Section Break",
@@ -800,7 +810,7 @@
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"max_attachments": 1, "max_attachments": 1,
"modified": "2015-01-06 17:17:04.598365", "modified": "2015-01-12 16:57:14.706270",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Selling", "module": "Selling",
"name": "Quotation", "name": "Quotation",

View File

@@ -420,11 +420,6 @@
"print_hide": 1, "print_hide": 1,
"read_only": 1 "read_only": 1
}, },
{
"fieldname": "column_break_46",
"fieldtype": "Column Break",
"permlevel": 0
},
{ {
"fieldname": "other_charges_total", "fieldname": "other_charges_total",
"fieldtype": "Currency", "fieldtype": "Currency",
@@ -437,12 +432,28 @@
"read_only": 1, "read_only": 1,
"width": "150px" "width": "150px"
}, },
{
"fieldname": "column_break_46",
"fieldtype": "Column Break",
"permlevel": 0
},
{ {
"fieldname": "discount_amount", "fieldname": "discount_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Discount Amount", "label": "Discount Amount",
"options": "currency",
"permlevel": 0,
"print_hide": 0
},
{
"fieldname": "base_discount_amount",
"fieldtype": "Currency",
"label": "Discount Amount (Company Currency)",
"options": "Company:company:default_currency", "options": "Company:company:default_currency",
"permlevel": 0 "permlevel": 0,
"precision": "",
"print_hide": 1,
"read_only": 1
}, },
{ {
"fieldname": "totals", "fieldname": "totals",
@@ -490,14 +501,6 @@
"read_only": 1, "read_only": 1,
"width": "200px" "width": "200px"
}, },
{
"fieldname": "advance_paid",
"fieldtype": "Currency",
"label": "Advance Paid",
"permlevel": 0,
"print_hide": 1,
"read_only": 1
},
{ {
"fieldname": "column_break3", "fieldname": "column_break3",
"fieldtype": "Column Break", "fieldtype": "Column Break",
@@ -543,6 +546,15 @@
"read_only": 1, "read_only": 1,
"width": "200px" "width": "200px"
}, },
{
"fieldname": "advance_paid",
"fieldtype": "Currency",
"label": "Advance Paid",
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 1,
"read_only": 1
},
{ {
"fieldname": "view_details", "fieldname": "view_details",
"fieldtype": "Fold", "fieldtype": "Fold",
@@ -1022,7 +1034,7 @@
"idx": 1, "idx": 1,
"is_submittable": 1, "is_submittable": 1,
"issingle": 0, "issingle": 0,
"modified": "2015-01-06 17:28:44.639230", "modified": "2015-01-12 15:16:51.611467",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Selling", "module": "Selling",
"name": "Sales Order", "name": "Sales Order",

View File

@@ -358,17 +358,22 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
var distributed_amount = 0.0; var distributed_amount = 0.0;
if (this.frm.doc.discount_amount) { if (this.frm.doc.discount_amount) {
this.frm.set_value("base_discount_amount",
flt(this.frm.doc.discount_amount * this.frm.doc.conversion_rate, precision("base_discount_amount")))
var grand_total_for_discount_amount = this.get_grand_total_for_discount_amount(); var grand_total_for_discount_amount = this.get_grand_total_for_discount_amount();
// calculate item amount after Discount Amount // calculate item amount after Discount Amount
if (grand_total_for_discount_amount) { if (grand_total_for_discount_amount) {
$.each(this.frm.item_doclist, function(i, item) { $.each(this.frm.item_doclist, function(i, item) {
distributed_amount = flt(me.frm.doc.discount_amount) * item.base_amount / grand_total_for_discount_amount; distributed_amount = flt(me.frm.doc.base_discount_amount) * item.base_amount / grand_total_for_discount_amount;
item.base_amount = flt(item.base_amount - distributed_amount, precision("base_amount", item)); item.base_amount = flt(item.base_amount - distributed_amount, precision("base_amount", item));
}); });
this.discount_amount_applied = true; this.discount_amount_applied = true;
this._calculate_taxes_and_totals(); this._calculate_taxes_and_totals();
} }
} else {
this.frm.set_value("base_discount_amount", 0);
} }
}, },
@@ -504,12 +509,12 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
} }
}); });
}; };
setup_field_label_map(["net_total", "other_charges_total", "grand_total", setup_field_label_map(["net_total", "other_charges_total", "base_discount_amount", "grand_total",
"rounded_total", "in_words", "rounded_total", "in_words",
"outstanding_amount", "total_advance", "paid_amount", "write_off_amount"], "outstanding_amount", "total_advance", "paid_amount", "write_off_amount"],
company_currency); company_currency);
setup_field_label_map(["net_total_export", "other_charges_total_export", "grand_total_export", setup_field_label_map(["net_total_export", "other_charges_total_export", "discount_amount", "grand_total_export",
"rounded_total_export", "in_words_export"], this.frm.doc.currency); "rounded_total_export", "in_words_export"], this.frm.doc.currency);
cur_frm.set_df_property("conversion_rate", "description", "1 " + this.frm.doc.currency cur_frm.set_df_property("conversion_rate", "description", "1 " + this.frm.doc.currency
@@ -522,7 +527,7 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
// toggle fields // toggle fields
this.frm.toggle_display(["conversion_rate", "net_total", "other_charges_total", this.frm.toggle_display(["conversion_rate", "net_total", "other_charges_total",
"grand_total", "rounded_total", "in_words"], "grand_total", "rounded_total", "in_words", "base_discount_amount"],
this.frm.doc.currency != company_currency); this.frm.doc.currency != company_currency);
this.frm.toggle_display(["plc_conversion_rate", "price_list_currency"], this.frm.toggle_display(["plc_conversion_rate", "price_list_currency"],

View File

@@ -434,6 +434,15 @@
"fieldtype": "Section Break", "fieldtype": "Section Break",
"permlevel": 0 "permlevel": 0
}, },
{
"fieldname": "other_charges_total_export",
"fieldtype": "Currency",
"label": "Taxes and Charges Total",
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 1,
"read_only": 1
},
{ {
"fieldname": "other_charges_total", "fieldname": "other_charges_total",
"fieldtype": "Currency", "fieldtype": "Currency",
@@ -452,22 +461,23 @@
"fieldtype": "Column Break", "fieldtype": "Column Break",
"permlevel": 0 "permlevel": 0
}, },
{
"fieldname": "other_charges_total_export",
"fieldtype": "Currency",
"label": "Taxes and Charges Total",
"options": "Company:company:default_currency",
"permlevel": 0,
"print_hide": 1,
"read_only": 1
},
{ {
"fieldname": "discount_amount", "fieldname": "discount_amount",
"fieldtype": "Currency", "fieldtype": "Currency",
"label": "Discount Amount", "label": "Discount Amount",
"options": "Company:company:default_currency", "options": "currency",
"permlevel": 0 "permlevel": 0
}, },
{
"fieldname": "base_discount_amount",
"fieldtype": "Currency",
"label": "Discount Amount (Company Currency)",
"options": "Company:company:default_currency",
"permlevel": 0,
"precision": "",
"print_hide": 1,
"read_only": 1
},
{ {
"fieldname": "totals", "fieldname": "totals",
"fieldtype": "Section Break", "fieldtype": "Section Break",
@@ -1014,7 +1024,7 @@
"idx": 1, "idx": 1,
"in_create": 0, "in_create": 0,
"is_submittable": 1, "is_submittable": 1,
"modified": "2015-01-06 17:34:32.623408", "modified": "2015-01-12 16:56:39.975961",
"modified_by": "Administrator", "modified_by": "Administrator",
"module": "Stock", "module": "Stock",
"name": "Delivery Note", "name": "Delivery Note",

View File

@@ -390,7 +390,7 @@ class Item(WebsiteGenerator):
if not frappe.db.exists("Item", newdn): if not frappe.db.exists("Item", newdn):
frappe.throw(_("Item {0} does not exist").format(newdn)) frappe.throw(_("Item {0} does not exist").format(newdn))
field_list = ["stock_uom", "is_stock_item", "has_serial_no", "has_batch_no"] field_list = ["stock_uom", "is_stock_item", "has_serial_no", "has_batch_no", "is_manufactured_item"]
new_properties = [cstr(d) for d in frappe.db.get_value("Item", newdn, field_list)] new_properties = [cstr(d) for d in frappe.db.get_value("Item", newdn, field_list)]
if new_properties != [cstr(self.get(fld)) for fld in field_list]: if new_properties != [cstr(self.get(fld)) for fld in field_list]:
frappe.throw(_("To merge, following properties must be same for both items") frappe.throw(_("To merge, following properties must be same for both items")

View File

@@ -987,6 +987,8 @@ def make_stock_entry(**args):
"incoming_rate": args.incoming_rate, "incoming_rate": args.incoming_rate,
"conversion_factor": 1.0 "conversion_factor": 1.0
}) })
s.posting_date= "2013-01-01"
s.fiscal_year= "_Test Fiscal Year 2013"
s.insert() s.insert()
s.submit() s.submit()
return s return s

View File

@@ -153,8 +153,8 @@ class StockReconciliation(StockController):
if row.valuation_rate in ("", None): if row.valuation_rate in ("", None):
row.valuation_rate = previous_sle.get("valuation_rate") row.valuation_rate = previous_sle.get("valuation_rate")
# if row.qty and not row.valuation_rate: if row.qty and not row.valuation_rate:
# frappe.throw(_("Valuation Rate required for Item {0}").format(row.item_code)) frappe.throw(_("Valuation Rate required for Item {0}").format(row.item_code))
self.insert_entries(row) self.insert_entries(row)

View File

@@ -4,7 +4,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
import frappe import frappe
from frappe import _, throw from frappe import _, throw
from frappe.utils import flt, cint, add_days from frappe.utils import flt, cint, add_days, cstr
import json import json
from erpnext.accounts.doctype.pricing_rule.pricing_rule import get_pricing_rule_for_item from erpnext.accounts.doctype.pricing_rule.pricing_rule import get_pricing_rule_for_item
from erpnext.setup.utils import get_exchange_rate from erpnext.setup.utils import get_exchange_rate
@@ -147,7 +147,7 @@ def get_basic_details(args, item):
out = frappe._dict({ out = frappe._dict({
"item_code": item.name, "item_code": item.name,
"item_name": item.item_name, "item_name": item.item_name,
"description": item.description_html or item.description, "description": cstr(item.description_html).strip() or cstr(item.description).strip(),
"warehouse": user_default_warehouse or args.warehouse or item.default_warehouse, "warehouse": user_default_warehouse or args.warehouse or item.default_warehouse,
"income_account": get_default_income_account(args, item), "income_account": get_default_income_account(args, item),
"expense_account": get_default_expense_account(args, item), "expense_account": get_default_expense_account(args, item),

View File

@@ -242,7 +242,7 @@ def repost_all_stock_vouchers():
doc.validate() doc.validate()
doc.update_stock_ledger() doc.update_stock_ledger()
doc.make_gl_entries(repost_future_gle=False, allow_negative_stock=True) doc.make_gl_entries(repost_future_gle=False)
frappe.db.commit() frappe.db.commit()
except Exception, e: except Exception, e:
print frappe.get_traceback() print frappe.get_traceback()