set schedule_Date when creating po
This commit is contained in:
parent
f2e2e23b6b
commit
869b878286
@ -3458,7 +3458,7 @@
|
|||||||
"issingle": 0,
|
"issingle": 0,
|
||||||
"istable": 0,
|
"istable": 0,
|
||||||
"max_attachments": 0,
|
"max_attachments": 0,
|
||||||
"modified": "2017-09-22 16:11:49.856808",
|
"modified": "2017-09-26 14:19:04.102534",
|
||||||
"modified_by": "Administrator",
|
"modified_by": "Administrator",
|
||||||
"module": "Buying",
|
"module": "Buying",
|
||||||
"name": "Purchase Order",
|
"name": "Purchase Order",
|
||||||
|
@ -118,6 +118,7 @@ class TestPurchaseOrder(unittest.TestCase):
|
|||||||
"company": "_Test Company",
|
"company": "_Test Company",
|
||||||
"supplier" : "_Test Supplier",
|
"supplier" : "_Test Supplier",
|
||||||
"is_subcontracted" : "No",
|
"is_subcontracted" : "No",
|
||||||
|
"schedule_Date": add_days(nowdate(), 1),
|
||||||
"currency" : frappe.db.get_value("Company", "_Test Company", "default_currency"),
|
"currency" : frappe.db.get_value("Company", "_Test Company", "default_currency"),
|
||||||
"conversion_factor" : 1,
|
"conversion_factor" : 1,
|
||||||
"items" : get_same_items(),
|
"items" : get_same_items(),
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.utils import flt
|
from frappe.utils import flt, nowdate, add_days
|
||||||
from frappe.model.mapper import get_mapped_doc
|
from frappe.model.mapper import get_mapped_doc
|
||||||
|
|
||||||
from erpnext.controllers.buying_controller import BuyingController
|
from erpnext.controllers.buying_controller import BuyingController
|
||||||
@ -104,6 +104,7 @@ def get_list_context(context=None):
|
|||||||
def make_purchase_order(source_name, target_doc=None):
|
def make_purchase_order(source_name, target_doc=None):
|
||||||
def set_missing_values(source, target):
|
def set_missing_values(source, target):
|
||||||
target.ignore_pricing_rule = 1
|
target.ignore_pricing_rule = 1
|
||||||
|
target.schedule_Date = add_days(nowdate(), 1)
|
||||||
target.run_method("set_missing_values")
|
target.run_method("set_missing_values")
|
||||||
target.run_method("get_schedule_dates")
|
target.run_method("get_schedule_dates")
|
||||||
target.run_method("calculate_taxes_and_totals")
|
target.run_method("calculate_taxes_and_totals")
|
||||||
|
@ -5,7 +5,7 @@ from __future__ import unicode_literals
|
|||||||
import frappe
|
import frappe
|
||||||
import json
|
import json
|
||||||
import frappe.utils
|
import frappe.utils
|
||||||
from frappe.utils import cstr, flt, getdate, comma_and, cint
|
from frappe.utils import cstr, flt, getdate, comma_and, cint, nowdate, add_days
|
||||||
from frappe import _
|
from frappe import _
|
||||||
from frappe.model.utils import get_fetch_values
|
from frappe.model.utils import get_fetch_values
|
||||||
from frappe.model.mapper import get_mapped_doc
|
from frappe.model.mapper import get_mapped_doc
|
||||||
@ -658,6 +658,7 @@ def make_purchase_order_for_drop_shipment(source_name, for_supplier, target_doc=
|
|||||||
target.apply_discount_on = ""
|
target.apply_discount_on = ""
|
||||||
target.additional_discount_percentage = 0.0
|
target.additional_discount_percentage = 0.0
|
||||||
target.discount_amount = 0.0
|
target.discount_amount = 0.0
|
||||||
|
target.schedule_date = add_days(nowdate(), 1)
|
||||||
|
|
||||||
default_price_list = frappe.get_value("Supplier", for_supplier, "default_price_list")
|
default_price_list = frappe.get_value("Supplier", for_supplier, "default_price_list")
|
||||||
if default_price_list:
|
if default_price_list:
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
import frappe
|
import frappe
|
||||||
|
|
||||||
from frappe.utils import cstr, flt, getdate, new_line_sep
|
from frappe.utils import cstr, flt, getdate, new_line_sep, nowdate, add_days
|
||||||
from frappe import msgprint, _
|
from frappe import msgprint, _
|
||||||
from frappe.model.mapper import get_mapped_doc
|
from frappe.model.mapper import get_mapped_doc
|
||||||
from erpnext.stock.stock_balance import update_bin_qty, get_indented_qty
|
from erpnext.stock.stock_balance import update_bin_qty, get_indented_qty
|
||||||
@ -228,6 +228,7 @@ def update_item(obj, target, source_parent):
|
|||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def make_purchase_order(source_name, target_doc=None):
|
def make_purchase_order(source_name, target_doc=None):
|
||||||
def postprocess(source, target_doc):
|
def postprocess(source, target_doc):
|
||||||
|
target_doc.schedule_Date = add_days(nowdate(), 1)
|
||||||
set_missing_values(source, target_doc)
|
set_missing_values(source, target_doc)
|
||||||
|
|
||||||
doclist = get_mapped_doc("Material Request", source_name, {
|
doclist = get_mapped_doc("Material Request", source_name, {
|
||||||
@ -287,6 +288,7 @@ def make_purchase_order_based_on_supplier(source_name, target_doc=None):
|
|||||||
|
|
||||||
def postprocess(source, target_doc):
|
def postprocess(source, target_doc):
|
||||||
target_doc.supplier = source_name
|
target_doc.supplier = source_name
|
||||||
|
target_doc.schedule_Date = add_days(nowdate(), 1)
|
||||||
|
|
||||||
target_doc.set("items", [d for d in target_doc.get("items")
|
target_doc.set("items", [d for d in target_doc.get("items")
|
||||||
if d.get("item_code") in supplier_items and d.get("qty") > 0])
|
if d.get("item_code") in supplier_items and d.get("qty") > 0])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user