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:
parent
51cf0eb159
commit
6071313965
@ -58,7 +58,9 @@ class Supplier(TransactionBase):
|
|||||||
frappe.db.set(self, "supplier_name", newdn)
|
frappe.db.set(self, "supplier_name", newdn)
|
||||||
|
|
||||||
def create_onboarding_docs(self, args):
|
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')):
|
for i in range(1, args.get('max_count')):
|
||||||
supplier = args.get('supplier_name_' + str(i))
|
supplier = args.get('supplier_name_' + str(i))
|
||||||
if supplier:
|
if supplier:
|
||||||
@ -67,7 +69,7 @@ class Supplier(TransactionBase):
|
|||||||
'doctype': self.doctype,
|
'doctype': self.doctype,
|
||||||
'supplier_name': supplier,
|
'supplier_name': supplier,
|
||||||
'supplier_group': _('Local'),
|
'supplier_group': _('Local'),
|
||||||
'company': defaults.get('company')
|
'company': company
|
||||||
}).insert()
|
}).insert()
|
||||||
|
|
||||||
if args.get('supplier_email_' + str(i)):
|
if args.get('supplier_email_' + str(i)):
|
||||||
|
@ -213,6 +213,9 @@ class Customer(TransactionBase):
|
|||||||
|
|
||||||
def create_onboarding_docs(self, args):
|
def create_onboarding_docs(self, args):
|
||||||
defaults = frappe.defaults.get_defaults()
|
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')):
|
for i in range(1, args.get('max_count')):
|
||||||
customer = args.get('customer_name_' + str(i))
|
customer = args.get('customer_name_' + str(i))
|
||||||
if customer:
|
if customer:
|
||||||
@ -223,7 +226,7 @@ class Customer(TransactionBase):
|
|||||||
'customer_type': 'Company',
|
'customer_type': 'Company',
|
||||||
'customer_group': _('Commercial'),
|
'customer_group': _('Commercial'),
|
||||||
'territory': defaults.get('country'),
|
'territory': defaults.get('country'),
|
||||||
'company': defaults.get('company')
|
'company': company
|
||||||
}).insert()
|
}).insert()
|
||||||
|
|
||||||
if args.get('customer_email_' + str(i)):
|
if args.get('customer_email_' + str(i)):
|
||||||
|
@ -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")
|
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):
|
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')):
|
for i in range(1, args.get('max_count')):
|
||||||
item = args.get('item_' + str(i))
|
item = args.get('item_' + str(i))
|
||||||
if item:
|
if item:
|
||||||
default_warehouse = ''
|
default_warehouse = ''
|
||||||
default_warehouse = frappe.db.get_value('Warehouse', filters={
|
default_warehouse = frappe.db.get_value('Warehouse', filters={
|
||||||
'warehouse_name': _('Finished Goods'),
|
'warehouse_name': _('Finished Goods'),
|
||||||
'company': defaults.get('company_name')
|
'company': company
|
||||||
})
|
})
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -901,7 +903,7 @@ class Item(WebsiteGenerator):
|
|||||||
'stock_uom': _(args.get('item_uom_' + str(i))),
|
'stock_uom': _(args.get('item_uom_' + str(i))),
|
||||||
'item_defaults': [{
|
'item_defaults': [{
|
||||||
'default_warehouse': default_warehouse,
|
'default_warehouse': default_warehouse,
|
||||||
'company': defaults.get('company_name')
|
'company': company
|
||||||
}]
|
}]
|
||||||
}).insert()
|
}).insert()
|
||||||
|
|
||||||
@ -909,7 +911,7 @@ class Item(WebsiteGenerator):
|
|||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
if args.get('item_price_' + str(i)):
|
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})
|
price_list_name = frappe.db.get_value('Price List', {'selling': 1})
|
||||||
make_item_price(item, price_list_name, item_price)
|
make_item_price(item, price_list_name, item_price)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user