Fixed conflict

This commit is contained in:
Nabin Hait 2015-01-14 16:27:13 +05:30
commit fff3ab752c
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
- cp -r $TRAVIS_BUILD_DIR/test_sites/test_site ~/frappe-bench/sites/
<<<<<<< HEAD
script:
- cd ~/frappe-bench
- bench get-app erpnext $TRAVIS_BUILD_DIR
@ -23,6 +24,13 @@ script:
- bench frappe --build_website
- bench frappe --serve_test &
- 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:
- 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)
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)
- [Developer Forum](http://groups.google.com/group/erpnext-developer-forum)
- [User Forum](http://groups.google.com/group/erpnext-user-forum)
- [Discussion Forum](https://discuss.frappe.io/)
---
### 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"
1. Administrator user name: "Administrator"
1. Administrator password: "admin"
### Virtual Image
### Download and Install
##### Virtual Image:
You can download a virtual image to run ERPNext in a virtual machine on your local system.
- [ERPNext Download](http://erpnext.com/download)
System and user credentials are listed on the download page.
---
## License

File diff suppressed because it is too large Load Diff

View File

@ -46,17 +46,17 @@ cur_frm.pformat.taxes= function(doc){
var new_val = flt(val)/flt(doc.conversion_rate);
return new_val;
}
function print_hide(fieldname) {
var doc_field = frappe.meta.get_docfield(doc.doctype, fieldname, doc.name);
return doc_field.print_hide;
}
out ='';
if (!doc.print_without_amount) {
var cl = doc.taxes || [];
// outer table
// outer table
var out='<div><table class="noborder" style="width:100%"><tr><td style="width: 60%"></td><td>';
// main table
@ -77,12 +77,12 @@ cur_frm.pformat.taxes= function(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
if(!print_hide('grand_total_export'))
out += make_row('Grand Total', doc.grand_total_export, 1);
if(!print_hide('rounded_total_export'))
out += make_row('Rounded Total', doc.rounded_total_export, 1);
@ -92,7 +92,7 @@ cur_frm.pformat.taxes= function(doc){
out += '<table><tr><td style="width:25%;"><b>In Words</b></td>';
out += '<td style="width:50%;">' + doc.in_words_export + '</td></tr>';
}
out += '</table></td></tr></table></div>';
out += '</table></td></tr></table></div>';
}
return out;
}
@ -139,14 +139,14 @@ cur_frm.fields_dict['taxes'].grid.get_field("account_head").get_query = function
"account_type": ["Tax", "Chargeable", "Income Account"],
"company": doc.company
}
}
}
}
cur_frm.fields_dict['taxes'].grid.get_field("cost_center").get_query = function(doc) {
return{
'company': doc.company,
'group_or_ledger': "Ledger"
}
}
}
cur_frm.cscript.rate = function(doc, cdt, cdn) {

View File

@ -1,15 +1,15 @@
{
"creation": "2012-04-11 13:16:56",
"doc_type": "Journal Entry",
"docstatus": 0,
"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>",
"idx": 1,
"modified": "2014-12-12 16:29:57.723432",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Cheque Printing Format",
"owner": "Administrator",
"print_format_type": "Server",
"creation": "2012-04-11 13:16:56",
"doc_type": "Journal Entry",
"docstatus": 0,
"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-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,
"modified": "2015-01-12 11:03:17.032512",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Cheque Printing Format",
"owner": "Administrator",
"print_format_type": "Server",
"standard": "Yes"
}
}

View File

@ -1,19 +1,19 @@
{
"creation": "2014-08-28 11:11:39.796473",
"disabled": 0,
"doc_type": "Journal Entry",
"docstatus": 0,
"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",
"idx": 2,
"modified": "2014-12-12 16:30:53.890457",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Credit Note",
"owner": "Administrator",
"parent": "Journal Entry",
"parentfield": "__print_formats",
"parenttype": "DocType",
"print_format_type": "Server",
"creation": "2014-08-28 11:11:39.796473",
"disabled": 0,
"doc_type": "Journal Entry",
"docstatus": 0,
"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-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,
"modified": "2015-01-12 11:02:25.716825",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Credit Note",
"owner": "Administrator",
"parent": "Journal Entry",
"parentfield": "__print_formats",
"parenttype": "DocType",
"print_format_type": "Server",
"standard": "Yes"
}
}

View File

