Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- # Copyright (c) 2015, Rootstack and contributors
- # For license information, please see license.txt
- from __future__ import unicode_literals
- import frappe
- from frappe.model.document import Document
- import datetime
- class reinventario(Document):
- def on_submit(self):
- today = datetime.datetime.now()
- date = today.strftime("%m-%d-%y")
- time = today.strftime("%H:%M:%S")
- print "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
- print today
- print time
- print frappe.defaults.get_user_default("fiscal_year")
- stock_entry = frappe.get_doc({
- "title" : self.title + " Reconciliation",
- "doctype":"Stock Reconciliation",
- "posting_date": today,
- "posting_time": time,
- "fiscal_year" : frappe.defaults.get_user_default("fiscal_year") ,
- "company": frappe.defaults.get_user_default("Company")
- })
- from random import randint
- stock_item = frappe.get_doc({
- "tem_code.item_name" : "Item 1" + str(randint(1,99)),
- "name": "Item 1" + str(randint(1,99)),
- "parenttype": "DocType",
- "parent": "Stock Reconciliation",
- "doctype":"Stock Reconciliation Item",
- "posting_date": today,
- "posting_time": time,
- "item_code": "Item 1",
- "warehouse" : "Finished Goods - R",
- "qty" : randint(1,99)
- })
- stock_entry.items = []
- stock_entry.append("items", stock_item)
- stock_entry.insert()
- print stock_entry
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement