How to display two surnames (ie primary & married name)

A possible workaround: one could use the attached Supertool script to generate a new artificial name for people. The new name would contain both the birth name and the married name. This new name should probably be used only temporarily while e.g. preparing a report.

[Gramps SuperTool script file]
version=1

[title]
combine_surnames

[category]
People

[initial_statements]
# Script that processes all people that have both a BIRTH surname and a MARRIED surname. Generates new surnames that contains both names and
# sets those as the primary names. This can be used as a temporary display name in e.g. graphs and reports. The change can be reverted using the 
# Gramps undo function (Edit > Undo).
#
# The type of the new name is set to "Generated" and the format would be like "<marriedsurname> (née <birthsurname>)". These can be changed,
# see the settings below.
#
# Example:
#
# Birth name:
#   Firstname: "Anna"
#   Surname: "Smith"
# Married name:
#   Firstname: "Anna"
#   Surname: "Jones"
#
# -->
#
# Generated:
#   Firstname: "Anna"
#   Surname: "Jones (née Smith)"

from gramps.gen.lib import NameType, Name, Surname

FMT = "{marriedsurname} (née {birthsurname})"
NAMETYPE = "Generated"

count = 0

[statements]
birthsurname = None
marriedsurname = None

if len(names) == 2:
	for name in nameobjs:
		if name.get_type() == NameType.BIRTH:
			birthname = name
			birthsurname = name.get_surname()
		if name.get_type() == NameType.MARRIED:
			marriedname = name
			marriedsurname = name.get_surname()
			firstname = name.get_first_name()
if birthsurname and marriedsurname:
	newname = Name()
	newname.set_type(NAMETYPE)
	newsurname = Surname()
	generatedsurname = FMT.format(marriedsurname=marriedsurname, birthsurname=birthsurname)
	newsurname.set_surname(generatedsurname)
	newname.set_surname_list([newsurname])
	newname.set_first_name(firstname)
	person.set_alternate_names([birthname,marriedname])
	person.set_primary_name(newname)
	count += 1

[filter]

[expressions]
"Generated {} names".format(count)

[scope]
all

[unwind_lists]
False

[commit_changes]
True

[summary_only]
True
1 Like