@ -1,15 +1,15 @@
{
"creation": "2012-05-01 12:46:31",
"doc_type": "Journal Entry",
"docstatus": 0,
"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",
"idx": 1,
"modified": "2014-12-12 16:31:33.869069",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Receipt Voucher",
"owner": "Administrator",
"print_format_type": "Server",
"creation": "2012-05-01 12:46:31",
"doc_type": "Journal Entry",
"docstatus": 0,
"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-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,
"modified": "2015-01-12 11:03:22.893209",
"modified_by": "Administrator",
"module": "Accounts",
"name": "Payment Receipt Voucher",
"owner": "Administrator",
"print_format_type": "Server",
"standard": "Yes"
}
}

View File

@ -23,12 +23,12 @@ def get_fiscal_years(transaction_date=None, fiscal_year=None, label="Date", verb
cond = "fy.name = %(fiscal_year)s"
else:
cond = "%(transaction_date)s >= fy.year_start_date and %(transaction_date)s <= fy.year_end_date"
if company:
cond += """ and (not exists(select name from `tabFiscal Year Company` fyc where fyc.parent = fy.name)
or exists(select company from `tabFiscal Year Company` fyc where fyc.parent = fy.name and fyc.company=%(company)s ))"""
fy = frappe.db.sql("""select fy.name, fy.year_start_date, fy.year_end_date from `tabFiscal Year` fy
fy = frappe.db.sql("""select fy.name, fy.year_start_date, fy.year_end_date from `tabFiscal Year` fy
where %s order by fy.year_start_date desc""" % cond, {
"fiscal_year": fiscal_year,
"transaction_date": transaction_date,
@ -36,7 +36,7 @@ def get_fiscal_years(transaction_date=None, fiscal_year=None, label="Date", verb
})
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)
raise FiscalYearError, error_msg
return fy

View File

@ -208,7 +208,8 @@ erpnext.buying.BuyingController = erpnext.TransactionController.extend({
var tax_count = this.frm.tax_doclist.length;
this.frm.doc.grand_total = flt(tax_count ?
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,
precision("total_tax"));

View File

@ -291,7 +291,7 @@ class AccountsController(TransactionBase):
self.precision("tax_amount", 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 +
discount_amount_loss, self.precision("tax_amount", 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)
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):
from erpnext.accounts.utils import get_company_default

View File

@ -115,7 +115,8 @@ class BuyingController(StockController):
def calculate_totals(self):
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"))

View File

@ -232,16 +232,20 @@ class SellingController(StockController):
def apply_discount_amount(self):
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()
if grand_total_for_discount_amount:
# calculate item amount after Discount Amount
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))
self.discount_amount_applied = True
self._calculate_taxes_and_totals()
else:
self.base_discount_amount = 0
def get_grand_total_for_discount_amount(self):
actual_taxes_dict = {}

View File

@ -167,7 +167,7 @@ class StockController(AccountsController):
else:
is_expense_account = frappe.db.get_value("Account",
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")
.format(item.get("expense_account")))
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 e in existing_gle:
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):
matched = False
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.toggle_enable("status", true);
} 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);
}
}

View File

@ -8,6 +8,8 @@ from frappe.utils import cint, cstr, flt
from frappe import _
from frappe.model.document import Document
from operator import itemgetter
class BOM(Document):
def autoname(self):
@ -335,7 +337,7 @@ class BOM(Document):
"Add items to Flat BOM table"
frappe.db.sql("""delete from `tabBOM Explosion Item` where parent=%s""", self.name)
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', {})
for i in self.cur_exploded_items[d].keys():
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
class TestProductionOrder(unittest.TestCase):
def test_planned_qty(self):
def check_planned_qty(self):
set_perpetual_inventory(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))
for d in s.get("items"):
d.s_warehouse = "Stores - _TC"
s.fiscal_year = "_Test Fiscal Year 2013"
s.posting_date = "2013-01-02"
s.insert()
s.submit()
# from wip to fg
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.submit()
@ -47,7 +51,7 @@ class TestProductionOrder(unittest.TestCase):
def test_over_production(self):
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",
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)
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()
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) {
return $c_obj(doc, 'validate_data', '', function(r, rt) {
if (!r['exc'])

View File

@ -1,180 +1,180 @@
{
"creation": "2013-01-21 12:03:47",
"default_print_format": "Standard",
"docstatus": 0,
"doctype": "DocType",
"creation": "2013-01-21 12:03:47",
"default_print_format": "Standard",
"docstatus": 0,
"doctype": "DocType",
"fields": [
{
"description": "Select Sales Orders from which you want to create Production Orders.",
"fieldname": "select_sales_orders",
"fieldtype": "Section Break",
"label": "Select Sales Orders",
"description": "Select Sales Orders from which you want to create Production Orders.",
"fieldname": "select_sales_orders",
"fieldtype": "Section Break",
"label": "Select Sales Orders",
"permlevel": 0
},
},
{
"fieldname": "column_break0",
"fieldtype": "Column Break",
"permlevel": 0,
"fieldname": "column_break0",
"fieldtype": "Column Break",
"permlevel": 0,
"width": "50%"
},
},
{
"fieldname": "fg_item",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Filter based on item",
"options": "Item",
"fieldname": "fg_item",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Filter based on item",
"options": "Item",
"permlevel": 0
},
},
{
"fieldname": "customer",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Filter based on customer",
"options": "Customer",
"fieldname": "customer",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Filter based on customer",
"options": "Customer",
"permlevel": 0
},
},
{
"fieldname": "company",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Company",
"options": "Company",
"permlevel": 0,
"fieldname": "company",
"fieldtype": "Link",
"in_list_view": 1,
"label": "Company",
"options": "Company",
"permlevel": 0,
"reqd": 1
},
},
{
"fieldname": "column_break1",
"fieldtype": "Column Break",
"permlevel": 0,
"fieldname": "column_break1",
"fieldtype": "Column Break",
"permlevel": 0,
"width": "50%"
},
},
{
"fieldname": "from_date",
"fieldtype": "Date",
"label": "From Date",
"fieldname": "from_date",
"fieldtype": "Date",
"label": "From Date",
"permlevel": 0
},
},
{
"fieldname": "to_date",
"fieldtype": "Date",
"label": "To Date",
"fieldname": "to_date",
"fieldtype": "Date",
"label": "To Date",
"permlevel": 0
},
},
{
"fieldname": "section_break1",
"fieldtype": "Section Break",
"options": "Simple",
"fieldname": "section_break1",
"fieldtype": "Section Break",
"options": "Simple",
"permlevel": 0
},
},
{
"description": "Pull sales orders (pending to deliver) based on the above criteria",
"fieldname": "get_sales_orders",
"fieldtype": "Button",
"label": "Get Sales Orders",
"options": "get_open_sales_orders",
"description": "Pull sales orders (pending to deliver) based on the above criteria",
"fieldname": "get_sales_orders",
"fieldtype": "Button",
"label": "Get Sales Orders",
"options": "get_open_sales_orders",
"permlevel": 0
},
},
{
"fieldname": "sales_orders",
"fieldtype": "Table",
"label": "Sales Orders",
"options": "Production Plan Sales Order",
"fieldname": "sales_orders",
"fieldtype": "Table",
"label": "Sales Orders",
"options": "Production Plan Sales Order",
"permlevel": 0
},
},
{
"fieldname": "items_for_production",
"fieldtype": "Section Break",
"label": "Select Items",
"fieldname": "items_for_production",
"fieldtype": "Section Break",
"label": "Select Items",
"permlevel": 0
},
},
{
"fieldname": "get_items_from_so",
"fieldtype": "Button",
"label": "Get Items From Sales Orders",
"options": "get_items_from_so",
"fieldname": "get_items_from_so",
"fieldtype": "Button",
"label": "Get Items From Sales Orders",
"options": "get_items_from_so",
"permlevel": 0
},
},
{
"default": "1",
"description": "If checked, BOM for sub-assembly items will be considered for getting raw materials. Otherwise, all sub-assembly items will be treated as a raw material.",
"fieldname": "use_multi_level_bom",
"fieldtype": "Check",
"label": "Use Multi-Level BOM",
"permlevel": 0,
"default": "1",
"description": "If checked, BOM for sub-assembly items will be considered for getting raw materials. Otherwise, all sub-assembly items will be treated as a raw material.",
"fieldname": "use_multi_level_bom",
"fieldtype": "Check",
"label": "Use Multi-Level BOM",
"permlevel": 0,
"reqd": 0
},
},
{
"fieldname": "items",
"fieldtype": "Table",
"label": "Items",
"options": "Production Plan Item",
"fieldname": "items",
"fieldtype": "Table",
"label": "Items",
"options": "Production Plan Item",
"permlevel": 0
},
},
{
"description": "Enter items and planned qty for which you want to raise production orders or download raw materials for analysis.",
"fieldname": "create_production_orders",
"fieldtype": "Section Break",
"label": "Production Orders",
"description": "Enter items and planned qty for which you want to raise production orders or download raw materials for analysis.",
"fieldname": "create_production_orders",
"fieldtype": "Section Break",
"label": "Production Orders",
"permlevel": 0
},
},
{
"description": "Separate production order will be created for each finished good item.",
"fieldname": "raise_production_order",
"fieldtype": "Button",
"label": "Create Production Orders",
"options": "raise_production_order",
"description": "Separate production order will be created for each finished good item.",
"fieldname": "raise_production_order",
"fieldtype": "Button",
"label": "Create Production Orders",
"options": "raise_production_order",
"permlevel": 0
},
},
{
"fieldname": "sb5",
"fieldtype": "Section Break",
"label": "Material Requirement",
"fieldname": "sb5",
"fieldtype": "Section Break",
"label": "Material Requirement",
"permlevel": 0
},
},
{
"fieldname": "purchase_request_for_warehouse",
"fieldtype": "Link",
"label": "Material Request For Warehouse",
"options": "Warehouse",
"fieldname": "purchase_request_for_warehouse",
"fieldtype": "Link",
"label": "Material Request For Warehouse",
"options": "Warehouse",
"permlevel": 0
},
},
{
"description": "Items to be requested which are \"Out of Stock\" considering all warehouses based on projected qty and minimum order qty",
"fieldname": "raise_purchase_request",
"fieldtype": "Button",
"label": "Create Material Requests",
"options": "raise_purchase_request",
"description": "Items to be requested which are \"Out of Stock\" considering all warehouses based on projected qty and minimum order qty",
"fieldname": "raise_purchase_request",
"fieldtype": "Button",
"label": "Create Material Requests",
"options": "",
"permlevel": 0
},
},
{
"description": "Download a report containing all raw materials with their latest inventory status",
"fieldname": "download_materials_required",
"fieldtype": "Button",
"label": "Download Materials Required",
"description": "Download a report containing all raw materials with their latest inventory status",
"fieldname": "download_materials_required",
"fieldtype": "Button",
"label": "Download Materials Required",
"permlevel": 0
}
],
"icon": "icon-calendar",
"idx": 1,
"in_create": 1,
"issingle": 1,
"modified": "2014-12-24 16:36:06.267344",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Planning Tool",
"owner": "jai@webnotestech.com",
],
"icon": "icon-calendar",
"idx": 1,
"in_create": 1,
"issingle": 1,
"modified": "2015-01-11 21:53:21.253556",
"modified_by": "Administrator",
"module": "Manufacturing",
"name": "Production Planning Tool",
"owner": "jai@webnotestech.com",
"permissions": [
{
"create": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 0,
"role": "Manufacturing User",
"submit": 0,
"create": 1,
"email": 1,
"permlevel": 0,
"print": 1,
"read": 1,
"report": 0,
"role": "Manufacturing User",
"submit": 0,
"write": 1
}
],
],
"read_only": 1
}
}

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_4.make_email_accounts
execute:frappe.delete_doc("DocType", "Contact Control")
erpnext.patches.v4_2.discount_amount
erpnext.patches.v4_2.reset_bom_costs
erpnext.patches.v5_0.update_frozen_accounts_permission_role
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) {
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 +
discount_amount_loss, precision("tax_amount", 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
var actual = flt(tax.rate, precision("tax_amount", tax));
current_tax_amount = this.frm.doc.net_total ?
((item.base_amount / this.frm.doc.net_total) * actual) :
0.0;
((item.base_amount / this.frm.doc.net_total) * actual) : 0.0;
} else if(tax.charge_type == "On Net Total") {
current_tax_amount = (tax_rate / 100.0) * item.base_amount;

View File

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

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -358,17 +358,22 @@ erpnext.selling.SellingController = erpnext.TransactionController.extend({
var distributed_amount = 0.0;
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();
// calculate item amount after Discount Amount
if (grand_total_for_discount_amount) {
$.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));
});
this.discount_amount_applied = true;
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",
"outstanding_amount", "total_advance", "paid_amount", "write_off_amount"],
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);
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
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.toggle_display(["plc_conversion_rate", "price_list_currency"],

File diff suppressed because it is too large Load Diff

View File

@ -390,7 +390,7 @@ class Item(WebsiteGenerator):
if not frappe.db.exists("Item", 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)]
if new_properties != [cstr(self.get(fld)) for fld in field_list]:
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,
"conversion_factor": 1.0
})
s.posting_date= "2013-01-01"
s.fiscal_year= "_Test Fiscal Year 2013"
s.insert()
s.submit()
return s

View File

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

View File

@ -4,7 +4,7 @@
from __future__ import unicode_literals
import frappe
from frappe import _, throw
from frappe.utils import flt, cint, add_days
from frappe.utils import flt, cint, add_days, cstr
import json
from erpnext.accounts.doctype.pricing_rule.pricing_rule import get_pricing_rule_for_item
from erpnext.setup.utils import get_exchange_rate
@ -147,7 +147,7 @@ def get_basic_details(args, item):
out = frappe._dict({
"item_code": 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,
"income_account": get_default_income_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.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()
except Exception, e:
print frappe.get_traceback()