fix: document creation via onboarding slide (#20644)

* fix: defaults not set in doc created via Onboarding Slide

* fix: default company not set in Supplier
This commit is contained in:
Rucha Mahabal 2020-02-20 12:57:21 +05:30 committed by GitHub
parent 51cf0eb159
commit 6071313965
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 7 deletions

View File

@ -58,7 +58,9 @@ class Supplier(TransactionBase):
frappe.db.set(self, "supplier_name", newdn)
def create_onboarding_docs(self, args):
defaults = frappe.defaults.get_defaults()
company = frappe.defaults.get_defaults().get('company') or \
frappe.db.get_single_value('Global Defaults', 'default_company')
for i in range(1, args.get('max_count')):
supplier = args.get('supplier_name_' + str(i))
if supplier:
@ -67,7 +69,7 @@ class Supplier(TransactionBase):
'doctype': self.doctype,
'supplier_name': supplier,
'supplier_group': _('Local'),
'company': defaults.get('company')
'company': company
}).insert()
if args.get('supplier_email_' + str(i)):

View File

@ -213,6 +213,9 @@ class Customer(TransactionBase):
def create_onboarding_docs(self, args):
defaults = frappe.defaults.get_defaults()
company = defaults.get('company') or \
frappe.db.get_single_value('Global Defaults', 'default_company')
for i in range(1, args.get('max_count')):
customer = args.get('customer_name_' + str(i))
if customer:
@ -223,7 +226,7 @@ class Customer(TransactionBase):
'customer_type': 'Company',
'customer_group': _('Commercial'),
'territory': defaults.get('country'),
'company': defaults.get('company')
'company': company
}).insert()
if args.get('customer_email_' + str(i)):

View File

@ -877,14 +877,16 @@ class Item(WebsiteGenerator):
frappe.msgprint(msg=_("You have to enable auto re-order in Stock Settings to maintain re-order levels."), title=_("Enable Auto Re-Order"), indicator="orange")
def create_onboarding_docs(self, args):
defaults = frappe.defaults.get_defaults()
company = frappe.defaults.get_defaults().get('company') or \
frappe.db.get_single_value('Global Defaults', 'default_company')
for i in range(1, args.get('max_count')):
item = args.get('item_' + str(i))
if item:
default_warehouse = ''
default_warehouse = frappe.db.get_value('Warehouse', filters={
'warehouse_name': _('Finished Goods'),
'company': defaults.get('company_name')
'company': company
})
try:
@ -901,7 +903,7 @@ class Item(WebsiteGenerator):
'stock_uom': _(args.get('item_uom_' + str(i))),
'item_defaults': [{
'default_warehouse': default_warehouse,
'company': defaults.get('company_name')
'company': company
}]
}).insert()
@ -909,7 +911,7 @@ class Item(WebsiteGenerator):
pass
else:
if args.get('item_price_' + str(i)):
item_price = flt(args.get('tem_price_' + str(i)))
item_price = flt(args.get('item_price_' + str(i)))
price_list_name = frappe.db.get_value('Price List', {'selling': 1})
make_item_price(item, price_list_name, item_price)