fix: variable referenced before assignment (#21561)

This commit is contained in:
Marica
2020-05-02 17:55:47 +05:30
committed by GitHub
parent bf1fc47564
commit ed709b36b4

View File

@@ -100,7 +100,7 @@ class BuyingController(StockController):
for d in tax_for_valuation: for d in tax_for_valuation:
d.category = 'Total' d.category = 'Total'
msgprint(_('Tax Category has been changed to "Total" because all the Items are non-stock items')) msgprint(_('Tax Category has been changed to "Total" because all the Items are non-stock items'))
def validate_asset_return(self): def validate_asset_return(self):
if self.doctype not in ['Purchase Receipt', 'Purchase Invoice'] or not self.is_return: if self.doctype not in ['Purchase Receipt', 'Purchase Invoice'] or not self.is_return:
return return
@@ -663,10 +663,10 @@ class BuyingController(StockController):
for qty in range(cint(d.qty)): for qty in range(cint(d.qty)):
asset = self.make_asset(d) asset = self.make_asset(d)
created_assets.append(asset) created_assets.append(asset)
if len(created_assets) > 5: if len(created_assets) > 5:
# dont show asset form links if more than 5 assets are created # dont show asset form links if more than 5 assets are created
messages.append(_('{} Asset{} created for {}').format(len(created_assets), is_plural, frappe.bold(d.item_code))) messages.append(_('{} Assets created for {}').format(len(created_assets), frappe.bold(d.item_code)))
else: else:
assets_link = list(map(lambda d: frappe.utils.get_link_to_form('Asset', d), created_assets)) assets_link = list(map(lambda d: frappe.utils.get_link_to_form('Asset', d), created_assets))
assets_link = frappe.bold(','.join(assets_link)) assets_link = frappe.bold(','.join(assets_link))