Merge pull request #34009 from iamejaaz/add-flag-letter-head
fix: add in_install flag condition in default values
This commit is contained in:
commit
1bcdd28255
1 changed files with 7 additions and 2 deletions
|
|
@ -37,7 +37,7 @@ class LetterHead(Document):
|
|||
|
||||
def before_insert(self):
|
||||
# for better UX, let user set from attachment
|
||||
if not frappe.flags.in_migrate:
|
||||
if not frappe.flags.in_migrate and not frappe.flags.in_install:
|
||||
self.source = "Image"
|
||||
|
||||
def validate(self):
|
||||
|
|
@ -48,7 +48,12 @@ class LetterHead(Document):
|
|||
if self.disabled and self.is_default:
|
||||
frappe.throw(_("Letter Head cannot be both disabled and default"))
|
||||
|
||||
if not self.is_default and not self.disabled and not frappe.flags.in_migrate:
|
||||
if (
|
||||
not self.is_default
|
||||
and not self.disabled
|
||||
and not frappe.flags.in_migrate
|
||||
and not frappe.flags.in_install
|
||||
):
|
||||
if not frappe.db.exists("Letter Head", dict(is_default=1)):
|
||||
self.is_default = 1
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue