Persona Jurídica — core.identidad.mae_personas_juridicas¶
Personas jurídicas externas al grupo (empresas cliente, consultores que facturan con RUC) que pueden tener cuenta de usuario. Hereda de mae_entidades.
class MaePersonaJuridica(MaeEntidad):
__tablename__ = 'mae_personas_juridicas'
__table_args__ = (
UniqueConstraint('identificacion', name='uq_mae_personas_juridicas_identificacion'),
{"schema": 'identidad'},
)
__mapper_args__ = {"polymorphic_identity": "PERSONA_JURIDICA"}
id: Mapped[uuid.UUID] = mapped_column(
UUID(as_uuid=True),
ForeignKey("identidad.mae_entidades.id"),
primary_key=True,
comment='Mismo id de mae_entidades (herencia de tabla)',
)
nombre: Mapped[str] = mapped_column(String(200), nullable=False, comment='Razón social')
nombre_comercial: Mapped[str | None] = mapped_column(String(200), comment='Nombre comercial')
identificacion: Mapped[str] = mapped_column(
String(20), nullable=False, comment='Número de identificación fiscal (RUC)'
)
pais_id: Mapped[uuid.UUID | None] = mapped_column(
UUID(as_uuid=True), ForeignKey("identidad.cat_paises.id"), comment='País'
)
ciudad_id: Mapped[uuid.UUID | None] = mapped_column(
UUID(as_uuid=True), ForeignKey("identidad.cat_ciudades.id"), comment='Ciudad'
)
tipo_identificacion_id: Mapped[uuid.UUID | None] = mapped_column(
UUID(as_uuid=True),
ForeignKey("identidad.cat_tipos_identificacion.id"),
comment='Tipo de identificación',
)
# Auditoría General
is_activo: Mapped[bool] = mapped_column(Boolean, nullable=False, server_default=text("true"))
created_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False, server_default=text("now()"))
updated_at: Mapped[datetime] = mapped_column(DateTime(timezone=True), nullable=False, server_default=text("now()"), onupdate=func.now())
deleted_at: Mapped[datetime | None] = mapped_column(DateTime(timezone=True))
created_by: Mapped[uuid.UUID | None] = mapped_column(UUID(as_uuid=True))
updated_by: Mapped[uuid.UUID | None] = mapped_column(UUID(as_uuid=True))
@property
def nombre_mostrar(self) -> str:
return self.nombre