mirror of
https://github.com/frappe/erpnext.git
synced 2026-05-24 23:49:19 +00:00
[mapper] purchase cycle
This commit is contained in:
@@ -1,147 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-03 12:49:42",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-03 12:49:43"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"parent": "Delivery Note-Sales Invoice",
|
||||
"doctype": "Table Mapper Detail",
|
||||
"parenttype": "DocType Mapper",
|
||||
"parentfield": "table_mapper_details"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"parent": "Delivery Note-Sales Invoice",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"parenttype": "DocType Mapper",
|
||||
"parentfield": "field_mapper_details"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"to_doctype": "Sales Invoice",
|
||||
"module": "Accounts",
|
||||
"doctype": "DocType Mapper",
|
||||
"ref_doc_submitted": 1,
|
||||
"from_doctype": "Delivery Note"
|
||||
},
|
||||
{
|
||||
"name": "Delivery Note-Sales Invoice",
|
||||
"doctype": "DocType Mapper"
|
||||
},
|
||||
{
|
||||
"map": "Yes",
|
||||
"match_id": 1,
|
||||
"to_field": "qty",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "eval: obj.basic_rate and (flt(obj.amount) - flt(obj.billed_amt)) / flt(obj.basic_rate) or obj.qty"
|
||||
},
|
||||
{
|
||||
"map": "Yes",
|
||||
"match_id": 1,
|
||||
"to_field": "delivery_note",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "parent"
|
||||
},
|
||||
{
|
||||
"map": "Yes",
|
||||
"match_id": 1,
|
||||
"to_field": "dn_detail",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "name"
|
||||
},
|
||||
{
|
||||
"map": "Yes",
|
||||
"match_id": 1,
|
||||
"to_field": "sales_order",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "prevdoc_docname"
|
||||
},
|
||||
{
|
||||
"map": "Yes",
|
||||
"match_id": 1,
|
||||
"to_field": "so_detail",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "prevdoc_detail_docname"
|
||||
},
|
||||
{
|
||||
"map": "Yes",
|
||||
"match_id": 1,
|
||||
"to_field": "amount",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "eval: flt(obj.amount) - flt(obj.billed_amt)"
|
||||
},
|
||||
{
|
||||
"map": "Yes",
|
||||
"match_id": 1,
|
||||
"to_field": "export_amount",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "eval: (flt(obj.amount) - flt(obj.billed_amt)) * flt(obj.export_rate)/flt(obj.basic_rate)"
|
||||
},
|
||||
{
|
||||
"map": "No",
|
||||
"match_id": 0,
|
||||
"to_field": "naming_series",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "naming_series"
|
||||
},
|
||||
{
|
||||
"map": "No",
|
||||
"match_id": 3,
|
||||
"to_field": "incentives",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "incentives"
|
||||
},
|
||||
{
|
||||
"map": "Yes",
|
||||
"match_id": 1,
|
||||
"to_field": "serial_no",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "serial_no"
|
||||
},
|
||||
{
|
||||
"map": "Yes",
|
||||
"match_id": 1,
|
||||
"to_field": "export_rate",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "export_rate",
|
||||
"checking_operator": "="
|
||||
},
|
||||
{
|
||||
"match_id": 0,
|
||||
"doctype": "Table Mapper Detail",
|
||||
"from_table": "Delivery Note",
|
||||
"to_table": "Sales Invoice",
|
||||
"validation_logic": "docstatus=1"
|
||||
},
|
||||
{
|
||||
"match_id": 1,
|
||||
"to_field": "entries",
|
||||
"doctype": "Table Mapper Detail",
|
||||
"from_field": "delivery_note_details",
|
||||
"from_table": "Delivery Note Item",
|
||||
"to_table": "Sales Invoice Item",
|
||||
"validation_logic": "(ifnull(amount, 0) = 0 or amount > ifnull(billed_amt, 0)) and docstatus = 1"
|
||||
},
|
||||
{
|
||||
"match_id": 2,
|
||||
"to_field": "other_charges",
|
||||
"doctype": "Table Mapper Detail",
|
||||
"from_field": "other_charges",
|
||||
"from_table": "Sales Taxes and Charges",
|
||||
"to_table": "Sales Taxes and Charges",
|
||||
"validation_logic": "name is not null"
|
||||
},
|
||||
{
|
||||
"match_id": 3,
|
||||
"to_field": "sales_team",
|
||||
"doctype": "Table Mapper Detail",
|
||||
"from_field": "sales_team",
|
||||
"from_table": "Sales Team",
|
||||
"to_table": "Sales Team",
|
||||
"validation_logic": "name is not null"
|
||||
}
|
||||
]
|
||||
@@ -1,149 +0,0 @@
|
||||
[
|
||||
{
|
||||
"owner": "Administrator",
|
||||
"docstatus": 0,
|
||||
"creation": "2012-04-03 12:49:42",
|
||||
"modified_by": "Administrator",
|
||||
"modified": "2012-04-03 12:49:42"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"parent": "Sales Order-Sales Invoice",
|
||||
"doctype": "Table Mapper Detail",
|
||||
"parenttype": "DocType Mapper",
|
||||
"parentfield": "table_mapper_details"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"parent": "Sales Order-Sales Invoice",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"parenttype": "DocType Mapper",
|
||||
"parentfield": "field_mapper_details"
|
||||
},
|
||||
{
|
||||
"name": "__common__",
|
||||
"to_doctype": "Sales Invoice",
|
||||
"module": "Accounts",
|
||||
"doctype": "DocType Mapper",
|
||||
"ref_doc_submitted": 1,
|
||||
"from_doctype": "Sales Order"
|
||||
},
|
||||
{
|
||||
"name": "Sales Order-Sales Invoice",
|
||||
"doctype": "DocType Mapper"
|
||||
},
|
||||
{
|
||||
"map": "Yes",
|
||||
"match_id": 0,
|
||||
"to_field": "customer",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "customer",
|
||||
"checking_operator": "="
|
||||
},
|
||||
{
|
||||
"map": "Yes",
|
||||
"match_id": 1,
|
||||
"to_field": "qty",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "eval: obj.basic_rate and (flt(obj.amount) - flt(obj.billed_amt))/flt(obj.basic_rate) or obj.qty"
|
||||
},
|
||||
{
|
||||
"map": "Yes",
|
||||
"match_id": 1,
|
||||
"to_field": "sales_order",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "parent"
|
||||
},
|
||||
{
|
||||
"map": "Yes",
|
||||
"match_id": 1,
|
||||
"to_field": "so_detail",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "name"
|
||||
},
|
||||
{
|
||||
"map": "Yes",
|
||||
"match_id": 1,
|
||||
"to_field": "amount",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "eval:flt(obj.amount) - flt(obj.billed_amt)"
|
||||
},
|
||||
{
|
||||
"map": "Yes",
|
||||
"match_id": 1,
|
||||
"to_field": "export_amount",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "eval: (flt(obj.amount) - flt(obj.billed_amt))* flt(obj.export_rate)/flt(obj.basic_rate)"
|
||||
},
|
||||
{
|
||||
"map": "Yes",
|
||||
"match_id": 0,
|
||||
"to_field": "project_name",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "project_name",
|
||||
"checking_operator": "="
|
||||
},
|
||||
{
|
||||
"map": "Yes",
|
||||
"match_id": 1,
|
||||
"to_field": "warehouse",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "reserved_warehouse"
|
||||
},
|
||||
{
|
||||
"map": "No",
|
||||
"match_id": 0,
|
||||
"to_field": "naming_series",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "naming_series"
|
||||
},
|
||||
{
|
||||
"map": "No",
|
||||
"match_id": 3,
|
||||
"to_field": "incentives",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "incentives"
|
||||
},
|
||||
{
|
||||
"map": "Yes",
|
||||
"match_id": 1,
|
||||
"to_field": "export_rate",
|
||||
"doctype": "Field Mapper Detail",
|
||||
"from_field": "export_rate",
|
||||
"checking_operator": "="
|
||||
},
|
||||
{
|
||||
"match_id": 0,
|
||||
"doctype": "Table Mapper Detail",
|
||||
"from_table": "Sales Order",
|
||||
"to_table": "Sales Invoice",
|
||||
"validation_logic": "docstatus=1"
|
||||
},
|
||||
{
|
||||
"match_id": 1,
|
||||
"to_field": "entries",
|
||||
"doctype": "Table Mapper Detail",
|
||||
"from_field": "sales_order_detail",
|
||||
"from_table": "Sales Order Item",
|
||||
"to_table": "Sales Invoice Item",
|
||||
"validation_logic": "(ifnull(amount, 0) = 0 or amount > ifnull(billed_amt, 0)) and docstatus = 1"
|
||||
},
|
||||
{
|
||||
"match_id": 2,
|
||||
"to_field": "other_charges",
|
||||
"doctype": "Table Mapper Detail",
|
||||
"from_field": "other_charges",
|
||||
"from_table": "Sales Taxes and Charges",
|
||||
"to_table": "Sales Taxes and Charges",
|
||||
"validation_logic": "name is not null"
|
||||
},
|
||||
{
|
||||
"match_id": 3,
|
||||
"to_field": "sales_team",
|
||||
"doctype": "Table Mapper Detail",
|
||||
"from_field": "sales_team",
|
||||
"from_table": "Sales Team",
|
||||
"to_table": "Sales Team",
|
||||
"validation_logic": "name is not null"
|
||||
}
|
||||
]
|
||||
@@ -67,7 +67,23 @@ erpnext.accounts.PurchaseInvoiceController = erpnext.buying.BuyingController.ext
|
||||
allocated_amount: function() {
|
||||
this.calculate_total_advance("Purchase Invoice", "advance_allocation_details");
|
||||
this.frm.refresh_fields();
|
||||
},
|
||||
|
||||
get_items: function() {
|
||||
if(doc.purchase_order_main) {
|
||||
wn.model.map_current_doc({
|
||||
method: "buying.doctype.purchase_order.purchase_order.make_purchase_invoice",
|
||||
source_name: cur_frm.doc.purchase_order_main,
|
||||
})
|
||||
}
|
||||
else if(doc.purchase_receipt_main) {
|
||||
wn.model.map_current_doc({
|
||||
method: "selling.doctype.purchase_receipt.purchase_receipt.make_purchase_invoice",
|
||||
source_name: cur_frm.doc.purchase_receipt_main,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
// for backward compatibility: combine new and previous states
|
||||
@@ -101,14 +117,6 @@ cur_frm.cscript.is_opening = function(doc, dt, dn) {
|
||||
if (doc.is_opening == 'Yes') unhide_field('aging_date');
|
||||
}
|
||||
|
||||
cur_frm.cscript.get_items = function(doc, dt, dn) {
|
||||
var callback = function(r,rt) {
|
||||
unhide_field(['supplier_address', 'contact_person']);
|
||||
cur_frm.refresh_fields();
|
||||
}
|
||||
$c_obj(make_doclist(dt,dn),'pull_details','',callback);
|
||||
}
|
||||
|
||||
cur_frm.cscript.make_bank_voucher = function() {
|
||||
wn.call({
|
||||
method: "accounts.doctype.journal_voucher.journal_voucher.get_default_bank_cash_account",
|
||||
|
||||
@@ -126,26 +126,6 @@ class DocType(BuyingController):
|
||||
ret['due_date'] = add_days(cstr(self.doc.posting_date), acc and cint(acc[1]) or 0)
|
||||
|
||||
return ret
|
||||
|
||||
def pull_details(self):
|
||||
if self.doc.purchase_receipt_main:
|
||||
self.validate_duplicate_docname('purchase_receipt')
|
||||
self.doclist = get_obj('DocType Mapper', 'Purchase Receipt-Purchase Invoice').dt_map('Purchase Receipt', 'Purchase Invoice', self.doc.purchase_receipt_main, self.doc, self.doclist, "[['Purchase Receipt', 'Purchase Invoice'], ['Purchase Receipt Item', 'Purchase Invoice Item'], ['Purchase Taxes and Charges','Purchase Taxes and Charges']]")
|
||||
|
||||
elif self.doc.purchase_order_main:
|
||||
self.validate_duplicate_docname('purchase_order')
|
||||
self.doclist = get_obj('DocType Mapper', 'Purchase Order-Purchase Invoice').dt_map('Purchase Order', 'Purchase Invoice', self.doc.purchase_order_main, self.doc, self.doclist, "[['Purchase Order', 'Purchase Invoice'],['Purchase Order Item', 'Purchase Invoice Item'], ['Purchase Taxes and Charges','Purchase Taxes and Charges']]")
|
||||
|
||||
self.get_expense_account('entries')
|
||||
|
||||
ret = self.get_credit_to()
|
||||
if ret.has_key('credit_to'):
|
||||
self.doc.credit_to = ret['credit_to']
|
||||
|
||||
def get_expense_account(self, doctype):
|
||||
for d in getlist(self.doclist, doctype):
|
||||
if d.item_code:
|
||||
d.fields.update(self.get_default_values(d.fields))
|
||||
|
||||
def get_advances(self):
|
||||
super(DocType, self).get_advances(self.doc.credit_to,
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
{
|
||||
"creation": "2013-05-21 16:16:39",
|
||||
"docstatus": 0,
|
||||
"modified": "2013-06-11 16:16:38",
|
||||
"modified": "2013-07-05 14:40:59",
|
||||
"modified_by": "Administrator",
|
||||
"owner": "Administrator"
|
||||
},
|
||||
@@ -30,7 +30,6 @@
|
||||
"parent": "Purchase Invoice",
|
||||
"parentfield": "permissions",
|
||||
"parenttype": "DocType",
|
||||
"permlevel": 0,
|
||||
"read": 1,
|
||||
"report": 1
|
||||
},
|
||||
@@ -259,7 +258,6 @@
|
||||
"fieldtype": "Button",
|
||||
"label": "Get Items",
|
||||
"oldfieldtype": "Button",
|
||||
"options": "pull_details",
|
||||
"read_only": 0
|
||||
},
|
||||
{
|
||||
@@ -827,31 +825,13 @@
|
||||
"read_only": 0,
|
||||
"reqd": 0
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Accounts User",
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Purchase User",
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"match": "supplier",
|
||||
"role": "Supplier",
|
||||
"permlevel": 1,
|
||||
"role": "Accounts Manager",
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
},
|
||||
@@ -860,6 +840,7 @@
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"role": "Accounts Manager",
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
@@ -869,8 +850,44 @@
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"role": "Auditor",
|
||||
"permlevel": 1,
|
||||
"role": "Accounts User",
|
||||
"submit": 0,
|
||||
"write": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 0,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 1,
|
||||
"role": "Purchase User",
|
||||
"submit": 0
|
||||
},
|
||||
{
|
||||
"amend": 0,
|
||||
"cancel": 0,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"role": "Purchase User",
|
||||
"submit": 0,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"amend": 1,
|
||||
"cancel": 1,
|
||||
"create": 1,
|
||||
"doctype": "DocPerm",
|
||||
"permlevel": 0,
|
||||
"role": "Accounts User",
|
||||
"submit": 1,
|
||||
"write": 1
|
||||
},
|
||||
{
|
||||
"doctype": "DocPerm",
|
||||
"match": "supplier",
|
||||
"permlevel": 0,
|
||||
"role": "Supplier"
|
||||
}
|
||||
]
|
||||
Reference in New Issue
Block a user