mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-18 12:39:18 +00:00
Merge branch 'master' of github.com:webnotes/erpnext
This commit is contained in:
@@ -1,189 +1,169 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"creation": "2013-02-22 01:28:05",
|
||||
"docstatus": 0,
|
||||
"creation": "2010-08-08 17:09:35",
|
||||
"modified": "2013-03-26 07:58:20",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-02 14:03:39"
|
||||
"owner": "Administrator"
|
||||
},
|
||||
{
|
||||
"doctype": "Table Mapper Detail",
|
||||
"name": "__common__",
|
||||
"parent": "Purchase Order-Purchase Receipt",
|
||||
"doctype": "Table Mapper Detail",
|
||||
"parenttype": "DocType Mapper",
|
||||
"parentfield": "table_mapper_details"
|
||||
"parentfield": "table_mapper_details",
|
||||
"parenttype": "DocType Mapper"
|
||||
},
|
||||
{
|
||||
"doctype": "Field Mapper Detail",
|
||||
"map": "Yes",
|
||||
"name": "__common__",
|
||||
"parent": "Purchase Order-Purchase Receipt",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"parenttype": "DocType Mapper",
|
||||
"parentfield": "field_mapper_details"
|
||||
"parentfield": "field_mapper_details",
|
||||
"parenttype": "DocType Mapper"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"to_doctype": "Purchase Receipt",
|
||||
"module": "Stock",
|
||||
"doctype": "DocType Mapper",
|
||||
"from_doctype": "Purchase Order",
|
||||
"module": "Stock",
|
||||
"name": "__common__",
|
||||
"ref_doc_submitted": 1,
|
||||
"from_doctype": "Purchase Order"
|
||||
"to_doctype": "Purchase Receipt"
|
||||
},
|
||||
{
|
||||
"name": "Purchase Order-Purchase Receipt",
|
||||
"doctype": "DocType Mapper"
|
||||
"doctype": "DocType Mapper",
|
||||
"name": "Purchase Order-Purchase Receipt"
|
||||
},
|
||||
{
|
||||
"match_id": 0,
|
||||
"to_field": "supplier",
|
||||
"checking_operator": "=",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "supplier",
|
||||
"checking_operator": "="
|
||||
"match_id": 0,
|
||||
"to_field": "supplier"
|
||||
},
|
||||
{
|
||||
"match_id": 0,
|
||||
"to_field": "company",
|
||||
"checking_operator": "=",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "company",
|
||||
"checking_operator": "="
|
||||
"match_id": 0,
|
||||
"to_field": "company"
|
||||
},
|
||||
{
|
||||
"match_id": 0,
|
||||
"to_field": "currency",
|
||||
"checking_operator": "=",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "currency",
|
||||
"checking_operator": "="
|
||||
"match_id": 0,
|
||||
"to_field": "currency"
|
||||
},
|
||||
{
|
||||
"to_field": "prevdoc_detail_docname",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "name",
|
||||
"match_id": 1,
|
||||
"from_field": "name"
|
||||
"to_field": "prevdoc_detail_docname"
|
||||
},
|
||||
{
|
||||
"to_field": "prevdoc_docname",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "parent",
|
||||
"match_id": 1,
|
||||
"from_field": "parent"
|
||||
"to_field": "prevdoc_docname"
|
||||
},
|
||||
{
|
||||
"to_field": "prevdoc_doctype",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "parenttype",
|
||||
"match_id": 1,
|
||||
"from_field": "parenttype"
|
||||
"to_field": "prevdoc_doctype"
|
||||
},
|
||||
{
|
||||
"match_id": 1,
|
||||
"to_field": "item_code",
|
||||
"checking_operator": "=",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "item_code",
|
||||
"checking_operator": "="
|
||||
},
|
||||
{
|
||||
"to_field": "received_qty",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"match_id": 1,
|
||||
"from_field": "eval:(flt(obj.qty) - flt(obj.received_qty)) "
|
||||
"to_field": "item_code"
|
||||
},
|
||||
{
|
||||
"to_field": "qty",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "eval:(flt(obj.qty) - flt(obj.received_qty)) ",
|
||||
"match_id": 1,
|
||||
"from_field": "eval:(flt(obj.qty) - flt(obj.received_qty)) "
|
||||
"to_field": "received_qty"
|
||||
},
|
||||
{
|
||||
"to_field": "stock_qty",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "eval:(flt(obj.qty) - flt(obj.received_qty)) ",
|
||||
"match_id": 1,
|
||||
"from_field": "eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.conversion_factor)"
|
||||
"to_field": "qty"
|
||||
},
|
||||
{
|
||||
"to_field": "import_amount",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.conversion_factor)",
|
||||
"match_id": 1,
|
||||
"from_field": "eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.import_rate)"
|
||||
"to_field": "stock_qty"
|
||||
},
|
||||
{
|
||||
"to_field": "amount",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.import_rate)",
|
||||
"match_id": 1,
|
||||
"from_field": "eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.purchase_rate)"
|
||||
"to_field": "import_amount"
|
||||
},
|
||||
{
|
||||
"to_field": "schedule_date",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "eval:(flt(obj.qty) - flt(obj.received_qty)) * flt(obj.purchase_rate)",
|
||||
"match_id": 1,
|
||||
"from_field": "schedule_date"
|
||||
"to_field": "amount"
|
||||
},
|
||||
{
|
||||
"to_field": "net_total",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "schedule_date",
|
||||
"match_id": 1,
|
||||
"to_field": "schedule_date"
|
||||
},
|
||||
{
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "net_total",
|
||||
"match_id": 0,
|
||||
"from_field": "net_total"
|
||||
"to_field": "net_total"
|
||||
},
|
||||
{
|
||||
"to_field": "grand_total",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "grand_total",
|
||||
"match_id": 0,
|
||||
"from_field": "grand_total"
|
||||
"to_field": "grand_total"
|
||||
},
|
||||
{
|
||||
"to_field": "total_tax",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "total_tax",
|
||||
"match_id": 0,
|
||||
"from_field": "total_tax"
|
||||
"to_field": "total_tax"
|
||||
},
|
||||
{
|
||||
"to_field": "conversion_rate",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "conversion_rate",
|
||||
"match_id": 0,
|
||||
"from_field": "conversion_rate"
|
||||
"to_field": "conversion_rate"
|
||||
},
|
||||
{
|
||||
"reference_key": "prevdoc_detail_docname",
|
||||
"match_id": 1,
|
||||
"reference_doctype_key": "prevdoc_doctype",
|
||||
"to_field": "purchase_receipt_details",
|
||||
"doctype": "Table Mapper Detail",
|
||||
"from_field": "po_details",
|
||||
"from_table": "Purchase Order Item",
|
||||
"match_id": 1,
|
||||
"reference_doctype_key": "prevdoc_doctype",
|
||||
"reference_key": "prevdoc_detail_docname",
|
||||
"to_field": "purchase_receipt_details",
|
||||
"to_table": "Purchase Receipt Item",
|
||||
"validation_logic": "docstatus=1 and qty > ifnull(received_qty,0)"
|
||||
},
|
||||
{
|
||||
"reference_key": "prevdoc_detail_docname",
|
||||
"match_id": 1,
|
||||
"reference_doctype_key": "prevdoc_doctype",
|
||||
"to_field": "purchase_receipt_details",
|
||||
"doctype": "Table Mapper Detail",
|
||||
"from_field": "po_details",
|
||||
"from_table": "Purchase Order Item",
|
||||
"to_table": "Purchase Receipt Item",
|
||||
"validation_logic": "docstatus=1 and qty > ifnull(received_qty,0)"
|
||||
},
|
||||
{
|
||||
"reference_key": "prevdoc_docname",
|
||||
"match_id": 0,
|
||||
"doctype": "Table Mapper Detail",
|
||||
"from_table": "Purchase Order",
|
||||
"match_id": 0,
|
||||
"reference_key": "prevdoc_docname",
|
||||
"to_table": "Purchase Receipt",
|
||||
"validation_logic": "docstatus = 1"
|
||||
},
|
||||
{
|
||||
"match_id": 2,
|
||||
"to_field": "purchase_tax_details",
|
||||
"doctype": "Table Mapper Detail",
|
||||
"from_field": "purchase_tax_details",
|
||||
"from_table": "Purchase Taxes and Charges",
|
||||
"to_table": "Purchase Taxes and Charges",
|
||||
"validation_logic": "docstatus = 1"
|
||||
},
|
||||
{
|
||||
"match_id": 2,
|
||||
"to_field": "purchase_tax_details",
|
||||
"doctype": "Table Mapper Detail",
|
||||
"from_field": "purchase_tax_details",
|
||||
"from_table": "Purchase Taxes and Charges",
|
||||
"to_table": "Purchase Taxes and Charges",
|
||||
"validation_logic": "docstatus = 1"
|
||||
}
|
||||
|
||||
@@ -323,7 +323,7 @@ cur_frm.fields_dict['delivery_note_details'].grid.get_field('expense_account').g
|
||||
}
|
||||
|
||||
// cost center
|
||||
cur_frm.fields_dict["delivery_note_details"].grid.get_field("cost_center").get_query = function(doc) {
|
||||
cur_frm.fields_dict.delivery_note_details.grid.get_field("cost_center").get_query = function(doc) {
|
||||
return {
|
||||
query: "accounts.utils.get_cost_center_list",
|
||||
filters: { company_name: doc.company}
|
||||
|
||||
@@ -85,8 +85,11 @@ class DocType(SellingController):
|
||||
obj = get_obj('Sales Common')
|
||||
for doc in self.doclist:
|
||||
if doc.fields.get('item_code'):
|
||||
arg = {'item_code':doc.fields.get('item_code'), 'income_account':doc.fields.get('income_account'),
|
||||
'cost_center': doc.fields.get('cost_center'), 'warehouse': doc.fields.get('warehouse')};
|
||||
arg = {
|
||||
'item_code':doc.fields.get('item_code'),
|
||||
'expense_account':doc.fields.get('expense_account'),
|
||||
'cost_center': doc.fields.get('cost_center'),
|
||||
'warehouse': doc.fields.get('warehouse')};
|
||||
ret = obj.get_item_defaults(arg)
|
||||
for r in ret:
|
||||
if not doc.fields.get(r):
|
||||
@@ -374,7 +377,6 @@ class DocType(SellingController):
|
||||
self.values.append({
|
||||
'item_code' : d['item_code'],
|
||||
'warehouse' : wh,
|
||||
'transaction_date' : getdate(self.doc.modified).strftime('%Y-%m-%d'),
|
||||
'posting_date' : self.doc.posting_date,
|
||||
'posting_time' : self.doc.posting_time,
|
||||
'voucher_type' : 'Delivery Note',
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-03-07 11:42:59",
|
||||
"creation": "2013-03-25 11:55:16",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-21 18:36:22",
|
||||
"modified": "2013-03-25 15:43:04",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -253,6 +253,7 @@
|
||||
"no_copy": 1,
|
||||
"options": "Account",
|
||||
"print_hide": 1,
|
||||
"read_only": 0,
|
||||
"width": "120px"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -321,7 +321,7 @@ class DocType(BuyingController):
|
||||
|
||||
from accounts.general_ledger import make_gl_entries
|
||||
|
||||
against_stock_account = self.get_default_account("stock_received_but_not_billed")
|
||||
against_stock_account = self.get_company_default("stock_received_but_not_billed")
|
||||
total_valuation_amount = self.get_total_valuation_amount()
|
||||
gl_entries = self.get_gl_entries_for_stock(against_stock_account, total_valuation_amount)
|
||||
|
||||
|
||||
@@ -27,15 +27,15 @@ erpnext.stock.StockEntry = erpnext.stock.StockController.extend({
|
||||
|
||||
if (sys_defaults.auto_inventory_accounting && !this.frm.doc.expense_adjustment_account) {
|
||||
if (this.frm.doc.purpose == "Sales Return")
|
||||
account_for = "stock_delivered_but_not_billed";
|
||||
account_for = "stock_in_hand_account";
|
||||
else if (this.frm.doc.purpose == "Purchase Return")
|
||||
account_for = "stock_received_but_not_billed";
|
||||
else account_for = "stock_adjustment_account";
|
||||
|
||||
this.frm.call({
|
||||
method: "controllers.accounts_controller.get_default_account",
|
||||
method: "accounts.utils.get_company_default",
|
||||
args: {
|
||||
"account_for": account_for,
|
||||
"fieldname": account_for,
|
||||
"company": this.frm.doc.company
|
||||
},
|
||||
callback: function(r) {
|
||||
|
||||
@@ -55,6 +55,7 @@ class DocType(StockController):
|
||||
self.validate_finished_goods()
|
||||
self.validate_return_reference_doc()
|
||||
self.validate_with_material_request()
|
||||
self.validate_fiscal_year()
|
||||
|
||||
def on_submit(self):
|
||||
self.update_serial_no(1)
|
||||
@@ -68,6 +69,11 @@ class DocType(StockController):
|
||||
self.update_production_order(0)
|
||||
self.make_gl_entries()
|
||||
|
||||
def validate_fiscal_year(self):
|
||||
import accounts.utils
|
||||
accounts.utils.validate_fiscal_year(self.doc.posting_date, self.doc.fiscal_year,
|
||||
self.meta.get_label("posting_date"))
|
||||
|
||||
def validate_purpose(self):
|
||||
valid_purposes = ["Material Issue", "Material Receipt", "Material Transfer",
|
||||
"Manufacture/Repack", "Subcontract", "Sales Return", "Purchase Return"]
|
||||
@@ -176,11 +182,10 @@ class DocType(StockController):
|
||||
|
||||
from accounts.general_ledger import make_gl_entries
|
||||
|
||||
cost_center = "Auto Inventory Accounting - %s" % (self.company_abbr,)
|
||||
total_valuation_amount = self.get_total_valuation_amount()
|
||||
|
||||
gl_entries = self.get_gl_entries_for_stock(self.doc.expense_adjustment_account,
|
||||
total_valuation_amount, cost_center=cost_center)
|
||||
total_valuation_amount)
|
||||
if gl_entries:
|
||||
make_gl_entries(gl_entries, cancel=self.doc.docstatus == 2)
|
||||
|
||||
@@ -777,8 +782,6 @@ def make_return_jv(stock_entry):
|
||||
|
||||
from accounts.utils import get_balance_on
|
||||
for r in result:
|
||||
if not r.get("account"):
|
||||
print result
|
||||
jv_list.append({
|
||||
"__islocal": 1,
|
||||
"doctype": "Journal Voucher Detail",
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[
|
||||
{
|
||||
"creation": "2013-03-11 12:34:40",
|
||||
"creation": "2013-03-26 06:51:17",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-03-19 17:48:29",
|
||||
"modified": "2013-03-26 07:24:53",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -542,6 +542,16 @@
|
||||
"reqd": 0,
|
||||
"search_index": 0
|
||||
},
|
||||
{
|
||||
"doctype": "DocField",
|
||||
"fieldname": "fiscal_year",
|
||||
"fieldtype": "Select",
|
||||
"in_filter": 0,
|
||||
"label": "Fiscal Year",
|
||||
"options": "link:Fiscal Year",
|
||||
"print_hide": 1,
|
||||
"reqd": 1
|
||||
},
|
||||
{
|
||||
"allow_on_submit": 0,
|
||||
"doctype": "DocField",
|
||||
@@ -610,13 +620,5 @@
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"role": "Manufacturing User"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"role": "Manufacturing Manager"
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"role": "Material Manager"
|
||||
}
|
||||
]
|
||||
@@ -490,7 +490,7 @@ class TestStockEntry(unittest.TestCase):
|
||||
def test_make_return_jv_for_purchase_receipt(self):
|
||||
se, pr_name = self.test_purchase_receipt_return()
|
||||
self._test_purchase_return_jv(se)
|
||||
|
||||
|
||||
se, pr_name = self._test_purchase_return_return_against_purchase_order()
|
||||
self._test_purchase_return_jv(se)
|
||||
|
||||
|
||||
@@ -27,9 +27,9 @@ erpnext.stock.StockReconciliation = erpnext.stock.StockController.extend({
|
||||
|
||||
if (sys_defaults.auto_inventory_accounting && !this.frm.doc.expense_account) {
|
||||
this.frm.call({
|
||||
method: "controllers.accounts_controller.get_default_account",
|
||||
method: "accounts.utils.get_company_default",
|
||||
args: {
|
||||
"account_for": "stock_adjustment_account",
|
||||
"fieldname": "stock_adjustment_account",
|
||||
"company": this.frm.doc.company
|
||||
},
|
||||
callback: function(r) {
|
||||
|
||||
@@ -310,11 +310,9 @@ class DocType(StockController):
|
||||
msgprint(_("Please enter Expense Account"), raise_exception=1)
|
||||
|
||||
from accounts.general_ledger import make_gl_entries
|
||||
|
||||
cost_center = "Auto Inventory Accounting - %s" % (self.company_abbr,)
|
||||
|
||||
|
||||
gl_entries = self.get_gl_entries_for_stock(self.doc.expense_account,
|
||||
self.doc.stock_value_difference, cost_center=cost_center)
|
||||
self.doc.stock_value_difference)
|
||||
if gl_entries:
|
||||
make_gl_entries(gl_entries, cancel=self.doc.docstatus == 2)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user