Advertisement
Guest User

Untitled

a guest
Mar 3rd, 2016
226
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.36 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. # Copyright (c) 2015, Rootstack and contributors
  3. # For license information, please see license.txt
  4.  
  5. from __future__ import unicode_literals
  6. import frappe
  7. from frappe.model.document import Document
  8. import datetime
  9.  
  10. class reinventario(Document):
  11.     def on_submit(self):
  12.         today = datetime.datetime.now()
  13.         date = today.strftime("%m-%d-%y")
  14.         time = today.strftime("%H:%M:%S")
  15.  
  16.         print "^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^"
  17.         print today
  18.         print time
  19.         print frappe.defaults.get_user_default("fiscal_year")
  20.         stock_entry = frappe.get_doc({
  21.             "title" : self.title + " Reconciliation",
  22.             "doctype":"Stock Reconciliation",
  23.             "posting_date": today,
  24.             "posting_time": time,
  25.             "fiscal_year" : frappe.defaults.get_user_default("fiscal_year") ,
  26.             "company": frappe.defaults.get_user_default("Company")
  27.         })
  28.         from random import randint
  29.         stock_item = frappe.get_doc({
  30.             "tem_code.item_name" : "Item 1" + str(randint(1,99)),
  31.             "name": "Item 1" + str(randint(1,99)),
  32.             "parenttype": "DocType",
  33.             "parent": "Stock Reconciliation",
  34.             "doctype":"Stock Reconciliation Item",
  35.             "posting_date": today,
  36.             "posting_time": time,
  37.             "item_code": "Item 1",
  38.             "warehouse" : "Finished Goods - R",
  39.             "qty" : randint(1,99)
  40.         })
  41.         stock_entry.items = []
  42.         stock_entry.append("items", stock_item)
  43.         stock_entry.insert()
  44.         print stock_entry
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement